Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooPlot.cxx
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * @(#)root/roofitcore:$Id$
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2000-2005, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16
17/**
18\file RooPlot.cxx
19\class RooPlot
20\ingroup Roofitcore
21
22A RooPlot is a plot frame and a container for graphics objects
23within that frame. As a frame, it provides the TH1-style public interface
24for setting plot ranges, configuring axes, etc. As a container, it
25holds an arbitrary set of objects that might be histograms of data,
26curves representing a fit model, or text labels. Use the Draw()
27method to draw a frame and the objects it contains. Use the various
28add...() methods to add objects to be drawn. In general, the
29add...() methods create a private copy of the object you pass them
30and return a pointer to this copy. The caller owns the input object
31and this class owns the returned object.
32All RooAbsReal and RooAbsData derived classes implement plotOn()
33functions that facilitate to plot themselves on a given RooPlot, e.g.
34~~~ {.cpp}
35RooPlot *frame = x.frame() ;
36data.plotOn(frame) ;
37pdf.plotOn(frame) ;
38~~~
39These high level functions also take care of any projections
40or other mappings that need to be made to plot a multi-dimensional
41object onto a one-dimensional plot.
42**/
43
44#include "RooPlot.h"
45
46#include "RooAbsReal.h"
47#include "RooAbsRealLValue.h"
48#include "RooPlotable.h"
49#include "RooArgSet.h"
50#include "RooCurve.h"
51#include "RooHist.h"
52#include "RooMsgService.h"
53
54#include "TClass.h"
55#include "TBuffer.h"
56#include "TH1D.h"
57#include "TBrowser.h"
58#include "TVirtualPad.h"
59
60#include "TAttLine.h"
61#include "TAttFill.h"
62#include "TAttMarker.h"
63#include "TAttText.h"
64#include "TDirectoryFile.h"
65#include "TLegend.h"
66#include "strlcpy.h"
67
68#include <iostream>
69#include <cstring>
70
71using namespace std;
72
74
75
77
79Bool_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
86RooPlot::RooPlot() : _hist(0), _plotVarClone(0), _plotVarSet(0), _normVars(0), _normObj(0), _dir(0)
87{
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
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
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
189RooPlot::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
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_%zx",_plotVarClone->GetName(),(size_t)this)) ;
334 } else {
335 return TString(Form("frame_%zx",(size_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/// Add a generic object to this plot. The specified options will be
388/// used to Draw() this object later. The caller transfers ownership
389/// of the object with this call, and the object will be deleted
390/// when its containing plot object is destroyed.
391
392void RooPlot::addObject(TObject *obj, Option_t *drawOptions, Bool_t invisible)
393{
394 if(0 == obj) {
395 coutE(InputArguments) << fName << "::addObject: called with a null pointer" << endl;
396 return;
397 }
398 DrawOpt opt(drawOptions) ;
399 opt.invisible = invisible ;
400 _items.Add(obj,opt.rawOpt());
401}
402
403
404////////////////////////////////////////////////////////////////////////////////
405/// Add a TH1 histogram object to this plot. The specified options
406/// will be used to Draw() this object later. "SAME" will be added to
407/// the options if they are not already present. The caller transfers
408/// ownership of the object with this call, and the object will be
409/// deleted when its containing plot object is destroyed.
410
411void RooPlot::addTH1(TH1 *hist, Option_t *drawOptions, Bool_t invisible)
412{
413 if(0 == hist) {
414 coutE(InputArguments) << fName << "::addTH1: called with a null pointer" << endl;
415 return;
416 }
417 // check that this histogram is really 1D
418 if(1 != hist->GetDimension()) {
419 coutE(InputArguments) << fName << "::addTH1: cannot plot histogram with "
420 << hist->GetDimension() << " dimensions" << endl;
421 return;
422 }
423
424 // add option "SAME" if necessary
425 TString options(drawOptions);
426 options.ToUpper();
427 if(!options.Contains("SAME")) options.Append("SAME");
428
429 // update our y-axis label and limits
430 updateYAxis(hist->GetMinimum(),hist->GetMaximum(),hist->GetYaxis()->GetTitle());
431
432 // use this histogram's normalization if necessary
433 updateFitRangeNorm(hist);
434
435 // add the histogram to our list
436 addObject(hist,options.Data(),invisible);
437}
438
439
440namespace {
441 // this helper function is intended to translate a graph from a regular axis to a labelled axis
442 // this version uses TGraph, which is a parent of RooCurve
443 void translateGraph(TH1* hist, RooAbsRealLValue* xvar, TGraph* graph){
444 // if the graph already has a labelled axis, don't do anything
445 if(graph->GetXaxis()->IsAlphanumeric()) return;
446 double xmin = hist->GetXaxis()->GetXmin();
447 double xmax = hist->GetXaxis()->GetXmax();
448 if(graph->TestBit(TGraph::kIsSortedX)){
449 // sorted graphs are "line graphs"
450 // evaluate the graph at the lower and upper edge as well as the center of each bin
451 std::vector<double> x;
452 std::vector<double> y;
453 x.push_back(xmin);
454 y.push_back(graph->Eval(xvar->getBinning().binLow(0)));
455 for(int i=0; i<hist->GetNbinsX(); ++i){
456 x.push_back(hist->GetXaxis()->GetBinUpEdge(i+1));
457 y.push_back(graph->Eval(xvar->getBinning().binHigh(i)));
458 x.push_back(hist->GetXaxis()->GetBinCenter(i+1));
459 y.push_back(graph->Eval(xvar->getBinning().binCenter(i)));
460 }
461 int n = x.size();
462 graph->Set(n);
463 for(int i=0; i<n; ++i){
464 graph->SetPoint(i,x[i],y[i]);
465 }
466 graph->Sort();
467 } else {
468 // unsorted graphs are "area graphs"
469 std::map<int,double> minValues;
470 std::map<int,double> maxValues;
471 int n = graph->GetN();
472 double x, y;
473 // for each bin, find the min and max points to form an envelope
474 for(int i=0; i<n; ++i){
475 graph->GetPoint(i,x,y);
476 int bin = xvar->getBinning().binNumber(x)+1;
477 if(maxValues.find(bin)!=maxValues.end()){
478 maxValues[bin] = std::max(maxValues[bin],y);
479 } else {
480 maxValues[bin] = y;
481 }
482 if(minValues.find(bin)!=minValues.end()){
483 minValues[bin] = std::min(minValues[bin],y);
484 } else {
485 minValues[bin] = y;
486 }
487 }
488 double xminY = graph->Eval(xmin);
489 double xmaxY = graph->Eval(xmax);
490 graph->Set(hist->GetNbinsX()+2);
491 int np=0;
492 graph->SetPoint(np,xmin,xminY);
493 // assign the calculated envelope boundaries to the bin centers of the bins
494 for(auto it = maxValues.begin(); it != maxValues.end(); ++it){
495 graph->SetPoint(++np,hist->GetXaxis()->GetBinCenter(it->first),it->second);
496 }
497 graph->SetPoint(++np,xmax,xmaxY);
498 for(auto it = minValues.rbegin(); it != minValues.rend(); ++it){
499 graph->SetPoint(++np,hist->GetXaxis()->GetBinCenter(it->first),it->second);
500 }
501 graph->SetPoint(++np,xmin,xminY);
502 }
503 // make sure that the graph also has the labels set, such that subsequent calls to translate this graph will not do anything
504 graph->GetXaxis()->Set(hist->GetNbinsX(),xmin,xmax);
505 for(int i=0; i<hist->GetNbinsX(); ++i){
506 graph->GetXaxis()->SetBinLabel(i+1,hist->GetXaxis()->GetBinLabel(i+1));
507 }
508 }
509 // this version uses TGraphErrors, which is a parent of RooHist
510 void translateGraph(TH1* hist, RooAbsRealLValue* xvar, TGraphAsymmErrors* graph){
511 // if the graph already has a labelled axis, don't do anything
512 if(graph->GetXaxis()->IsAlphanumeric()) return;
513 int n = graph->GetN();
514 double xmin = hist->GetXaxis()->GetXmin();
515 double xmax = hist->GetXaxis()->GetXmax();
516 double x, y;
517 // as this graph is histogram-like, we expect there to be one point per bin
518 // we just move these points to the respective bin centers
519 for(int i=0; i<n; ++i){
520 if(graph->GetPoint(i,x,y)!=i) break;
521 int bin = xvar->getBinning().binNumber(x);
522 graph->SetPoint(i,hist->GetXaxis()->GetBinCenter(bin+1),y);
523 graph->SetPointEXhigh(i,0.5*hist->GetXaxis()->GetBinWidth(bin+1));
524 graph->SetPointEXlow(i,0.5*hist->GetXaxis()->GetBinWidth(bin+1));
525 }
526 graph->GetXaxis()->Set(hist->GetNbinsX(),xmin,xmax);
527 // make sure that the graph also has the labels set, such that subsequent calls to translate this graph will not do anything
528 for(int i=0; i<hist->GetNbinsX(); ++i){
529 graph->GetXaxis()->SetBinLabel(i+1,hist->GetXaxis()->GetBinLabel(i+1));
530 }
531 }
532}
533
534////////////////////////////////////////////////////////////////////////////////
535/// Add the specified plotable object to our plot. Increase our y-axis
536/// limits to fit this object if necessary. The default lower-limit
537/// is zero unless we are plotting an object that takes on negative values.
538/// This call transfers ownership of the plotable object to this class.
539/// The plotable object will be deleted when this plot object is deleted.
540void RooPlot::addPlotable(RooPlotable *plotable, Option_t *drawOptions, Bool_t invisible, Bool_t refreshNorm)
541{
542 // update our y-axis label and limits
543 updateYAxis(plotable->getYAxisMin(),plotable->getYAxisMax(),plotable->getYAxisLabel());
544
545 // use this object's normalization if necessary
546 updateFitRangeNorm(plotable,refreshNorm) ;
547
548 // add this element to our list and remember its drawing option
549 TObject *obj= plotable->crossCast();
550 if(0 == obj) {
551 coutE(InputArguments) << fName << "::add: cross-cast to TObject failed (nothing added)" << endl;
552 }
553 else {
554 // if the frame axis is alphanumeric, the coordinates of the graph need to be translated to this binning
555 if(this->_hist->GetXaxis()->IsAlphanumeric()){
556 if(obj->InheritsFrom(RooCurve::Class())){
557 ::translateGraph(this->_hist,_plotVarClone,static_cast<RooCurve*>(obj));
558 } else if(obj->InheritsFrom(RooHist::Class())){
559 ::translateGraph(this->_hist,_plotVarClone,static_cast<RooHist*>(obj));
560 }
561 }
562
563 DrawOpt opt(drawOptions) ;
564 opt.invisible = invisible ;
565 _items.Add(obj,opt.rawOpt());
566 }
567}
568
569
570////////////////////////////////////////////////////////////////////////////////
571/// Update our plot normalization over our plot variable's fit range,
572/// which will be determined by the first suitable object added to our plot.
573
575{
576 const TAxis* xa = ((TH1*)hist)->GetXaxis() ;
577 _normBinWidth = (xa->GetXmax()-xa->GetXmin())/hist->GetNbinsX() ;
579}
580
581
582////////////////////////////////////////////////////////////////////////////////
583/// Update our plot normalization over our plot variable's fit range,
584/// which will be determined by the first suitable object added to our plot.
585
587{
588 if (_normNumEvts != 0) {
589
590 // If refresh feature is disabled stop here
591 if (!refreshNorm) return ;
592
593 Double_t corFac(1.0) ;
594 if (dynamic_cast<const RooHist*>(rp)) corFac = _normBinWidth/rp->getFitRangeBinW() ;
595
596
597 if (fabs(rp->getFitRangeNEvt()/corFac-_normNumEvts)>1e-6) {
598 coutI(Plotting) << "RooPlot::updateFitRangeNorm: New event count of " << rp->getFitRangeNEvt()/corFac
599 << " will supercede previous event count of " << _normNumEvts << " for normalization of PDF projections" << endl ;
600 }
601
602 // Nominal bin width (i.e event density) is already locked in by previously drawn histogram
603 // scale this histogram to match that density
604 _normNumEvts = rp->getFitRangeNEvt()/corFac ;
605 _normObj = rp ;
606 // cout << "correction factor = " << _normBinWidth << "/" << rp->getFitRangeBinW() << endl ;
607 // cout << "updating numevts to " << _normNumEvts << endl ;
608
609 } else {
610
611 _normObj = rp ;
613 if (rp->getFitRangeBinW()) {
615 }
616
617 // cout << "updating numevts to " << _normNumEvts << endl ;
618 }
619
620}
621
622
623
624////////////////////////////////////////////////////////////////////////////////
625/// Update our y-axis limits to accomodate an object whose spread
626/// in y is (ymin,ymax). Use the specified y-axis label if we don't
627/// have one assigned already.
628
630{
631 // force an implicit lower limit of zero if appropriate
632 if(GetMinimum() == 0 && ymin > 0) ymin= 0;
633
634 // calculate padded values
635 Double_t ypad= getPadFactor()*(ymax-ymin);
636 ymax+= ypad;
637 if(ymin < 0) ymin-= ypad;
638
639 // update our limits if necessary
640 if(GetMaximum() < ymax) {
641 _defYmax = ymax ;
643 // if we don't do this - Unzoom on y-axis will reset upper bound to 1
645 }
646 if(GetMinimum() > ymin) {
647 _defYmin = ymin ;
649 }
650
651 // use the specified y-axis label if we don't have one already
652 if(0 == strlen(_hist->GetYaxis()->GetTitle())) _hist->SetYTitle(label);
653}
654
655
656////////////////////////////////////////////////////////////////////////////////
657/// Draw this plot and all of the elements it contains. The specified options
658/// only apply to the drawing of our frame. The options specified in our add...()
659/// methods will be used to draw each object we contain.
660
662{
663 TString optArg = option ;
664 optArg.ToLower() ;
665
666 // This draw options prevents the histogram with one dummy entry
667 // to be drawn
668 if (optArg.Contains("same")) {
669 _hist->Draw("FUNCSAME");
670 } else {
671 _hist->Draw("FUNC");
672 }
673
674 std::unique_ptr<TIterator> _iterator(_items.MakeIterator());
675 TObject *obj = 0;
676 while((obj= _iterator->Next())) {
677 DrawOpt opt(_iterator->GetOption()) ;
678 if (!opt.invisible) {
679 //LM: in case of a TGraph derived object, do not use default "" option
680 // which is "ALP" from 5.34.10 (and will then redrawn the axis) but use "LP"
681 if (!strlen(opt.drawOptions) && obj->IsA()->InheritsFrom(TGraph::Class()) ) strlcpy(opt.drawOptions,"LP",3);
682 obj->Draw(opt.drawOptions);
683 }
684 }
685
686 _hist->Draw("AXISSAME");
687}
688
689
690
691////////////////////////////////////////////////////////////////////////////////
692/// Print frame name
693
694void RooPlot::printName(ostream& os) const
695{
696 os << GetName() ;
697}
698
699
700////////////////////////////////////////////////////////////////////////////////
701/// Print frame title
702
703void RooPlot::printTitle(ostream& os) const
704{
705 os << GetTitle() ;
706}
707
708
709////////////////////////////////////////////////////////////////////////////////
710/// Print frame class name
711
712void RooPlot::printClassName(ostream& os) const
713{
714 os << IsA()->GetName() ;
715}
716
717
718
719////////////////////////////////////////////////////////////////////////////////
720
721void RooPlot::printArgs(ostream& os) const
722{
723 if (_plotVarClone) {
724 os << "[" ;
726 os << "]" ;
727 }
728}
729
730
731
732////////////////////////////////////////////////////////////////////////////////
733/// Print frame arguments
734
735void RooPlot::printValue(ostream& os) const
736{
737 os << "(" ;
738 std::unique_ptr<TIterator> _iterator(_items.MakeIterator());
739 TObject *obj = 0;
741 while((obj= _iterator->Next())) {
742 if (first) {
743 first=kFALSE ;
744 } else {
745 os << "," ;
746 }
747 if(obj->IsA()->InheritsFrom(RooPrintable::Class())) {
748 RooPrintable* po = dynamic_cast<RooPrintable*>(obj) ;
749 // coverity[FORWARD_NULL]
751 }
752 // is it a TNamed subclass?
753 else {
754 os << obj->ClassName() << "::" << obj->GetName() ;
755 }
756 }
757 os << ")" ;
758}
759
760
761////////////////////////////////////////////////////////////////////////////////
762/// Frame detailed printing
763
764void RooPlot::printMultiline(ostream& os, Int_t /*content*/, Bool_t verbose, TString indent) const
765{
766 TString deeper(indent);
767 deeper.Append(" ");
768 if(0 != _plotVarClone) {
769 os << indent << "RooPlot " << GetName() << " (" << GetTitle() << ") plots variable ";
771 }
772 else {
773 os << indent << "RooPlot " << GetName() << " (" << GetTitle() << ") has no associated plot variable" << endl ;
774 }
775 os << indent << " Plot frame contains " << _items.GetSize() << " object(s):" << endl;
776
777 if(verbose) {
778 std::unique_ptr<TIterator> _iterator(_items.MakeIterator());
779 TObject *obj = 0;
780 Int_t i=0 ;
781 while((obj= _iterator->Next())) {
782 os << deeper << "[" << i++ << "] (Options=\"" << _iterator->GetOption() << "\") ";
783 // Is this a printable object?
784 if(obj->IsA()->InheritsFrom(RooPrintable::Class())) {
785 RooPrintable* po = dynamic_cast<RooPrintable*>(obj) ;
786 if (po) {
788 }
789 }
790 // is it a TNamed subclass?
791 else {
792 os << obj->ClassName() << "::" << obj->GetName() << endl;
793 }
794 }
795 }
796}
797
798
799
800////////////////////////////////////////////////////////////////////////////////
801/// Return the name of the object at slot 'idx' in this RooPlot.
802/// If the given index is out of range, return a null pointer
803
804const char* RooPlot::nameOf(Int_t idx) const
805{
806 TObject* obj = _items.At(idx) ;
807 if (!obj) {
808 coutE(InputArguments) << "RooPlot::nameOf(" << GetName() << ") index " << idx << " out of range" << endl ;
809 return 0 ;
810 }
811 return obj->GetName() ;
812}
813
814
815
816////////////////////////////////////////////////////////////////////////////////
817/// Return the name of the object at slot 'idx' in this RooPlot.
818/// If the given index is out of range, return a null pointer
819
821{
822 TObject* obj = _items.At(idx) ;
823 if (!obj) {
824 coutE(InputArguments) << "RooPlot::getObject(" << GetName() << ") index " << idx << " out of range" << endl ;
825 return 0 ;
826 }
827 return obj ;
828}
829
830
831
832////////////////////////////////////////////////////////////////////////////////
833/// Return a pointer to the line attributes of the named object in this plot,
834/// or zero if the named object does not exist or does not have line attributes.
835
837{
838 return dynamic_cast<TAttLine*>(findObject(name));
839}
840
841
842////////////////////////////////////////////////////////////////////////////////
843/// Return a pointer to the fill attributes of the named object in this plot,
844/// or zero if the named object does not exist or does not have fill attributes.
845
847{
848 return dynamic_cast<TAttFill*>(findObject(name));
849}
850
851
852////////////////////////////////////////////////////////////////////////////////
853/// Return a pointer to the marker attributes of the named object in this plot,
854/// or zero if the named object does not exist or does not have marker attributes.
855
857{
858 return dynamic_cast<TAttMarker*>(findObject(name));
859}
860
861
862////////////////////////////////////////////////////////////////////////////////
863/// Return a pointer to the text attributes of the named object in this plot,
864/// or zero if the named object does not exist or does not have text attributes.
865
867{
868 return dynamic_cast<TAttText*>(findObject(name));
869}
870
871
872
873////////////////////////////////////////////////////////////////////////////////
874/// Return a RooCurve pointer of the named object in this plot,
875/// or zero if the named object does not exist or is not a RooCurve
876
877RooCurve* RooPlot::getCurve(const char* name) const
878{
879 return dynamic_cast<RooCurve*>(findObject(name)) ;
880}
881
882
883////////////////////////////////////////////////////////////////////////////////
884/// Return a RooCurve pointer of the named object in this plot,
885/// or zero if the named object does not exist or is not a RooCurve
886
887RooHist* RooPlot::getHist(const char* name) const
888{
889 return dynamic_cast<RooHist*>(findObject(name)) ;
890}
891
892
893
894////////////////////////////////////////////////////////////////////////////////
895/// Remove object with given name, or last object added if no name is given.
896/// If deleteToo is true (default), the object removed from the RooPlot is
897/// also deleted.
898
899void RooPlot::remove(const char* name, Bool_t deleteToo)
900{
901 TObject* obj = findObject(name) ;
902 if (!obj) {
903 if (name) {
904 coutE(InputArguments) << "RooPlot::remove(" << GetName() << ") ERROR: no object found with name " << name << endl ;
905 } else {
906 coutE(InputArguments) << "RooPlot::remove(" << GetName() << ") ERROR: plot frame is empty, cannot remove last object" << endl ;
907 }
908 return ;
909 }
910
911 _items.Remove(obj) ;
912
913 if (deleteToo) {
914 delete obj ;
915 }
916}
917
918
919////////////////////////////////////////////////////////////////////////////////
920/// Change the order in which our contained objects are drawn so that
921/// the target object is drawn just before the specified object.
922/// Returns kFALSE if either object does not exist.
923
924Bool_t RooPlot::drawBefore(const char *before, const char *target)
925{
926 return _items.moveBefore(before, target, caller("drawBefore"));
927}
928
929
930////////////////////////////////////////////////////////////////////////////////
931/// Change the order in which our contained objects are drawn so that
932/// the target object is drawn just after the specified object.
933/// Returns kFALSE if either object does not exist.
934
935Bool_t RooPlot::drawAfter(const char *after, const char *target)
936{
937 return _items.moveAfter(after, target, caller("drawAfter"));
938}
939
940
941////////////////////////////////////////////////////////////////////////////////
942/// Find the named object in our list of items and return a pointer
943/// to it. Return zero and print a warning message if the named
944/// object cannot be found. If no name is supplied the last object
945/// added is returned.
946///
947/// Note that the returned pointer is to a
948/// TObject and so will generally need casting. Use the getAtt...()
949/// methods to change the drawing style attributes of a contained
950/// object directly.
951
952TObject *RooPlot::findObject(const char *name, const TClass* clas) const
953{
954 TObject *obj = 0;
955 TObject *ret = 0;
956
957 TIterator* iter = _items.MakeIterator() ;
958 while((obj=iter->Next())) {
959 if ((!name || name[0] == '\0' || !TString(name).CompareTo(obj->GetName()))
960 && (!clas || (obj->IsA()==clas))) {
961 ret = obj ;
962 }
963 }
964 delete iter ;
965
966 if (ret==0) {
967 coutE(InputArguments) << "RooPlot::findObject(" << GetName() << ") cannot find object " << (name?name:"<last>") << endl ;
968 }
969 return ret ;
970}
971
972
973////////////////////////////////////////////////////////////////////////////////
974/// Return the Draw() options registered for the named object. Return
975/// an empty string if the named object cannot be found.
976
978{
979 TObjOptLink *link= _items.findLink(name,caller("getDrawOptions"));
980 DrawOpt opt(0 == link ? "" : link->GetOption()) ;
981 return TString(opt.drawOptions) ;
982}
983
984
985////////////////////////////////////////////////////////////////////////////////
986/// Register the specified drawing options for the named object.
987/// Return kFALSE if the named object cannot be found.
988
990{
991 TObjOptLink *link= _items.findLink(name,caller("setDrawOptions"));
992 if(0 == link) return kFALSE;
993
994 DrawOpt opt(link->GetOption()) ;
995 strlcpy(opt.drawOptions,options,128) ;
996 link->SetOption(opt.rawOpt());
997 return kTRUE;
998}
999
1000
1001////////////////////////////////////////////////////////////////////////////////
1002/// Returns true of object with given name is set to be invisible
1003
1005{
1006 TObjOptLink *link= _items.findLink(name,caller("getInvisible"));
1007 if(0 == link) return kFALSE;
1008
1009 return DrawOpt(link->GetOption()).invisible ;
1010}
1011
1012
1013////////////////////////////////////////////////////////////////////////////////
1014/// If flag is true object with 'name' is set to be invisible
1015/// i.e. it is not drawn when Draw() is called
1016
1017void RooPlot::setInvisible(const char* name, Bool_t flag)
1018{
1019 TObjOptLink *link= _items.findLink(name,caller("getInvisible"));
1020
1021 DrawOpt opt ;
1022
1023 if(link) {
1024 opt.initialize(link->GetOption()) ;
1025 opt.invisible = flag ;
1026 link->SetOption(opt.rawOpt()) ;
1027 }
1028
1029}
1030
1031
1032
1033////////////////////////////////////////////////////////////////////////////////
1034/// Utility function
1035
1036TString RooPlot::caller(const char *method) const
1037{
1039 if(strlen(method)) {
1040 name.Append("::");
1041 name.Append(method);
1042 }
1043 return name;
1044}
1045
1046
1047
1048////////////////////////////////////////////////////////////////////////////////
1049/// Set maximum value of Y axis
1050
1052{
1053 _hist->SetMaximum(maximum==-1111?_defYmax:maximum) ;
1054}
1055
1056
1057
1058////////////////////////////////////////////////////////////////////////////////
1059/// Set minimum value of Y axis
1060
1062{
1063 _hist->SetMinimum(minimum==-1111?_defYmin:minimum) ;
1064}
1065
1066
1067
1068////////////////////////////////////////////////////////////////////////////////
1069/// Calculate and return reduced chi-squared between a curve and a histogram.
1070///
1071/// \param[in] curvename Name of the curve or nullptr for last curve
1072/// \param[in] histname Name of the histogram to compare to or nullptr for last added histogram
1073/// \param[in] nFitParam If non-zero, reduce the number of degrees of freedom by this
1074/// number. This means that the curve was fitted to the data with nFitParam floating
1075/// parameters, which needs to be reflected in the calculation of \f$\chi^2 / \mathrm{ndf}\f$.
1076///
1077/// \return \f$ \chi^2 / \mathrm{ndf} \f$ between the plotted curve and the data.
1078///
1079/// \note The \f$ \chi^2 \f$ is calculated between a *plot of the original distribution* and the data.
1080/// It therefore has more rounding errors than directly calculating the \f$ \chi^2 \f$ from a PDF or
1081/// function. To do this, use RooChi2Var.
1082Double_t RooPlot::chiSquare(const char* curvename, const char* histname, int nFitParam) const
1083{
1084
1085 // Find curve object
1086 RooCurve* curve = (RooCurve*) findObject(curvename,RooCurve::Class()) ;
1087 if (!curve) {
1088 coutE(InputArguments) << "RooPlot::chiSquare(" << GetName() << ") cannot find curve" << endl ;
1089 return -1. ;
1090 }
1091
1092 // Find histogram object
1093 RooHist* hist = (RooHist*) findObject(histname,RooHist::Class()) ;
1094 if (!hist) {
1095 coutE(InputArguments) << "RooPlot::chiSquare(" << GetName() << ") cannot find histogram" << endl ;
1096 return -1. ;
1097 }
1098
1099 return curve->chiSquare(*hist,nFitParam) ;
1100}
1101
1102
1103////////////////////////////////////////////////////////////////////////////////
1104/// Return a RooHist (derives from TGraphAsymErrors) containing the residuals of a histogram.
1105/// The plotting range of the graph is adapted to the plotting range of the current plot.
1106///
1107/// \param histname Name of the data histogram.
1108/// Passing an empty string or `nullptr` will create residuals of the last-plotted histogram.
1109/// \param curvename Name of the curve to compare to data.
1110/// Passing an empty string or `nullptr` will create residuals of the last-plotted curve.
1111/// \param normalize If true, the residuals are divided by the error
1112/// of the histogram, effectively returning a pull histogram.
1113/// \param useAverage If true, the histogram is compared with the curve averaged in each bin.
1114/// Otherwise, the curve is evaluated at the bin centres, which is not accurate for strongly curved distributions.
1115RooHist* RooPlot::residHist(const char* histname, const char* curvename, bool normalize, bool useAverage) const
1116{
1117 // Find all curve objects with the name "curvename" or the name of the last
1118 // plotted curve (there might be multiple in the case of multi-range fits).
1119 std::vector<RooCurve *> curves;
1120
1121 TIter next{&_items, kIterBackward};
1122 while(TObject * obj = next()) {
1123 if(obj->IsA() == RooCurve::Class()) {
1124 // If no curvename was passed, we take by default the last curve and all
1125 // other curves that have the same name
1126 if((!curvename || curvename[0] == '\0') || std::string(curvename) == obj->GetName()) {
1127 curvename = obj->GetName();
1128 curves.push_back(static_cast<RooCurve*>(obj));
1129 }
1130 }
1131 }
1132
1133 if (curves.empty()) {
1134 coutE(InputArguments) << "RooPlot::residHist(" << GetName() << ") cannot find curve" << std::endl;
1135 return nullptr;
1136 }
1137
1138 // Find histogram object
1139 auto hist = static_cast<RooHist*>(findObject(histname,RooHist::Class()));
1140 if (!hist) {
1141 coutE(InputArguments) << "RooPlot::residHist(" << GetName() << ") cannot find histogram" << std::endl;
1142 return nullptr;
1143 }
1144
1145 auto residHist = hist->createEmptyResidHist(*curves.front(), normalize);
1146
1147 // We consider all curves with the same name as long as the ranges don't
1148 // overlap, to create also the full residual plot in multi-range fits.
1149 std::vector<std::pair<double, double>> coveredRanges;
1150 for(RooCurve * curve : curves) {
1151 const double xmin = curve->GetPointX(0);
1152 const double xmax = curve->GetPointX(curve->GetN() - 1);
1153
1154 for(auto const& prevRange : coveredRanges) {
1155 const double pxmin = prevRange.first;
1156 const double pxmax = prevRange.second;
1157 // If either xmin or xmax is within any previous range, the ranges
1158 // overloap and it makes to sense to also consider this curve for the
1159 // residuals (i.e., they can't come from a multi-range fit).
1160 if((pxmax > xmin && pxmin <= xmin) || (pxmax > xmax && pxmin <= xmax)) {
1161 continue;
1162 }
1163 }
1164
1165 coveredRanges.emplace_back(xmin, xmax);
1166
1167 hist->fillResidHist(*residHist, *curve, normalize, useAverage);
1168 }
1171 residHist->GetHistogram()->GetYaxis()->SetTitle(normalize ? "(Data - curve) / #sigma_{data}" : "Data - curve");
1172 return residHist.release();
1173}
1174
1175
1176
1177////////////////////////////////////////////////////////////////////////////////
1178/// Initialize the DrawOpt helper class
1179
1180void RooPlot::DrawOpt::initialize(const char* inRawOpt)
1181{
1182 if (!inRawOpt) {
1183 drawOptions[0] = 0 ;
1185 return ;
1186 }
1187 strlcpy(drawOptions,inRawOpt,128) ;
1188 strtok(drawOptions,":") ;
1189 const char* extraOpt = strtok(0,":") ;
1190 if (extraOpt) {
1191 invisible = (extraOpt[0]=='I') ;
1192 }
1193}
1194
1195
1196////////////////////////////////////////////////////////////////////////////////
1197/// Return the raw draw options
1198
1199const char* RooPlot::DrawOpt::rawOpt() const
1200{
1201 static char buf[128] ;
1202 strlcpy(buf,drawOptions,128) ;
1203 if (invisible) {
1204 strlcat(buf,":I",128) ;
1205 }
1206 return buf ;
1207}
1208
1209
1210
1211////////////////////////////////////////////////////////////////////////////////
1212/// Return the number of events that is associated with the range [xlo,xhi]
1213/// This method is only fully functional for ranges not equal to the full
1214/// range if the object that inserted the normalization data provided
1215/// a link to an external object that can calculate the event count in
1216/// in sub ranges. An error will be printed if this function is used
1217/// on sub-ranges while that information is not available
1218
1220{
1221 Double_t scaleFactor = 1.0 ;
1222 if (_normObj) {
1223 scaleFactor = _normObj->getFitRangeNEvt(xlo,xhi)/_normObj->getFitRangeNEvt() ;
1224 } else {
1225 coutW(Plotting) << "RooPlot::getFitRangeNEvt(" << GetName() << ") WARNING: Unable to obtain event count in range "
1226 << xlo << " to " << xhi << ", substituting full event count" << endl ;
1227 }
1228 return getFitRangeNEvt()*scaleFactor ;
1229}
1230
1231
1232////////////////////////////////////////////////////////////////////////////////
1233/// Set the name of the RooPlot to 'name'
1234
1235void RooPlot::SetName(const char *name)
1236{
1237 if (_dir) _dir->GetList()->Remove(this);
1239 if (_dir) _dir->GetList()->Add(this);
1240}
1241
1242
1243////////////////////////////////////////////////////////////////////////////////
1244/// Set the name and title of the RooPlot to 'name' and 'title'
1245
1246void RooPlot::SetNameTitle(const char *name, const char* title)
1247{
1248 if (_dir) _dir->GetList()->Remove(this);
1249 TNamed::SetNameTitle(name,title) ;
1250 if (_dir) _dir->GetList()->Add(this);
1251}
1252
1253
1254////////////////////////////////////////////////////////////////////////////////
1255/// Set the title of the RooPlot to 'title'
1256
1257void RooPlot::SetTitle(const char* title)
1258{
1259 TNamed::SetTitle(title) ;
1260 _hist->SetTitle(title) ;
1261}
1262
1263
1264
1265////////////////////////////////////////////////////////////////////////////////
1266/// Define default print options, for a given print style
1267
1269{
1270 return kName|kArgs|kValue ;
1271}
1272
1273
1274
1275/// \see TH1::GetXaxis()
1276TAxis* RooPlot::GetXaxis() const { return _hist->GetXaxis() ; }
1277/// \see TH1::GetYaxis()
1278TAxis* RooPlot::GetYaxis() const { return _hist->GetYaxis() ; }
1279/// \see TH1::GetNbinsX()
1281/// \see TH1::GetNdivisions()
1283/// \see TH1::GetMinimum()
1284Double_t RooPlot::GetMinimum(Double_t minval) const { return _hist->GetMinimum(minval) ; }
1285/// \see TH1::GetMaximum()
1286Double_t RooPlot::GetMaximum(Double_t maxval) const { return _hist->GetMaximum(maxval) ; }
1287
1288
1289/// \see TH1::SetAxisColor()
1290void RooPlot::SetAxisColor(Color_t color, Option_t* axis) { _hist->SetAxisColor(color,axis) ; }
1291/// \see TH1::SetAxisRange()
1293/// \see TH1::SetBarOffset()
1295/// \see TH1::SetBarWidth()
1297/// \see TH1::SetContour()
1298void RooPlot::SetContour(Int_t nlevels, const Double_t* levels) { _hist->SetContour(nlevels,levels) ; }
1299/// \see TH1::SetContourLevel()
1300void RooPlot::SetContourLevel(Int_t level, Double_t value) { _hist->SetContourLevel(level,value) ; }
1301/// \see TH1::SetDrawOption()
1303/// \see TH1::SetFillAttributes()
1305/// \see TH1::SetFillColor()
1307/// \see TH1::SetFillStyle()
1309/// \see TH1::SetLabelColor()
1310void RooPlot::SetLabelColor(Color_t color, Option_t* axis) { _hist->SetLabelColor(color,axis) ; }
1311/// \see TH1::SetLabelFont()
1312void RooPlot::SetLabelFont(Style_t font, Option_t* axis) { _hist->SetLabelFont(font,axis) ; }
1313/// \see TH1::SetLabelOffset()
1314void RooPlot::SetLabelOffset(Float_t offset, Option_t* axis) { _hist->SetLabelOffset(offset,axis) ; }
1315/// \see TH1::SetLabelSize()
1317/// \see TH1::SetLineAttributes()
1319/// \see TH1::SetLineColor()
1321/// \see TH1::SetLineStyle()
1323/// \see TH1::SetLineWidth()
1325/// \see TH1::SetMarkerAttributes()
1327/// \see TH1::SetMarkerColor()
1329/// \see TH1::SetMarkerSize()
1331/// \see TH1::SetMarkerStyle()
1333/// \see TH1::SetNdivisions()
1335/// \see TH1::SetOption()
1336void RooPlot::SetOption(Option_t* option) { _hist->SetOption(option) ; }
1337/// Like TH1::SetStats(), but statistics boxes are *off* by default in RooFit.
1338void RooPlot::SetStats(Bool_t stats) { _hist->SetStats(stats) ; }
1339/// \see TH1::SetTickLength()
1340void RooPlot::SetTickLength(Float_t length, Option_t* axis) { _hist->SetTickLength(length,axis) ; }
1341/// \see TH1::SetTitleFont()
1342void RooPlot::SetTitleFont(Style_t font, Option_t* axis) { _hist->SetTitleFont(font,axis) ; }
1343/// \see TH1::SetTitleOffset()
1344void RooPlot::SetTitleOffset(Float_t offset, Option_t* axis) { _hist->SetTitleOffset(offset,axis) ; }
1345/// \see TH1::SetTitleSize()
1347/// \see TH1::SetXTitle()
1348void RooPlot::SetXTitle(const char *title) { _hist->SetXTitle(title) ; }
1349/// \see TH1::SetYTitle()
1350void RooPlot::SetYTitle(const char *title) { _hist->SetYTitle(title) ; }
1351/// \see TH1::SetZTitle()
1352void RooPlot::SetZTitle(const char *title) { _hist->SetZTitle(title) ; }
1353
1354
1355
1356
1357////////////////////////////////////////////////////////////////////////////////
1358/// Plot RooPlot when double-clicked in browser
1359
1361{
1362 Draw();
1363 gPad->Update();
1364}
1365
1366
1367
1368
1369////////////////////////////////////////////////////////////////////////////////
1370
1371void RooPlot::Streamer(TBuffer &R__b)
1372{
1373 // Custom streamer, needed for backward compatibility
1374
1375 if (R__b.IsReading()) {
1376 const bool oldAddDir = TH1::AddDirectoryStatus();
1377 TH1::AddDirectory(false);
1378
1379 // The default c'tor might have registered this with a TDirectory.
1380 // Streaming the TNamed will make this not retrievable anymore, so
1381 // unregister first.
1382 if (_dir)
1383 _dir->Remove(this);
1384
1385 UInt_t R__s, R__c;
1386 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1387 if (R__v > 1) {
1388 R__b.ReadClassBuffer(RooPlot::Class(),this,R__v,R__s,R__c);
1389 } else {
1390 // backward compatible streamer code here
1391 // Version 1 of RooPlot was deriving from TH1 and RooPrintable
1392 // Version 2 derives instead from TNamed and RooPrintable
1393 _hist = new TH1F();
1394 _hist->TH1::Streamer(R__b);
1395 SetName(_hist->GetName());
1397 RooPrintable::Streamer(R__b);
1398 _items.Streamer(R__b);
1399 R__b >> _padFactor;
1400 R__b >> _plotVarClone;
1401 R__b >> _plotVarSet;
1402 R__b >> _normVars;
1403 R__b >> _normNumEvts;
1404 R__b >> _normBinWidth;
1405 R__b >> _defYmin;
1406 R__b >> _defYmax;
1407 R__b.CheckByteCount(R__s, R__c, RooPlot::IsA());
1408 }
1409
1410 TH1::AddDirectory(oldAddDir);
1411 if (_dir)
1412 _dir->Append(this);
1413
1414 } else {
1415 R__b.WriteClassBuffer(RooPlot::Class(),this);
1416 }
1417}
1418
1419////////////////////////////////////////////////////////////////////////////////
1420/// Build a legend that contains all objects that have been drawn on the plot.
1421std::unique_ptr<TLegend> RooPlot::BuildLegend() const {
1422 std::unique_ptr<TLegend> leg(new TLegend(0.5, 0.7, 0.9, 0.9));
1423 leg->SetBorderSize(0);
1424 leg->SetFillStyle(0);
1425 for (int i=0; i < _items.GetSize(); ++i) {
1426 leg->AddEntry(getObject(i));
1427 }
1428
1429 return leg;
1430}
#define e(i)
Definition RSha256.hxx:103
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
#define coutI(a)
#define coutW(a)
#define coutE(a)
float Size_t
Definition RtypesCore.h:96
short Version_t
Definition RtypesCore.h:65
const Bool_t kFALSE
Definition RtypesCore.h:101
short Width_t
Definition RtypesCore.h:91
bool Bool_t
Definition RtypesCore.h:63
short Color_t
Definition RtypesCore.h:92
short Style_t
Definition RtypesCore.h:89
const Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:364
static void indent(ostringstream &buf, int indent_level)
const Bool_t kIterBackward
Definition TCollection.h:43
#define gDirectory
Definition TDirectory.h:385
include TDocParser_001 C image html pict1_TDocParser_001 png width
char name[80]
Definition TGX11.cxx:110
float xmin
float ymin
float xmax
float ymax
char * Form(const char *fmt,...)
#define gPad
virtual Double_t binLow(Int_t bin) const =0
Int_t numBins() const
Return number of bins.
virtual Double_t binHigh(Int_t bin) const =0
virtual Double_t binCenter(Int_t bin) const =0
virtual Int_t binNumber(Double_t x) const =0
RooAbsArg * find(const char *name) const
Find object with given name in list.
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
virtual Double_t getMax(const char *name=0) const
Get maximum of currently defined range.
Bool_t hasMax(const char *name=0) const
Check if variable has an upper bound.
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.
Bool_t hasMin(const char *name=0) const
Check if variable has a lower bound.
virtual Double_t getMin(const char *name=0) const
Get miniminum of currently defined range.
TString getTitle(Bool_t appendUnit=kFALSE) const
Return this variable's title string.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:35
RooArgSet * snapshot(bool deepCopy=true) const
Use RooAbsCollection::snapshot(), but return as RooArgSet.
Definition RooArgSet.h:158
A RooCurve is a one-dimensional graphical representation of a real-valued function.
Definition RooCurve.h:32
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:558
A RooHist is a graphical representation of binned data based on the TGraphAsymmErrors class.
Definition RooHist.h:27
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
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
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
char drawOptions[128]
Definition RooPlot.h:215
void initialize(const char *_rawOpt)
Initialize the DrawOpt helper class.
Definition RooPlot.cxx:1180
Bool_t invisible
Definition RooPlot.h:216
const char * rawOpt() const
Return the raw draw options.
Definition RooPlot.cxx:1199
A RooPlot is a plot frame and a container for graphics objects within that frame.
Definition RooPlot.h:44
RooPlot()
Default constructor coverity[UNINIT_CTOR].
Definition RooPlot.cxx:86
void SetAxisColor(Color_t color=1, Option_t *axis="X")
Definition RooPlot.cxx:1290
static Bool_t setAddDirectoryStatus(Bool_t flag)
Configure whether new instances of RooPlot will add themselves to gDirectory.
Definition RooPlot.cxx:79
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:935
void SetMarkerSize(Size_t msize=1)
Definition RooPlot.cxx:1330
Double_t _defYmin
Definition RooPlot.h:239
const RooPlotable * _normObj
Definition RooPlot.h:235
RooAbsRealLValue * _plotVarClone
Definition RooPlot.h:231
RooHist * residHist(const char *histname=0, const char *pdfname=0, bool normalize=false, bool useAverage=true) const
Return a RooHist (derives from TGraphAsymErrors) containing the residuals of a histogram.
Definition RooPlot.cxx:1115
virtual void printTitle(std::ostream &os) const
Print frame title.
Definition RooPlot.cxx:703
RooArgSet * _normVars
Definition RooPlot.h:233
virtual Int_t defaultPrintContents(Option_t *opt) const
Define default print options, for a given print style.
Definition RooPlot.cxx:1268
static Bool_t _addDirStatus
non-persistent
Definition RooPlot.h:244
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:924
void SetMarkerColor(Color_t tcolor=1)
Definition RooPlot.cxx:1328
Double_t chiSquare(int nFitParam=0) const
Shortcut for RooPlot::chiSquare(const char* pdfname, const char* histname, int nFitParam=0)
Definition RooPlot.h:173
virtual void printClassName(std::ostream &os) const
Print frame class name.
Definition RooPlot.cxx:712
void SetContourLevel(Int_t level, Double_t value)
Definition RooPlot.cxx:1300
void SetXTitle(const char *title)
Definition RooPlot.cxx:1348
void SetFillColor(Color_t fcolor)
Definition RooPlot.cxx:1306
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:856
RooArgSet * _plotVarSet
Definition RooPlot.h:232
void SetStats(Bool_t stats=kTRUE)
Like TH1::SetStats(), but statistics boxes are off by default in RooFit.
Definition RooPlot.cxx:1338
void SetNdivisions(Int_t n=510, Option_t *axis="X")
Definition RooPlot.cxx:1334
TDirectory * _dir
Definition RooPlot.h:242
TString histName() const
Construct automatic name of internal TH1.
Definition RooPlot.cxx:330
RooList _items
Definition RooPlot.h:229
TH1 * _hist
Definition RooPlot.h:227
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:629
void SetMarkerStyle(Style_t mstyle=1)
Definition RooPlot.cxx:1332
void addObject(TObject *obj, Option_t *drawOptions="", Bool_t invisible=kFALSE)
Add a generic object to this plot.
Definition RooPlot.cxx:392
TString getDrawOptions(const char *name) const
Return the Draw() options registered for the named object.
Definition RooPlot.cxx:977
virtual void printArgs(std::ostream &os) const
Interface for printing of object arguments.
Definition RooPlot.cxx:721
void SetDrawOption(Option_t *option="")
Definition RooPlot.cxx:1302
void SetZTitle(const char *title)
Definition RooPlot.cxx:1352
Double_t GetMinimum(Double_t minval=-FLT_MAX) const
Definition RooPlot.cxx:1284
void SetContour(Int_t nlevels, const Double_t *levels=0)
Definition RooPlot.cxx:1298
Double_t getFitRangeNEvt() const
Return the number of events in the fit range.
Definition RooPlot.h:138
Double_t getPadFactor() const
Definition RooPlot.h:142
void SetDirectory(TDirectory *dir)
Set the directory that this plot is associated to.
Definition RooPlot.cxx:362
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:846
void SetTitle(const char *name)
Set the title of the RooPlot to 'title'.
Definition RooPlot.cxx:1257
virtual void printName(std::ostream &os) const
Print frame name.
Definition RooPlot.cxx:694
void SetLabelOffset(Float_t offset=0.005, Option_t *axis="X")
Definition RooPlot.cxx:1314
void SetLineWidth(Width_t lwidth)
Definition RooPlot.cxx:1324
void SetTickLength(Float_t length=0.02, Option_t *axis="X")
Definition RooPlot.cxx:1340
void SetFillAttributes()
Definition RooPlot.cxx:1304
Double_t _normNumEvts
Pointer to normalization object ;.
Definition RooPlot.h:236
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:866
void SetLabelSize(Float_t size=0.02, Option_t *axis="X")
Definition RooPlot.cxx:1316
virtual void SetMinimum(Double_t minimum=-1111)
Set minimum value of Y axis.
Definition RooPlot.cxx:1061
void SetOption(Option_t *option=" ")
Definition RooPlot.cxx:1336
TObject * getObject(Int_t idx) const
Return the name of the object at slot 'idx' in this RooPlot.
Definition RooPlot.cxx:820
TAxis * GetYaxis() const
Definition RooPlot.cxx:1278
void SetNameTitle(const char *name, const char *title)
Set the name and title of the RooPlot to 'name' and 'title'.
Definition RooPlot.cxx:1246
void SetName(const char *name)
Set the name of the RooPlot to 'name'.
Definition RooPlot.cxx:1235
void SetLabelFont(Style_t font=62, Option_t *axis="X")
Definition RooPlot.cxx:1312
void SetLineStyle(Style_t lstyle)
Definition RooPlot.cxx:1322
void setPadFactor(Double_t factor)
Definition RooPlot.h:143
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:836
void SetTitleFont(Style_t font=62, Option_t *axis="X")
Definition RooPlot.cxx:1342
TAxis * GetXaxis() const
Definition RooPlot.cxx:1276
void SetLineColor(Color_t lcolor)
Definition RooPlot.cxx:1320
void SetFillStyle(Style_t fstyle)
Definition RooPlot.cxx:1308
const char * nameOf(Int_t idx) const
Return the name of the object at slot 'idx' in this RooPlot.
Definition RooPlot.cxx:804
Bool_t getInvisible(const char *name) const
Returns true of object with given name is set to be invisible.
Definition RooPlot.cxx:1004
void updateNormVars(const RooArgSet &vars)
Install the given set of observables are reference normalization variables for this frame.
Definition RooPlot.cxx:380
RooPlot * emptyClone(const char *name)
Return empty clone of current RooPlot.
Definition RooPlot.cxx:296
void SetMarkerAttributes()
Definition RooPlot.cxx:1326
Double_t GetMaximum(Double_t maxval=FLT_MAX) const
Definition RooPlot.cxx:1286
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
virtual ~RooPlot()
Destructor.
Definition RooPlot.cxx:343
Bool_t setDrawOptions(const char *name, TString options)
Register the specified drawing options for the named object.
Definition RooPlot.cxx:989
void SetLabelColor(Color_t color=1, Option_t *axis="X")
Definition RooPlot.cxx:1310
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:540
Int_t GetNbinsX() const
Definition RooPlot.cxx:1280
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:1017
void SetLineAttributes()
Definition RooPlot.cxx:1318
void addTH1(TH1 *hist, Option_t *drawOptions="", Bool_t invisible=kFALSE)
Add a TH1 histogram object to this plot.
Definition RooPlot.cxx:411
virtual void SetMaximum(Double_t maximum=-1111)
Set maximum value of Y axis.
Definition RooPlot.cxx:1051
void SetYTitle(const char *title)
Definition RooPlot.cxx:1350
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:952
Double_t _normBinWidth
Definition RooPlot.h:237
void Browse(TBrowser *b)
Plot RooPlot when double-clicked in browser.
Definition RooPlot.cxx:1360
virtual void printMultiline(std::ostream &os, Int_t content, Bool_t verbose=kFALSE, TString indent="") const
Frame detailed printing.
Definition RooPlot.cxx:764
std::unique_ptr< TLegend > BuildLegend() const
Build a legend that contains all objects that have been drawn on the plot.
Definition RooPlot.cxx:1421
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:574
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:877
void SetTitleSize(Float_t size=0.02, Option_t *axis="X")
Definition RooPlot.cxx:1346
static Bool_t addDirectoryStatus()
Query whether new instances of RooPlot will add themselves to gDirectory.
Definition RooPlot.cxx:78
virtual void Draw(Option_t *options=0)
Draw this plot and all of the elements it contains.
Definition RooPlot.cxx:661
Double_t _padFactor
Definition RooPlot.h:230
void SetBarOffset(Float_t offset=0.25)
Definition RooPlot.cxx:1294
void SetBarWidth(Float_t width=0.5)
Definition RooPlot.cxx:1296
Int_t GetNdivisions(Option_t *axis="X") const
Definition RooPlot.cxx:1282
void SetAxisRange(Double_t xmin, Double_t xmax, Option_t *axis="X")
Definition RooPlot.cxx:1292
Double_t _defYmax
Definition RooPlot.h:240
TString caller(const char *method) const
Utility function.
Definition RooPlot.cxx:1036
void initialize()
Perform initialization that is common to all constructors.
Definition RooPlot.cxx:307
static RooPlot * frameWithLabels(const RooAbsRealLValue &var)
Create a new frame for a given variable in x, adding bin labels.
Definition RooPlot.cxx:261
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:899
void SetTitleOffset(Float_t offset=1, Option_t *axis="X")
Definition RooPlot.cxx:1344
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:887
virtual void printValue(std::ostream &os) const
Print frame arguments.
Definition RooPlot.cxx:735
Class RooPotable is a base class for objects that can be inserted into RooPlots and take advantage of...
Definition RooPlotable.h:26
Double_t getYAxisMin() const
Definition RooPlotable.h:41
virtual Double_t getFitRangeNEvt() const =0
Double_t getYAxisMax() const
Definition RooPlotable.h:42
virtual Double_t getFitRangeBinW() const =0
TObject * crossCast()
Return cast of RooPlotable as TObject.
const char * getYAxisLabel() const
Definition RooPlotable.h:31
RooPlotable is a 'mix-in' base class that define the standard RooFit plotting and printing methods.
virtual void printStream(std::ostream &os, Int_t contents, StyleOption style, TString indent="") const
Print description of object on ostream, printing contents set by contents integer,...
void Set(Int_t n)
Set size of this array to n doubles.
Definition TArrayD.cxx:106
Fill Area Attributes class.
Definition TAttFill.h:19
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition TAttFill.h:37
virtual void SetFillAttributes()
Invoke the DialogCanvas Fill attributes.
Definition TAttFill.cxx:253
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
Definition TAttFill.h:39
Line Attributes class.
Definition TAttLine.h:18
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Definition TAttLine.h:42
virtual void SetLineAttributes()
Invoke the DialogCanvas Line attributes.
Definition TAttLine.cxx:293
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition TAttLine.h:43
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition TAttLine.h:40
Marker Attributes class.
Definition TAttMarker.h:19
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
Definition TAttMarker.h:38
virtual void SetMarkerAttributes()
Invoke the DialogCanvas Marker attributes.
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
Definition TAttMarker.h:40
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
Definition TAttMarker.h:41
Text Attributes class.
Definition TAttText.h:18
Class to manage histogram axis.
Definition TAxis.h:30
virtual void SetBinLabel(Int_t bin, const char *label)
Set label for bin.
Definition TAxis.cxx:823
Bool_t IsAlphanumeric() const
Definition TAxis.h:84
virtual Double_t GetBinCenter(Int_t bin) const
Return center of bin.
Definition TAxis.cxx:478
Double_t GetXmax() const
Definition TAxis.h:134
const char * GetBinLabel(Int_t bin) const
Return label for bin.
Definition TAxis.cxx:440
Double_t GetXmin() const
Definition TAxis.h:133
virtual void SetRangeUser(Double_t ufirst, Double_t ulast)
Set the viewing range for the axis from ufirst to ulast (in user coordinates, that is,...
Definition TAxis.cxx:946
const char * GetTitle() const
Returns title of object.
Definition TAxis.h:129
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width.
Definition TAxis.cxx:540
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
Definition TAxis.cxx:528
Using a TBrowser one can browse all ROOT objects.
Definition TBrowser.h:37
Buffer base class used for serializing objects.
Definition TBuffer.h:43
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
Bool_t IsReading() const
Definition TBuffer.h:86
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:80
virtual const char * GetName() const
Return name of this collection.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Describe directory structure in memory.
Definition TDirectory.h:45
virtual TList * GetList() const
Definition TDirectory.h:222
virtual void Append(TObject *obj, Bool_t replace=kFALSE)
Append object to this directory.
virtual TObject * Remove(TObject *)
Remove an object from the in-memory list.
TGraph with asymmetric error bars.
A TGraph is an object made of two arrays X and Y with npoints each.
Definition TGraph.h:41
@ kIsSortedX
Graph is sorted in X points.
Definition TGraph.h:74
TH1F * GetHistogram() const
Returns a pointer to the histogram used to draw the axis Takes into account the two following cases.
Definition TGraph.cxx:1485
1-D histogram with a double per channel (see TH1 documentation)}
Definition TH1.h:618
1-D histogram with a float per channel (see TH1 documentation)}
Definition TH1.h:575
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:58
virtual void SetLabelFont(Style_t font=62, Option_t *axis="X")
Set font number used to draw axis labels.
Definition Haxis.cxx:249
virtual void SetDirectory(TDirectory *dir)
By default, when a histogram is created, it is added to the list of histogram objects in the current ...
Definition TH1.cxx:8767
virtual void SetTitle(const char *title)
See GetStatOverflows for more information.
Definition TH1.cxx:6667
virtual void SetBarOffset(Float_t offset=0.25)
Set the bar offset as fraction of the bin width for drawing mode "B".
Definition TH1.h:359
virtual void SetTitleSize(Float_t size=0.02, Option_t *axis="X")
Set the axis' title size.
Definition Haxis.cxx:365
virtual void SetLabelOffset(Float_t offset=0.005, Option_t *axis="X")
Set offset between axis and axis' labels.
Definition Haxis.cxx:267
virtual void SetXTitle(const char *title)
Definition TH1.h:413
virtual Int_t GetDimension() const
Definition TH1.h:282
static void AddDirectory(Bool_t add=kTRUE)
Sets the flag controlling the automatic add of histograms in memory.
Definition TH1.cxx:1283
virtual void SetContourLevel(Int_t level, Double_t value)
Set value for one contour level.
Definition TH1.cxx:8352
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
Definition TH1.h:320
virtual void SetNdivisions(Int_t n=510, Option_t *axis="X")
Set the number of divisions to draw an axis.
Definition Haxis.cxx:170
virtual Double_t GetMaximum(Double_t maxval=FLT_MAX) const
Return maximum value smaller than maxval of bins in the range, unless the value has been overridden b...
Definition TH1.cxx:8375
virtual Int_t GetNbinsX() const
Definition TH1.h:296
virtual void SetMaximum(Double_t maximum=-1111)
Definition TH1.h:398
TAxis * GetYaxis()
Definition TH1.h:321
virtual void SetContour(Int_t nlevels, const Double_t *levels=0)
Set the number and values of contour levels.
Definition TH1.cxx:8313
virtual Int_t GetNdivisions(Option_t *axis="X") const
Return the number of divisions for "axis".
Definition Haxis.cxx:27
virtual void SetMinimum(Double_t minimum=-1111)
Definition TH1.h:399
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:9052
virtual Double_t GetEntries() const
Return the current number of entries.
Definition TH1.cxx:4387
virtual void SetZTitle(const char *title)
Definition TH1.h:415
virtual void Draw(Option_t *option="")
Draw this histogram with options.
Definition TH1.cxx:3074
virtual TArrayD * GetSumw2()
Definition TH1.h:312
virtual void SetTitleOffset(Float_t offset=1, Option_t *axis="X")
Specify a parameter offset to control the distance between the axis and the axis' title.
Definition Haxis.cxx:345
virtual void SetLabelColor(Color_t color=1, Option_t *axis="X")
Set axis labels color.
Definition Haxis.cxx:226
virtual void SetAxisColor(Color_t color=1, Option_t *axis="X")
Set color to draw the axis line and tick marks.
Definition Haxis.cxx:187
virtual void SetOption(Option_t *option=" ")
Definition TH1.h:406
virtual void SetAxisRange(Double_t xmin, Double_t xmax, Option_t *axis="X")
Set the "axis" range.
Definition Haxis.cxx:201
virtual void SetYTitle(const char *title)
Definition TH1.h:414
virtual void SetTitleFont(Style_t font=62, Option_t *axis="X")
Set the axis' title font.
Definition Haxis.cxx:323
virtual Double_t GetMinimum(Double_t minval=-FLT_MAX) const
Return minimum value larger than minval of bins in the range, unless the value has been overridden by...
Definition TH1.cxx:8465
virtual void SetLabelSize(Float_t size=0.02, Option_t *axis="X")
Set size of axis' labels.
Definition Haxis.cxx:285
virtual void Sumw2(Bool_t flag=kTRUE)
Create structure to store sum of squares of weights.
Definition TH1.cxx:8850
static Bool_t AddDirectoryStatus()
Static function: cannot be inlined on Windows/NT.
Definition TH1.cxx:751
virtual void SetBarWidth(Float_t width=0.5)
Set the width of bars as fraction of the bin width for drawing mode "B".
Definition TH1.h:360
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
Definition TH1.cxx:8820
virtual void SetTickLength(Float_t length=0.02, Option_t *axis="X")
Set the axis' tick marks length.
Definition Haxis.cxx:302
Iterator abstract base class.
Definition TIterator.h:30
virtual TObject * Next()=0
This class displays a legend box (TPaveText) containing several legend entries.
Definition TLegend.h:23
virtual void Add(TObject *obj)
Definition TList.h:81
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Definition TList.cxx:822
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
Definition TList.cxx:357
virtual void RecursiveRemove(TObject *obj)
Remove object from this collection and recursively remove the object from all other objects (and coll...
Definition TList.cxx:764
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const
Return a list iterator.
Definition TList.cxx:722
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Definition TList.cxx:470
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition TNamed.cxx:164
TString fName
Definition TNamed.h:32
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition TNamed.cxx:140
virtual const char * GetTitle() const
Returns title of object.
Definition TNamed.h:48
virtual const char * GetName() const
Returns name of object.
Definition TNamed.h:47
virtual void SetNameTitle(const char *name, const char *title)
Set all the TNamed parameters (name and title).
Definition TNamed.cxx:154
Mother of all ROOT objects.
Definition TObject.h:41
virtual const char * GetName() const
Returns name of object.
Definition TObject.cxx:429
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition TObject.cxx:200
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:515
virtual void SetDrawOption(Option_t *option="")
Set drawing option for object.
Definition TObject.cxx:749
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition TObject.cxx:267
Basic string class.
Definition TString.h:136
void ToLower()
Change string to lower-case.
Definition TString.cxx:1150
const char * Data() const
Definition TString.h:369
void ToUpper()
Change string to upper case.
Definition TString.cxx:1163
TString & Append(const char *cs)
Definition TString.h:564
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:2336
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:624
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
leg
Definition legend1.C:34
Definition first.py:1
Definition graph.py:1
th1 Draw()