Logo ROOT   6.18/05
Reference Guide
RooPlot.cxx
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * @(#)root/roofitcore:$Id$
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2000-2005, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16
17/**
18\file RooPlot.cxx
19\class RooPlot
20\ingroup Roofitcore
21
22A RooPlot is a plot frame and a container for graphics objects
23within that frame. As a frame, it provides the TH1-style public interface
24for settting 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
45#include "RooFit.h"
46
47#include "TClass.h"
48#include "TH1D.h"
49#include "TBrowser.h"
50#include "TPad.h"
51
52#include "RooPlot.h"
53#include "RooAbsReal.h"
54#include "RooAbsRealLValue.h"
55#include "RooPlotable.h"
56#include "RooArgSet.h"
57#include "RooCurve.h"
58#include "RooHist.h"
59#include "RooMsgService.h"
60
61#include "TAttLine.h"
62#include "TAttFill.h"
63#include "TAttMarker.h"
64#include "TAttText.h"
65#include "TDirectory.h"
66#include "TDirectoryFile.h"
67
68#include "Riostream.h"
69#include <string.h>
70
71using namespace std;
72
74;
75
77
79Bool_t RooPlot::setAddDirectoryStatus(Bool_t flag) { Bool_t ret = flag ; _addDirStatus = flag ; return ret ; }
80
81
82////////////////////////////////////////////////////////////////////////////////
83/// Default constructor
84/// coverity[UNINIT_CTOR]
85
86RooPlot::RooPlot() : _hist(0), _plotVarClone(0), _plotVarSet(0), _normVars(0), _normObj(0), _dir(0)
87{
89
92 gDirectory->Append(this) ;
93 }
94}
95
96
97////////////////////////////////////////////////////////////////////////////////
98/// Constructor of RooPlot with range [xmin,xmax]
99
101 _hist(0), _items(), _plotVarClone(0), _plotVarSet(0), _normObj(0),
102 _defYmin(1e-5), _defYmax(1), _dir(0)
103{
104 Bool_t histAddDirStatus = TH1::AddDirectoryStatus();
106
107 _hist = new TH1D(histName(),"A RooPlot",100,xmin,xmax) ;
108 _hist->Sumw2(kFALSE) ;
109 _hist->GetSumw2()->Set(0) ;
110
111
112 TH1::AddDirectory(histAddDirStatus) ;
113
114
115 // Create an empty frame with the specified x-axis limits.
116 initialize();
117
118}
119
120
121
122////////////////////////////////////////////////////////////////////////////////
123/// Construct of a two-dimensioanl RooPlot with ranges [xmin,xmax] x [ymin,ymax]
124
126 _hist(0), _items(), _plotVarClone(0),
127 _plotVarSet(0), _normObj(0), _defYmin(1e-5), _defYmax(0), _dir(0)
128{
129 Bool_t histAddDirStatus = TH1::AddDirectoryStatus();
131
132 _hist = new TH1D(histName(),"A RooPlot",100,xmin,xmax) ;
133 _hist->Sumw2(kFALSE) ;
134 _hist->GetSumw2()->Set(0) ;
135
136 TH1::AddDirectory(histAddDirStatus) ;
137
140 initialize();
141}
142
143
144////////////////////////////////////////////////////////////////////////////////
145/// Construct a two-dimensional RooPlot with ranges and properties taken
146/// from variables var1 and var2
147
149 _hist(0), _items(),
150 _plotVarClone(0), _plotVarSet(0), _normObj(0), _defYmin(1e-5), _defYmax(0), _dir(0)
151{
152 Bool_t histAddDirStatus = TH1::AddDirectoryStatus();
154
155 _hist = new TH1D(histName(),"A RooPlot",100,var1.getMin(),var1.getMax()) ;
156 _hist->Sumw2(kFALSE) ;
157 _hist->GetSumw2()->Set(0) ;
158
159 TH1::AddDirectory(histAddDirStatus) ;
160
161 if(!var1.hasMin() || !var1.hasMax()) {
162 coutE(InputArguments) << "RooPlot::RooPlot: cannot create plot for variable without finite limits: "
163 << var1.GetName() << endl;
164 return;
165 }
166 if(!var2.hasMin() || !var2.hasMax()) {
167 coutE(InputArguments) << "RooPlot::RooPlot: cannot create plot for variable without finite limits: "
168 << var1.GetName() << endl;
169 return;
170 }
171 SetMinimum(var2.getMin());
172 SetMaximum(var2.getMax());
173 SetXTitle(var1.getTitle(kTRUE));
174 SetYTitle(var2.getTitle(kTRUE));
175 initialize();
176}
177
178
179////////////////////////////////////////////////////////////////////////////////
180/// Construct a two-dimensional RooPlot with ranges and properties taken
181/// from variables var1 and var2 but with an overriding range definition
182/// of [xmin,xmax] x [ymin,ymax]
183
186 _hist(0), _items(), _plotVarClone(0),
187 _plotVarSet(0), _normObj(0), _defYmin(1e-5), _defYmax(0), _dir(0)
188{
189 Bool_t histAddDirStatus = TH1::AddDirectoryStatus();
191
192 _hist = new TH1D(histName(),"A RooPlot",100,xmin,xmax) ;
193 _hist->Sumw2(kFALSE) ;
194 _hist->GetSumw2()->Set(0) ;
195
196 TH1::AddDirectory(histAddDirStatus) ;
197
200 SetXTitle(var1.getTitle(kTRUE));
201 SetYTitle(var2.getTitle(kTRUE));
202 initialize();
203}
204
205
206////////////////////////////////////////////////////////////////////////////////
207/// Create an 1-dimensional with all properties taken from 'var', but
208/// with an explicit range [xmin,xmax] and a default binning of 'nbins'
209
210RooPlot::RooPlot(const char* name, const char* title, const RooAbsRealLValue &var, Double_t xmin, Double_t xmax, Int_t nbins) :
211 _hist(0), _items(),
212 _plotVarClone(0), _plotVarSet(0), _normObj(0), _defYmin(1e-5), _defYmax(1), _dir(0)
213{
214 Bool_t histAddDirStatus = TH1::AddDirectoryStatus();
216
217 _hist = new TH1D(name,title,nbins,xmin,xmax) ;
218 _hist->Sumw2(kFALSE) ;
219 _hist->GetSumw2()->Set(0) ;
220
221 TH1::AddDirectory(histAddDirStatus) ;
222
223 // plotVar can be a composite in case of a RooDataSet::plot, need deepClone
226
227 TString xtitle= var.getTitle(kTRUE);
228 SetXTitle(xtitle.Data());
229
230 initialize();
231
232 _normBinWidth = (xmax-xmin)/nbins ;
233}
234
235
236////////////////////////////////////////////////////////////////////////////////
237/// Create an 1-dimensional with all properties taken from 'var', but
238/// with an explicit range [xmin,xmax] and a default binning of 'nbins'
239
241 _hist(0), _items(),
242 _plotVarClone(0), _plotVarSet(0), _normObj(0), _defYmin(1e-5), _defYmax(1), _dir(0)
243{
244 Bool_t histAddDirStatus = TH1::AddDirectoryStatus();
246
247 _hist = new TH1D(histName(),"RooPlot",nbins,xmin,xmax) ;
248 _hist->Sumw2(kFALSE) ;
249 _hist->GetSumw2()->Set(0) ;
250
251 TH1::AddDirectory(histAddDirStatus) ;
252
253 // plotVar can be a composite in case of a RooDataSet::plot, need deepClone
256
257 TString xtitle= var.getTitle(kTRUE);
258 SetXTitle(xtitle.Data());
259
260 TString title("A RooPlot of \"");
261 title.Append(var.getTitle());
262 title.Append("\"");
263 SetTitle(title.Data());
264 initialize();
265
266 _normBinWidth = (xmax-xmin)/nbins ;
267}
268
269
270
271////////////////////////////////////////////////////////////////////////////////
272/// Return empty clone of current RooPlot
273
275{
277 clone->SetName(name) ;
278 return clone ;
279}
280
281
282////////////////////////////////////////////////////////////////////////////////
283/// Perform initialization that is common to all constructors.
284
286{
287 SetName(histName()) ;
288
290 _dir = gDirectory ;
291 gDirectory->Append(this) ;
292 }
293
294 // We do not have useful stats of our own
296 // Default vertical padding of our enclosed objects
297 setPadFactor(0.05);
298 // We don't know our normalization yet
299 _normNumEvts= 0;
300 _normBinWidth = 0;
301 _normVars= 0;
302 // Create an iterator over our enclosed objects
304 assert(0 != _iterator);
305}
306
307
308////////////////////////////////////////////////////////////////////////////////
309/// Construct automatic name of internal TH1
310
312{
313 if (_plotVarClone) {
314 return TString(Form("frame_%s_%lx",_plotVarClone->GetName(),(ULong_t)this)) ;
315 } else {
316 return TString(Form("frame_%lx",(ULong_t)this)) ;
317 }
318}
319
320
321////////////////////////////////////////////////////////////////////////////////
322/// Destructor
323
325{
326 // Delete the items in our container and our iterator.
327 if (_dir) {
329 _dir->GetList()->RecursiveRemove(this) ;
330 }
331 }
332
333 _items.Delete();
334 delete _iterator;
335 if(_plotVarSet) delete _plotVarSet;
336 if(_normVars) delete _normVars;
337 delete _hist ;
338
339}
340
341
342////////////////////////////////////////////////////////////////////////////////
343/// Install the given set of observables are reference normalization
344/// variables for this frame. These observables are e.g. later used
345/// to automatically project out observables when plotting functions
346/// on this frame. This function is only effective when called the
347/// first time on a frame
348
350{
351 if(0 == _normVars) _normVars= (RooArgSet*) vars.snapshot(kTRUE);
352}
353
354
355////////////////////////////////////////////////////////////////////////////////
356/// A plot object is a frame without any bin contents of its own so this
357/// method always returns zero.
358
360 return 0;
361}
362
363
364////////////////////////////////////////////////////////////////////////////////
365/// A plot object is a frame without any bin contents of its own so this
366/// method always returns zero.
367
369{
370 return 0;
371}
372
373
374////////////////////////////////////////////////////////////////////////////////
375/// A plot object is a frame without any bin contents of its own so this
376/// method always returns zero.
377
379{
380 return 0;
381}
382
383
384
385////////////////////////////////////////////////////////////////////////////////
386/// Add a generic object to this plot. The specified options will be
387/// used to Draw() this object later. The caller transfers ownership
388/// of the object with this call, and the object will be deleted
389/// when its containing plot object is destroyed.
390
391void RooPlot::addObject(TObject *obj, Option_t *drawOptions, Bool_t invisible)
392{
393 if(0 == obj) {
394 coutE(InputArguments) << fName << "::addObject: called with a null pointer" << endl;
395 return;
396 }
397 DrawOpt opt(drawOptions) ;
398 opt.invisible = invisible ;
399 _items.Add(obj,opt.rawOpt());
400}
401
402
403////////////////////////////////////////////////////////////////////////////////
404/// Add a TH1 histogram object to this plot. The specified options
405/// will be used to Draw() this object later. "SAME" will be added to
406/// the options if they are not already present. The caller transfers
407/// ownership of the object with this call, and the object will be
408/// deleted when its containing plot object is destroyed.
409
410void RooPlot::addTH1(TH1 *hist, Option_t *drawOptions, Bool_t invisible)
411{
412 if(0 == hist) {
413 coutE(InputArguments) << fName << "::addTH1: called with a null pointer" << endl;
414 return;
415 }
416 // check that this histogram is really 1D
417 if(1 != hist->GetDimension()) {
418 coutE(InputArguments) << fName << "::addTH1: cannot plot histogram with "
419 << hist->GetDimension() << " dimensions" << endl;
420 return;
421 }
422
423 // add option "SAME" if necessary
424 TString options(drawOptions);
425 options.ToUpper();
426 if(!options.Contains("SAME")) options.Append("SAME");
427
428 // update our y-axis label and limits
429 updateYAxis(hist->GetMinimum(),hist->GetMaximum(),hist->GetYaxis()->GetTitle());
430
431 // use this histogram's normalization if necessary
432 updateFitRangeNorm(hist);
433
434 // add the histogram to our list
435 addObject(hist,options.Data(),invisible);
436}
437
438
439////////////////////////////////////////////////////////////////////////////////
440/// Add the specified plotable object to our plot. Increase our y-axis
441/// limits to fit this object if necessary. The default lower-limit
442/// is zero unless we are plotting an object that takes on negative values.
443/// This call transfers ownership of the plotable object to this class.
444/// The plotable object will be deleted when this plot object is deleted.
445
446void RooPlot::addPlotable(RooPlotable *plotable, Option_t *drawOptions, Bool_t invisible, Bool_t refreshNorm)
447{
448 // update our y-axis label and limits
449 updateYAxis(plotable->getYAxisMin(),plotable->getYAxisMax(),plotable->getYAxisLabel());
450
451 // use this object's normalization if necessary
452 updateFitRangeNorm(plotable,refreshNorm) ;
453
454 // add this element to our list and remember its drawing option
455 TObject *obj= plotable->crossCast();
456 if(0 == obj) {
457 coutE(InputArguments) << fName << "::add: cross-cast to TObject failed (nothing added)" << endl;
458 }
459 else {
460 DrawOpt opt(drawOptions) ;
461 opt.invisible = invisible ;
462 _items.Add(obj,opt.rawOpt());
463 }
464}
465
466
467////////////////////////////////////////////////////////////////////////////////
468/// Update our plot normalization over our plot variable's fit range,
469/// which will be determined by the first suitable object added to our plot.
470
472{
473 const TAxis* xa = ((TH1*)hist)->GetXaxis() ;
474 _normBinWidth = (xa->GetXmax()-xa->GetXmin())/hist->GetNbinsX() ;
476}
477
478
479////////////////////////////////////////////////////////////////////////////////
480/// Update our plot normalization over our plot variable's fit range,
481/// which will be determined by the first suitable object added to our plot.
482
484{
485 if (_normNumEvts != 0) {
486
487 // If refresh feature is disabled stop here
488 if (!refreshNorm) return ;
489
490 Double_t corFac(1.0) ;
491 if (dynamic_cast<const RooHist*>(rp)) corFac = _normBinWidth/rp->getFitRangeBinW() ;
492
493
494 if (fabs(rp->getFitRangeNEvt()/corFac-_normNumEvts)>1e-6) {
495 coutI(Plotting) << "RooPlot::updateFitRangeNorm: New event count of " << rp->getFitRangeNEvt()/corFac
496 << " will supercede previous event count of " << _normNumEvts << " for normalization of PDF projections" << endl ;
497 }
498
499 // Nominal bin width (i.e event density) is already locked in by previously drawn histogram
500 // scale this histogram to match that density
501 _normNumEvts = rp->getFitRangeNEvt()/corFac ;
502 _normObj = rp ;
503 // cout << "correction factor = " << _normBinWidth << "/" << rp->getFitRangeBinW() << endl ;
504 // cout << "updating numevts to " << _normNumEvts << endl ;
505
506 } else {
507
508 _normObj = rp ;
510 if (rp->getFitRangeBinW()) {
512 }
513
514 // cout << "updating numevts to " << _normNumEvts << endl ;
515 }
516
517}
518
519
520
521////////////////////////////////////////////////////////////////////////////////
522/// Update our y-axis limits to accomodate an object whose spread
523/// in y is (ymin,ymax). Use the specified y-axis label if we don't
524/// have one assigned already.
525
527{
528 // force an implicit lower limit of zero if appropriate
529 if(GetMinimum() == 0 && ymin > 0) ymin= 0;
530
531 // calculate padded values
532 Double_t ypad= getPadFactor()*(ymax-ymin);
533 ymax+= ypad;
534 if(ymin < 0) ymin-= ypad;
535
536 // update our limits if necessary
537 if(GetMaximum() < ymax) {
538 _defYmax = ymax ;
540 // if we don't do this - Unzoom on y-axis will reset upper bound to 1
542 }
543 if(GetMinimum() > ymin) {
544 _defYmin = ymin ;
546 }
547
548 // use the specified y-axis label if we don't have one already
549 if(0 == strlen(_hist->GetYaxis()->GetTitle())) _hist->SetYTitle(label);
550}
551
552
553////////////////////////////////////////////////////////////////////////////////
554/// Draw this plot and all of the elements it contains. The specified options
555/// only apply to the drawing of our frame. The options specified in our add...()
556/// methods will be used to draw each object we contain.
557
559{
560 TString optArg = option ;
561 optArg.ToLower() ;
562
563 // This draw options prevents the histogram with one dummy entry
564 // to be drawn
565 if (optArg.Contains("same")) {
566 _hist->Draw("FUNCSAME");
567 } else {
568 _hist->Draw("FUNC");
569 }
570
571 _iterator->Reset();
572 TObject *obj = 0;
573 while((obj= _iterator->Next())) {
574 DrawOpt opt(_iterator->GetOption()) ;
575 if (!opt.invisible) {
576 //LM: in case of a TGraph derived object, do not use default "" option
577 // which is "ALP" from 5.34.10 (and will then redrawn the axis) but use "LP"
578 if (!strlen(opt.drawOptions) && obj->IsA()->InheritsFrom(TGraph::Class()) ) strlcpy(opt.drawOptions,"LP",3);
579 obj->Draw(opt.drawOptions);
580 }
581 }
582
583 _hist->Draw("AXISSAME");
584}
585
586
587
588////////////////////////////////////////////////////////////////////////////////
589/// Print frame name
590
591void RooPlot::printName(ostream& os) const
592{
593 os << GetName() ;
594}
595
596
597////////////////////////////////////////////////////////////////////////////////
598/// Print frame title
599
600void RooPlot::printTitle(ostream& os) const
601{
602 os << GetTitle() ;
603}
604
605
606////////////////////////////////////////////////////////////////////////////////
607/// Print frame class name
608
609void RooPlot::printClassName(ostream& os) const
610{
611 os << IsA()->GetName() ;
612}
613
614
615
616////////////////////////////////////////////////////////////////////////////////
617
618void RooPlot::printArgs(ostream& os) const
619{
620 if (_plotVarClone) {
621 os << "[" ;
623 os << "]" ;
624 }
625}
626
627
628
629////////////////////////////////////////////////////////////////////////////////
630/// Print frame arguments
631
632void RooPlot::printValue(ostream& os) const
633{
634 os << "(" ;
635 _iterator->Reset();
636 TObject *obj = 0;
638 while((obj= _iterator->Next())) {
639 if (first) {
640 first=kFALSE ;
641 } else {
642 os << "," ;
643 }
644 if(obj->IsA()->InheritsFrom(RooPrintable::Class())) {
645 RooPrintable* po = dynamic_cast<RooPrintable*>(obj) ;
646 // coverity[FORWARD_NULL]
648 }
649 // is it a TNamed subclass?
650 else {
651 os << obj->ClassName() << "::" << obj->GetName() ;
652 }
653 }
654 os << ")" ;
655}
656
657
658////////////////////////////////////////////////////////////////////////////////
659/// Frame detailed printing
660
661void RooPlot::printMultiline(ostream& os, Int_t /*content*/, Bool_t verbose, TString indent) const
662{
663 TString deeper(indent);
664 deeper.Append(" ");
665 if(0 != _plotVarClone) {
666 os << indent << "RooPlot " << GetName() << " (" << GetTitle() << ") plots variable ";
668 }
669 else {
670 os << indent << "RooPlot " << GetName() << " (" << GetTitle() << ") has no associated plot variable" << endl ;
671 }
672 os << indent << " Plot frame contains " << _items.GetSize() << " object(s):" << endl;
673
674 if(verbose) {
675 _iterator->Reset();
676 TObject *obj = 0;
677 Int_t i=0 ;
678 while((obj= _iterator->Next())) {
679 os << deeper << "[" << i++ << "] (Options=\"" << _iterator->GetOption() << "\") ";
680 // Is this a printable object?
681 if(obj->IsA()->InheritsFrom(RooPrintable::Class())) {
682 RooPrintable* po = dynamic_cast<RooPrintable*>(obj) ;
683 if (po) {
685 }
686 }
687 // is it a TNamed subclass?
688 else {
689 os << obj->ClassName() << "::" << obj->GetName() << endl;
690 }
691 }
692 }
693}
694
695
696
697////////////////////////////////////////////////////////////////////////////////
698/// Return the name of the object at slot 'idx' in this RooPlot.
699/// If the given index is out of range, return a null pointer
700
701const char* RooPlot::nameOf(Int_t idx) const
702{
703 TObject* obj = _items.At(idx) ;
704 if (!obj) {
705 coutE(InputArguments) << "RooPlot::nameOf(" << GetName() << ") index " << idx << " out of range" << endl ;
706 return 0 ;
707 }
708 return obj->GetName() ;
709}
710
711
712
713////////////////////////////////////////////////////////////////////////////////
714/// Return the name of the object at slot 'idx' in this RooPlot.
715/// If the given index is out of range, return a null pointer
716
718{
719 TObject* obj = _items.At(idx) ;
720 if (!obj) {
721 coutE(InputArguments) << "RooPlot::getObject(" << GetName() << ") index " << idx << " out of range" << endl ;
722 return 0 ;
723 }
724 return obj ;
725}
726
727
728
729////////////////////////////////////////////////////////////////////////////////
730/// Return a pointer to the line attributes of the named object in this plot,
731/// or zero if the named object does not exist or does not have line attributes.
732
734{
735 return dynamic_cast<TAttLine*>(findObject(name));
736}
737
738
739////////////////////////////////////////////////////////////////////////////////
740/// Return a pointer to the fill attributes of the named object in this plot,
741/// or zero if the named object does not exist or does not have fill attributes.
742
744{
745 return dynamic_cast<TAttFill*>(findObject(name));
746}
747
748
749////////////////////////////////////////////////////////////////////////////////
750/// Return a pointer to the marker attributes of the named object in this plot,
751/// or zero if the named object does not exist or does not have marker attributes.
752
754{
755 return dynamic_cast<TAttMarker*>(findObject(name));
756}
757
758
759////////////////////////////////////////////////////////////////////////////////
760/// Return a pointer to the text attributes of the named object in this plot,
761/// or zero if the named object does not exist or does not have text attributes.
762
764{
765 return dynamic_cast<TAttText*>(findObject(name));
766}
767
768
769
770////////////////////////////////////////////////////////////////////////////////
771/// Return a RooCurve pointer of the named object in this plot,
772/// or zero if the named object does not exist or is not a RooCurve
773
774RooCurve* RooPlot::getCurve(const char* name) const
775{
776 return dynamic_cast<RooCurve*>(findObject(name)) ;
777}
778
779
780////////////////////////////////////////////////////////////////////////////////
781/// Return a RooCurve pointer of the named object in this plot,
782/// or zero if the named object does not exist or is not a RooCurve
783
784RooHist* RooPlot::getHist(const char* name) const
785{
786 return dynamic_cast<RooHist*>(findObject(name)) ;
787}
788
789
790
791////////////////////////////////////////////////////////////////////////////////
792/// Remove object with given name, or last object added if no name is given.
793/// If deleteToo is true (default), the object removed from the RooPlot is
794/// also deleted.
795
796void RooPlot::remove(const char* name, Bool_t deleteToo)
797{
798 TObject* obj = findObject(name) ;
799 if (!obj) {
800 if (name) {
801 coutE(InputArguments) << "RooPlot::remove(" << GetName() << ") ERROR: no object found with name " << name << endl ;
802 } else {
803 coutE(InputArguments) << "RooPlot::remove(" << GetName() << ") ERROR: plot frame is empty, cannot remove last object" << endl ;
804 }
805 return ;
806 }
807
808 _items.Remove(obj) ;
809
810 if (deleteToo) {
811 delete obj ;
812 }
813}
814
815
816////////////////////////////////////////////////////////////////////////////////
817/// Change the order in which our contained objects are drawn so that
818/// the target object is drawn just before the specified object.
819/// Returns kFALSE if either object does not exist.
820
821Bool_t RooPlot::drawBefore(const char *before, const char *target)
822{
823 return _items.moveBefore(before, target, caller("drawBefore"));
824}
825
826
827////////////////////////////////////////////////////////////////////////////////
828/// Change the order in which our contained objects are drawn so that
829/// the target object is drawn just after the specified object.
830/// Returns kFALSE if either object does not exist.
831
832Bool_t RooPlot::drawAfter(const char *after, const char *target)
833{
834 return _items.moveAfter(after, target, caller("drawAfter"));
835}
836
837
838////////////////////////////////////////////////////////////////////////////////
839/// Find the named object in our list of items and return a pointer
840/// to it. Return zero and print a warning message if the named
841/// object cannot be found. If no name is supplied the last object
842/// added is returned.
843///
844/// Note that the returned pointer is to a
845/// TObject and so will generally need casting. Use the getAtt...()
846/// methods to change the drawing style attributes of a contained
847/// object directly.
848
849TObject *RooPlot::findObject(const char *name, const TClass* clas) const
850{
851 TObject *obj = 0;
852 TObject *ret = 0;
853
854 TIterator* iter = _items.MakeIterator() ;
855 while((obj=iter->Next())) {
856 if ((!name || !TString(name).CompareTo(obj->GetName())) &&
857 (!clas || (obj->IsA()==clas))) {
858 ret = obj ;
859 }
860 }
861 delete iter ;
862
863 if (ret==0) {
864 coutE(InputArguments) << "RooPlot::findObject(" << GetName() << ") cannot find object " << (name?name:"<last>") << endl ;
865 }
866 return ret ;
867}
868
869
870////////////////////////////////////////////////////////////////////////////////
871/// Return the Draw() options registered for the named object. Return
872/// an empty string if the named object cannot be found.
873
875{
876 TObjOptLink *link= _items.findLink(name,caller("getDrawOptions"));
877 DrawOpt opt(0 == link ? "" : link->GetOption()) ;
878 return TString(opt.drawOptions) ;
879}
880
881
882////////////////////////////////////////////////////////////////////////////////
883/// Register the specified drawing options for the named object.
884/// Return kFALSE if the named object cannot be found.
885
887{
888 TObjOptLink *link= _items.findLink(name,caller("setDrawOptions"));
889 if(0 == link) return kFALSE;
890
891 DrawOpt opt(link->GetOption()) ;
892 strlcpy(opt.drawOptions,options,128) ;
893 link->SetOption(opt.rawOpt());
894 return kTRUE;
895}
896
897
898////////////////////////////////////////////////////////////////////////////////
899/// Returns true of object with given name is set to be invisible
900
902{
903 TObjOptLink *link= _items.findLink(name,caller("getInvisible"));
904 if(0 == link) return kFALSE;
905
906 return DrawOpt(link->GetOption()).invisible ;
907}
908
909
910////////////////////////////////////////////////////////////////////////////////
911/// If flag is true object with 'name' is set to be invisible
912/// i.e. it is not drawn when Draw() is called
913
914void RooPlot::setInvisible(const char* name, Bool_t flag)
915{
916 TObjOptLink *link= _items.findLink(name,caller("getInvisible"));
917
918 DrawOpt opt ;
919
920 if(link) {
921 opt.initialize(link->GetOption()) ;
922 opt.invisible = flag ;
923 link->SetOption(opt.rawOpt()) ;
924 }
925
926}
927
928
929
930////////////////////////////////////////////////////////////////////////////////
931/// Utility function
932
933TString RooPlot::caller(const char *method) const
934{
936 if(strlen(method)) {
937 name.Append("::");
938 name.Append(method);
939 }
940 return name;
941}
942
943
944
945////////////////////////////////////////////////////////////////////////////////
946/// Set maximum value of Y axis
947
949{
950 _hist->SetMaximum(maximum==-1111?_defYmax:maximum) ;
951}
952
953
954
955////////////////////////////////////////////////////////////////////////////////
956/// Set minimum value of Y axis
957
959{
960 _hist->SetMinimum(minimum==-1111?_defYmin:minimum) ;
961}
962
963
964
965////////////////////////////////////////////////////////////////////////////////
966/// Calculate and return reduced chi-squared of curve with given name with respect
967/// to histogram with given name.
968///
969/// \param[in] curvename Name of the curve or nullptr for last curve
970/// \param[in] histname Name of the histogram to compare to or nullptr for last added histogram
971/// \param[in] nFitParam If non-zero, reduce the number of degrees of freedom by this
972/// number. This means that the curve was fitted to the data with nFitParam floating
973/// parameters, which needs to be reflected in the calculation of \f$\chi^2 / \mathrm{ndf}\f$.
974///
975/// \return \f$ \chi^2 / \mathrm{ndf} \f$
976
977Double_t RooPlot::chiSquare(const char* curvename, const char* histname, int nFitParam) const
978{
979
980 // Find curve object
981 RooCurve* curve = (RooCurve*) findObject(curvename,RooCurve::Class()) ;
982 if (!curve) {
983 coutE(InputArguments) << "RooPlot::chiSquare(" << GetName() << ") cannot find curve" << endl ;
984 return -1. ;
985 }
986
987 // Find histogram object
988 RooHist* hist = (RooHist*) findObject(histname,RooHist::Class()) ;
989 if (!hist) {
990 coutE(InputArguments) << "RooPlot::chiSquare(" << GetName() << ") cannot find histogram" << endl ;
991 return -1. ;
992 }
993
994 return curve->chiSquare(*hist,nFitParam) ;
995}
996
997
998////////////////////////////////////////////////////////////////////////////////
999/// Return a RooHist containing the residuals of histogram 'histname' with respect
1000/// to curve 'curvename'. If normalize is true the residuals are divided by the error
1001/// on the histogram, effectively returning a pull histogram
1002
1003RooHist* RooPlot::residHist(const char* histname, const char* curvename, bool normalize, bool useAverage) const
1004{
1005 // Find curve object
1006 RooCurve* curve = (RooCurve*) findObject(curvename,RooCurve::Class()) ;
1007 if (!curve) {
1008 coutE(InputArguments) << "RooPlot::residHist(" << GetName() << ") cannot find curve" << endl ;
1009 return 0 ;
1010 }
1011
1012 // Find histogram object
1013 RooHist* hist = (RooHist*) findObject(histname,RooHist::Class()) ;
1014 if (!hist) {
1015 coutE(InputArguments) << "RooPlot::residHist(" << GetName() << ") cannot find histogram" << endl ;
1016 return 0 ;
1017 }
1018
1019 return hist->makeResidHist(*curve,normalize,useAverage) ;
1020}
1021
1022
1023
1024////////////////////////////////////////////////////////////////////////////////
1025/// Initialize the DrawOpt helper class
1026
1027void RooPlot::DrawOpt::initialize(const char* inRawOpt)
1028{
1029 if (!inRawOpt) {
1030 drawOptions[0] = 0 ;
1032 return ;
1033 }
1034 strlcpy(drawOptions,inRawOpt,128) ;
1035 strtok(drawOptions,":") ;
1036 const char* extraOpt = strtok(0,":") ;
1037 if (extraOpt) {
1038 invisible = (extraOpt[0]=='I') ;
1039 }
1040}
1041
1042
1043////////////////////////////////////////////////////////////////////////////////
1044/// Return the raw draw options
1045
1046const char* RooPlot::DrawOpt::rawOpt() const
1047{
1048 static char buf[128] ;
1049 strlcpy(buf,drawOptions,128) ;
1050 if (invisible) {
1051 strlcat(buf,":I",128) ;
1052 }
1053 return buf ;
1054}
1055
1056
1057
1058////////////////////////////////////////////////////////////////////////////////
1059/// Return the number of events that is associated with the range [xlo,xhi]
1060/// This method is only fully functional for ranges not equal to the full
1061/// range if the object that inserted the normalization data provided
1062/// a link to an external object that can calculate the event count in
1063/// in sub ranges. An error will be printed if this function is used
1064/// on sub-ranges while that information is not available
1065
1067{
1068 Double_t scaleFactor = 1.0 ;
1069 if (_normObj) {
1070 scaleFactor = _normObj->getFitRangeNEvt(xlo,xhi)/_normObj->getFitRangeNEvt() ;
1071 } else {
1072 coutW(Plotting) << "RooPlot::getFitRangeNEvt(" << GetName() << ") WARNING: Unable to obtain event count in range "
1073 << xlo << " to " << xhi << ", substituting full event count" << endl ;
1074 }
1075 return getFitRangeNEvt()*scaleFactor ;
1076}
1077
1078
1079////////////////////////////////////////////////////////////////////////////////
1080/// Set the name of the RooPlot to 'name'
1081
1082void RooPlot::SetName(const char *name)
1083{
1084 if (_dir) _dir->GetList()->Remove(this);
1086 if (_dir) _dir->GetList()->Add(this);
1087}
1088
1089
1090////////////////////////////////////////////////////////////////////////////////
1091/// Set the name and title of the RooPlot to 'name' and 'title'
1092
1093void RooPlot::SetNameTitle(const char *name, const char* title)
1094{
1095 if (_dir) _dir->GetList()->Remove(this);
1096 TNamed::SetNameTitle(name,title) ;
1097 if (_dir) _dir->GetList()->Add(this);
1098}
1099
1100
1101////////////////////////////////////////////////////////////////////////////////
1102/// Set the title of the RooPlot to 'title'
1103
1104void RooPlot::SetTitle(const char* title)
1105{
1106 TNamed::SetTitle(title) ;
1107 _hist->SetTitle(title) ;
1108}
1109
1110
1111
1112////////////////////////////////////////////////////////////////////////////////
1113/// Define default print options, for a given print style
1114
1116{
1117 return kName|kArgs|kValue ;
1118}
1119
1120
1121
1122TAxis* RooPlot::GetXaxis() const { return _hist->GetXaxis() ; }
1123TAxis* RooPlot::GetYaxis() const { return _hist->GetYaxis() ; }
1126Double_t RooPlot::GetMinimum(Double_t minval) const { return _hist->GetMinimum(minval) ; }
1127Double_t RooPlot::GetMaximum(Double_t maxval) const { return _hist->GetMaximum(maxval) ; }
1128
1129
1130void RooPlot::SetAxisColor(Color_t color, Option_t* axis) { _hist->SetAxisColor(color,axis) ; }
1134void RooPlot::SetContour(Int_t nlevels, const Double_t* levels) { _hist->SetContour(nlevels,levels) ; }
1135void RooPlot::SetContourLevel(Int_t level, Double_t value) { _hist->SetContourLevel(level,value) ; }
1140void RooPlot::SetLabelColor(Color_t color, Option_t* axis) { _hist->SetLabelColor(color,axis) ; }
1141void RooPlot::SetLabelFont(Style_t font, Option_t* axis) { _hist->SetLabelFont(font,axis) ; }
1142void RooPlot::SetLabelOffset(Float_t offset, Option_t* axis) { _hist->SetLabelOffset(offset,axis) ; }
1143void RooPlot::SetLabelSize(Float_t size, Option_t* axis) { _hist->SetLabelSize(size,axis) ; }
1153void RooPlot::SetOption(Option_t* option) { _hist->SetOption(option) ; }
1154void RooPlot::SetStats(Bool_t stats) { _hist->SetStats(stats) ; }
1155void RooPlot::SetTickLength(Float_t length, Option_t* axis) { _hist->SetTickLength(length,axis) ; }
1156void RooPlot::SetTitleFont(Style_t font, Option_t* axis) { _hist->SetTitleFont(font,axis) ; }
1157void RooPlot::SetTitleOffset(Float_t offset, Option_t* axis) { _hist->SetTitleOffset(offset,axis) ; }
1158void RooPlot::SetTitleSize(Float_t size, Option_t* axis) { _hist->SetTitleSize(size,axis) ; }
1159void RooPlot::SetXTitle(const char *title) { _hist->SetXTitle(title) ; }
1160void RooPlot::SetYTitle(const char *title) { _hist->SetYTitle(title) ; }
1161void RooPlot::SetZTitle(const char *title) { _hist->SetZTitle(title) ; }
1162
1163
1164
1165
1166////////////////////////////////////////////////////////////////////////////////
1167/// Plot RooPlot when double-clicked in browser
1168
1170{
1171 Draw();
1172 gPad->Update();
1173}
1174
1175
1176
1177
1178////////////////////////////////////////////////////////////////////////////////
1179
1180void RooPlot::Streamer(TBuffer &R__b)
1181{
1182 // Custom streamer, needed for backward compatibility
1183
1184 if (R__b.IsReading()) {
1185
1187
1188 // The default c'tor might have registered this with a TDirectory.
1189 // Streaming the TNamed will make this not retrievable anymore, so
1190 // unregister first.
1191 if (_dir)
1192 _dir->Remove(this);
1193
1194 UInt_t R__s, R__c;
1195 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1196 if (R__v > 1) {
1197 R__b.ReadClassBuffer(RooPlot::Class(),this,R__v,R__s,R__c);
1198 } else {
1199 // backward compatible streamer code here
1200 // Version 1 of RooPlot was deriving from TH1 and RooPrintable
1201 // Version 2 derives instead from TNamed and RooPrintable
1202 _hist = new TH1F();
1203 _hist->TH1::Streamer(R__b);
1204 SetName(_hist->GetName());
1206 RooPrintable::Streamer(R__b);
1207 _items.Streamer(R__b);
1208 R__b >> _padFactor;
1209 R__b >> _plotVarClone;
1210 R__b >> _plotVarSet;
1211 R__b >> _normVars;
1212 R__b >> _normNumEvts;
1213 R__b >> _normBinWidth;
1214 R__b >> _defYmin;
1215 R__b >> _defYmax;
1216 R__b.CheckByteCount(R__s, R__c, RooPlot::IsA());
1217 }
1218
1220 if (_dir)
1221 _dir->Append(this);
1222
1223 } else {
1224 R__b.WriteClassBuffer(RooPlot::Class(),this);
1225 }
1226}
void Class()
Definition: Class.C:29
#define e(i)
Definition: RSha256.hxx:103
#define coutI(a)
Definition: RooMsgService.h:31
#define coutW(a)
Definition: RooMsgService.h:33
#define coutE(a)
Definition: RooMsgService.h:34
int Int_t
Definition: RtypesCore.h:41
float Size_t
Definition: RtypesCore.h:83
short Version_t
Definition: RtypesCore.h:61
unsigned int UInt_t
Definition: RtypesCore.h:42
const Bool_t kFALSE
Definition: RtypesCore.h:88
unsigned long ULong_t
Definition: RtypesCore.h:51
short Width_t
Definition: RtypesCore.h:78
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
double Stat_t
Definition: RtypesCore.h:73
short Color_t
Definition: RtypesCore.h:79
short Style_t
Definition: RtypesCore.h:76
float Float_t
Definition: RtypesCore.h:53
const Bool_t kTRUE
Definition: RtypesCore.h:87
const char Option_t
Definition: RtypesCore.h:62
#define ClassImp(name)
Definition: Rtypes.h:365
static void indent(ostringstream &buf, int indent_level)
#define gDirectory
Definition: TDirectory.h:218
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
char name[80]
Definition: TGX11.cxx:109
float xmin
Definition: THbookFile.cxx:93
float ymin
Definition: THbookFile.cxx:93
float xmax
Definition: THbookFile.cxx:93
float ymax
Definition: THbookFile.cxx:93
char * Form(const char *fmt,...)
#define gPad
Definition: TVirtualPad.h:286
RooAbsArg * find(const char *name) const
Find object with given name in list.
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
virtual Double_t getMax(const char *name=0) const
Get maximum of currently defined range.
Bool_t hasMax(const char *name=0) const
Check if variable has an upper bound.
Bool_t hasMin(const char *name=0) const
Check if variable has a lower bound.
virtual Double_t getMin(const char *name=0) const
Get miniminum of currently defined range.
TString getTitle(Bool_t appendUnit=kFALSE) const
Return this variable's title string.
Definition: RooAbsReal.cxx:254
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:28
RooArgSet * snapshot(bool deepCopy=true) const
Use RooAbsCollection::snapshot(), but return as RooArgSet.
Definition: RooArgSet.h:134
A RooCurve is a one-dimensional graphical representation of a real-valued function.
Definition: RooCurve.h:32
Double_t chiSquare(const RooHist &hist, int nFitParam) const
Calculate the chi^2/NDOF of this curve with respect to the histogram 'hist' accounting nFitParam floa...
Definition: RooCurve.cxx:545
A RooHist is a graphical representation of binned data based on the TGraphAsymmErrors class.
Definition: RooHist.h:26
RooHist * makeResidHist(const RooCurve &curve, bool normalize=false, bool useAverage=false) const
Create and return RooHist containing residuals w.r.t to given curve.
Definition: RooHist.cxx:700
TObjOptLink * findLink(const char *name, const char *caller=0) const
Find the link corresponding to the named object in this list.
Definition: RooList.cxx:46
Bool_t moveAfter(const char *after, const char *target, const char *caller=0)
Move the target object immediately after the specified object, preserving any Option_t associated wit...
Definition: RooList.cxx:104
Bool_t moveBefore(const char *before, const char *target, const char *caller=0)
Move the target object immediately before the specified object, preserving any Option_t associated wi...
Definition: RooList.cxx:69
char drawOptions[128]
Definition: RooPlot.h:193
void initialize(const char *_rawOpt)
Initialize the DrawOpt helper class.
Definition: RooPlot.cxx:1027
Bool_t invisible
Definition: RooPlot.h:194
const char * rawOpt() const
Return the raw draw options.
Definition: RooPlot.cxx:1046
A RooPlot is a plot frame and a container for graphics objects within that frame.
Definition: RooPlot.h:41
RooPlot()
Default constructor coverity[UNINIT_CTOR].
Definition: RooPlot.cxx:86
void SetAxisColor(Color_t color=1, Option_t *axis="X")
Definition: RooPlot.cxx:1130
static Bool_t setAddDirectoryStatus(Bool_t flag)
Definition: RooPlot.cxx:79
Bool_t drawAfter(const char *after, const char *target)
Change the order in which our contained objects are drawn so that the target object is drawn just aft...
Definition: RooPlot.cxx:832
void SetMarkerSize(Size_t msize=1)
Definition: RooPlot.cxx:1150
RooHist * residHist(const char *histname=0, const char *pdfname=0, bool normalize=false, bool useAverage=kFALSE) const
Return a RooHist containing the residuals of histogram 'histname' with respect to curve 'curvename'.
Definition: RooPlot.cxx:1003
Double_t _defYmin
non-persistent
Definition: RooPlot.h:219
const RooPlotable * _normObj
Definition: RooPlot.h:213
RooAbsRealLValue * _plotVarClone
Definition: RooPlot.h:209
virtual void printTitle(std::ostream &os) const
Print frame title.
Definition: RooPlot.cxx:600
RooArgSet * _normVars
Definition: RooPlot.h:211
virtual Int_t defaultPrintContents(Option_t *opt) const
Define default print options, for a given print style.
Definition: RooPlot.cxx:1115
static Bool_t _addDirStatus
non-persistent
Definition: RooPlot.h:224
Bool_t drawBefore(const char *before, const char *target)
Change the order in which our contained objects are drawn so that the target object is drawn just bef...
Definition: RooPlot.cxx:821
void SetMarkerColor(Color_t tcolor=1)
Definition: RooPlot.cxx:1149
Double_t chiSquare(int nFitParam=0) const
Shortcut for RooPlot::chiSquare(const char* pdfname, const char* histname, int nFitParam=0)
Definition: RooPlot.h:169
virtual void printClassName(std::ostream &os) const
Print frame class name.
Definition: RooPlot.cxx:609
void SetContourLevel(Int_t level, Double_t value)
Definition: RooPlot.cxx:1135
void SetXTitle(const char *title)
Definition: RooPlot.cxx:1159
void SetFillColor(Color_t fcolor)
Definition: RooPlot.cxx:1138
TAttMarker * getAttMarker(const char *name=0) const
Return a pointer to the marker attributes of the named object in this plot, or zero if the named obje...
Definition: RooPlot.cxx:753
RooArgSet * _plotVarSet
Definition: RooPlot.h:210
void SetStats(Bool_t stats=kTRUE)
Definition: RooPlot.cxx:1154
void SetNdivisions(Int_t n=510, Option_t *axis="X")
Definition: RooPlot.cxx:1152
TDirectory * _dir
Definition: RooPlot.h:222
TString histName() const
Construct automatic name of internal TH1.
Definition: RooPlot.cxx:311
RooList _items
Definition: RooPlot.h:207
TH1 * _hist
Definition: RooPlot.h:205
void updateYAxis(Double_t ymin, Double_t ymax, const char *label="")
Update our y-axis limits to accomodate an object whose spread in y is (ymin,ymax).
Definition: RooPlot.cxx:526
void SetMarkerStyle(Style_t mstyle=1)
Definition: RooPlot.cxx:1151
void addObject(TObject *obj, Option_t *drawOptions="", Bool_t invisible=kFALSE)
Add a generic object to this plot.
Definition: RooPlot.cxx:391
TString getDrawOptions(const char *name) const
Return the Draw() options registered for the named object.
Definition: RooPlot.cxx:874
virtual void printArgs(std::ostream &os) const
Interface for printing of object arguments.
Definition: RooPlot.cxx:618
void SetDrawOption(Option_t *option="")
Set drawing option for object.
Definition: RooPlot.cxx:1136
void SetZTitle(const char *title)
Definition: RooPlot.cxx:1161
Double_t GetMinimum(Double_t minval=-FLT_MAX) const
Definition: RooPlot.cxx:1126
void SetContour(Int_t nlevels, const Double_t *levels=0)
Definition: RooPlot.cxx:1134
Double_t getFitRangeNEvt() const
Return the number of events in the fit range.
Definition: RooPlot.h:134
Double_t getPadFactor() const
Definition: RooPlot.h:138
TAttFill * getAttFill(const char *name=0) const
Return a pointer to the fill attributes of the named object in this plot, or zero if the named object...
Definition: RooPlot.cxx:743
void SetTitle(const char *name)
Set the title of the RooPlot to 'title'.
Definition: RooPlot.cxx:1104
virtual void printName(std::ostream &os) const
Print frame name.
Definition: RooPlot.cxx:591
void SetLabelOffset(Float_t offset=0.005, Option_t *axis="X")
Definition: RooPlot.cxx:1142
void SetLineWidth(Width_t lwidth)
Definition: RooPlot.cxx:1147
void SetTickLength(Float_t length=0.02, Option_t *axis="X")
Definition: RooPlot.cxx:1155
virtual Stat_t GetBinContent(Int_t) const
A plot object is a frame without any bin contents of its own so this method always returns zero.
Definition: RooPlot.cxx:359
void SetFillAttributes()
Definition: RooPlot.cxx:1137
Double_t _normNumEvts
Pointer to normalization object ;.
Definition: RooPlot.h:214
TAttText * getAttText(const char *name=0) const
Return a pointer to the text attributes of the named object in this plot, or zero if the named object...
Definition: RooPlot.cxx:763
void SetLabelSize(Float_t size=0.02, Option_t *axis="X")
Definition: RooPlot.cxx:1143
virtual void SetMinimum(Double_t minimum=-1111)
Set minimum value of Y axis.
Definition: RooPlot.cxx:958
void SetOption(Option_t *option=" ")
Definition: RooPlot.cxx:1153
TObject * getObject(Int_t idx) const
Return the name of the object at slot 'idx' in this RooPlot.
Definition: RooPlot.cxx:717
TAxis * GetYaxis() const
Definition: RooPlot.cxx:1123
void SetNameTitle(const char *name, const char *title)
Set the name and title of the RooPlot to 'name' and 'title'.
Definition: RooPlot.cxx:1093
void SetName(const char *name)
Set the name of the RooPlot to 'name'.
Definition: RooPlot.cxx:1082
void SetLabelFont(Style_t font=62, Option_t *axis="X")
Definition: RooPlot.cxx:1141
void SetLineStyle(Style_t lstyle)
Definition: RooPlot.cxx:1146
void setPadFactor(Double_t factor)
Definition: RooPlot.h:139
TAttLine * getAttLine(const char *name=0) const
Return a pointer to the line attributes of the named object in this plot, or zero if the named object...
Definition: RooPlot.cxx:733
void SetTitleFont(Style_t font=62, Option_t *axis="X")
Definition: RooPlot.cxx:1156
TAxis * GetXaxis() const
Definition: RooPlot.cxx:1122
void SetLineColor(Color_t lcolor)
Definition: RooPlot.cxx:1145
void SetFillStyle(Style_t fstyle)
Definition: RooPlot.cxx:1139
const char * nameOf(Int_t idx) const
Return the name of the object at slot 'idx' in this RooPlot.
Definition: RooPlot.cxx:701
Bool_t getInvisible(const char *name) const
Returns true of object with given name is set to be invisible.
Definition: RooPlot.cxx:901
void updateNormVars(const RooArgSet &vars)
Install the given set of observables are reference normalization variables for this frame.
Definition: RooPlot.cxx:349
RooPlot * emptyClone(const char *name)
Return empty clone of current RooPlot.
Definition: RooPlot.cxx:274
void SetMarkerAttributes()
Definition: RooPlot.cxx:1148
Double_t GetMaximum(Double_t maxval=FLT_MAX) const
Definition: RooPlot.cxx:1127
virtual ~RooPlot()
Destructor.
Definition: RooPlot.cxx:324
Bool_t setDrawOptions(const char *name, TString options)
Register the specified drawing options for the named object.
Definition: RooPlot.cxx:886
void SetLabelColor(Color_t color=1, Option_t *axis="X")
Definition: RooPlot.cxx:1140
void addPlotable(RooPlotable *plotable, Option_t *drawOptions="", Bool_t invisible=kFALSE, Bool_t refreshNorm=kFALSE)
Add the specified plotable object to our plot.
Definition: RooPlot.cxx:446
Int_t GetNbinsX() const
Definition: RooPlot.cxx:1124
void setInvisible(const char *name, Bool_t flag=kTRUE)
If flag is true object with 'name' is set to be invisible i.e.
Definition: RooPlot.cxx:914
void SetLineAttributes()
Definition: RooPlot.cxx:1144
void addTH1(TH1 *hist, Option_t *drawOptions="", Bool_t invisible=kFALSE)
Add a TH1 histogram object to this plot.
Definition: RooPlot.cxx:410
virtual void SetMaximum(Double_t maximum=-1111)
Set maximum value of Y axis.
Definition: RooPlot.cxx:948
void SetYTitle(const char *title)
Definition: RooPlot.cxx:1160
TObject * findObject(const char *name, const TClass *clas=0) const
Find the named object in our list of items and return a pointer to it.
Definition: RooPlot.cxx:849
Double_t _normBinWidth
Definition: RooPlot.h:215
void Browse(TBrowser *b)
Plot RooPlot when double-clicked in browser.
Definition: RooPlot.cxx:1169
virtual void printMultiline(std::ostream &os, Int_t content, Bool_t verbose=kFALSE, TString indent="") const
Frame detailed printing.
Definition: RooPlot.cxx:661
TIterator * _iterator
Definition: RooPlot.h:217
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:471
RooCurve * getCurve(const char *name=0) const
Return a RooCurve pointer of the named object in this plot, or zero if the named object does not exis...
Definition: RooPlot.cxx:774
void SetTitleSize(Float_t size=0.02, Option_t *axis="X")
Definition: RooPlot.cxx:1158
static Bool_t addDirectoryStatus()
Definition: RooPlot.cxx:78
virtual void Draw(Option_t *options=0)
Draw this plot and all of the elements it contains.
Definition: RooPlot.cxx:558
Double_t _padFactor
Definition: RooPlot.h:208
void SetBarOffset(Float_t offset=0.25)
Definition: RooPlot.cxx:1132
void SetBarWidth(Float_t width=0.5)
Definition: RooPlot.cxx:1133
Int_t GetNdivisions(Option_t *axis="X") const
Definition: RooPlot.cxx:1125
void SetAxisRange(Double_t xmin, Double_t xmax, Option_t *axis="X")
Definition: RooPlot.cxx:1131
Double_t _defYmax
Definition: RooPlot.h:220
TString caller(const char *method) const
Utility function.
Definition: RooPlot.cxx:933
void initialize()
Perform initialization that is common to all constructors.
Definition: RooPlot.cxx:285
void remove(const char *name=0, Bool_t deleteToo=kTRUE)
Remove object with given name, or last object added if no name is given.
Definition: RooPlot.cxx:796
void SetTitleOffset(Float_t offset=1, Option_t *axis="X")
Definition: RooPlot.cxx:1157
RooHist * getHist(const char *name=0) const
Return a RooCurve pointer of the named object in this plot, or zero if the named object does not exis...
Definition: RooPlot.cxx:784
virtual void printValue(std::ostream &os) const
Print frame arguments.
Definition: RooPlot.cxx:632
Class RooPotable is a base class for objects that can be inserted into RooPlots and take advantage of...
Definition: RooPlotable.h:26
Double_t getYAxisMin() const
Definition: RooPlotable.h:41
virtual Double_t getFitRangeNEvt() const =0
Double_t getYAxisMax() const
Definition: RooPlotable.h:42
virtual Double_t getFitRangeBinW() const =0
TObject * crossCast()
Return cast of RooPlotable as TObject.
Definition: RooPlotable.cxx:55
const char * getYAxisLabel() const
Definition: RooPlotable.h:31
RooPlotable is a 'mix-in' base class that define the standard RooFit plotting and printing methods.
Definition: RooPrintable.h:25
virtual void printStream(std::ostream &os, Int_t contents, StyleOption style, TString indent="") const
Print description of object on ostream, printing contents set by contents integer,...
void Set(Int_t n)
Set size of this array to n doubles.
Definition: TArrayD.cxx:106
Fill Area Attributes class.
Definition: TAttFill.h:19
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition: TAttFill.h:37
virtual void SetFillAttributes()
Invoke the DialogCanvas Fill attributes.
Definition: TAttFill.cxx:251
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
Definition: TAttFill.h:39
Line Attributes class.
Definition: TAttLine.h:18
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Definition: TAttLine.h:42
virtual void SetLineAttributes()
Invoke the DialogCanvas Line attributes.
Definition: TAttLine.cxx:282
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition: TAttLine.h:43
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition: TAttLine.h:40
Marker Attributes class.
Definition: TAttMarker.h:19
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
Definition: TAttMarker.h:38
virtual void SetMarkerAttributes()
Invoke the DialogCanvas Marker attributes.
Definition: TAttMarker.cxx:265
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
Definition: TAttMarker.h:40
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
Definition: TAttMarker.h:41
Text Attributes class.
Definition: TAttText.h:18
Class to manage histogram axis.
Definition: TAxis.h:30
Double_t GetXmax() const
Definition: TAxis.h:134
Double_t GetXmin() const
Definition: TAxis.h:133
const char * GetTitle() const
Returns title of object.
Definition: TAxis.h:129
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
Buffer base class used for serializing objects.
Definition: TBuffer.h:42
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
Bool_t IsReading() const
Definition: TBuffer.h:85
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:75
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Definition: TCollection.h:182
virtual TList * GetList() const
Definition: TDirectory.h:154
virtual void Append(TObject *obj, Bool_t replace=kFALSE)
Append object to this directory.
Definition: TDirectory.cxx:190
virtual TObject * Remove(TObject *)
Remove an object from the in-memory list.
1-D histogram with a double per channel (see TH1 documentation)}
Definition: TH1.h:614
1-D histogram with a float per channel (see TH1 documentation)}
Definition: TH1.h:571
The TH1 histogram class.
Definition: TH1.h:56
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 SetTitle(const char *title)
See GetStatOverflows for more information.
Definition: TH1.cxx:6309
virtual void SetTitleSize(Float_t size=0.02, Option_t *axis="X")
Set the axis' title size.
Definition: Haxis.cxx:365
virtual void SetLabelOffset(Float_t offset=0.005, Option_t *axis="X")
Set offset between axis and axis' labels.
Definition: Haxis.cxx:267
virtual void SetXTitle(const char *title)
Definition: TH1.h:409
virtual Int_t GetDimension() const
Definition: TH1.h:278
static void AddDirectory(Bool_t add=kTRUE)
Sets the flag controlling the automatic add of histograms in memory.
Definition: TH1.cxx:1225
virtual void SetContourLevel(Int_t level, Double_t value)
Set value for one contour level.
Definition: TH1.cxx:7944
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
Definition: TH1.h:316
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:7964
virtual Int_t GetNbinsX() const
Definition: TH1.h:292
virtual void SetMaximum(Double_t maximum=-1111)
Definition: TH1.h:394
TAxis * GetYaxis()
Definition: TH1.h:317
virtual void SetContour(Int_t nlevels, const Double_t *levels=0)
Set the number and values of contour levels.
Definition: TH1.cxx:7905
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:395
virtual void SetBarWidth(Float_t width=0.5)
Definition: TH1.h:356
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:8635
virtual Double_t GetEntries() const
Return the current number of entries.
Definition: TH1.cxx:4277
virtual void SetZTitle(const char *title)
Definition: TH1.h:411
virtual void Draw(Option_t *option="")
Draw this histogram with options.
Definition: TH1.cxx:2981
virtual void SetBarOffset(Float_t offset=0.25)
Definition: TH1.h:355
virtual TArrayD * GetSumw2()
Definition: TH1.h:308
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:402
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:410
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:8049
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:8433
static Bool_t AddDirectoryStatus()
Static function: cannot be inlined on Windows/NT.
Definition: TH1.cxx:705
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
Definition: TH1.cxx:8404
virtual void SetTickLength(Float_t length=0.02, Option_t *axis="X")
Set the axis' tick marks length.
Definition: Haxis.cxx:302
Iterator abstract base class.
Definition: TIterator.h:30
virtual void Reset()=0
virtual TObject * Next()=0
virtual Option_t * GetOption() const
Definition: TIterator.h:40
virtual void Add(TObject *obj)
Definition: TList.h:87
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Definition: TList.cxx:819
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
Definition: TList.cxx:354
virtual void RecursiveRemove(TObject *obj)
Remove object from this collection and recursively remove the object from all other objects (and coll...
Definition: TList.cxx:761
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const
Return a list iterator.
Definition: TList.cxx:719
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Definition: TList.cxx:467
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition: TNamed.cxx:164
TString fName
Definition: TNamed.h:32
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
virtual void SetNameTitle(const char *name, const char *title)
Set all the TNamed parameters (name and title).
Definition: TNamed.cxx:154
Mother of all ROOT objects.
Definition: TObject.h:37
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:357
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:172
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition: TObject.cxx:128
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:443
virtual void SetDrawOption(Option_t *option="")
Set drawing option for object.
Definition: TObject.cxx:677
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition: TObject.cxx:195
Basic string class.
Definition: TString.h:131
void ToLower()
Change string to lower-case.
Definition: TString.cxx:1125
const char * Data() const
Definition: TString.h:364
void ToUpper()
Change string to upper case.
Definition: TString.cxx:1138
TString & Append(const char *cs)
Definition: TString.h:559
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:619
const Int_t n
Definition: legend1.C:16
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
@ InputArguments
Definition: RooGlobalFunc.h:58
Definition: first.py:1