Logo ROOT   6.08/07
Reference Guide
SamplingDistPlot.cxx
Go to the documentation of this file.
1 // @(#)root/roostats:$Id$
2 // Authors: Sven Kreiss June 2010
3 // Authors: Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke
4 /*************************************************************************
5  * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 
13 
15 
17 
18 #include "RooRealVar.h"
19 #include "TStyle.h"
20 #include "TLine.h"
21 #include "TFile.h"
22 #include "TVirtualPad.h" // for gPad
23 
24 #include <algorithm>
25 #include <iostream>
26 
27 
28 #ifndef ROO_MSG_SERVICE
29 #include "RooMsgService.h"
30 #endif
31 
32 #include <limits>
33 #define NaN std::numeric_limits<float>::quiet_NaN()
34 #include "TMath.h"
35 #define IsNaN(a) TMath::IsNaN(a)
36 
37 
38 /// ClassImp for building the THtml documentation of the class
40 
41 using namespace RooStats;
42 using namespace std;
43 
44 ////////////////////////////////////////////////////////////////////////////////
45 /// SamplingDistPlot default constructor with bin size
46 
48  fHist(0),
49  fLegend(NULL),
50  fItems(),
51  fOtherItems(),
52  fRooPlot(NULL),
53  fLogXaxis(kFALSE),
54  fLogYaxis(kFALSE),
55  fXMin(NaN), fXMax(NaN), fYMin(NaN), fYMax(NaN),
56  fApplyStyle(kTRUE),
57  fFillStyle(3004)
58 {
61  fBins = nbins;
62  fMarkerType = 20;
63  fColor = 1;
64 }
65 
66 ////////////////////////////////////////////////////////////////////////////////
67 /// SamplingDistPlot constructor with bin size, min and max
68 
70  fHist(0),
71  fLegend(NULL),
72  fItems(),
73  fOtherItems(),
74  fRooPlot(NULL),
79  fFillStyle(3004)
80 {
83  fBins = nbins;
84  fMarkerType = 20;
85  fColor = 1;
86 
87  SetXRange( min, max );
88 }
89 
90 ////////////////////////////////////////////////////////////////////////////////
91 /// destructors - delete objects contained in the list
92 
94  fItems.Delete();
96  if (fRooPlot) delete fRooPlot;
97 }
98 
99 
100 ////////////////////////////////////////////////////////////////////////////////
101 /// adds sampling distribution (and normalizes if "NORMALIZE" is given as an option)
102 
104  fSamplingDistr = samplingDist->GetSamplingDistribution();
105  if( fSamplingDistr.empty() ) {
106  coutW(Plotting) << "Empty sampling distribution given to plot. Skipping." << endl;
107  return 0.0;
108  }
109  SetSampleWeights(samplingDist);
110 
111  TString options(drawOptions);
112  options.ToUpper();
113 
115  // remove cases where xmin and xmax are +/- inf
116  for( unsigned int i=0; i < fSamplingDistr.size(); i++ ) {
117  if( fSamplingDistr[i] < xmin && fSamplingDistr[i] != -TMath::Infinity() ) {
118  xmin = fSamplingDistr[i];
119  }
120  if( fSamplingDistr[i] > xmax && fSamplingDistr[i] != TMath::Infinity() ) {
121  xmax = fSamplingDistr[i];
122  }
123  }
124  if( xmin >= xmax ) {
125  coutW(Plotting) << "Could not determine xmin and xmax of sampling distribution that was given to plot." << endl;
126  xmin = -1.0;
127  xmax = 1.0;
128  }
129 
130 
131  // add 1.5 bins left and right
132  assert(fBins > 1);
133  double binWidth = (xmax-xmin)/(fBins);
134  Double_t xlow = xmin - 1.5*binWidth;
135  Double_t xup = xmax + 1.5*binWidth;
136  if( !IsNaN(fXMin) ) xlow = fXMin;
137  if( !IsNaN(fXMax) ) xup = fXMax;
138 
139  fHist = new TH1F(samplingDist->GetName(), samplingDist->GetTitle(), fBins, xlow, xup);
140  fHist->SetDirectory(0); // make the object managed by this class
141 
142  if( fVarName.Length() == 0 ) fVarName = samplingDist->GetVarName();
143  fHist->GetXaxis()->SetTitle(fVarName.Data());
144 
145 
146  std::vector<Double_t>::iterator valuesIt = fSamplingDistr.begin();
147  for (int w_idx = 0; valuesIt != fSamplingDistr.end(); ++valuesIt, ++w_idx) {
148  if (fIsWeighted) fHist->Fill(*valuesIt, fSampleWeights[w_idx]);
149  else fHist->Fill(*valuesIt);
150  }
151 
152  // NORMALIZATION
153  fHist->Sumw2();
154  double weightSum = 1.0;
155  if(options.Contains("NORMALIZE")) {
156  weightSum = fHist->Integral("width");
157  fHist->Scale(1./weightSum);
158 
159  options.ReplaceAll("NORMALIZE", "");
160  options.Strip();
161  }
162 
163 
164  //some basic aesthetics
168 
169  fMarkerType++;
170  fColor++;
171 
173 
174  addObject(fHist, options.Data());
175 
176  TString title = samplingDist->GetTitle();
177  if(fLegend && title.Length() > 0) fLegend->AddEntry(fHist, title, "L");
178 
179  return 1./weightSum;
180 }
181 
182 ////////////////////////////////////////////////////////////////////////////////
183 
185  if( samplingDist->GetSamplingDistribution().empty() ) {
186  coutW(Plotting) << "Empty sampling distribution given to plot. Skipping." << endl;
187  return 0.0;
188  }
189  Double_t scaleFactor = AddSamplingDistribution(samplingDist, drawOptions);
190 
191  TH1F *shaded = (TH1F*)fHist->Clone((string(samplingDist->GetName())+string("_shaded")).c_str());
192  shaded->SetDirectory(0);
193  shaded->SetFillStyle(fFillStyle++);
194  shaded->SetLineWidth(1);
195 
196  for (int i=0; i<shaded->GetNbinsX(); ++i) {
197  if (shaded->GetBinCenter(i) < minShaded || shaded->GetBinCenter(i) > maxShaded){
198  shaded->SetBinContent(i,0);
199  }
200  }
201 
202  TString options(drawOptions);
203  options.ToUpper();
204  if(options.Contains("NORMALIZE")) {
205  options.ReplaceAll("NORMALIZE", "");
206  options.Strip();
207  }
208  addObject(shaded, options.Data());
209 
210  return scaleFactor;
211 }
212 
213 void SamplingDistPlot::AddLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2, const char* title) {
214  TLine *line = new TLine(x1, y1, x2, y2);
215  line->SetLineWidth(3);
216  line->SetLineColor(kBlack);
217 
218  if(fLegend && title) fLegend->AddEntry(line, title, "L");
219 
220  addOtherObject(line, ""); // no options
221 }
222 
223 void SamplingDistPlot::AddTH1(TH1* h, Option_t *drawOptions) {
224  // add an histogram (it will be cloned);
225  if(fLegend && h->GetTitle()) fLegend->AddEntry(h, h->GetTitle(), "L");
226  TH1 * hcopy = (TH1*) h->Clone();
227  hcopy->SetDirectory(0);
228  addObject(hcopy, drawOptions);
229 }
230 void SamplingDistPlot::AddTF1(TF1* f, const char* title, Option_t *drawOptions) {
231  if(fLegend && title) fLegend->AddEntry(f, title, "L");
232  addOtherObject(f->Clone(), drawOptions);
233 }
234 
235 
236 ////////////////////////////////////////////////////////////////////////////////
237 ///Determine if the sampling distribution has weights and store them
238 
240 {
242 
243  if(samplingDist->GetSampleWeights().size() != 0){
244  fIsWeighted = kTRUE;
245  fSampleWeights = samplingDist->GetSampleWeights();
246  }
247 
248  return;
249 }
250 
252 {
253  // Add a generic object to this plot. The specified options will be
254  // used to Draw() this object later. The caller transfers ownership
255  // of the object with this call, and the object will be deleted
256  // when its containing plot object is destroyed.
257 
258  if(0 == obj) {
259  std::cerr << fName << "::addObject: called with a null pointer" << std::endl;
260  return;
261  }
262 
263  fItems.Add(obj,drawOptions);
264 
265  return;
266 }
268 {
269  // Add a generic object to this plot. The specified options will be
270  // used to Draw() this object later. The caller transfers ownership
271  // of the object with this call, and the object will be deleted
272  // when its containing plot object is destroyed.
273 
274  if(0 == obj) {
275  oocoutE(this,InputArguments) << fName << "::addOtherObject: called with a null pointer" << std::endl;
276  return;
277  }
278 
279  fOtherItems.Add(obj,drawOptions);
280 
281  return;
282 }
283 
284 ////////////////////////////////////////////////////////////////////////////////
285 /// Draw this plot and all of the elements it contains. The specified options
286 /// only apply to the drawing of our frame. The options specified in our add...()
287 /// methods will be used to draw each object we contain.
288 
289 void SamplingDistPlot::Draw(Option_t * /*options */) {
291 
292  Double_t theMin(0.), theMax(0.), theYMin(NaN), theYMax(0.);
293  GetAbsoluteInterval(theMin, theMax, theYMax);
294  if( !IsNaN(fXMin) ) theMin = fXMin;
295  if( !IsNaN(fXMax) ) theMax = fXMax;
296  if( !IsNaN(fYMin) ) theYMin = fYMin;
297  if( !IsNaN(fYMax) ) theYMax = fYMax;
298 
299  RooRealVar xaxis("xaxis", fVarName.Data(), theMin, theMax);
300 
301  //L.M. by drawing many times we create a memory leak ???
302  if (fRooPlot) delete fRooPlot;
303 
304  bool dirStatus = RooPlot::addDirectoryStatus();
305  // make the RooPlot managed by this class
306  if (dirStatus) RooPlot::setAddDirectoryStatus(false);
307  fRooPlot = xaxis.frame();
308  if (dirStatus) RooPlot::setAddDirectoryStatus(true);
309  if (!fRooPlot) {
310  oocoutE(this,InputArguments) << "invalid variable to plot" << std::endl;
311  return;
312  }
313  fRooPlot->SetTitle("");
314  if( !IsNaN(theYMax) ) {
315  //coutI(InputArguments) << "Setting maximum to " << theYMax << endl;
316  fRooPlot->SetMaximum(theYMax);
317  }
318  if( !IsNaN(theYMin) ) {
319  //coutI(InputArguments) << "Setting minimum to " << theYMin << endl;
320  fRooPlot->SetMinimum(theYMin);
321  }
322 
323  fIterator->Reset();
324  TH1F *obj = 0;
325  while ((obj = (TH1F*) fIterator->Next())) {
326  //obj->Draw(fIterator->GetOption());
327  // add cloned objects to avoid mem leaks
328  TH1 * cloneObj = (TH1*)obj->Clone();
329  if( !IsNaN(theYMax) ) {
330  //coutI(InputArguments) << "Setting maximum of TH1 to " << theYMax << endl;
331  cloneObj->SetMaximum(theYMax);
332  }
333  if( !IsNaN(theYMin) ) {
334  //coutI(InputArguments) << "Setting minimum of TH1 to " << theYMin << endl;
335  cloneObj->SetMinimum(theYMin);
336  }
337  cloneObj->SetDirectory(0); // transfer ownership of the object
338  fRooPlot->addTH1(cloneObj, fIterator->GetOption());
339  }
340 
341  TIterator *otherIt = fOtherItems.MakeIterator();
342  TObject *otherObj = NULL;
343  while ((otherObj = otherIt->Next())) {
344  TObject * cloneObj = otherObj->Clone();
345  fRooPlot->addObject(cloneObj, otherIt->GetOption());
346  }
347  delete otherIt;
348 
349 
351 
352  if(bool(gStyle->GetOptLogx()) != fLogXaxis) {
353  if(!fApplyStyle) coutW(Plotting) << "gStyle will be changed to adjust SetOptLogx(...)" << endl;
355  }
356  if(bool(gStyle->GetOptLogy()) != fLogYaxis) {
357  if(!fApplyStyle) coutW(Plotting) << "gStyle will be changed to adjust SetOptLogy(...)" << endl;
359  }
360  fRooPlot->Draw();
361 
362  // apply this since gStyle does not work for RooPlot
363  if (gPad) {
364  gPad->SetLogx(fLogXaxis);
365  gPad->SetLogy(fLogYaxis);
366  }
367 
368  return;
369 }
370 
372  if(fApplyStyle) {
373  // use plain black on white colors
374  Int_t icol = 0;
375  gStyle->SetFrameBorderMode( icol );
376  gStyle->SetCanvasBorderMode( icol );
377  gStyle->SetPadBorderMode( icol );
378  gStyle->SetPadColor( icol );
379  gStyle->SetCanvasColor( icol );
380  gStyle->SetStatColor( icol );
382 
383  // set the paper & margin sizes
384  gStyle->SetPaperSize( 20, 26 );
385 
386  if(fLegend) {
387  fLegend->SetFillColor(0);
389  }
390  }
391 }
392 
393 ////////////////////////////////////////////////////////////////////////////////
394 
395 void SamplingDistPlot::GetAbsoluteInterval(Double_t &theMin, Double_t &theMax, Double_t &theYMax) const
396 {
397  Double_t tmpmin = TMath::Infinity();
398  Double_t tmpmax = -TMath::Infinity();
399  Double_t tmpYmax = -TMath::Infinity();
400 
401 
402  fIterator->Reset();
403  TH1F *obj = 0;
404  while((obj = (TH1F*)fIterator->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();
408  }
409 
410  theMin = tmpmin;
411  theMax = tmpmax;
412  theYMax = tmpYmax;
413 
414  return;
415 }
416 
417 ////////////////////////////////////////////////////////////////////////////////
418 /// Sets line color for given sampling distribution and
419 /// fill color for the associated shaded TH1F.
420 
422  if (samplDist == 0) {
423  fHist->SetLineColor(color);
424 
425  fIterator->Reset();
426  TH1F *obj = 0;
427 
428  TString shadedName(fHist->GetName());
429  shadedName += "_shaded";
430 
431  while ((obj = (TH1F*) fIterator->Next())) {
432  if (!strcmp(obj->GetName(), shadedName.Data())) {
433  obj->SetLineColor(color);
434  obj->SetFillColor(color);
435  //break;
436  }
437  }
438  } else {
439  fIterator->Reset();
440  TH1F *obj = 0;
441 
442  TString shadedName(samplDist->GetName());
443  shadedName += "_shaded";
444 
445  while ((obj = (TH1F*) fIterator->Next())) {
446  if (!strcmp(obj->GetName(), samplDist->GetName())) {
447  obj->SetLineColor(color);
448  //break;
449  }
450  if (!strcmp(obj->GetName(), shadedName.Data())) {
451  obj->SetLineColor(color);
452  obj->SetFillColor(color);
453  //break;
454  }
455  }
456  }
457 
458  return;
459 }
460 
461 ////////////////////////////////////////////////////////////////////////////////
462 
464 {
465  if(samplDist == 0){
466  fHist->SetLineWidth(lwidth);
467  }
468  else{
469  fIterator->Reset();
470  TH1F *obj = 0;
471  while((obj = (TH1F*)fIterator->Next())) {
472  if(!strcmp(obj->GetName(),samplDist->GetName())){
473  obj->SetLineWidth(lwidth);
474  break;
475  }
476  }
477  }
478 
479  return;
480 }
481 
482 ////////////////////////////////////////////////////////////////////////////////
483 
485 {
486  if(samplDist == 0){
487  fHist->SetLineStyle(style);
488  }
489  else{
490  fIterator->Reset();
491  TH1F *obj = 0;
492  while((obj = (TH1F*)fIterator->Next())) {
493  if(!strcmp(obj->GetName(),samplDist->GetName())){
494  obj->SetLineStyle(style);
495  break;
496  }
497  }
498  }
499 
500  return;
501 }
502 
503 ////////////////////////////////////////////////////////////////////////////////
504 
506 {
507  if(samplDist == 0){
508  fHist->SetMarkerStyle(style);
509  }
510  else{
511  fIterator->Reset();
512  TH1F *obj = 0;
513  while((obj = (TH1F*)fIterator->Next())) {
514  if(!strcmp(obj->GetName(),samplDist->GetName())){
515  obj->SetMarkerStyle(style);
516  break;
517  }
518  }
519  }
520 
521  return;
522 }
523 
524 ////////////////////////////////////////////////////////////////////////////////
525 
527 {
528  if(samplDist == 0){
529  fHist->SetMarkerColor(color);
530  }
531  else{
532  fIterator->Reset();
533  TH1F *obj = 0;
534  while((obj = (TH1F*)fIterator->Next())) {
535  if(!strcmp(obj->GetName(),samplDist->GetName())){
536  obj->SetMarkerColor(color);
537  break;
538  }
539  }
540  }
541 
542  return;
543 }
544 
545 ////////////////////////////////////////////////////////////////////////////////
546 
548 {
549  if(samplDist == 0){
550  fHist->SetMarkerSize(size);
551  }
552  else{
553  fIterator->Reset();
554  TH1F *obj = 0;
555  while((obj = (TH1F*)fIterator->Next())) {
556  if(!strcmp(obj->GetName(),samplDist->GetName())){
557  obj->SetMarkerSize(size);
558  break;
559  }
560  }
561  }
562 
563  return;
564 }
565 
566 ////////////////////////////////////////////////////////////////////////////////
567 
569 {
570  if(samplDist == NULL){
571  return fHist;
572  }else{
573  fIterator->Reset();
574  TH1F *obj = 0;
575  while((obj = (TH1F*)fIterator->Next())) {
576  if(!strcmp(obj->GetName(),samplDist->GetName())){
577  return obj;
578  }
579  }
580  }
581 
582  return NULL;
583 }
584 
585 
586 ////////////////////////////////////////////////////////////////////////////////
587 
589 {
590  if(samplDist == 0){
591  fHist->Rebin(rebinFactor);
592  }
593  else{
594  fIterator->Reset();
595  TH1F *obj = 0;
596  while((obj = (TH1F*)fIterator->Next())) {
597  if(!strcmp(obj->GetName(),samplDist->GetName())){
598  obj->Rebin(rebinFactor);
599  break;
600  }
601  }
602  }
603 
604  return;
605 }
606 
607 
608 // TODO test
609 void SamplingDistPlot::DumpToFile(const char* RootFileName, Option_t *option, const char *ftitle, Int_t compress) {
610  // All the objects are written to rootfile
611 
612  if(!fRooPlot) {
613  cout << "Plot was not drawn yet. Dump can only be saved after it was drawn with Draw()." << endl;
614  return;
615  }
616 
617  TFile ofile(RootFileName, option, ftitle, compress);
618  ofile.cd();
619  fRooPlot->Write();
620  ofile.Close();
621 }
622 
RooPlot * fRooPlot
TODO remove class variable and instantiate locally as necessary.
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
Definition: TObject.cxx:830
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition: TAttLine.h:49
virtual void Scale(Double_t c1=1, Option_t *option="")
Multiply this histogram by a constant c1.
Definition: TH1.cxx:5936
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
Definition: TH1.cxx:3125
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:7664
const std::vector< Double_t > & GetSamplingDistribution() const
Get test statistics values.
float xmin
Definition: THbookFile.cxx:93
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Definition: TList.cxx:405
virtual Double_t GetBinCenter(Int_t bin) const
Return bin center for 1D histogram.
Definition: TH1.cxx:8251
virtual Option_t * GetOption() const
Definition: TIterator.h:42
virtual void SetMaximum(Double_t maximum=-1111)
Definition: TH1.h:399
void ApplyDefaultStyle(void)
Applies a predefined style if fApplyStyle is kTRUE (default).
short Style_t
Definition: RtypesCore.h:76
virtual void Reset()=0
void SetStatColor(Color_t color=19)
Definition: TStyle.h:379
void SetFrameBorderMode(Int_t mode=1)
Definition: TStyle.h:368
void SetLineColor(Color_t color, const SamplingDistribution *samplDist=0)
Sets line color for given sampling distribution and fill color for the associated shaded TH1F...
TLine * line
virtual void SetDirectory(TDirectory *dir)
By default when an histogram is created, it is added to the list of histogram objects in the current ...
Definition: TH1.cxx:8051
float Size_t
Definition: RtypesCore.h:83
const char Option_t
Definition: RtypesCore.h:62
void addObject(TObject *obj, Option_t *drawOptions="", Bool_t invisible=kFALSE)
Add a generic object to this plot.
Definition: RooPlot.cxx:392
R__EXTERN TStyle * gStyle
Definition: TStyle.h:418
THist< 1, float, THistStatContent, THistStatUncertainty > TH1F
Definition: THist.hxx:302
TH1 * h
Definition: legend2.C:5
Definition: Rtypes.h:60
void addTH1(TH1 *hist, Option_t *drawOptions="", Bool_t invisible=kFALSE)
Add a TH1 histogram object to this plot.
Definition: RooPlot.cxx:411
virtual Double_t Integral(Option_t *option="") const
Return integral of bin contents.
Definition: TH1.cxx:7124
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)
Definition: TH1.h:400
tomato 1-D histogram with a float per channel (see TH1 documentation)}
Definition: TH1.h:575
int Int_t
Definition: RtypesCore.h:41
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
Definition: TAttFill.h:44
void SetTitle(const char *name)
Set the title of the RooPlot to &#39;title&#39;.
Definition: RooPlot.cxx:1099
int nbins[3]
const std::vector< Double_t > & GetSampleWeights() const
Get the sampling weights.
STL namespace.
#define coutW(a)
Definition: RooMsgService.h:34
void SetSampleWeights(const SamplingDistribution *samplingDist)
Determine if the sampling distribution has weights and store them.
void GetAbsoluteInterval(Double_t &theMin, Double_t &theMax, Double_t &theYMax) const
Iterator abstract base class.
Definition: TIterator.h:32
void SetCanvasColor(Color_t color=19)
Definition: TStyle.h:334
virtual void SetMinimum(Double_t minimum=-1111)
Set minimum value of Y axis.
Definition: RooPlot.cxx:959
Double_t GetXmin() const
Definition: TAxis.h:139
static const double x2[5]
#define IsNaN(a)
#define oocoutE(o, a)
Definition: RooMsgService.h:48
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
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
Definition: TAttMarker.h:43
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 Infinity()
Definition: TMath.h:635
short Color_t
Definition: RtypesCore.h:79
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const
Return a list iterator.
Definition: TList.cxx:604
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.
Definition: RooRealVar.h:37
void SetOptLogx(Int_t logx=1)
Definition: TStyle.h:320
RooList fOtherItems
holds TH1Fs only
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition: TAttLine.h:46
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)
Definition: TStyle.h:347
void SetCanvasBorderMode(Int_t mode=1)
Definition: TStyle.h:336
void SetMarkerStyle(Style_t style, const SamplingDistribution *samplDist=0)
void SetPadColor(Color_t color=19)
Definition: TStyle.h:345
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition: TAttFill.h:42
virtual void SetMaximum(Double_t maximum=-1111)
Set maximum value of Y axis.
Definition: RooPlot.cxx:949
TIterator * fIterator
other objects to be drawn like TLine etc.
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:8323
virtual TH1 * Rebin(Int_t ngroup=2, const char *newname="", const Double_t *xbins=0)
Rebin this histogram.
Definition: TH1.cxx:5604
Int_t GetOptLogy() const
Definition: TStyle.h:248
A simple line.
Definition: TLine.h:33
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
Definition: TAttMarker.h:45
float xmax
Definition: THbookFile.cxx:93
TString fName
Definition: TNamed.h:36
This class simply holds a sampling distribution of some test statistic.
Int_t GetOptLogx() const
Definition: TStyle.h:247
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
Definition: TAttMarker.h:46
void RebinDistribution(Int_t rebinFactor, const SamplingDistribution *samplDist=0)
void SetFrameFillStyle(Style_t styl=0)
Definition: TStyle.h:364
short Width_t
Definition: RtypesCore.h:78
Namespace for the RooStats classes.
Definition: Asimov.h:20
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.
#define ClassImp(name)
Definition: Rtypes.h:279
double f(double x)
double Double_t
Definition: RtypesCore.h:55
TLegendEntry * AddEntry(const TObject *obj, const char *label="", Option_t *option="lpf")
Add a new entry to this legend.
Definition: TLegend.cxx:280
static Bool_t setAddDirectoryStatus(Bool_t flag)
Definition: RooPlot.cxx:80
TCanvas * style()
Definition: style.C:1
The TH1 histogram class.
Definition: TH1.h:80
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)
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Definition: TAttLine.h:48
std::vector< Double_t > fSampleWeights
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
Definition: TNamed.cxx:65
void SetPaperSize(EPaperSize size)
Set paper size for PostScript output.
Definition: TStyle.cxx:1322
This class provides simple and straightforward utilities to plot SamplingDistribution objects...
Mother of all ROOT objects.
Definition: TObject.h:37
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
Definition: TObject.cxx:204
void SetLineStyle(Style_t style, const SamplingDistribution *samplDist=0)
virtual void Add(TObject *obj)
Definition: TList.h:81
#define NaN
1-Dim function class
Definition: TF1.h:149
virtual TObject * Next()=0
virtual void Sumw2(Bool_t flag=kTRUE)
Create structure to store sum of squares of weights.
Definition: TH1.cxx:8130
TObject * Clone(const char *newname=0) const
Make a complete copy of the underlying object.
Definition: TH1.cxx:2544
void SetOptLogy(Int_t logy=1)
Definition: TStyle.h:321
#define NULL
Definition: Rtypes.h:82
#define gPad
Definition: TVirtualPad.h:289
void addOtherObject(TObject *obj, Option_t *drawOptions=0)
virtual Int_t GetNbinsX() const
Definition: TH1.h:301
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual ~SamplingDistPlot()
Destructor of SamplingDistribution.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition: TNamed.cxx:155
Double_t GetXmax() const
Definition: TAxis.h:140
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
Definition: TH1.cxx:8101
static Bool_t addDirectoryStatus()
Definition: RooPlot.cxx:79
SamplingDistPlot(Int_t nbins=100)
Constructors for SamplingDistribution.
virtual void SetBorderSize(Int_t bordersize=4)
Definition: TPave.h:74
TAxis * GetXaxis()
Definition: TH1.h:324
std::vector< Double_t > fSamplingDistr
virtual void Draw(Option_t *options=0)
Draw this plot and all of the elements it contains.
Definition: RooPlot.cxx:559
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:52