Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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/** \class DebuggingSampler
15 \ingroup Roostats
16
17DebuggingSampler is a simple implementation of the DistributionCreator interface used for debugging.
18The sampling distribution is uniformly random between [0,1] and is INDEPENDENT of the data. So it is not useful
19for true statistical tests, but it is useful for debugging.
20
21*/
22
23#include "Rtypes.h"
24
25#include <vector>
26
29
30#include "RooRealVar.h"
31#include "TRandom.h"
32
33namespace RooStats {
34
36
37 public:
39 fTestStatistic = new RooRealVar("UniformTestStatistic","UniformTestStatistic",0,0,1);
40 fRand = new TRandom();
41 }
43 delete fRand;
44 delete fTestStatistic;
45 }
46
47 // Main interface to get a ConfInterval, pure virtual
49 (void)paramsOfInterest; // avoid warning
50 // normally this method would be complex, but here it is simple for debugging
51 std::vector<Double_t> testStatVec;
52 for(Int_t i=0; i<1000; ++i){
53 testStatVec.push_back( fRand->Uniform() );
54 }
55 return new SamplingDistribution("UniformSamplingDist", "for debugging", testStatVec );
56 }
57
58 // Main interface to evaluate the test statistic on a dataset
59 virtual Double_t EvaluateTestStatistic(RooAbsData& /*data*/, RooArgSet& /*paramsOfInterest*/) {
60 // data = data; // avoid warning
61 // paramsOfInterest = paramsOfInterest; // avoid warning
62 return fRand->Uniform();
63 }
64
65 // Get the TestStatistic
67 // TODO change to Roo... notifications
68 std::cout << "GetTestStatistic() IS NOT IMPLEMENTED FOR THIS SAMPLER. Returning NULL." << std::endl;
69 return NULL; /*fTestStatistic;*/
70 }
71
72 // Get the Confidence level for the test
73 virtual Double_t ConfidenceLevel() const {return 1.-fSize;}
74
75 // Common Initialization
76 virtual void Initialize(RooAbsArg& /* testStatistic */, RooArgSet& /* paramsOfInterest */, RooArgSet& /* nuisanceParameters */ ) {
77 }
78
79 // Set the Pdf, add to the the workspace if not already there
80 virtual void SetPdf(RooAbsPdf&) {}
81
82 // specify the parameters of interest in the interval
83 virtual void SetParameters(RooArgSet&) {}
84 // specify the nuisance parameters (eg. the rest of the parameters)
85 virtual void SetNuisanceParameters(const RooArgSet&) {}
86 // specify the values of parameters used when evaluating test statistic
87 virtual void SetParametersForTestStat(const RooArgSet& ) {}
88 // specify the conditional observables
89 virtual void SetGlobalObservables(const RooArgSet& ) {}
90
91
92 // set the size of the test (rate of Type I error) ( Eg. 0.05 for a 95% Confidence Interval)
93 virtual void SetTestSize(Double_t size) {fSize = size;}
94 // set the confidence level for the interval (eg. 0.95 for a 95% Confidence Interval)
95 virtual void SetConfidenceLevel(Double_t cl) {fSize = 1.-cl;}
96
97 // Set the TestStatistic (want the argument to be a function of the data & parameter points
98 virtual void SetTestStatistic(TestStatistic* /*testStatistic*/) {
99 // TODO change to Roo... notifications
100 std::cout << "SetTestStatistic(...) IS NOT IMPLEMENTED FOR THIS SAMPLER" << std::endl;
101 }
102
103 private:
107
108 protected:
109 ClassDef(DebuggingSampler,1) // A simple implementation of the DistributionCreator interface
110 };
111}
112
113
114#endif
typedef void(GLAPIENTRYP _GLUfuncptr)(void)
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
double Double_t
Definition RtypesCore.h:59
#define ClassDef(name, id)
Definition Rtypes.h:325
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition RooAbsArg.h:69
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition RooAbsData.h:82
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:35
RooRealVar represents a variable that can be changed from the outside.
Definition RooRealVar.h:39
virtual void SetGlobalObservables(const RooArgSet &)
virtual void SetParametersForTestStat(const RooArgSet &)
virtual TestStatistic * GetTestStatistic() const
virtual void SetTestSize(Double_t size)
virtual Double_t EvaluateTestStatistic(RooAbsData &, RooArgSet &)
virtual SamplingDistribution * GetSamplingDistribution(RooArgSet &paramsOfInterest)
virtual void SetTestStatistic(TestStatistic *)
virtual void SetParameters(RooArgSet &)
virtual void SetNuisanceParameters(const RooArgSet &)
virtual void SetPdf(RooAbsPdf &)
virtual void Initialize(RooAbsArg &, RooArgSet &, RooArgSet &)
virtual Double_t ConfidenceLevel() const
virtual void SetConfidenceLevel(Double_t cl)
This class simply holds a sampling distribution of some test statistic.
TestStatSampler is an interface class for a tools which produce RooStats SamplingDistributions.
TestStatistic is an interface class to provide a facility for construction test statistics distributi...
This is the base class for the ROOT Random number generators.
Definition TRandom.h:27
virtual Double_t Uniform(Double_t x1=1)
Returns a uniform deviate on the interval (0, x1).
Definition TRandom.cxx:672
Namespace for the RooStats classes.
Definition Asimov.h:19