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