28 #ifndef ROO_MSG_SERVICE
33 #define NaN std::numeric_limits<float>::quiet_NaN()
35 #define IsNaN(a) TMath::IsNaN(a)
41 using namespace RooStats;
106 coutW(
Plotting) <<
"Empty sampling distribution given to plot. Skipping." << endl;
125 coutW(
Plotting) <<
"Could not determine xmin and xmax of sampling distribution that was given to plot." << endl;
140 fHist->SetDirectory(0);
146 std::vector<Double_t>::iterator valuesIt =
fSamplingDistr.begin();
147 for (
int w_idx = 0; valuesIt !=
fSamplingDistr.end(); ++valuesIt, ++w_idx) {
149 else fHist->Fill(*valuesIt);
154 double weightSum = 1.0;
156 weightSum =
fHist->Integral(
"width");
157 fHist->Scale(1./weightSum);
186 coutW(
Plotting) <<
"Empty sampling distribution given to plot. Skipping." << endl;
191 TH1F *shaded = (TH1F*)
fHist->Clone((
string(samplingDist->
GetName())+
string(
"_shaded")).c_str());
192 shaded->SetDirectory(0);
194 shaded->SetLineWidth(1);
196 for (
int i=0; i<shaded->GetNbinsX(); ++i) {
197 if (shaded->GetBinCenter(i) < minShaded || shaded->GetBinCenter(i) > maxShaded){
198 shaded->SetBinContent(i,0);
214 TLine *
line =
new TLine(x1, y1, x2, y2);
215 line->SetLineWidth(3);
216 line->SetLineColor(
kBlack);
259 std::cerr <<
fName <<
"::addObject: called with a null pointer" << std::endl;
292 Double_t theMin(0.), theMax(0.), theYMin(
NaN), theYMax(0.);
314 if( !
IsNaN(theYMax) ) {
318 if( !
IsNaN(theYMin) ) {
329 if( !
IsNaN(theYMax) ) {
333 if( !
IsNaN(theYMin) ) {
343 while ((otherObj = otherIt->
Next())) {
405 if(obj->GetXaxis()->GetXmin() < tmpmin) tmpmin = obj->GetXaxis()->GetXmin();
406 if(obj->GetXaxis()->GetXmax() > tmpmax) tmpmax = obj->GetXaxis()->GetXmax();
407 if(obj->GetMaximum() > tmpYmax) tmpYmax = obj->GetMaximum() + 0.1*obj->GetMaximum();
422 if (samplDist == 0) {
423 fHist->SetLineColor(color);
429 shadedName +=
"_shaded";
432 if (!strcmp(obj->GetName(), shadedName.Data())) {
433 obj->SetLineColor(color);
434 obj->SetFillColor(color);
443 shadedName +=
"_shaded";
446 if (!strcmp(obj->GetName(), samplDist->
GetName())) {
447 obj->SetLineColor(color);
450 if (!strcmp(obj->GetName(), shadedName.Data())) {
451 obj->SetLineColor(color);
452 obj->SetFillColor(color);
466 fHist->SetLineWidth(lwidth);
472 if(!strcmp(obj->GetName(),samplDist->
GetName())){
473 obj->SetLineWidth(lwidth);
487 fHist->SetLineStyle(style);
493 if(!strcmp(obj->GetName(),samplDist->
GetName())){
494 obj->SetLineStyle(style);
508 fHist->SetMarkerStyle(style);
514 if(!strcmp(obj->GetName(),samplDist->
GetName())){
515 obj->SetMarkerStyle(style);
529 fHist->SetMarkerColor(color);
535 if(!strcmp(obj->GetName(),samplDist->
GetName())){
536 obj->SetMarkerColor(color);
550 fHist->SetMarkerSize(size);
556 if(!strcmp(obj->GetName(),samplDist->
GetName())){
557 obj->SetMarkerSize(size);
570 if(samplDist ==
NULL){
576 if(!strcmp(obj->GetName(),samplDist->
GetName())){
591 fHist->Rebin(rebinFactor);
597 if(!strcmp(obj->GetName(),samplDist->
GetName())){
598 obj->Rebin(rebinFactor);
613 cout <<
"Plot was not drawn yet. Dump can only be saved after it was drawn with Draw()." << endl;
617 TFile ofile(RootFileName, option, ftitle, compress);
RooPlot * fRooPlot
TODO remove class variable and instantiate locally as necessary.
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
virtual const char * GetTitle() const
Returns title of object.
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
static Vc_ALWAYS_INLINE int_v min(const int_v &x, const int_v &y)
void GetAbsoluteInterval(Double_t &theMin, Double_t &theMax, Double_t &theYMax) const
virtual void SetMaximum(Double_t maximum=-1111)
void ApplyDefaultStyle(void)
Applies a predefined style if fApplyStyle is kTRUE (default).
void SetStatColor(Color_t color=19)
void SetFrameBorderMode(Int_t mode=1)
void SetLineColor(Color_t color, const SamplingDistribution *samplDist=0)
Sets line color for given sampling distribution and fill color for the associated shaded TH1F...
virtual void SetDirectory(TDirectory *dir)
By default when an histogram is created, it is added to the list of histogram objects in the current ...
void addObject(TObject *obj, Option_t *drawOptions="", Bool_t invisible=kFALSE)
Add a generic object to this plot.
TString & ReplaceAll(const TString &s1, const TString &s2)
R__EXTERN TStyle * gStyle
void addTH1(TH1 *hist, Option_t *drawOptions="", Bool_t invisible=kFALSE)
Add a TH1 histogram object to this plot.
void ToUpper()
Change string to upper case.
Double_t AddSamplingDistribution(const SamplingDistribution *samplingDist, Option_t *drawOptions="NORMALIZE HIST")
adds the sampling distribution and returns the scale factor
virtual void SetMinimum(Double_t minimum=-1111)
void SetTitle(const char *name)
Set the title of the RooPlot to 'title'.
void SetSampleWeights(const SamplingDistribution *samplingDist)
Determine if the sampling distribution has weights and store them.
const std::vector< Double_t > & GetSamplingDistribution() const
Get test statistics values.
Iterator abstract base class.
const TString GetVarName() const
virtual Option_t * GetOption() const
TObject * Clone(const char *newname=0) const
Make a complete copy of the underlying object.
void SetCanvasColor(Color_t color=19)
const char * Data() const
virtual void SetMinimum(Double_t minimum=-1111)
Set minimum value of Y axis.
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
static const double x2[5]
void addObject(TObject *obj, Option_t *drawOptions=0)
void SetLineWidth(Width_t lwidth, const SamplingDistribution *samplDist=0)
void SetXRange(double mi, double ma)
change x range
void Draw(Option_t *options=0)
Draw this plot and all of the elements it contains.
void AddTH1(TH1 *h, Option_t *drawOptions="")
add a TH1
void SetMarkerSize(Size_t size, const SamplingDistribution *samplDist=0)
Double_t AddSamplingDistributionShaded(const SamplingDistribution *samplingDist, Double_t minShaded, Double_t maxShaded, Option_t *drawOptions="NORMALIZE HIST")
Like AddSamplingDistribution, but also sets a shaded area in the minShaded and maxShaded boundaries...
RooRealVar represents a fundamental (non-derived) real valued object.
void SetOptLogx(Int_t logx=1)
RooList fOtherItems
holds TH1Fs only
void DumpToFile(const char *RootFileName, Option_t *option="", const char *ftitle="", Int_t compress=1)
write to Root file
void SetPadBorderMode(Int_t mode=1)
void SetCanvasBorderMode(Int_t mode=1)
void SetMarkerStyle(Style_t style, const SamplingDistribution *samplDist=0)
void SetPadColor(Color_t color=19)
TPaveLabel title(3, 27.1, 15, 28.7,"ROOT Environment and Tools")
virtual void SetFillColor(Color_t fcolor)
virtual void SetMaximum(Double_t maximum=-1111)
Set maximum value of Y axis.
TIterator * fIterator
other objects to be drawn like TLine etc.
virtual const char * GetName() const
Returns name of object.
TSubString Strip(EStripType s=kTrailing, char c= ' ') const
Return a substring of self stripped at beginning and/or end.
const std::vector< Double_t > & GetSampleWeights() const
Get the sampling weights.
This class simply holds a sampling distribution of some test statistic.
void RebinDistribution(Int_t rebinFactor, const SamplingDistribution *samplDist=0)
void SetFrameFillStyle(Style_t styl=0)
void AddTF1(TF1 *f, const char *title=NULL, Option_t *drawOptions="SAME")
add a TF1
static const double x1[5]
TH1F * GetTH1F(const SamplingDistribution *samplDist=NULL)
Returns the TH1F associated with the give SamplingDistribution.
TLegendEntry * AddEntry(const TObject *obj, const char *label="", Option_t *option="lpf")
Add a new entry to this legend.
static Bool_t setAddDirectoryStatus(Bool_t flag)
void AddLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2, const char *title=NULL)
add a line
void SetMarkerColor(Color_t color, const SamplingDistribution *samplDist=0)
std::vector< Double_t > fSampleWeights
static Vc_ALWAYS_INLINE int_v max(const int_v &x, const int_v &y)
void SetPaperSize(EPaperSize size)
Set paper size for PostScript output.
This class provides simple and straightforward utilities to plot SamplingDistribution objects...
Mother of all ROOT objects.
void SetLineStyle(Style_t style, const SamplingDistribution *samplDist=0)
virtual void Add(TObject *obj)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual TObject * Next()=0
void SetOptLogy(Int_t logy=1)
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const
Return a list iterator.
void addOtherObject(TObject *obj, Option_t *drawOptions=0)
virtual ~SamplingDistPlot()
Destructor of SamplingDistribution.
static Bool_t addDirectoryStatus()
ClassImp(RooStats::SamplingDistPlot)
ClassImp for building the THtml documentation of the class.
SamplingDistPlot(Int_t nbins=100)
Constructors for SamplingDistribution.
virtual void SetBorderSize(Int_t bordersize=4)
std::vector< Double_t > fSamplingDistr
virtual void Draw(Option_t *options=0)
Draw this plot and all of the elements it contains.