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