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