00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef ROOSTATS_DebuggingSampler
00012 #define ROOSTATS_DebuggingSampler
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef ROOT_Rtypes
00027 #include "Rtypes.h"
00028 #endif
00029
00030 #include <vector>
00031
00032 #include "RooStats/TestStatSampler.h"
00033 #include "RooStats/SamplingDistribution.h"
00034
00035 #include "RooRealVar.h"
00036 #include "TRandom.h"
00037
00038 namespace RooStats {
00039
00040 class DebuggingSampler: public TestStatSampler {
00041
00042 public:
00043 DebuggingSampler() {
00044 fTestStatistic = new RooRealVar("UniformTestStatistic","UniformTestStatistic",0,0,1);
00045 fRand = new TRandom();
00046 }
00047 virtual ~DebuggingSampler() {
00048 delete fRand;
00049 delete fTestStatistic;
00050 }
00051
00052
00053 virtual SamplingDistribution* GetSamplingDistribution(RooArgSet& paramsOfInterest) {
00054 paramsOfInterest = paramsOfInterest;
00055
00056 std::vector<Double_t> testStatVec;
00057 for(Int_t i=0; i<1000; ++i){
00058 testStatVec.push_back( fRand->Uniform() );
00059 }
00060 return new SamplingDistribution("UniformSamplingDist", "for debugging", testStatVec );
00061 }
00062
00063
00064 virtual Double_t EvaluateTestStatistic(RooAbsData& , RooArgSet& ) {
00065
00066
00067 return fRand->Uniform();
00068 }
00069
00070
00071 virtual TestStatistic* GetTestStatistic() const {
00072
00073 cout << "GetTestStatistic() IS NOT IMPLEMENTED FOR THIS SAMPLER. Returning NULL." << endl;
00074 return NULL;
00075 }
00076
00077
00078 virtual Double_t ConfidenceLevel() const {return 1.-fSize;}
00079
00080
00081 virtual void Initialize(RooAbsArg& , RooArgSet& , RooArgSet& ) {
00082 }
00083
00084
00085 virtual void SetPdf(RooAbsPdf&) {}
00086
00087
00088 virtual void SetParameters(RooArgSet&) {}
00089
00090 virtual void SetNuisanceParameters(const RooArgSet&) {}
00091
00092 virtual void SetParametersForTestStat(const RooArgSet& ) {}
00093
00094 virtual void SetGlobalObservables(const RooArgSet& ) {}
00095
00096
00097
00098 virtual void SetTestSize(Double_t size) {fSize = size;}
00099
00100 virtual void SetConfidenceLevel(Double_t cl) {fSize = 1.-cl;}
00101
00102
00103 virtual void SetTestStatistic(TestStatistic* ) {
00104
00105 cout << "SetTestStatistic(...) IS NOT IMPLEMENTED FOR THIS SAMPLER" << endl;
00106 }
00107
00108 private:
00109 Double_t fSize;
00110 RooRealVar* fTestStatistic;
00111 TRandom* fRand;
00112
00113 protected:
00114 ClassDef(DebuggingSampler,1)
00115 };
00116 }
00117
00118
00119 #endif