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