65 #include "TDirectory.h"
87 RooPlot::RooPlot() : _hist(0), _plotVarClone(0), _plotVarSet(0), _normVars(0), _normObj(0), _dir(0)
102 _hist(0), _items(), _plotVarClone(0), _plotVarSet(0), _normObj(0),
103 _defYmin(1e-5), _defYmax(1), _dir(0)
127 _hist(0), _items(), _plotVarClone(0),
128 _plotVarSet(0), _normObj(0), _defYmin(1e-5), _defYmax(0), _dir(0)
151 _plotVarClone(0), _plotVarSet(0), _normObj(0), _defYmin(1e-5), _defYmax(0), _dir(0)
163 coutE(
InputArguments) <<
"RooPlot::RooPlot: cannot create plot for variable without finite limits: "
168 coutE(
InputArguments) <<
"RooPlot::RooPlot: cannot create plot for variable without finite limits: "
187 _hist(0), _items(), _plotVarClone(0),
188 _plotVarSet(0), _normObj(0), _defYmin(1e-5), _defYmax(0), _dir(0)
213 _plotVarClone(0), _plotVarSet(0), _normObj(0), _defYmin(1e-5), _defYmax(1), _dir(0)
218 _hist =
new TH1D(name,title,nbins,xmin,xmax) ;
233 _normBinWidth = (xmax-
xmin)/nbins ;
243 _plotVarClone(0), _plotVarSet(0), _normObj(0), _defYmin(1e-5), _defYmax(1), _dir(0)
261 TString title(
"A RooPlot of \"");
267 _normBinWidth = (xmax-
xmin)/nbins ;
474 const TAxis* xa = ((
TH1*)hist)->GetXaxis() ;
486 if (_normNumEvts != 0) {
489 if (!refreshNorm)
return ;
492 if (dynamic_cast<const RooHist*>(rp)) corFac = _normBinWidth/rp->
getFitRangeBinW() ;
497 <<
" will supercede previous event count of " << _normNumEvts <<
" for normalization of PDF projections" << endl ;
535 if(ymin < 0) ymin-= ypad;
576 if (!opt.invisible) {
580 obj->
Draw(opt.drawOptions);
666 if(0 != _plotVarClone) {
667 os << indent <<
"RooPlot " <<
GetName() <<
" (" <<
GetTitle() <<
") plots variable ";
671 os << indent <<
"RooPlot " <<
GetName() <<
" (" <<
GetTitle() <<
") has no associated plot variable" << endl ;
673 os << indent <<
" Plot frame contains " <<
_items.
GetSize() <<
" object(s):" << endl;
804 coutE(
InputArguments) <<
"RooPlot::remove(" <<
GetName() <<
") ERROR: plot frame is empty, cannot remove last object" << endl ;
856 while((obj=iter->
Next())) {
858 (!clas || (obj->IsA()==clas))) {
879 return TString(opt.drawOptions) ;
890 if(0 == link)
return kFALSE;
893 strlcpy(opt.drawOptions,options,128) ;
905 if(0 == link)
return kFALSE;
989 return curve->
chiSquare(*hist,nFitParam) ;
1031 const char* extraOpt = strtok(0,
":") ;
1043 static char buf[128] ;
1044 strlcpy(buf,drawOptions,128) ;
1046 strlcat(buf,
":I",128) ;
1067 coutW(
Plotting) <<
"RooPlot::getFitRangeNEvt(" <<
GetName() <<
") WARNING: Unable to obtain event count in range "
1068 << xlo <<
" to " << xhi <<
", substituting full event count" << endl ;
1175 void RooPlot::Streamer(
TBuffer &R__b)
1198 _hist->TH1::Streamer(R__b);
1201 RooPrintable::Streamer(R__b);
void SetNdivisions(Int_t n=510, Option_t *axis="X")
void SetOption(Option_t *option=" ")
void SetXTitle(const char *title)
virtual void SetZTitle(const char *title)
virtual const char * GetTitle() const
Returns title of object.
virtual void SetLineWidth(Width_t lwidth)
Option_t * GetOption() const
virtual void SetBarOffset(Float_t offset=0.25)
virtual void printValue(std::ostream &os) const
Print frame arguments.
void SetBarWidth(Float_t width=0.5)
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.
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
virtual void SetLineAttributes()
Invoke the DialogCanvas Line attributes.
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
RooAbsCollection * snapshot(Bool_t deepCopy=kTRUE) const
Take a snap shot of current collection contents: An owning collection is returned containing clones o...
virtual void SetFillAttributes()
Invoke the DialogCanvas Fill attributes.
void SetLineColor(Color_t lcolor)
virtual void SetTitleFont(Style_t font=62, Option_t *axis="X")
The the axis' title font.
virtual void printName(std::ostream &os) const
Print frame name.
virtual void SetMaximum(Double_t maximum=-1111)
void SetLabelColor(Color_t color=1, Option_t *axis="X")
void SetName(const char *name)
Set the name of the RooPlot to 'name'.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual ~RooPlot()
Destructor.
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, which is interpreted as an OR of 'enum ContentsOptions' values and in the style given by 'enum StyleOption'.
virtual Double_t getFitRangeBinW() const =0
void addObject(TObject *obj, Option_t *drawOptions="", Bool_t invisible=kFALSE)
Add a generic object to this plot.
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...
virtual void SetContour(Int_t nlevels, const Double_t *levels=0)
Set the number and values of contour levels.
virtual Int_t GetDimension() const
void SetYTitle(const char *title)
virtual void SetName(const char *name)
Change (i.e.
virtual TList * GetList() const
void SetMarkerColor(Color_t tcolor=1)
void addTH1(TH1 *hist, Option_t *drawOptions="", Bool_t invisible=kFALSE)
Add a TH1 histogram object to this plot.
virtual void SetNdivisions(Int_t n=510, Option_t *axis="X")
Set the number of divisions to draw an axis.
void addPlotable(RooPlotable *plotable, Option_t *drawOptions="", Bool_t invisible=kFALSE, Bool_t refreshNorm=kFALSE)
Add the specified plotable object to our plot.
void SetZTitle(const char *title)
void ToUpper()
Change string to upper case.
Buffer base class used for serializing objects.
virtual void SetMinimum(Double_t minimum=-1111)
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
void SetStats(Bool_t stats=kTRUE)
virtual void SetLabelSize(Float_t size=0.02, Option_t *axis="X")
Set size of axis' labels.
void updateNormVars(const RooArgSet &vars)
Install the given set of observables are reference normalization variables for this frame...
static Bool_t AddDirectoryStatus()
static function: cannot be inlined on Windows/NT
virtual Double_t getMin(const char *name=0) const
virtual void SetMarkerAttributes()
Invoke the DialogCanvas Marker attributes.
void ToLower()
Change string to lower-case.
virtual void SetYTitle(const char *title)
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
virtual void SetFillStyle(Style_t fstyle)
void SetTitle(const char *name)
Set the title of the RooPlot to 'title'.
virtual Int_t GetNbinsX() const
virtual void SetAxisRange(Double_t xmin, Double_t xmax, Option_t *axis="X")
Set the "axis" range.
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...
virtual Double_t GetEntries() const
return the current number of entries
void SetDrawOption(Option_t *option="")
Set drawing option for object.
virtual void SetNameTitle(const char *name, const char *title)
Change (i.e. set) all the TNamed parameters (name and title).
TObject * getObject(Int_t idx) const
Return the name of the object at slot 'idx' in this RooPlot.
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
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...
Double_t GetMaximum(Double_t maxval=FLT_MAX) const
Iterator abstract base class.
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...
TObject * crossCast()
Return cast of RooPlotable as TObject.
static void AddDirectory(Bool_t add=kTRUE)
Sets the flag controlling the automatic add of histograms in memory.
virtual Option_t * GetOption() const
virtual void SetBarWidth(Float_t width=0.5)
void SetTitleSize(Float_t size=0.02, Option_t *axis="X")
const char * Data() const
virtual void SetMinimum(Double_t minimum=-1111)
Set minimum value of Y axis.
void setInvisible(const char *name, Bool_t flag=kTRUE)
If flag is true object with 'name' is set to be invisible i.e.
ClassImp(RooList) TObjOptLink *RooList TObjLink * link
Find the link corresponding to the named object in this list.
Fill Area Attributes class.
Bool_t hasMax(const char *name=0) const
static Bool_t _addDirStatus
non-persistent
virtual Double_t getFitRangeNEvt() const =0
virtual void SetOption(Option_t *option=" ")
std::map< std::string, std::string >::const_iterator iter
virtual void SetContourLevel(Int_t level, Double_t value)
Set value for one contour level.
virtual void SetMarkerColor(Color_t mcolor=1)
Bool_t setDrawOptions(const char *name, TString options)
Register the specified drawing options for the named object.
Double_t _defYmin
non-persistent
TString & Append(const char *cs)
void SetLineWidth(Width_t lwidth)
Double_t _normNumEvts
Pointer to normalization object ;.
virtual TArrayD * GetSumw2()
virtual void SetLabelFont(Style_t font=62, Option_t *axis="X")
Set font number used to draw axis labels.
TString histName() const
Construct automatic name of internal TH1.
virtual void printMultiline(std::ostream &os, Int_t content, Bool_t verbose=kFALSE, TString indent="") const
Frame detailed printing.
virtual void SetAxisColor(Color_t color=1, Option_t *axis="X")
Set color to draw the axis line and tick marks.
void initialize(const char *_rawOpt)
Initialize the DrawOpt helper class.
void SetLineStyle(Style_t lstyle)
void SetLabelOffset(Float_t offset=0.005, Option_t *axis="X")
void SetAxisRange(Double_t xmin, Double_t xmax, Option_t *axis="X")
virtual void SetLineColor(Color_t lcolor)
Using a TBrowser one can browse all ROOT objects.
void initialize()
Perform initialization that is common to all constructors.
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
void SetLabelSize(Float_t size=0.02, Option_t *axis="X")
virtual Int_t GetNdivisions(Option_t *axis="X") const
Return the number of divisions for "axis".
Double_t length(const TVector2 &v)
void SetContourLevel(Int_t level, Double_t value)
Class to manage histogram axis.
RooAbsArg * find(const char *name) const
Find object with given name in list.
virtual void Draw(Option_t *option="")
Draw this histogram with options.
virtual void SetFillColor(Color_t fcolor)
virtual void SetMaximum(Double_t maximum=-1111)
Set maximum value of Y axis.
void updateFitRangeNorm(const TH1 *hist)
Update our plot normalization over our plot variable's fit range, which will be determined by the fir...
void SetMarkerAttributes()
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...
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual TObject * Remove(TObject *obj)
Remove object from the list.
void SetNameTitle(const char *name, const char *title)
Set the name and title of the RooPlot to 'name' and 'title'.
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...
void SetMarkerSize(Size_t msize=1)
virtual Int_t defaultPrintContents(Option_t *opt) const
Define default print options, for a given print style.
void SetContour(Int_t nlevels, const Double_t *levels=0)
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'...
Bool_t TestBit(UInt_t f) const
Double_t getYAxisMax() const
char * Form(const char *fmt,...)
virtual void Append(TObject *obj, Bool_t replace=kFALSE)
Append object to this directory.
const char * rawOpt() const
Return the raw draw options.
RooAbsRealLValue * _plotVarClone
void SetLabelFont(Style_t font=62, Option_t *axis="X")
void SetTitleFont(Style_t font=62, Option_t *axis="X")
virtual const char * GetName() const
Returns name of object.
The ROOT global object gROOT contains a list of all defined classes.
virtual void SetMarkerStyle(Style_t mstyle=1)
void Browse(TBrowser *b)
Plot RooPlot when double-clicked in browser.
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...
const char * GetTitle() const
Returns title of object.
Double_t chiSquare(int nFitParam=0) const
void SetTickLength(Float_t length=0.02, Option_t *axis="X")
static void indent(ostringstream &buf, int indent_level)
virtual void SetMarkerSize(Size_t msize=1)
const char * getYAxisLabel() const
Bool_t hasMin(const char *name=0) const
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...
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
const char * nameOf(Int_t idx) const
Return the name of the object at slot 'idx' in this RooPlot.
Bool_t getInvisible(const char *name) const
Returns true of object with given name is set to be invisible.
virtual Int_t GetSize() const
virtual TObject * Remove(TObject *)
Remove an object from the in-memory list.
Int_t GetNdivisions(Option_t *axis="X") const
virtual const char * GetName() const
Returns name of object.
void SetMarkerStyle(Style_t mstyle=1)
virtual void printArgs(std::ostream &os) const
Interface for printing of object arguments.
virtual void SetTitleSize(Float_t size=0.02, Option_t *axis="X")
The the axis' title size.
const RooPlotable * _normObj
static Bool_t setAddDirectoryStatus(Bool_t flag)
Double_t getYAxisMin() const
void setPadFactor(Double_t factor)
TObjOptLink * findLink(const char *name, const char *caller=0) const
TString caller(const char *method) const
Utility function.
void SetBarOffset(Float_t offset=0.25)
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...
virtual void printTitle(std::ostream &os) const
Print frame title.
RooPlot * emptyClone(const char *name)
Return empty clone of current RooPlot.
virtual void SetLineStyle(Style_t lstyle)
void SetTitleOffset(Float_t offset=1, Option_t *axis="X")
virtual void SetTickLength(Float_t length=0.02, Option_t *axis="X")
Set the axis' tick marks length.
Mother of all ROOT objects.
virtual Double_t getMax(const char *name=0) const
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...
virtual void printClassName(std::ostream &os) const
Print frame class name.
virtual void SetXTitle(const char *title)
virtual void Add(TObject *obj)
TString getTitle(Bool_t appendUnit=kFALSE) const
Return this variable's title string.
virtual void RecursiveRemove(TObject *obj)
Remove object from this collection and recursively remove the object from all other objects (and coll...
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...
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Double_t GetMinimum(Double_t minval=-FLT_MAX) const
virtual TObject * Next()=0
void SetAxisColor(Color_t color=1, Option_t *axis="X")
virtual void Sumw2(Bool_t flag=kTRUE)
Create structure to store sum of squares of weights.
void SetOption(Option_t *option)
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const
Return a list iterator.
virtual void SetTitle(const char *title)
Change (i.e.
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...
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...
virtual void SetDrawOption(Option_t *option="")
Set drawing option for object.
void SetFillColor(Color_t fcolor)
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...
virtual void SetTitle(const char *title="")
Change (i.e. set) the title of the TNamed.
void SetFillStyle(Style_t fstyle)
void Set(Int_t n)
Set size of this array to n doubles.
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).
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
static Bool_t addDirectoryStatus()
RooPlot()
Default constructor coverity[UNINIT_CTOR].
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...
TString getDrawOptions(const char *name) const
Return the Draw() options registered for the named object.
void remove(const char *name=0, Bool_t deleteToo=kTRUE)
Remove object with given name, or last object added if no name is given.
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
Double_t getPadFactor() const
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual void Draw(Option_t *options=0)
Draw this plot and all of the elements it contains.
virtual void SetLabelColor(Color_t color=1, Option_t *axis="X")
Set axis labels color.
Double_t getFitRangeNEvt() const
RooHist * makeResidHist(const RooCurve &curve, bool normalize=false, bool useAverage=false) const
Create and return RooHist containing residuals w.r.t to given curve.
virtual void SetLabelOffset(Float_t offset=0.005, Option_t *axis="X")
Set offset between axis and axis' labels.
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...