00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef ROO_PLOT
00017 #define ROO_PLOT
00018
00019 #include <float.h>
00020 #include "RooList.h"
00021 #include "RooPrintable.h"
00022 #include "TNamed.h"
00023
00024 class TH1 ;
00025
00026 class RooAbsReal;
00027 class RooAbsRealLValue;
00028 class RooArgSet ;
00029 class RooHist;
00030 class RooCurve ;
00031 class RooPlotable;
00032 class TDirectory ;
00033 class TAttLine;
00034 class TAttFill;
00035 class TAttMarker;
00036 class TAttText;
00037 class TClass ;
00038 class TAxis;
00039 class TBrowser ;
00040
00041 class RooPlot : public TNamed, public RooPrintable {
00042 public:
00043 RooPlot() ;
00044 RooPlot(const char* name, const char* title, const RooAbsRealLValue &var, Double_t xmin, Double_t xmax, Int_t nBins) ;
00045 RooPlot(const RooAbsRealLValue &var, Double_t xmin, Double_t xmax, Int_t nBins);
00046 RooPlot(Double_t xmin, Double_t xmax);
00047 RooPlot(Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax);
00048 RooPlot(const RooAbsRealLValue &var1, const RooAbsRealLValue &var2);
00049 RooPlot(const RooAbsRealLValue &var1, const RooAbsRealLValue &var2,
00050 Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax);
00051 virtual ~RooPlot();
00052
00053 RooPlot* emptyClone(const char* name) ;
00054
00055
00056 virtual Stat_t GetBinContent(Int_t) const;
00057 virtual Stat_t GetBinContent(Int_t, Int_t) const;
00058 virtual Stat_t GetBinContent(Int_t, Int_t, Int_t) const;
00059 virtual void Draw(Option_t *options= 0);
00060
00061
00062 TAxis* GetXaxis() const ;
00063 TAxis* GetYaxis() const ;
00064 Int_t GetNbinsX() const ;
00065 Int_t GetNdivisions(Option_t* axis = "X") const ;
00066 Double_t GetMinimum(Double_t minval = -FLT_MAX) const ;
00067 Double_t GetMaximum(Double_t maxval = FLT_MAX) const ;
00068
00069 void SetAxisColor(Color_t color = 1, Option_t* axis = "X") ;
00070 void SetAxisRange(Double_t xmin, Double_t xmax, Option_t* axis = "X") ;
00071 void SetBarOffset(Float_t offset = 0.25) ;
00072 void SetBarWidth(Float_t width = 0.5) ;
00073 void SetContour(Int_t nlevels, const Double_t* levels = 0) ;
00074 void SetContourLevel(Int_t level, Double_t value) ;
00075 void SetDrawOption(Option_t* option = "") ;
00076 void SetFillAttributes() ;
00077 void SetFillColor(Color_t fcolor) ;
00078 void SetFillStyle(Style_t fstyle) ;
00079 void SetLabelColor(Color_t color = 1, Option_t* axis = "X") ;
00080 void SetLabelFont(Style_t font = 62, Option_t* axis = "X") ;
00081 void SetLabelOffset(Float_t offset = 0.005, Option_t* axis = "X") ;
00082 void SetLabelSize(Float_t size = 0.02, Option_t* axis = "X") ;
00083 void SetLineAttributes() ;
00084 void SetLineColor(Color_t lcolor) ;
00085 void SetLineStyle(Style_t lstyle) ;
00086 void SetLineWidth(Width_t lwidth) ;
00087 void SetMarkerAttributes() ;
00088 void SetMarkerColor(Color_t tcolor = 1) ;
00089 void SetMarkerSize(Size_t msize = 1) ;
00090 void SetMarkerStyle(Style_t mstyle = 1) ;
00091 void SetName(const char *name) ;
00092 void SetTitle(const char *name) ;
00093 void SetNameTitle(const char *name, const char* title) ;
00094 void SetNdivisions(Int_t n = 510, Option_t* axis = "X") ;
00095 void SetOption(Option_t* option = " ") ;
00096 void SetStats(Bool_t stats = kTRUE) ;
00097 void SetTickLength(Float_t length = 0.02, Option_t* axis = "X") ;
00098 void SetTitleFont(Style_t font = 62, Option_t* axis = "X") ;
00099 void SetTitleOffset(Float_t offset = 1, Option_t* axis = "X") ;
00100 void SetTitleSize(Float_t size = 0.02, Option_t* axis = "X") ;
00101 void SetXTitle(const char* title) ;
00102 void SetYTitle(const char* title) ;
00103 void SetZTitle(const char* title) ;
00104
00105
00106 const char* nameOf(Int_t idx) const ;
00107 TObject *findObject(const char *name, const TClass* clas=0) const;
00108 TObject* getObject(Int_t idx) const ;
00109 Stat_t numItems() const {return _items.GetSize();}
00110
00111 void addPlotable(RooPlotable *plotable, Option_t *drawOptions= "", Bool_t invisible=kFALSE, Bool_t refreshNorm=kFALSE);
00112 void addObject(TObject* obj, Option_t* drawOptions= "", Bool_t invisible=kFALSE);
00113 void addTH1(TH1 *hist, Option_t* drawOptions= "", Bool_t invisible=kFALSE);
00114
00115 void remove(const char* name=0, Bool_t deleteToo=kTRUE) ;
00116
00117
00118 virtual void printName(ostream& os) const ;
00119 virtual void printTitle(ostream& os) const ;
00120 virtual void printClassName(ostream& os) const ;
00121 virtual void printArgs(ostream& os) const ;
00122 virtual void printValue(ostream& os) const ;
00123 virtual void printMultiline(ostream& os, Int_t content, Bool_t verbose=kFALSE, TString indent="") const ;
00124
00125 virtual Int_t defaultPrintContents(Option_t* opt) const ;
00126
00127 inline virtual void Print(Option_t *options= 0) const {
00128 printStream(defaultPrintStream(),defaultPrintContents(options),defaultPrintStyle(options));
00129 }
00130
00131
00132 inline RooAbsRealLValue *getPlotVar() const { return _plotVarClone; }
00133 inline Double_t getFitRangeNEvt() const { return _normNumEvts; }
00134 Double_t getFitRangeNEvt(Double_t xlo, Double_t xhi) const ;
00135 inline Double_t getFitRangeBinW() const { return _normBinWidth; }
00136 inline Double_t getPadFactor() const { return _padFactor; }
00137 inline void setPadFactor(Double_t factor) { if(factor >= 0) _padFactor= factor; }
00138 void updateNormVars(const RooArgSet &vars);
00139 const RooArgSet *getNormVars() const { return _normVars; }
00140
00141
00142 TAttLine *getAttLine(const char *name=0) const;
00143 TAttFill *getAttFill(const char *name=0) const;
00144 TAttMarker *getAttMarker(const char *name=0) const;
00145 TAttText *getAttText(const char *name=0) const;
00146
00147
00148 RooCurve* getCurve(const char* name=0) const ;
00149 RooHist* getHist(const char* name=0) const ;
00150
00151
00152
00153 Bool_t drawBefore(const char *before, const char *target);
00154 Bool_t drawAfter(const char *after, const char *target);
00155
00156
00157 TString getDrawOptions(const char *name) const;
00158 Bool_t setDrawOptions(const char *name, TString options);
00159
00160 Bool_t getInvisible(const char* name) const ;
00161 void setInvisible(const char* name, Bool_t flag=kTRUE) ;
00162
00163 virtual void SetMaximum(Double_t maximum = -1111) ;
00164 virtual void SetMinimum(Double_t minimum = -1111) ;
00165
00166 Double_t chiSquare(int nFitParam=0) const { return chiSquare(0,0,nFitParam) ; }
00167 Double_t chiSquare(const char* pdfname, const char* histname, int nFitParam=0) const ;
00168
00169 RooHist* residHist(const char* histname=0, const char* pdfname=0,bool normalize=false) const ;
00170 RooHist* pullHist(const char* histname=0, const char* pdfname=0) const { return residHist(histname,pdfname,true); }
00171
00172 void Browse(TBrowser *b) ;
00173
00174 protected:
00175
00176 RooPlot(const RooPlot& other);
00177
00178 class DrawOpt {
00179 public:
00180
00181 DrawOpt(const char* _rawOpt=0) : invisible(kFALSE) { drawOptions[0] = 0 ; initialize(_rawOpt) ; }
00182 void initialize(const char* _rawOpt) ;
00183 const char* rawOpt() const ;
00184
00185 char drawOptions[128] ;
00186 Bool_t invisible ;
00187 } ;
00188
00189
00190 void initialize();
00191 TString histName() const ;
00192 TString caller(const char *method) const;
00193 void updateYAxis(Double_t ymin, Double_t ymax, const char *label= "");
00194 void updateFitRangeNorm(const TH1* hist);
00195 void updateFitRangeNorm(const RooPlotable* rp, Bool_t refeshNorm=kFALSE);
00196
00197 TH1* _hist ;
00198
00199 RooList _items;
00200 Double_t _padFactor;
00201 RooAbsRealLValue *_plotVarClone;
00202 RooArgSet *_plotVarSet;
00203 RooArgSet *_normVars;
00204
00205 const RooPlotable* _normObj ;
00206 Double_t _normNumEvts;
00207 Double_t _normBinWidth;
00208
00209 TIterator *_iterator;
00210
00211 Double_t _defYmin ;
00212 Double_t _defYmax ;
00213
00214 TDirectory* _dir ;
00215
00216 ClassDef(RooPlot,2)
00217 };
00218
00219 #endif