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