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