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 {}
42 ~DebuggingSampler() override {
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> testStatVec;
52 testStatVec.reserve(1000);
53for(Int_t i=0; i<1000; ++i){
54 testStatVec.push_back( fRand->Uniform() );
55 }
56 return new SamplingDistribution("UniformSamplingDist", "for debugging", testStatVec );
57 }
58
59 /// Main interface to evaluate the test statistic on a dataset
60 double EvaluateTestStatistic(RooAbsData& /*data*/, RooArgSet& /*paramsOfInterest*/) override {
61 // data = data; // avoid warning
62 // paramsOfInterest = paramsOfInterest; // avoid warning
63 return fRand->Uniform();
64 }
65
66 /// Get the TestStatistic
67 TestStatistic* GetTestStatistic() const override {
68 std::cout << "GetTestStatistic() IS NOT IMPLEMENTED FOR THIS SAMPLER. Returning nullptr." << std::endl;
69 return nullptr; /*fTestStatistic;*/
70 }
71
72 /// Get the Confidence level for the test
73 double ConfidenceLevel() const override {return 1.-fSize;}
74
75 /// Common Initialization
76 void Initialize(RooAbsArg& /* testStatistic */, RooArgSet& /* paramsOfInterest */, RooArgSet& /* nuisanceParameters */ ) override {
77 }
78
79 /// Set the Pdf, add to the workspace if not already there
80 void SetPdf(RooAbsPdf&) override {}
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 void SetNuisanceParameters(const RooArgSet&) override {}
86 /// specify the values of parameters used when evaluating test statistic
87 void SetParametersForTestStat(const RooArgSet& ) override {}
88 /// specify the conditional observables
89 void SetGlobalObservables(const RooArgSet& ) override {}
90
91
92 /// set the size of the test (rate of Type I error) ( Eg. 0.05 for a 95% Confidence Interval)
93 void SetTestSize(double size) override {fSize = size;}
94 /// set the confidence level for the interval (eg. 0.95 for a 95% Confidence Interval)
95 void SetConfidenceLevel(double cl) override {fSize = 1.-cl;}
96
97 /// Set the TestStatistic (want the argument to be a function of the data & parameter points
98 void SetTestStatistic(TestStatistic* /*testStatistic*/) override {
99 std::cout << "SetTestStatistic(...) IS NOT IMPLEMENTED FOR THIS SAMPLER" << std::endl;
100 }
101
102 private:
103 double fSize;
106
107 protected:
108 ClassDefOverride(DebuggingSampler,1) // A simple implementation of the DistributionCreator interface
109 };
110}
111
112
113#endif
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Definition RooAbsArg.h:79
void reserve(Storage_t::size_type count)
Abstract base class for binned and unbinned datasets.
Definition RooAbsData.h:57
Abstract interface for all probability density functions.
Definition RooAbsPdf.h:40
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:24
Variable that can be changed from the outside.
Definition RooRealVar.h:37
void SetTestSize(double size) override
set the size of the test (rate of Type I error) ( Eg. 0.05 for a 95% Confidence Interval)
void Initialize(RooAbsArg &, RooArgSet &, RooArgSet &) override
Common Initialization.
void SetParametersForTestStat(const RooArgSet &) override
specify the values of parameters used when evaluating test statistic
TestStatistic * GetTestStatistic() const override
Get the TestStatistic.
virtual void SetParameters(RooArgSet &)
specify the parameters of interest in the interval
double ConfidenceLevel() const override
Get the Confidence level for the test.
void SetPdf(RooAbsPdf &) override
Set the Pdf, add to the workspace if not already there.
void SetConfidenceLevel(double cl) override
set the confidence level for the interval (eg. 0.95 for a 95% Confidence Interval)
SamplingDistribution * GetSamplingDistribution(RooArgSet &paramsOfInterest) override
Main interface to get a ConfInterval, pure virtual.
void SetTestStatistic(TestStatistic *) override
Set the TestStatistic (want the argument to be a function of the data & parameter points.
void SetGlobalObservables(const RooArgSet &) override
specify the conditional observables
double EvaluateTestStatistic(RooAbsData &, RooArgSet &) override
Main interface to evaluate the test statistic on a dataset.
void SetNuisanceParameters(const RooArgSet &) override
specify the nuisance parameters (eg. the rest of the parameters)
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:682
Namespace for the RooStats classes.
Definition Asimov.h:19