Logo ROOT   6.08/07
Reference Guide
DebuggingSampler.h
Go to the documentation of this file.
1 // @(#)root/roostats:$Id$
2 // Author: Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke
3 /*************************************************************************
4  * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
5  * All rights reserved. *
6  * *
7  * For the licensing terms see $ROOTSYS/LICENSE. *
8  * For the list of contributors see $ROOTSYS/README/CREDITS. *
9  *************************************************************************/
10 
11 #ifndef ROOSTATS_DebuggingSampler
12 #define ROOSTATS_DebuggingSampler
13 
14 //_________________________________________________
15 /*
16 BEGIN_HTML
17 <p>
18 DebuggingSampler is a simple implementation of the DistributionCreator interface used for debugging.
19 The sampling distribution is uniformly random between [0,1] and is INDEPENDENT of the data. So it is not useful
20 for true statistical tests, but it is useful for debugging.
21 </p>
22 END_HTML
23 */
24 //
25 
26 #ifndef ROOT_Rtypes
27 #include "Rtypes.h"
28 #endif
29 
30 #include <vector>
31 
34 
35 #include "RooRealVar.h"
36 #include "TRandom.h"
37 
38 namespace RooStats {
39 
41 
42  public:
44  fTestStatistic = new RooRealVar("UniformTestStatistic","UniformTestStatistic",0,0,1);
45  fRand = new TRandom();
46  }
47  virtual ~DebuggingSampler() {
48  delete fRand;
49  delete fTestStatistic;
50  }
51 
52  // Main interface to get a ConfInterval, pure virtual
54  paramsOfInterest = paramsOfInterest; // avoid warning
55  // normally this method would be complex, but here it is simple for debugging
56  std::vector<Double_t> testStatVec;
57  for(Int_t i=0; i<1000; ++i){
58  testStatVec.push_back( fRand->Uniform() );
59  }
60  return new SamplingDistribution("UniformSamplingDist", "for debugging", testStatVec );
61  }
62 
63  // Main interface to evaluate the test statistic on a dataset
64  virtual Double_t EvaluateTestStatistic(RooAbsData& /*data*/, RooArgSet& /*paramsOfInterest*/) {
65  // data = data; // avoid warning
66  // paramsOfInterest = paramsOfInterest; // avoid warning
67  return fRand->Uniform();
68  }
69 
70  // Get the TestStatistic
71  virtual TestStatistic* GetTestStatistic() const {
72  // TODO change to Roo... notifications
73  std::cout << "GetTestStatistic() IS NOT IMPLEMENTED FOR THIS SAMPLER. Returning NULL." << std::endl;
74  return NULL; /*fTestStatistic;*/
75  }
76 
77  // Get the Confidence level for the test
78  virtual Double_t ConfidenceLevel() const {return 1.-fSize;}
79 
80  // Common Initialization
81  virtual void Initialize(RooAbsArg& /* testStatistic */, RooArgSet& /* paramsOfInterest */, RooArgSet& /* nuisanceParameters */ ) {
82  }
83 
84  // Set the Pdf, add to the the workspace if not already there
85  virtual void SetPdf(RooAbsPdf&) {}
86 
87  // specify the parameters of interest in the interval
88  virtual void SetParameters(RooArgSet&) {}
89  // specify the nuisance parameters (eg. the rest of the parameters)
90  virtual void SetNuisanceParameters(const RooArgSet&) {}
91  // specify the values of parameters used when evaluating test statistic
92  virtual void SetParametersForTestStat(const RooArgSet& ) {}
93  // specify the conditional observables
94  virtual void SetGlobalObservables(const RooArgSet& ) {}
95 
96 
97  // set the size of the test (rate of Type I error) ( Eg. 0.05 for a 95% Confidence Interval)
98  virtual void SetTestSize(Double_t size) {fSize = size;}
99  // set the confidence level for the interval (eg. 0.95 for a 95% Confidence Interval)
100  virtual void SetConfidenceLevel(Double_t cl) {fSize = 1.-cl;}
101 
102  // Set the TestStatistic (want the argument to be a function of the data & parameter points
103  virtual void SetTestStatistic(TestStatistic* /*testStatistic*/) {
104  // TODO change to Roo... notifications
105  std::cout << "SetTestStatistic(...) IS NOT IMPLEMENTED FOR THIS SAMPLER" << std::endl;
106  }
107 
108  private:
112 
113  protected:
114  ClassDef(DebuggingSampler,1) // A simple implementation of the DistributionCreator interface
115  };
116 }
117 
118 
119 #endif
virtual void SetNuisanceParameters(const RooArgSet &)
TestStatSampler is an interface class for a tools which produce RooStats SamplingDistributions.
int Int_t
Definition: RtypesCore.h:41
virtual SamplingDistribution * GetSamplingDistribution(RooArgSet &paramsOfInterest)
virtual void SetConfidenceLevel(Double_t cl)
#define ClassDef(name, id)
Definition: Rtypes.h:254
This is the base class for the ROOT Random number generators.
Definition: TRandom.h:31
virtual TestStatistic * GetTestStatistic() const
virtual void SetTestSize(Double_t size)
RooRealVar represents a fundamental (non-derived) real valued object.
Definition: RooRealVar.h:37
virtual void SetGlobalObservables(const RooArgSet &)
virtual Double_t EvaluateTestStatistic(RooAbsData &, RooArgSet &)
virtual void SetPdf(RooAbsPdf &)
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:37
This class simply holds a sampling distribution of some test statistic.
Namespace for the RooStats classes.
Definition: Asimov.h:20
double Double_t
Definition: RtypesCore.h:55
virtual Double_t Uniform(Double_t x1=1)
Returns a uniform deviate on the interval (0, x1).
Definition: TRandom.cxx:606
virtual void SetParametersForTestStat(const RooArgSet &)
virtual void SetParameters(RooArgSet &)
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
Definition: RooAbsPdf.h:41
virtual void SetTestStatistic(TestStatistic *)
#define NULL
Definition: Rtypes.h:82
virtual Double_t ConfidenceLevel() const
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
Definition: RooAbsArg.h:66
virtual void Initialize(RooAbsArg &, RooArgSet &, RooArgSet &)
TestStatistic is an interface class to provide a facility for construction test statistics distributi...
Definition: TestStatistic.h:33