Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooPlot.cxx
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * @(#)root/roofitcore:$Id$
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2000-2005, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16
17/**
18\file RooPlot.cxx
19\class RooPlot
20\ingroup Roofitcore
21
22Plot frame and a container for graphics objects
23within that frame. As a frame, it provides the TH1-style public interface
24for setting plot ranges, configuring axes, etc. As a container, it
25holds an arbitrary set of objects that might be histograms of data,
26curves representing a fit model, or text labels. Use the Draw()
27method to draw a frame and the objects it contains. Use the various
28add...() methods to add objects to be drawn. In general, the
29add...() methods create a private copy of the object you pass them
30and return a pointer to this copy. The caller owns the input object
31and this class owns the returned object.
32All RooAbsReal and RooAbsData derived classes implement plotOn()
33functions that facilitate to plot themselves on a given RooPlot, e.g.
34~~~ {.cpp}
35RooPlot *frame = x.frame() ;
36data.plotOn(frame) ;
37pdf.plotOn(frame) ;
38~~~
39These high level functions also take care of any projections
40or other mappings that need to be made to plot a multi-dimensional
41object onto a one-dimensional plot.
42**/
43
44#include "RooPlot.h"
45
46#include "RooAbsReal.h"
47#include "RooAbsRealLValue.h"
48#include "RooPlotable.h"
49#include "RooArgSet.h"
50#include "RooCurve.h"
51#include "RooHist.h"
52#include "RooMsgService.h"
53
54#include "TClass.h"
55#include "TBuffer.h"
56#include "TH1D.h"
57#include "TBrowser.h"
58#include "TVirtualPad.h"
59
60#include "TAttLine.h"
61#include "TAttFill.h"
62#include "TAttMarker.h"
63#include "TAttText.h"
64#include "TDirectoryFile.h"
65#include "TLegend.h"
66#include "strlcpy.h"
67
68#include <algorithm>
69#include <cstring>
70#include <iostream>
71
73
74
75bool RooPlot::_addDirStatus = true ;
76
78bool RooPlot::setAddDirectoryStatus(bool flag) { bool ret = flag ; _addDirStatus = flag ; return ret ; }
79
80
81////////////////////////////////////////////////////////////////////////////////
82/// Default constructor
83/// coverity[UNINIT_CTOR]
84
86{
89 }
90}
91
92
93////////////////////////////////////////////////////////////////////////////////
94/// Constructor of RooPlot with range [xmin,xmax]
95
96RooPlot::RooPlot(double xmin, double xmax, int nBins)
97 : _normBinWidth((xmax - xmin) / nBins)
98{
99 _hist = new TH1D(histName(),"A RooPlot",nBins,xmin,xmax) ;
100 _hist->Sumw2(false) ;
101 _hist->GetSumw2()->Set(0) ;
102 _hist->SetDirectory(nullptr);
103
104 // Create an empty frame with the specified x-axis limits.
105 initialize();
106
107}
108
109namespace {
110
111const RooAbsRealLValue& validateFiniteLimits(const RooAbsRealLValue &var)
112{
113 if (!var.hasMin() || !var.hasMax()) {
114 std::stringstream ss;
115 ss << "RooPlot::RooPlot: cannot create plot for variable without finite limits: " << var.GetName();
116 oocoutE(nullptr, InputArguments) << ss.str() << std::endl;
117 throw std::runtime_error(ss.str());
118 }
119 return var;
120}
121
122} // namespace
123
124////////////////////////////////////////////////////////////////////////////////
125/// Construct a two-dimensional RooPlot with ranges and properties taken
126/// from variables var1 and var2
127
129 : RooPlot{validateFiniteLimits(var1),
130 validateFiniteLimits(var2),
131 var1.getMin(),
132 var1.getMax(),
133 var2.getMin(),
134 var2.getMax()}
135{
136}
137
138
139////////////////////////////////////////////////////////////////////////////////
140/// Construct a two-dimensional RooPlot with ranges and properties taken
141/// from variables var1 and var2 but with an overriding range definition
142/// of [xmin,xmax] x [ymin,ymax]
143
144RooPlot::RooPlot(const RooAbsRealLValue &var1, const RooAbsRealLValue &var2, double xmin, double xmax, double ymin,
145 double ymax)
146 : RooPlot{xmin, xmax}
147{
150 SetXTitle(var1.getTitle(true));
151 SetYTitle(var2.getTitle(true));
152}
153
154
155////////////////////////////////////////////////////////////////////////////////
156/// Create an 1-dimensional with all properties taken from 'var', but
157/// with an explicit range [xmin,xmax] and a default binning of 'nbins'
158
159RooPlot::RooPlot(const RooAbsRealLValue &var, double xmin, double xmax, Int_t nbins)
160 : _plotVar(const_cast<RooAbsRealLValue *>(&var)), _normBinWidth((xmax - xmin) / nbins)
161{
162 _hist = new TH1D(histName(),"RooPlot",nbins,xmin,xmax) ;
163 _hist->Sumw2(false) ;
164 _hist->GetSumw2()->Set(0) ;
165 _hist->SetDirectory(nullptr);
166
167 // In the past, the plot variable was cloned, but there was no apparent reason for doing so.
168
169 TString xtitle= var.getTitle(true);
170 SetXTitle(xtitle.Data());
171
172 SetTitle("A RooPlot of \"" + var.getTitle() + "\"");
173 initialize();
174}
175
176////////////////////////////////////////////////////////////////////////////////
177/// Create a new frame for a given variable in x. This is just a
178/// wrapper for the RooPlot constructor with the same interface.
179///
180/// More details.
181/// \param[in] var The variable on the x-axis
182/// \param[in] xmin Left edge of the x-axis
183/// \param[in] xmax Right edge of the x-axis
184/// \param[in] nBins number of bins on the x-axis
185RooPlot* RooPlot::frame(const RooAbsRealLValue &var, double xmin, double xmax, Int_t nBins){
186 return new RooPlot(var,xmin,xmax,nBins);
187}
188
189////////////////////////////////////////////////////////////////////////////////
190/// Create a new frame for a given variable in x, adding bin labels.
191/// The binning will be extracted from the variable given. The bin
192/// labels will be set as "%g-%g" for the left and right edges of each
193/// bin of the given variable.
194///
195/// More details.
196/// \param[in] var The variable on the x-axis
198 RooPlot* pl = new RooPlot();
199 int nbins = var.getBinning().numBins();
200
201 pl->_hist = new TH1D(pl->histName(),"RooPlot",nbins,var.getMin(),var.getMax()) ;
202 pl->_hist->Sumw2(false) ;
203 pl->_hist->GetSumw2()->Set(0) ;
204 pl->_hist->SetDirectory(nullptr);
205
206 pl->_hist->SetNdivisions(-nbins);
207 for(int i=0; i<nbins; ++i){
208 TString s = TString::Format("%g-%g",var.getBinning().binLow(i),var.getBinning().binHigh(i));
209 pl->_hist->GetXaxis()->SetBinLabel(i+1,s);
210 }
211
212 // In the past, the plot variable was cloned, but there was no apparent reason for doing so.
213 pl->_plotVar = const_cast<RooAbsRealLValue*>(&var);
214
215 TString xtitle= var.getTitle(true);
216 pl->SetXTitle(xtitle.Data());
217
218 TString title("A RooPlot of \"");
219 title.Append(var.getTitle());
220 title.Append("\"");
221 pl->SetTitle(title.Data());
222 pl->initialize();
223
224 pl->_normBinWidth = 1.;
225 return pl;
226}
227
228////////////////////////////////////////////////////////////////////////////////
229/// Return empty clone of current RooPlot
230
232{
234 clone->SetName(name) ;
235 return clone ;
236}
237
238
239////////////////////////////////////////////////////////////////////////////////
240/// Perform initialization that is common to all constructors.
241
243{
244 SetName(histName()) ;
245
248 }
249
250 // We do not have useful stats of our own
251 _hist->SetStats(false);
252 _hist->SetDirectory(nullptr);
253 // Default vertical padding of our enclosed objects
254 setPadFactor(0.05);
255}
256
257
258////////////////////////////////////////////////////////////////////////////////
259/// Construct automatic name of internal TH1
260
262{
263 if (_plotVar) {
264 return TString(Form("frame_%s_%zx",_plotVar->GetName(),reinterpret_cast<size_t>(this))) ;
265 } else {
266 return TString(Form("frame_%zx",reinterpret_cast<size_t>(this))) ;
267 }
268}
269
270
271////////////////////////////////////////////////////////////////////////////////
272/// Destructor
273
275{
276 // Delete the items in our container and our iterator.
277 if (_dir) {
278 _dir->GetList()->RecursiveRemove(this) ;
279 }
280
281 for(auto& item : _items) delete item.first;
282 if(_plotVarSet) delete _plotVarSet;
283 if(_normVars) delete _normVars;
284 delete _hist ;
285
286}
287
288
289////////////////////////////////////////////////////////////////////////////////
290/// Set the directory that this plot is associated to.
291/// Setting it to `nullptr` will remove the object from all directories.
292/// Like TH1::SetDirectory.
294 if (_dir) {
295 _dir->GetList()->RecursiveRemove(this);
296 }
297 _dir = dir;
298 if (_dir) {
299 _dir->Append(this);
300 }
301}
302
303
304////////////////////////////////////////////////////////////////////////////////
305/// Install the given set of observables are reference normalization
306/// variables for this frame. These observables are e.g. later used
307/// to automatically project out observables when plotting functions
308/// on this frame. This function is only effective when called the
309/// first time on a frame
310
312{
313 if(_normVars == nullptr) {
314 _normVars = new RooArgSet;
315 vars.snapshot(*_normVars, true);
316 }
317}
318
319
320////////////////////////////////////////////////////////////////////////////////
321/// Add a generic object to this plot. The specified options will be
322/// used to Draw() this object later. The caller transfers ownership
323/// of the object with this call, and the object will be deleted
324/// when its containing plot object is destroyed.
325
326void RooPlot::addObject(TObject *obj, Option_t *drawOptions, bool invisible)
327{
328 if(nullptr == obj) {
329 coutE(InputArguments) << fName << "::addObject: called with a null pointer" << std::endl;
330 return;
331 }
332 DrawOpt opt(drawOptions) ;
333 opt.invisible = invisible ;
334 _items.emplace_back(obj,opt.rawOpt());
335}
336
337
338////////////////////////////////////////////////////////////////////////////////
339/// Add a TH1 histogram object to this plot. The specified options
340/// will be used to Draw() this object later. "SAME" will be added to
341/// the options if they are not already present. The caller transfers
342/// ownership of the object with this call, and the object will be
343/// deleted when its containing plot object is destroyed.
344
345void RooPlot::addTH1(TH1 *hist, Option_t *drawOptions, bool invisible)
346{
347 if(nullptr == hist) {
348 coutE(InputArguments) << fName << "::addTH1: called with a null pointer" << std::endl;
349 return;
350 }
351 // check that this histogram is really 1D
352 if(1 != hist->GetDimension()) {
353 coutE(InputArguments) << fName << "::addTH1: cannot plot histogram with "
354 << hist->GetDimension() << " dimensions" << std::endl;
355 return;
356 }
357
358 // add option "SAME" if necessary
359 TString options(drawOptions);
360 options.ToUpper();
361 if(!options.Contains("SAME")) options.Append("SAME");
362
363 // update our y-axis label and limits
364 updateYAxis(hist->GetMinimum(),hist->GetMaximum(),hist->GetYaxis()->GetTitle());
365
366 // use this histogram's normalization if necessary
367 updateFitRangeNorm(hist);
368
369 // add the histogram to our list
370 addObject(hist,options.Data(),invisible);
371}
372
373
374namespace {
375 // this helper function is intended to translate a graph from a regular axis to a labelled axis
376 // this version uses TGraph, which is a parent of RooCurve
377 void translateGraph(TH1* hist, RooAbsRealLValue* xvar, TGraph* graph){
378 // if the graph already has a labelled axis, don't do anything
379 if(graph->GetXaxis()->IsAlphanumeric()) return;
380 double xmin = hist->GetXaxis()->GetXmin();
381 double xmax = hist->GetXaxis()->GetXmax();
382 if(graph->TestBit(TGraph::kIsSortedX)){
383 // sorted graphs are "line graphs"
384 // evaluate the graph at the lower and upper edge as well as the center of each bin
385 std::vector<double> x;
386 std::vector<double> y;
387 x.push_back(xmin);
388 y.push_back(graph->Eval(xvar->getBinning().binLow(0)));
389 for(int i=0; i<hist->GetNbinsX(); ++i){
390 x.push_back(hist->GetXaxis()->GetBinUpEdge(i+1));
391 y.push_back(graph->Eval(xvar->getBinning().binHigh(i)));
392 x.push_back(hist->GetXaxis()->GetBinCenter(i+1));
393 y.push_back(graph->Eval(xvar->getBinning().binCenter(i)));
394 }
395 int n = x.size();
396 graph->Set(n);
397 for(int i=0; i<n; ++i){
398 graph->SetPoint(i,x[i],y[i]);
399 }
400 graph->Sort();
401 } else {
402 // unsorted graphs are "area graphs"
403 std::map<int,double> minValues;
404 std::map<int,double> maxValues;
405 int n = graph->GetN();
406 double x;
407 double y;
408 // for each bin, find the min and max points to form an envelope
409 for(int i=0; i<n; ++i){
410 graph->GetPoint(i,x,y);
411 int bin = xvar->getBinning().binNumber(x)+1;
412 if(maxValues.find(bin)!=maxValues.end()){
413 maxValues[bin] = std::max(maxValues[bin],y);
414 } else {
415 maxValues[bin] = y;
416 }
417 if(minValues.find(bin)!=minValues.end()){
418 minValues[bin] = std::min(minValues[bin],y);
419 } else {
420 minValues[bin] = y;
421 }
422 }
423 double xminY = graph->Eval(xmin);
424 double xmaxY = graph->Eval(xmax);
425 graph->Set(hist->GetNbinsX()+2);
426 int np=0;
427 graph->SetPoint(np,xmin,xminY);
428 // assign the calculated envelope boundaries to the bin centers of the bins
429 for(auto it = maxValues.begin(); it != maxValues.end(); ++it){
430 graph->SetPoint(++np,hist->GetXaxis()->GetBinCenter(it->first),it->second);
431 }
432 graph->SetPoint(++np,xmax,xmaxY);
433 for(auto it = minValues.rbegin(); it != minValues.rend(); ++it){
434 graph->SetPoint(++np,hist->GetXaxis()->GetBinCenter(it->first),it->second);
435 }
436 graph->SetPoint(++np,xmin,xminY);
437 }
438 // make sure that the graph also has the labels set, such that subsequent calls to translate this graph will not do anything
439 graph->GetXaxis()->Set(hist->GetNbinsX(),xmin,xmax);
440 for(int i=0; i<hist->GetNbinsX(); ++i){
441 graph->GetXaxis()->SetBinLabel(i+1,hist->GetXaxis()->GetBinLabel(i+1));
442 }
443 }
444 // this version uses TGraphErrors, which is a parent of RooHist
445 void translateGraph(TH1* hist, RooAbsRealLValue* xvar, TGraphAsymmErrors* graph){
446 // if the graph already has a labelled axis, don't do anything
447 if(graph->GetXaxis()->IsAlphanumeric()) return;
448 int n = graph->GetN();
449 double xmin = hist->GetXaxis()->GetXmin();
450 double xmax = hist->GetXaxis()->GetXmax();
451 double x;
452 double y;
453 // as this graph is histogram-like, we expect there to be one point per bin
454 // we just move these points to the respective bin centers
455 for(int i=0; i<n; ++i){
456 if(graph->GetPoint(i,x,y)!=i) break;
457 int bin = xvar->getBinning().binNumber(x);
458 graph->SetPoint(i,hist->GetXaxis()->GetBinCenter(bin+1),y);
459 graph->SetPointEXhigh(i,0.5*hist->GetXaxis()->GetBinWidth(bin+1));
460 graph->SetPointEXlow(i,0.5*hist->GetXaxis()->GetBinWidth(bin+1));
461 }
462 graph->GetXaxis()->Set(hist->GetNbinsX(),xmin,xmax);
463 // make sure that the graph also has the labels set, such that subsequent calls to translate this graph will not do anything
464 for(int i=0; i<hist->GetNbinsX(); ++i){
465 graph->GetXaxis()->SetBinLabel(i+1,hist->GetXaxis()->GetBinLabel(i+1));
466 }
467 }
468}
469
470////////////////////////////////////////////////////////////////////////////////
471/// Add the specified plotable object to our plot. Increase our y-axis
472/// limits to fit this object if necessary. The default lower-limit
473/// is zero unless we are plotting an object that takes on negative values.
474/// This call transfers ownership of the plotable object to this class.
475/// The plotable object will be deleted when this plot object is deleted.
476void RooPlot::addPlotable(RooPlotable *plotable, Option_t *drawOptions, bool invisible, bool refreshNorm)
477{
478 // update our y-axis label and limits
479 updateYAxis(plotable->getYAxisMin(),plotable->getYAxisMax(),plotable->getYAxisLabel());
480
481 // use this object's normalization if necessary
482 updateFitRangeNorm(plotable,refreshNorm) ;
483
484 // add this element to our list and remember its drawing option
485 TObject *obj= plotable->crossCast();
486 if(nullptr == obj) {
487 coutE(InputArguments) << fName << "::add: cross-cast to TObject failed (nothing added)" << std::endl;
488 }
489 else {
490 // if the frame axis is alphanumeric, the coordinates of the graph need to be translated to this binning
491 if(_hist->GetXaxis()->IsAlphanumeric()){
492 if(obj->InheritsFrom(RooCurve::Class())){
493 ::translateGraph(_hist,_plotVar,static_cast<RooCurve*>(obj));
494 } else if(obj->InheritsFrom(RooHist::Class())){
495 ::translateGraph(_hist,_plotVar,static_cast<RooHist*>(obj));
496 }
497 }
498
499 DrawOpt opt(drawOptions) ;
500 opt.invisible = invisible ;
501 _items.emplace_back(obj,opt.rawOpt());
502 }
503}
504
505
506////////////////////////////////////////////////////////////////////////////////
507/// Update our plot normalization over our plot variable's fit range,
508/// which will be determined by the first suitable object added to our plot.
509
511{
512 const TAxis* xa = const_cast<TH1 *>(hist)->GetXaxis() ;
513 _normBinWidth = (xa->GetXmax()-xa->GetXmin())/hist->GetNbinsX() ;
515}
516
517
518////////////////////////////////////////////////////////////////////////////////
519/// Update our plot normalization over our plot variable's fit range,
520/// which will be determined by the first suitable object added to our plot.
521
522void RooPlot::updateFitRangeNorm(const RooPlotable* rp, bool refreshNorm)
523{
524 if (_normNumEvts != 0) {
525
526 // If refresh feature is disabled stop here
527 if (!refreshNorm) return ;
528
529 double corFac(1.0) ;
530 if (dynamic_cast<const RooHist*>(rp)) corFac = _normBinWidth/rp->getFitRangeBinW() ;
531
532
533 if (std::abs(rp->getFitRangeNEvt()/corFac-_normNumEvts)>1e-6) {
534 coutI(Plotting) << "RooPlot::updateFitRangeNorm: New event count of " << rp->getFitRangeNEvt()/corFac
535 << " will supersede previous event count of " << _normNumEvts << " for normalization of PDF projections" << std::endl ;
536 }
537
538 // Nominal bin width (i.e event density) is already locked in by previously drawn histogram
539 // scale this histogram to match that density
540 _normNumEvts = rp->getFitRangeNEvt()/corFac ;
541 _normObj = rp ;
542 // cout << "correction factor = " << _normBinWidth << "/" << rp->getFitRangeBinW() << std::endl ;
543 // cout << "updating numevts to " << _normNumEvts << std::endl ;
544
545 } else {
546
547 _normObj = rp ;
549 if (rp->getFitRangeBinW()) {
551 }
552
553 // cout << "updating numevts to " << _normNumEvts << std::endl ;
554 }
555
556}
557
558
559
560////////////////////////////////////////////////////////////////////////////////
561/// Update our y-axis limits to accommodate an object whose spread
562/// in y is (ymin,ymax). Use the specified y-axis label if we don't
563/// have one assigned already.
564
565void RooPlot::updateYAxis(double ymin, double ymax, const char *label)
566{
567 // force an implicit lower limit of zero if appropriate
568 if(GetMinimum() == 0 && ymin > 0) ymin= 0;
569
570 // calculate padded values
571 double ypad= getPadFactor()*(ymax-ymin);
572 ymax+= ypad;
573 if(ymin < 0) ymin-= ypad;
574
575 // update our limits if necessary
576 if(GetMaximum() < ymax) {
577 _defYmax = ymax ;
579 // if we don't do this - Unzoom on y-axis will reset upper bound to 1
581 }
582 if(GetMinimum() > ymin) {
583 _defYmin = ymin ;
585 }
586
587 // use the specified y-axis label if we don't have one already
588 if(0 == strlen(_hist->GetYaxis()->GetTitle())) _hist->SetYTitle(label);
589}
590
591
592////////////////////////////////////////////////////////////////////////////////
593/// Draw this plot and all of the elements it contains. The specified options
594/// only apply to the drawing of our frame. The options specified in our add...()
595/// methods will be used to draw each object we contain.
596
598{
599 TString optArg = option ;
600 optArg.ToLower() ;
601
602 // This draw options prevents the histogram with one dummy entry
603 // to be drawn
604 if (optArg.Contains("same")) {
605 _hist->Draw("FUNCSAME");
606 } else {
607 _hist->Draw("FUNC");
608 }
609
610 for(auto const& item : _items) {
611 TObject &obj = *item.first;
612 DrawOpt opt(item.second.c_str()) ;
613 if (!opt.invisible) {
614 //LM: in case of a TGraph derived object, do not use default "" option
615 // which is "ALP" from 5.34.10 (and will then redrawn the axis) but use "LP"
616 if (!strlen(opt.drawOptions) && obj.IsA()->InheritsFrom(TGraph::Class()) ) strlcpy(opt.drawOptions,"LP",3);
617 obj.Draw(opt.drawOptions);
618 }
619 }
620
621 _hist->Draw("AXISSAME");
622}
623
624
625
626////////////////////////////////////////////////////////////////////////////////
627/// Print frame name
628
629void RooPlot::printName(std::ostream& os) const
630{
631 os << GetName() ;
632}
633
634
635////////////////////////////////////////////////////////////////////////////////
636/// Print frame title
637
638void RooPlot::printTitle(std::ostream& os) const
639{
640 os << GetTitle() ;
641}
642
643
644////////////////////////////////////////////////////////////////////////////////
645/// Print frame class name
646
647void RooPlot::printClassName(std::ostream& os) const
648{
649 os << ClassName() ;
650}
651
652
653
654////////////////////////////////////////////////////////////////////////////////
655
656void RooPlot::printArgs(std::ostream& os) const
657{
658 if (_plotVar) {
659 os << "[" ;
661 os << "]" ;
662 }
663}
664
665
666
667////////////////////////////////////////////////////////////////////////////////
668/// Print frame arguments
669
670void RooPlot::printValue(std::ostream& os) const
671{
672 os << "(" ;
673 bool first(true) ;
674 for(auto const& item : _items) {
675 TObject &obj = *item.first;
676 if (first) {
677 first=false ;
678 } else {
679 os << "," ;
680 }
681 if(obj.IsA()->InheritsFrom(RooPrintable::Class())) {
682 auto po = dynamic_cast<RooPrintable&>(obj) ;
683 // coverity[FORWARD_NULL]
685 }
686 // is it a TNamed subclass?
687 else {
688 os << obj.ClassName() << "::" << obj.GetName() ;
689 }
690 }
691 os << ")" ;
692}
693
694
695////////////////////////////////////////////////////////////////////////////////
696/// Frame detailed printing
697
698void RooPlot::printMultiline(std::ostream& os, Int_t /*content*/, bool verbose, TString indent) const
699{
700 TString deeper(indent);
701 deeper.Append(" ");
702 if(nullptr != _plotVar) {
703 os << indent << "RooPlot " << GetName() << " (" << GetTitle() << ") plots variable ";
705 }
706 else {
707 os << indent << "RooPlot " << GetName() << " (" << GetTitle() << ") has no associated plot variable" << std::endl ;
708 }
709 os << indent << " Plot frame contains " << _items.size() << " object(s):" << std::endl;
710
711 if(verbose) {
712 Int_t i=0 ;
713 for(auto const& item : _items) {
714 TObject &obj = *item.first;
715 os << deeper << "[" << i++ << "] (Options=\"" << item.second << "\") ";
716 // Is this a printable object?
717 if(obj.IsA()->InheritsFrom(RooPrintable::Class())) {
718 auto po = dynamic_cast<RooPrintable&>(obj) ;
720 }
721 // is it a TNamed subclass?
722 else {
723 os << obj.ClassName() << "::" << obj.GetName() << std::endl;
724 }
725 }
726 }
727}
728
729
730
731////////////////////////////////////////////////////////////////////////////////
732/// Return the name of the object at slot 'idx' in this RooPlot.
733/// If the given index is out of range, return a null pointer
734
735const char* RooPlot::nameOf(Int_t idx) const
736{
737 TObject* obj = _items.at(idx).first;
738 if (!obj) {
739 coutE(InputArguments) << "RooPlot::nameOf(" << GetName() << ") index " << idx << " out of range" << std::endl ;
740 return nullptr ;
741 }
742 return obj->GetName() ;
743}
744
745
746
747////////////////////////////////////////////////////////////////////////////////
748/// Return the name of the object at slot 'idx' in this RooPlot.
749/// If the given index is out of range, return a null pointer
750
752{
753 TObject* obj = _items.at(idx).first;
754 if (!obj) {
755 coutE(InputArguments) << "RooPlot::getObject(" << GetName() << ") index " << idx << " out of range" << std::endl ;
756 return nullptr ;
757 }
758 return obj ;
759}
760
761
762
763////////////////////////////////////////////////////////////////////////////////
764/// Return a pointer to the line attributes of the named object in this plot,
765/// or zero if the named object does not exist or does not have line attributes.
766
768{
769 return dynamic_cast<TAttLine*>(findObject(name));
770}
771
772
773////////////////////////////////////////////////////////////////////////////////
774/// Return a pointer to the fill attributes of the named object in this plot,
775/// or zero if the named object does not exist or does not have fill attributes.
776
778{
779 return dynamic_cast<TAttFill*>(findObject(name));
780}
781
782
783////////////////////////////////////////////////////////////////////////////////
784/// Return a pointer to the marker attributes of the named object in this plot,
785/// or zero if the named object does not exist or does not have marker attributes.
786
788{
789 return dynamic_cast<TAttMarker*>(findObject(name));
790}
791
792
793////////////////////////////////////////////////////////////////////////////////
794/// Return a pointer to the text attributes of the named object in this plot,
795/// or zero if the named object does not exist or does not have text attributes.
796
798{
799 return dynamic_cast<TAttText*>(findObject(name));
800}
801
802
803
804////////////////////////////////////////////////////////////////////////////////
805/// Return a RooCurve pointer of the named object in this plot,
806/// or zero if the named object does not exist or is not a RooCurve
807
808RooCurve* RooPlot::getCurve(const char* name) const
809{
810 return dynamic_cast<RooCurve*>(findObject(name)) ;
811}
812
813
814////////////////////////////////////////////////////////////////////////////////
815/// Return a RooCurve pointer of the named object in this plot,
816/// or zero if the named object does not exist or is not a RooCurve
817
818RooHist* RooPlot::getHist(const char* name) const
819{
820 return dynamic_cast<RooHist*>(findObject(name)) ;
821}
822
823
824
825////////////////////////////////////////////////////////////////////////////////
826/// Remove object with given name, or last object added if no name is given.
827
828void RooPlot::remove(const char* name, bool deleteToo)
829{
830 if(name == nullptr) {
831 if(!_items.empty()) {
832 if(deleteToo) delete _items.back().first;
833 _items.pop_back();
834 } else {
835 coutE(InputArguments) << "RooPlot::remove(" << GetName() << ") ERROR: plot frame is empty, cannot remove last object" << std::endl ;
836 }
837 } else {
838 auto item = findItem(name);
839 if(item == _items.end()) {
840 coutE(InputArguments) << "RooPlot::remove(" << GetName() << ") ERROR: no object found with name " << name << std::endl ;
841 } else {
842 if(deleteToo) delete item->first;
843 _items.erase(item);
844 }
845 }
846}
847
848
849namespace {
850
851template<class Iter>
852void moveBefore(Iter before, Iter target) {
853 auto d = std::distance(before, target);
854 if(d > 0) std::rotate(before, target, target + 1);
855 else if(d < 0) std::rotate(target, target+1, before);
856}
857
858} // namespace
859
860
861////////////////////////////////////////////////////////////////////////////////
862/// Change the order in which our contained objects are drawn so that
863/// the target object is drawn just before the specified object.
864/// Returns false if either object does not exist.
865
866bool RooPlot::drawBefore(const char *before, const char *target)
867{
868 auto iterBefore = findItem(before);
869 auto iterTarget = findItem(target);
870 if(iterBefore == _items.end() || iterTarget == _items.end()) return false;
871 moveBefore(iterBefore, iterTarget);
872 return true;
873}
874
875
876////////////////////////////////////////////////////////////////////////////////
877/// Change the order in which our contained objects are drawn so that
878/// the target object is drawn just after the specified object.
879/// Returns false if either object does not exist.
880
881bool RooPlot::drawAfter(const char *after, const char *target)
882{
883 auto iterAfter = findItem(after);
884 auto iterTarget = findItem(target);
885 if(iterAfter == _items.end() || iterTarget == _items.end()) return false;
886 moveBefore(iterAfter + 1, iterTarget);
887 return true;
888}
889
890
891////////////////////////////////////////////////////////////////////////////////
892/// Find the named object in our list of items and return a pointer
893/// to it. Return zero and print a warning message if the named
894/// object cannot be found. If no name is supplied the last object
895/// added is returned.
896///
897/// Note that the returned pointer is to a
898/// TObject and so will generally need casting. Use the getAtt...()
899/// methods to change the drawing style attributes of a contained
900/// object directly.
901
902TObject *RooPlot::findObject(const char *name, const TClass* tClass) const
903{
904 TObject *ret = nullptr;
905
906 for(auto const& item : _items) {
907 TObject &obj = *item.first;
908 if ((!name || name[0] == '\0' || !TString(name).CompareTo(obj.GetName()))
909 && (!tClass || (obj.IsA()==tClass))) {
910 ret = &obj ;
911 }
912 }
913
914 if (ret == nullptr) {
915 coutE(InputArguments) << "RooPlot::findObject(" << GetName() << ") cannot find object " << (name?name:"<last>") << std::endl ;
916 }
917 return ret ;
918}
919
920
921RooPlot::Items::iterator RooPlot::findItem(std::string const& name)
922{
923 return std::find_if(_items.begin(), _items.end(), [&name](auto const& item){
924 return name == item.first->GetName();
925 });
926}
927
928RooPlot::Items::const_iterator RooPlot::findItem(std::string const& name) const
929{
930 return std::find_if(_items.begin(), _items.end(), [&name](auto const& item){
931 return name == item.first->GetName();
932 });
933}
934
935
936////////////////////////////////////////////////////////////////////////////////
937/// Return the Draw() options registered for the named object. Return
938/// an empty string if the named object cannot be found.
939
941{
942 auto item = findItem(name);
943 if(item == _items.end()) return "";
944
945 return DrawOpt{item->second.c_str()}.drawOptions;
946}
947
948
949////////////////////////////////////////////////////////////////////////////////
950/// Register the specified drawing options for the named object.
951/// Return false if the named object cannot be found.
952
953bool RooPlot::setDrawOptions(const char *name, TString options)
954{
955 auto item = findItem(name);
956 if(item == _items.end()) return false;
957
958 DrawOpt opt(item->second.c_str()) ;
959 strlcpy(opt.drawOptions,options,128) ;
960 item->second = opt.rawOpt();
961 return true;
962}
963
964
965////////////////////////////////////////////////////////////////////////////////
966/// Returns true of object with given name is set to be invisible
967
968bool RooPlot::getInvisible(const char* name) const
969{
970 auto item = findItem(name);
971 if(item == _items.end()) return false;
972
973 return DrawOpt{item->second.c_str()}.invisible ;
974}
975
976
977////////////////////////////////////////////////////////////////////////////////
978/// If flag is true object with 'name' is set to be invisible
979/// i.e. it is not drawn when Draw() is called
980
981void RooPlot::setInvisible(const char* name, bool flag)
982{
983 auto item = findItem(name);
984 if(item != _items.end()) {
985 DrawOpt opt;
986 opt.initialize(item->second.c_str());
987 opt.invisible = flag;
988 item->second = opt.rawOpt();
989 }
990
991}
992
993
994////////////////////////////////////////////////////////////////////////////////
995/// Set maximum value of Y axis
996
997void RooPlot::SetMaximum(double maximum)
998{
999 _hist->SetMaximum(maximum==-1111?_defYmax:maximum) ;
1000}
1001
1002
1003
1004////////////////////////////////////////////////////////////////////////////////
1005/// Set minimum value of Y axis
1006
1007void RooPlot::SetMinimum(double minimum)
1008{
1009 _hist->SetMinimum(minimum==-1111?_defYmin:minimum) ;
1010}
1011
1012
1013
1014////////////////////////////////////////////////////////////////////////////////
1015/// Calculate and return reduced chi-squared between a curve and a histogram.
1016///
1017/// \param[in] curvename Name of the curve or nullptr for last curve
1018/// \param[in] histname Name of the histogram to compare to or nullptr for last added histogram
1019/// \param[in] nFitParam If non-zero, reduce the number of degrees of freedom by this
1020/// number. This means that the curve was fitted to the data with nFitParam floating
1021/// parameters, which needs to be reflected in the calculation of \f$\chi^2 / \mathrm{ndf}\f$.
1022///
1023/// \return \f$ \chi^2 / \mathrm{ndf} \f$ between the plotted curve and the data.
1024///
1025/// \note The \f$ \chi^2 \f$ is calculated between a *plot of the original distribution* and the data.
1026/// It therefore has more rounding errors than directly calculating the \f$ \chi^2 \f$ from a PDF or
1027/// function. To do this, use RooAbsReal::createChi2(RooDataHist&, const RooCmdArg&, const RooCmdArg&, const RooCmdArg&, const RooCmdArg&, const RooCmdArg&, const RooCmdArg&, const RooCmdArg&, const RooCmdArg&).
1028double RooPlot::chiSquare(const char* curvename, const char* histname, int nFitParam) const
1029{
1030
1031 // Find curve object
1032 RooCurve* curve = static_cast<RooCurve*>(findObject(curvename,RooCurve::Class())) ;
1033 if (!curve) {
1034 coutE(InputArguments) << "RooPlot::chiSquare(" << GetName() << ") cannot find curve" << std::endl ;
1035 return -1. ;
1036 }
1037
1038 // Find histogram object
1039 RooHist* hist = static_cast<RooHist*>(findObject(histname,RooHist::Class())) ;
1040 if (!hist) {
1041 coutE(InputArguments) << "RooPlot::chiSquare(" << GetName() << ") cannot find histogram" << std::endl ;
1042 return -1. ;
1043 }
1044
1045 return curve->chiSquare(*hist,nFitParam) ;
1046}
1047
1048
1049////////////////////////////////////////////////////////////////////////////////
1050/// Return a RooHist (derives from TGraphAsymErrors) containing the residuals of a histogram.
1051/// The plotting range of the graph is adapted to the plotting range of the current plot.
1052///
1053/// \param histname Name of the data histogram.
1054/// Passing an empty string or `nullptr` will create residuals of the last-plotted histogram.
1055/// \param curvename Name of the curve to compare to data.
1056/// Passing an empty string or `nullptr` will create residuals of the last-plotted curve.
1057/// \param normalize If true, the residuals are divided by the error
1058/// of the histogram, effectively returning a pull histogram.
1059/// \param useAverage If true, the histogram is compared with the curve averaged in each bin.
1060/// Otherwise, the curve is evaluated at the bin centres, which is not accurate for strongly curved distributions.
1061RooHist* RooPlot::residHist(const char* histname, const char* curvename, bool normalize, bool useAverage) const
1062{
1063 // Find all curve objects with the name "curvename" or the name of the last
1064 // plotted curve (there might be multiple in the case of multi-range fits).
1065 std::vector<RooCurve *> curves;
1066
1067 for(auto it = _items.rbegin(); it != _items.rend(); ++it) {
1068 TObject &obj = *it->first;
1069 if(obj.IsA() == RooCurve::Class()) {
1070 // If no curvename was passed, we take by default the last curve and all
1071 // other curves that have the same name
1072 if((!curvename || curvename[0] == '\0') || std::string(curvename) == obj.GetName()) {
1073 curvename = obj.GetName();
1074 curves.push_back(static_cast<RooCurve*>(&obj));
1075 }
1076 }
1077 }
1078
1079 if (curves.empty()) {
1080 coutE(InputArguments) << "RooPlot::residHist(" << GetName() << ") cannot find curve" << std::endl;
1081 return nullptr;
1082 }
1083
1084 // Find histogram object
1085 auto hist = static_cast<RooHist*>(findObject(histname,RooHist::Class()));
1086 if (!hist) {
1087 coutE(InputArguments) << "RooPlot::residHist(" << GetName() << ") cannot find histogram" << std::endl;
1088 return nullptr;
1089 }
1090
1091 auto residHist = hist->createEmptyResidHist(*curves.front(), normalize);
1092
1093 // We consider all curves with the same name as long as the ranges don't
1094 // overlap, to create also the full residual plot in multi-range fits.
1095 std::vector<std::pair<double, double>> coveredRanges;
1096 for(RooCurve * curve : curves) {
1097 const double xmin = curve->GetPointX(0);
1098 const double xmax = curve->GetPointX(curve->GetN() - 1);
1099
1100 for(auto const& prevRange : coveredRanges) {
1101 const double pxmin = prevRange.first;
1102 const double pxmax = prevRange.second;
1103 // If either xmin or xmax is within any previous range, the ranges
1104 // overloap and it makes to sense to also consider this curve for the
1105 // residuals (i.e., they can't come from a multi-range fit).
1106 if((pxmax > xmin && pxmin <= xmin) || (pxmax > xmax && pxmin <= xmax)) {
1107 continue;
1108 }
1109 }
1110
1111 coveredRanges.emplace_back(xmin, xmax);
1112
1113 hist->fillResidHist(*residHist, *curve, normalize, useAverage);
1114 }
1117 residHist->GetHistogram()->GetYaxis()->SetTitle(normalize ? "(Data - curve) / #sigma_{data}" : "Data - curve");
1118 return residHist.release();
1119}
1120
1121
1122
1123////////////////////////////////////////////////////////////////////////////////
1124/// Initialize the DrawOpt helper class
1125
1126void RooPlot::DrawOpt::initialize(const char* inRawOpt)
1127{
1128 if (!inRawOpt) {
1129 drawOptions[0] = 0 ;
1130 invisible=false ;
1131 return ;
1132 }
1133 strlcpy(drawOptions,inRawOpt,128) ;
1134 strtok(drawOptions,":") ;
1135 const char* extraOpt = strtok(nullptr,":") ;
1136 if (extraOpt) {
1137 invisible = (extraOpt[0]=='I') ;
1138 }
1139}
1140
1141
1142////////////////////////////////////////////////////////////////////////////////
1143/// Return the raw draw options
1144
1145const char* RooPlot::DrawOpt::rawOpt() const
1146{
1147 static char buf[128] ;
1148 strlcpy(buf,drawOptions,128) ;
1149 if (invisible) {
1150 strlcat(buf,":I",128) ;
1151 }
1152 return buf ;
1153}
1154
1155
1156
1157////////////////////////////////////////////////////////////////////////////////
1158/// Return the number of events that is associated with the range [xlo,xhi]
1159/// This method is only fully functional for ranges not equal to the full
1160/// range if the object that inserted the normalization data provided
1161/// a link to an external object that can calculate the event count in
1162/// in sub ranges. An error will be printed if this function is used
1163/// on sub-ranges while that information is not available
1164
1165double RooPlot::getFitRangeNEvt(double xlo, double xhi) const
1166{
1167 double scaleFactor = 1.0 ;
1168 if (_normObj) {
1169 scaleFactor = _normObj->getFitRangeNEvt(xlo,xhi)/_normObj->getFitRangeNEvt() ;
1170 } else {
1171 coutW(Plotting) << "RooPlot::getFitRangeNEvt(" << GetName() << ") WARNING: Unable to obtain event count in range "
1172 << xlo << " to " << xhi << ", substituting full event count" << std::endl ;
1173 }
1174 return getFitRangeNEvt()*scaleFactor ;
1175}
1176
1177
1178////////////////////////////////////////////////////////////////////////////////
1179/// Set the name of the RooPlot to 'name'
1180
1181void RooPlot::SetName(const char *name)
1182{
1183 if (_dir) _dir->GetList()->Remove(this);
1185 if (_dir) _dir->GetList()->Add(this);
1186}
1187
1188
1189////////////////////////////////////////////////////////////////////////////////
1190/// Set the name and title of the RooPlot to 'name' and 'title'
1191
1192void RooPlot::SetNameTitle(const char *name, const char* title)
1193{
1194 if (_dir) _dir->GetList()->Remove(this);
1195 TNamed::SetNameTitle(name,title) ;
1196 if (_dir) _dir->GetList()->Add(this);
1197}
1198
1199
1200////////////////////////////////////////////////////////////////////////////////
1201/// Set the title of the RooPlot to 'title'
1202
1203void RooPlot::SetTitle(const char* title)
1204{
1205 TNamed::SetTitle(title) ;
1206 _hist->SetTitle(title) ;
1207}
1208
1209
1210
1211////////////////////////////////////////////////////////////////////////////////
1212/// Define default print options, for a given print style
1213
1215{
1216 return kName|kArgs|kValue ;
1217}
1218
1219
1220
1221/// \see TH1::GetXaxis()
1222TAxis* RooPlot::GetXaxis() const { return _hist->GetXaxis() ; }
1223/// \see TH1::GetYaxis()
1224TAxis* RooPlot::GetYaxis() const { return _hist->GetYaxis() ; }
1225/// \see TH1::GetNbinsX()
1227/// \see TH1::GetNdivisions()
1229/// \see TH1::GetMinimum()
1230double RooPlot::GetMinimum(double minval) const { return _hist->GetMinimum(minval) ; }
1231/// \see TH1::GetMaximum()
1232double RooPlot::GetMaximum(double maxval) const { return _hist->GetMaximum(maxval) ; }
1233
1234
1235/// \see TH1::SetAxisColor()
1236void RooPlot::SetAxisColor(Color_t color, Option_t* axis) { _hist->SetAxisColor(color,axis) ; }
1237/// \see TH1::SetAxisRange()
1238void RooPlot::SetAxisRange(double xmin, double xmax, Option_t* axis) { _hist->SetAxisRange(xmin,xmax,axis) ; }
1239/// \see TH1::SetBarOffset()
1241/// \see TH1::SetBarWidth()
1243/// \see TH1::SetContour()
1244void RooPlot::SetContour(Int_t nlevels, const double* levels) { _hist->SetContour(nlevels,levels) ; }
1245/// \see TH1::SetContourLevel()
1247/// \see TH1::SetDrawOption()
1249/// \see TH1::SetFillAttributes()
1251/// \see TH1::SetFillColor()
1253/// \see TH1::SetFillStyle()
1255/// \see TH1::SetLabelColor()
1256void RooPlot::SetLabelColor(Color_t color, Option_t* axis) { _hist->SetLabelColor(color,axis) ; }
1257/// \see TH1::SetLabelFont()
1258void RooPlot::SetLabelFont(Style_t font, Option_t* axis) { _hist->SetLabelFont(font,axis) ; }
1259/// \see TH1::SetLabelOffset()
1261/// \see TH1::SetLabelSize()
1263/// \see TH1::SetLineAttributes()
1265/// \see TH1::SetLineColor()
1267/// \see TH1::SetLineStyle()
1269/// \see TH1::SetLineWidth()
1271/// \see TH1::SetMarkerAttributes()
1273/// \see TH1::SetMarkerColor()
1275/// \see TH1::SetMarkerSize()
1277/// \see TH1::SetMarkerStyle()
1279/// \see TH1::SetNdivisions()
1281/// \see TH1::SetOption()
1283/// Like TH1::SetStats(), but statistics boxes are *off* by default in RooFit.
1284void RooPlot::SetStats(bool stats) { _hist->SetStats(stats) ; }
1285/// \see TH1::SetTickLength()
1287/// \see TH1::SetTitleFont()
1288void RooPlot::SetTitleFont(Style_t font, Option_t* axis) { _hist->SetTitleFont(font,axis) ; }
1289/// \see TH1::SetTitleOffset()
1291/// \see TH1::SetTitleSize()
1293/// \see TH1::SetXTitle()
1294void RooPlot::SetXTitle(const char *title) { _hist->SetXTitle(title) ; }
1295/// \see TH1::SetYTitle()
1296void RooPlot::SetYTitle(const char *title) { _hist->SetYTitle(title) ; }
1297/// \see TH1::SetZTitle()
1298void RooPlot::SetZTitle(const char *title) { _hist->SetZTitle(title) ; }
1299
1300
1301
1302
1303////////////////////////////////////////////////////////////////////////////////
1304/// Plot RooPlot when double-clicked in browser
1305
1307{
1308 Draw();
1309 gPad->Update();
1310}
1311
1312
1313
1314
1315////////////////////////////////////////////////////////////////////////////////
1316
1318{
1319 // Custom streamer, needed for backward compatibility
1320
1321 if (R__b.IsReading()) {
1322 const bool oldAddDir = TH1::AddDirectoryStatus();
1323 TH1::AddDirectory(false);
1324
1325 // The default c'tor might have registered this with a TDirectory.
1326 // Streaming the TNamed will make this not retrievable anymore, so
1327 // unregister first.
1328 if (_dir)
1329 _dir->Remove(this);
1330
1331 UInt_t R__s;
1332 UInt_t R__c;
1333 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1334 if (R__v > 1) {
1335 R__b.ReadClassBuffer(RooPlot::Class(),this,R__v,R__s,R__c);
1336 } else {
1337 // backward compatible streamer code here
1338 // Version 1 of RooPlot was deriving from TH1 and RooPrintable
1339 // Version 2 derives instead from TNamed and RooPrintable
1340 _hist = new TH1F();
1341 _hist->TH1::Streamer(R__b);
1342 SetName(_hist->GetName());
1345 {
1346 TList itemsList;
1347 itemsList.Streamer(R__b);
1349 }
1350 R__b >> _padFactor;
1351 R__b >> _plotVar;
1352 R__b >> _plotVarSet;
1353 R__b >> _normVars;
1354 R__b >> _normNumEvts;
1355 R__b >> _normBinWidth;
1356 R__b >> _defYmin;
1357 R__b >> _defYmax;
1358 R__b.CheckByteCount(R__s, R__c, RooPlot::IsA());
1359 }
1360
1361 TH1::AddDirectory(oldAddDir);
1362 if (_dir)
1363 _dir->Append(this);
1364
1365 } else {
1366 R__b.WriteClassBuffer(RooPlot::Class(),this);
1367 }
1368}
1369
1370////////////////////////////////////////////////////////////////////////////////
1371/// Build a legend that contains all objects that have been drawn on the plot.
1372std::unique_ptr<TLegend> RooPlot::BuildLegend() const {
1373 auto leg = std::make_unique<TLegend>(0.5, 0.7, 0.9, 0.9);
1374 leg->SetBorderSize(0);
1375 leg->SetFillStyle(0);
1376 for (std::size_t i=0; i < _items.size(); ++i) {
1377 leg->AddEntry(getObject(i));
1378 }
1379
1380 return leg;
1381}
1382
1383/// RooFit-internal function for backwards compatibility.
1385 for(TObject * obj : tlist) {
1386 items.emplace_back(obj, obj->GetOption());
1387 }
1388}
1389
1390/// Replaces the pointer to the plot variable with a pointer to a clone of the
1391/// plot variable that is owned by this RooPlot. The RooPlot references the
1392/// plotted variable by non-owning pointer by default since ROOT 6.28, which
1393/// resulted in a big speedup when plotting complicated pdfs that are expensive
1394/// to clone. However, going back to an owned clone is useful in rare cases.
1395/// For example in the RooUnitTest, where the registered plots need to live
1396/// longer than the scope of the unit test.
1398 // If the plot variable is already cloned, we don't need to do anything.
1399 if(_plotVarSet) return;
1400 _plotVarSet = static_cast<RooArgSet*>(RooArgSet(*_plotVar).snapshot());
1402}
#define d(i)
Definition RSha256.hxx:102
#define e(i)
Definition RSha256.hxx:103
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
#define coutI(a)
#define coutW(a)
#define oocoutE(o, a)
#define coutE(a)
short Style_t
Definition RtypesCore.h:82
short Color_t
Definition RtypesCore.h:85
float Size_t
Definition RtypesCore.h:89
short Version_t
Definition RtypesCore.h:65
short Width_t
Definition RtypesCore.h:84
float Float_t
Definition RtypesCore.h:57
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:382
static void indent(ostringstream &buf, int indent_level)
#define gDirectory
Definition TDirectory.h:384
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t target
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t np
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h length
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t width
char name[80]
Definition TGX11.cxx:110
float xmin
float ymin
float xmax
float ymax
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2489
#define gPad
int binNumber(double x) const
Returns the bin number corresponding to the value x.
virtual double binCenter(Int_t bin) const =0
Int_t numBins() const
Return number of bins.
virtual double binLow(Int_t bin) const =0
virtual double binHigh(Int_t bin) const =0
RooAbsArg * find(const char *name) const
Find object with given name in list.
Abstract base class for objects that represent a real value that may appear on the left hand side of ...
virtual const RooAbsBinning & getBinning(const char *name=nullptr, bool verbose=true, bool createOnTheFly=false) const =0
Retrieve binning configuration with given name or default binning.
virtual double getMax(const char *name=nullptr) const
Get maximum of currently defined range.
bool hasMax(const char *name=nullptr) const
Check if variable has an upper bound.
virtual double getMin(const char *name=nullptr) const
Get minimum of currently defined range.
bool hasMin(const char *name=nullptr) const
Check if variable has a lower bound.
TString getTitle(bool appendUnit=false) const
Return this variable's title string.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:24
RooArgSet * snapshot(bool deepCopy=true) const
Use RooAbsCollection::snapshot(), but return as RooArgSet.
Definition RooArgSet.h:159
One-dimensional graphical representation of a real-valued function.
Definition RooCurve.h:36
double chiSquare(const RooHist &hist, int nFitParam) const
Calculate the chi^2/NDOF of this curve with respect to the histogram 'hist' accounting nFitParam floa...
Definition RooCurve.cxx:535
static TClass * Class()
Graphical representation of binned data based on the TGraphAsymmErrors class.
Definition RooHist.h:29
static TClass * Class()
char drawOptions[128]
Definition RooPlot.h:218
void initialize(const char *_rawOpt)
Initialize the DrawOpt helper class.
Definition RooPlot.cxx:1126
const char * rawOpt() const
Return the raw draw options.
Definition RooPlot.cxx:1145
Plot frame and a container for graphics objects within that frame.
Definition RooPlot.h:43
RooPlot()
Default constructor coverity[UNINIT_CTOR].
Definition RooPlot.cxx:85
void SetName(const char *name) override
Set the name of the RooPlot to 'name'.
Definition RooPlot.cxx:1181
void SetAxisColor(Color_t color=1, Option_t *axis="X")
Definition RooPlot.cxx:1236
void remove(const char *name=nullptr, bool deleteToo=true)
Remove object with given name, or last object added if no name is given.
Definition RooPlot.cxx:828
void SetDrawOption(Option_t *option="") override
Definition RooPlot.cxx:1248
void updateYAxis(double ymin, double ymax, const char *label="")
Update our y-axis limits to accommodate an object whose spread in y is (ymin,ymax).
Definition RooPlot.cxx:565
Items _items
A list of the items we contain.
Definition RooPlot.h:233
void SetMarkerSize(Size_t msize=1)
Definition RooPlot.cxx:1276
static RooPlot * frame(const RooAbsRealLValue &var, double xmin, double xmax, Int_t nBins)
Create a new frame for a given variable in x.
Definition RooPlot.cxx:185
const RooPlotable * _normObj
! Pointer to normalization object ;
Definition RooPlot.h:239
double _normNumEvts
Number of events in histogram (for normalization)
Definition RooPlot.h:240
bool drawBefore(const char *before, const char *target)
Change the order in which our contained objects are drawn so that the target object is drawn just bef...
Definition RooPlot.cxx:866
bool getInvisible(const char *name) const
Returns true of object with given name is set to be invisible.
Definition RooPlot.cxx:968
void SetTitle(const char *name) override
Set the title of the RooPlot to 'title'.
Definition RooPlot.cxx:1203
RooArgSet * _normVars
Variables that PDF plots should be normalized over.
Definition RooPlot.h:237
void addObject(TObject *obj, Option_t *drawOptions="", bool invisible=false)
Add a generic object to this plot.
Definition RooPlot.cxx:326
void addTH1(TH1 *hist, Option_t *drawOptions="", bool invisible=false)
Add a TH1 histogram object to this plot.
Definition RooPlot.cxx:345
double _padFactor
Scale our y-axis to _padFactor of our maximum contents.
Definition RooPlot.h:234
void SetMarkerColor(Color_t tcolor=1)
Definition RooPlot.cxx:1274
void printMultiline(std::ostream &os, Int_t content, bool verbose=false, TString indent="") const override
Frame detailed printing.
Definition RooPlot.cxx:698
void SetXTitle(const char *title)
Definition RooPlot.cxx:1294
void SetFillColor(Color_t fcolor)
Definition RooPlot.cxx:1252
RooArgSet * _plotVarSet
A list owning the cloned tree nodes of the plotVarClone.
Definition RooPlot.h:236
void SetNdivisions(Int_t n=510, Option_t *axis="X")
Definition RooPlot.cxx:1280
TDirectory * _dir
! non-persistent
Definition RooPlot.h:246
TString histName() const
Construct automatic name of internal TH1.
Definition RooPlot.cxx:261
TH1 * _hist
Histogram that we uses as basis for drawing the content.
Definition RooPlot.h:232
void SetMarkerStyle(Style_t mstyle=1)
Definition RooPlot.cxx:1278
void printName(std::ostream &os) const override
Print frame name.
Definition RooPlot.cxx:629
TString getDrawOptions(const char *name) const
Return the Draw() options registered for the named object.
Definition RooPlot.cxx:940
double _normBinWidth
Histogram bin width (for normalization)
Definition RooPlot.h:241
void SetZTitle(const char *title)
Definition RooPlot.cxx:1298
void setInvisible(const char *name, bool flag=true)
If flag is true object with 'name' is set to be invisible i.e.
Definition RooPlot.cxx:981
void Streamer(TBuffer &) override
Stream an object of class TObject.
Definition RooPlot.cxx:1317
void SetContour(Int_t nlevels, const double *levels=nullptr)
Definition RooPlot.cxx:1244
void printClassName(std::ostream &os) const override
Print frame class name.
Definition RooPlot.cxx:647
bool setDrawOptions(const char *name, TString options)
Register the specified drawing options for the named object.
Definition RooPlot.cxx:953
TObject * findObject(const char *name, const TClass *tClass=nullptr) const
Find the named object in our list of items and return a pointer to it.
Definition RooPlot.cxx:902
void SetStats(bool stats=true)
Like TH1::SetStats(), but statistics boxes are off by default in RooFit.
Definition RooPlot.cxx:1284
double getFitRangeNEvt() const
Return the number of events in the fit range.
Definition RooPlot.h:139
virtual void SetMinimum(double minimum=-1111)
Set minimum value of Y axis.
Definition RooPlot.cxx:1007
std::vector< std::pair< TObject *, std::string > > Items
Definition RooPlot.h:45
double GetMaximum(double maxval=FLT_MAX) const
Definition RooPlot.cxx:1232
TAttLine * getAttLine(const char *name=nullptr) const
Return a pointer to the line attributes of the named object in this plot, or zero if the named object...
Definition RooPlot.cxx:767
bool drawAfter(const char *after, const char *target)
Change the order in which our contained objects are drawn so that the target object is drawn just aft...
Definition RooPlot.cxx:881
RooAbsRealLValue * _plotVar
The variable we are plotting.
Definition RooPlot.h:235
void SetDirectory(TDirectory *dir)
Set the directory that this plot is associated to.
Definition RooPlot.cxx:293
~RooPlot() override
Destructor.
Definition RooPlot.cxx:274
void SetLabelOffset(Float_t offset=0.005, Option_t *axis="X")
Definition RooPlot.cxx:1260
TAttFill * getAttFill(const char *name=nullptr) const
Return a pointer to the fill attributes of the named object in this plot, or zero if the named object...
Definition RooPlot.cxx:777
void printTitle(std::ostream &os) const override
Print frame title.
Definition RooPlot.cxx:638
void SetLineWidth(Width_t lwidth)
Definition RooPlot.cxx:1270
void SetTickLength(Float_t length=0.02, Option_t *axis="X")
Definition RooPlot.cxx:1286
void SetFillAttributes()
Definition RooPlot.cxx:1250
void SetContourLevel(Int_t level, double value)
Definition RooPlot.cxx:1246
static bool addDirectoryStatus()
Query whether new instances of RooPlot will add themselves to gDirectory.
Definition RooPlot.cxx:77
void SetLabelSize(Float_t size=0.02, Option_t *axis="X")
Definition RooPlot.cxx:1262
double chiSquare(int nFitParam=0) const
Shortcut for RooPlot::chiSquare(const char* pdfname, const char* histname, int nFitParam=nullptr)
Definition RooPlot.h:174
Items::iterator findItem(std::string const &name)
Definition RooPlot.cxx:921
void SetOption(Option_t *option=" ")
Definition RooPlot.cxx:1282
TObject * getObject(Int_t idx) const
Return the name of the object at slot 'idx' in this RooPlot.
Definition RooPlot.cxx:751
virtual void SetMaximum(double maximum=-1111)
Set maximum value of Y axis.
Definition RooPlot.cxx:997
TAxis * GetYaxis() const
Definition RooPlot.cxx:1224
void Draw(Option_t *options=nullptr) override
Draw this plot and all of the elements it contains.
Definition RooPlot.cxx:597
void SetLabelFont(Style_t font=62, Option_t *axis="X")
Definition RooPlot.cxx:1258
void Browse(TBrowser *b) override
Plot RooPlot when double-clicked in browser.
Definition RooPlot.cxx:1306
double _defYmax
Default maximum for Yaxis (as calculated from contents)
Definition RooPlot.h:244
void SetLineStyle(Style_t lstyle)
Definition RooPlot.cxx:1268
TAttMarker * getAttMarker(const char *name=nullptr) const
Return a pointer to the marker attributes of the named object in this plot, or zero if the named obje...
Definition RooPlot.cxx:787
void SetTitleFont(Style_t font=62, Option_t *axis="X")
Definition RooPlot.cxx:1288
void SetAxisRange(double xmin, double xmax, Option_t *axis="X")
Definition RooPlot.cxx:1238
TAxis * GetXaxis() const
Definition RooPlot.cxx:1222
void SetLineColor(Color_t lcolor)
Definition RooPlot.cxx:1266
void SetFillStyle(Style_t fstyle)
Definition RooPlot.cxx:1254
const char * nameOf(Int_t idx) const
Return the name of the object at slot 'idx' in this RooPlot.
Definition RooPlot.cxx:735
void updateNormVars(const RooArgSet &vars)
Install the given set of observables are reference normalization variables for this frame.
Definition RooPlot.cxx:311
RooHist * residHist(const char *histname=nullptr, const char *pdfname=nullptr, bool normalize=false, bool useAverage=true) const
Return a RooHist (derives from TGraphAsymErrors) containing the residuals of a histogram.
Definition RooPlot.cxx:1061
RooPlot * emptyClone(const char *name)
Return empty clone of current RooPlot.
Definition RooPlot.cxx:231
void SetMarkerAttributes()
Definition RooPlot.cxx:1272
void createInternalPlotVarClone()
Replaces the pointer to the plot variable with a pointer to a clone of the plot variable that is owne...
Definition RooPlot.cxx:1397
void SetNameTitle(const char *name, const char *title) override
Set the name and title of the RooPlot to 'name' and 'title'.
Definition RooPlot.cxx:1192
void setPadFactor(double factor)
Definition RooPlot.h:144
Int_t defaultPrintContents(Option_t *opt) const override
Define default print options, for a given print style.
Definition RooPlot.cxx:1214
RooCurve * getCurve(const char *name=nullptr) const
Return a RooCurve pointer of the named object in this plot, or zero if the named object does not exis...
Definition RooPlot.cxx:808
static bool setAddDirectoryStatus(bool flag)
Configure whether new instances of RooPlot will add themselves to gDirectory.
Definition RooPlot.cxx:78
TAttText * getAttText(const char *name=nullptr) const
Return a pointer to the text attributes of the named object in this plot, or zero if the named object...
Definition RooPlot.cxx:797
void SetLabelColor(Color_t color=1, Option_t *axis="X")
Definition RooPlot.cxx:1256
TClass * IsA() const override
Definition RooPlot.h:250
Int_t GetNbinsX() const
Definition RooPlot.cxx:1226
static void fillItemsFromTList(Items &items, TList const &tlist)
RooFit-internal function for backwards compatibility.
Definition RooPlot.cxx:1384
void SetLineAttributes()
Definition RooPlot.cxx:1264
static bool _addDirStatus
static flag controlling AutoDirectoryAdd feature
Definition RooPlot.h:248
void printValue(std::ostream &os) const override
Print frame arguments.
Definition RooPlot.cxx:670
void SetYTitle(const char *title)
Definition RooPlot.cxx:1296
double getPadFactor() const
Definition RooPlot.h:143
void printArgs(std::ostream &os) const override
Interface for printing of object arguments.
Definition RooPlot.cxx:656
std::unique_ptr< TLegend > BuildLegend() const
Build a legend that contains all objects that have been drawn on the plot.
Definition RooPlot.cxx:1372
RooHist * getHist(const char *name=nullptr) const
Return a RooCurve pointer of the named object in this plot, or zero if the named object does not exis...
Definition RooPlot.cxx:818
void updateFitRangeNorm(const TH1 *hist)
Update our plot normalization over our plot variable's fit range, which will be determined by the fir...
Definition RooPlot.cxx:510
void SetTitleSize(Float_t size=0.02, Option_t *axis="X")
Definition RooPlot.cxx:1292
double _defYmin
Default minimum for Yaxis (as calculated from contents)
Definition RooPlot.h:243
static TClass * Class()
void SetBarOffset(Float_t offset=0.25)
Definition RooPlot.cxx:1240
void SetBarWidth(Float_t width=0.5)
Definition RooPlot.cxx:1242
Int_t GetNdivisions(Option_t *axis="X") const
Definition RooPlot.cxx:1228
void addPlotable(RooPlotable *plotable, Option_t *drawOptions="", bool invisible=false, bool refreshNorm=false)
Add the specified plotable object to our plot.
Definition RooPlot.cxx:476
void initialize()
Perform initialization that is common to all constructors.
Definition RooPlot.cxx:242
static RooPlot * frameWithLabels(const RooAbsRealLValue &var)
Create a new frame for a given variable in x, adding bin labels.
Definition RooPlot.cxx:197
void SetTitleOffset(Float_t offset=1, Option_t *axis="X")
Definition RooPlot.cxx:1290
double GetMinimum(double minval=-FLT_MAX) const
Definition RooPlot.cxx:1230
Class RooPotable is a base class for objects that can be inserted into RooPlots and take advantage of...
Definition RooPlotable.h:26
virtual double getFitRangeNEvt() const =0
TObject * crossCast()
Return cast of RooPlotable as TObject.
double getYAxisMin() const
Definition RooPlotable.h:38
double getYAxisMax() const
Definition RooPlotable.h:39
const char * getYAxisLabel() const
Definition RooPlotable.h:28
virtual double getFitRangeBinW() const =0
A 'mix-in' base class that define the standard RooFit plotting and printing methods.
static TClass * Class()
virtual void Streamer(TBuffer &)
virtual void printStream(std::ostream &os, Int_t contents, StyleOption style, TString indent="") const
Print description of object on ostream, printing contents set by contents integer,...
void Set(Int_t n) override
Set size of this array to n doubles.
Definition TArrayD.cxx:106
Fill Area Attributes class.
Definition TAttFill.h:20
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition TAttFill.h:38
virtual void SetFillAttributes()
Invoke the DialogCanvas Fill attributes.
Definition TAttFill.cxx:254
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
Definition TAttFill.h:40
Line Attributes class.
Definition TAttLine.h:20
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Definition TAttLine.h:44
virtual void SetLineAttributes()
Invoke the DialogCanvas Line attributes.
Definition TAttLine.cxx:294
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition TAttLine.h:45
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition TAttLine.h:42
Marker Attributes class.
Definition TAttMarker.h:20
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
Definition TAttMarker.h:39
virtual void SetMarkerAttributes()
Invoke the DialogCanvas Marker attributes.
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
Definition TAttMarker.h:41
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
Definition TAttMarker.h:46
Text Attributes class.
Definition TAttText.h:20
Class to manage histogram axis.
Definition TAxis.h:32
virtual void SetBinLabel(Int_t bin, const char *label)
Set label for bin.
Definition TAxis.cxx:882
Bool_t IsAlphanumeric() const
Definition TAxis.h:90
const char * GetTitle() const override
Returns title of object.
Definition TAxis.h:137
virtual Double_t GetBinCenter(Int_t bin) const
Return center of bin.
Definition TAxis.cxx:473
Double_t GetXmax() const
Definition TAxis.h:142
const char * GetBinLabel(Int_t bin) const
Return label for bin.
Definition TAxis.cxx:435
Double_t GetXmin() const
Definition TAxis.h:141
virtual void SetRangeUser(Double_t ufirst, Double_t ulast)
Set the viewing range for the axis from ufirst to ulast (in user coordinates, that is,...
Definition TAxis.cxx:1084
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width.
Definition TAxis.cxx:537
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
Definition TAxis.cxx:523
Using a TBrowser one can browse all ROOT objects.
Definition TBrowser.h:37
Buffer base class used for serializing objects.
Definition TBuffer.h:43
virtual Version_t ReadVersion(UInt_t *start=nullptr, UInt_t *bcnt=nullptr, const TClass *cl=nullptr)=0
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=nullptr)=0
Bool_t IsReading() const
Definition TBuffer.h:86
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:81
Bool_t InheritsFrom(const char *cl) const override
Return kTRUE if this class inherits from a class with name "classname".
Definition TClass.cxx:4943
Describe directory structure in memory.
Definition TDirectory.h:45
virtual TList * GetList() const
Definition TDirectory.h:222
virtual void Append(TObject *obj, Bool_t replace=kFALSE)
Append object to this directory.
virtual TObject * Remove(TObject *)
Remove an object from the in-memory list.
TGraph with asymmetric error bars.
A TGraph is an object made of two arrays X and Y with npoints each.
Definition TGraph.h:41
static TClass * Class()
@ kIsSortedX
Graph is sorted in X points.
Definition TGraph.h:79
virtual TH1F * GetHistogram() const
Returns a pointer to the histogram used to draw the axis Takes into account the two following cases.
Definition TGraph.cxx:1430
1-D histogram with a double per channel (see TH1 documentation)
Definition TH1.h:682
1-D histogram with a float per channel (see TH1 documentation)
Definition TH1.h:634
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:59
virtual void SetLabelFont(Style_t font=62, Option_t *axis="X")
Set font number used to draw axis labels.
Definition Haxis.cxx:249
virtual void SetDirectory(TDirectory *dir)
By default, when a histogram is created, it is added to the list of histogram objects in the current ...
Definition TH1.cxx:8957
virtual void SetBarOffset(Float_t offset=0.25)
Set the bar offset as fraction of the bin width for drawing mode "B".
Definition TH1.h:376
virtual void SetTitleSize(Float_t size=0.02, Option_t *axis="X")
Set the axis' title size.
Definition Haxis.cxx:365
virtual void SetLabelOffset(Float_t offset=0.005, Option_t *axis="X")
Set offset between axis and axis' labels.
Definition Haxis.cxx:267
void SetTitle(const char *title) override
Change/set the title.
Definition TH1.cxx:6734
virtual void SetXTitle(const char *title)
Definition TH1.h:431
virtual Int_t GetDimension() const
Definition TH1.h:295
static void AddDirectory(Bool_t add=kTRUE)
Sets the flag controlling the automatic add of histograms in memory.
Definition TH1.cxx:1281
virtual void SetContourLevel(Int_t level, Double_t value)
Set value for one contour level.
Definition TH1.cxx:8542
TAxis * GetXaxis()
Definition TH1.h:336
virtual void SetNdivisions(Int_t n=510, Option_t *axis="X")
Set the number of divisions to draw an axis.
Definition Haxis.cxx:170
virtual Double_t GetMaximum(Double_t maxval=FLT_MAX) const
Return maximum value smaller than maxval of bins in the range, unless the value has been overridden b...
Definition TH1.cxx:8565
virtual Int_t GetNbinsX() const
Definition TH1.h:309
virtual void SetMaximum(Double_t maximum=-1111)
Definition TH1.h:416
TAxis * GetYaxis()
Definition TH1.h:337
void Draw(Option_t *option="") override
Draw this histogram with options.
Definition TH1.cxx:3055
virtual Int_t GetNdivisions(Option_t *axis="X") const
Return the number of divisions for "axis".
Definition Haxis.cxx:27
virtual void SetMinimum(Double_t minimum=-1111)
Definition TH1.h:417
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
Definition TH1.cxx:9242
virtual Double_t GetEntries() const
Return the current number of entries.
Definition TH1.cxx:4418
virtual void SetZTitle(const char *title)
Definition TH1.h:433
virtual TArrayD * GetSumw2()
Definition TH1.h:325
virtual void SetTitleOffset(Float_t offset=1, Option_t *axis="X")
Specify a parameter offset to control the distance between the axis and the axis' title.
Definition Haxis.cxx:345
virtual void SetLabelColor(Color_t color=1, Option_t *axis="X")
Set axis labels color.
Definition Haxis.cxx:226
virtual void SetAxisColor(Color_t color=1, Option_t *axis="X")
Set color to draw the axis line and tick marks.
Definition Haxis.cxx:187
virtual void SetOption(Option_t *option=" ")
Definition TH1.h:424
virtual void SetContour(Int_t nlevels, const Double_t *levels=nullptr)
Set the number and values of contour levels.
Definition TH1.cxx:8503
virtual void SetAxisRange(Double_t xmin, Double_t xmax, Option_t *axis="X")
Set the "axis" range.
Definition Haxis.cxx:201
virtual void SetYTitle(const char *title)
Definition TH1.h:432
virtual void SetTitleFont(Style_t font=62, Option_t *axis="X")
Set the axis' title font.
Definition Haxis.cxx:323
virtual Double_t GetMinimum(Double_t minval=-FLT_MAX) const
Return minimum value larger than minval of bins in the range, unless the value has been overridden by...
Definition TH1.cxx:8655
virtual void SetLabelSize(Float_t size=0.02, Option_t *axis="X")
Set size of axis' labels.
Definition Haxis.cxx:285
virtual void Sumw2(Bool_t flag=kTRUE)
Create structure to store sum of squares of weights.
Definition TH1.cxx:9040
static Bool_t AddDirectoryStatus()
Static function: cannot be inlined on Windows/NT.
Definition TH1.cxx:741
virtual void SetBarWidth(Float_t width=0.5)
Set the width of bars as fraction of the bin width for drawing mode "B".
Definition TH1.h:377
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
Definition TH1.cxx:9010
virtual void SetTickLength(Float_t length=0.02, Option_t *axis="X")
Set the axis' tick marks length.
Definition Haxis.cxx:302
A doubly linked list.
Definition TList.h:38
void Streamer(TBuffer &) override
Stream all objects in the collection to or from the I/O buffer.
Definition TList.cxx:1189
void RecursiveRemove(TObject *obj) override
Remove object from this collection and recursively remove the object from all other objects (and coll...
Definition TList.cxx:762
void Add(TObject *obj) override
Definition TList.h:81
TObject * Remove(TObject *obj) override
Remove object from the list.
Definition TList.cxx:820
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition TNamed.cxx:164
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:48
TString fName
Definition TNamed.h:32
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition TNamed.cxx:140
virtual void SetNameTitle(const char *name, const char *title)
Set all the TNamed parameters (name and title).
Definition TNamed.cxx:154
Mother of all ROOT objects.
Definition TObject.h:41
virtual const char * GetName() const
Returns name of object.
Definition TObject.cxx:456
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition TObject.cxx:225
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:542
virtual void SetDrawOption(Option_t *option="")
Set drawing option for object.
Definition TObject.cxx:782
virtual TClass * IsA() const
Definition TObject.h:243
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition TObject.cxx:292
Basic string class.
Definition TString.h:139
void ToLower()
Change string to lower-case.
Definition TString.cxx:1182
const char * Data() const
Definition TString.h:376
void ToUpper()
Change string to upper case.
Definition TString.cxx:1195
TString & Append(const char *cs)
Definition TString.h:572
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2378
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:632
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
leg
Definition legend1.C:34
Definition graph.py:1
th1 Draw()