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