Logo ROOT  
Reference Guide
NeymanConstruction.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_NeymanConstruction
12#define ROOSTATS_NeymanConstruction
13
14
15#include "Rtypes.h"
16
18
23
24#include "RooAbsData.h"
25#include "RooAbsPdf.h"
26#include "RooArgSet.h"
27
28class RooAbsData;
29
30namespace RooStats {
31
32 class ConfInterval;
33
35
36 public:
37
38 /// NeymanConstruction();
40
41 virtual ~NeymanConstruction();
42
43 /// Main interface to get a ConfInterval (will be a PointSetInterval)
44 virtual PointSetInterval* GetInterval() const;
45
46 /// in addition to interface we also need:
47 /// Set the TestStatSampler (eg. ToyMC or FFT, includes choice of TestStatistic)
49 /// fLeftSideTailFraction*fSize defines lower edge of acceptance region.
50 /// Unified limits use 0, central limits use 0.5,
51 /// for upper/lower limits it is 0/1 depends on sign of test statistic w.r.t. parameter
52 void SetLeftSideTailFraction(Double_t leftSideFraction = 0.) {fLeftSideFraction = leftSideFraction;}
53
54 /// User-defined set of points to test
56 fPointsToTest = &pointsToTest;
57 fConfBelt = new ConfidenceBelt("ConfBelt",pointsToTest);
58 }
59 /// This class can make regularly spaced scans based on range stored in RooRealVars.
60 /// Choose number of steps for a rastor scan (common for each dimension)
61 /// void SetNumSteps(Int_t);
62 /// This class can make regularly spaced scans based on range stored in RooRealVars.
63 /// Choose number of steps for a rastor scan (specific for each dimension)
64 /// void SetNumSteps(std::map<RooAbsArg, Int_t>)
65
66 /// Get the size of the test (eg. rate of Type I error)
67 virtual Double_t Size() const {return fSize;}
68
69 /// Get the Confidence level for the test
70 virtual Double_t ConfidenceLevel() const {return 1.-fSize;}
71
72 /// Set ModelConfig
73 virtual void SetModel(const ModelConfig &model) {fModel = model;}
74
75 /// Set the DataSet
76 virtual void SetData(RooAbsData& data) { fData = data; }
77
78 /// Set the Pdf, add to the the workspace if not already there
79 virtual void SetPdf(RooAbsPdf& /*pdf*/) {
80 std::cout << "DEPRECATED, use ModelConfig"<<std::endl;
81 }
82
83 /// specify the parameters of interest in the interval
84 virtual void SetParameters(const RooArgSet& /*set*/) {
85 std::cout << "DEPRECATED, use ModelConfig"<<std::endl;
86 }
87
88 /// specify the nuisance parameters (eg. the rest of the parameters)
89 virtual void SetNuisanceParameters(const RooArgSet& /*set*/) {
90 std::cout << "DEPRECATED, use ModelConfig"<<std::endl;
91 }
92
93 /// set the size of the test (rate of Type I error) ( Eg. 0.05 for a 95% Confidence Interval)
94 virtual void SetTestSize(Double_t size) {fSize = size;}
95 /// set the confidence level for the interval (eg. 0.95 for a 95% Confidence Interval)
96 virtual void SetConfidenceLevel(Double_t cl) {fSize = 1.-cl;}
97
98 /// Get confidence belt. This requires that CreateConfBelt() has been called.
100
101 /// adaptive sampling algorithm to speed up interval calculation
102 void UseAdaptiveSampling(bool flag=true){fAdaptiveSampling=flag;}
103
104 /// give user ability to ask for more toys
106
107 /// save the confidence belt to a file
108 void SaveBeltToFile(bool flag=true){
109 fSaveBeltToFile = flag;
110 if(flag) fCreateBelt = true;
111 }
112 /// should create confidence belt
113 void CreateConfBelt(bool flag=true){fCreateBelt = flag;}
114
115 /// Returns instance of TestStatSampler. Use to change properties of
116 /// TestStatSampler, e.g. GetTestStatSampler.SetTestSize(Double_t size);
118
119
120 private:
121
122 Double_t fSize; /// size of the test (eg. specified rate of Type I error)
123 RooAbsData& fData; /// data set
125 /*
126 RooAbsPdf * fPdf; // common PDF
127 mutable RooArgSet fPOI; // RooArgSet specifying parameters of interest for interval
128 RooArgSet fNuisParams;// RooArgSet specifying nuisance parameters for interval
129 */
130
135 bool fAdaptiveSampling; // controls use of adaptive sampling algorithm
136 Double_t fAdditionalNToysFactor; // give user ability to ask for more toys
137 bool fSaveBeltToFile; // controls use if ConfidenceBelt should be saved to a TFile
138 bool fCreateBelt; // controls use if ConfidenceBelt should be saved to a TFile
139
140 protected:
141 ClassDef(NeymanConstruction,1) // Interface for tools setting limits (producing confidence intervals)
142 };
143}
144
145
146#endif
double Double_t
Definition: RtypesCore.h:57
#define ClassDef(name, id)
Definition: Rtypes.h:322
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:44
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:28
ConfidenceBelt is a concrete implementation of the ConfInterval interface.
IntervalCalculator is an interface class for a tools which produce RooStats ConfIntervals.
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
Definition: ModelConfig.h:30
NeymanConstruction is a concrete implementation of the NeymanConstruction interface that,...
virtual void SetTestSize(Double_t size)
set the size of the test (rate of Type I error) ( Eg. 0.05 for a 95% Confidence Interval)
virtual void SetParameters(const RooArgSet &)
specify the parameters of interest in the interval
TestStatSampler * GetTestStatSampler(void)
Returns instance of TestStatSampler.
virtual void SetNuisanceParameters(const RooArgSet &)
specify the nuisance parameters (eg. the rest of the parameters)
void SaveBeltToFile(bool flag=true)
save the confidence belt to a file
ConfidenceBelt * GetConfidenceBelt()
Get confidence belt. This requires that CreateConfBelt() has been called.
virtual void SetModel(const ModelConfig &model)
Set ModelConfig.
virtual PointSetInterval * GetInterval() const
Main interface to get a ConfInterval (will be a PointSetInterval)
void SetTestStatSampler(TestStatSampler &sampler)
in addition to interface we also need: Set the TestStatSampler (eg.
virtual void SetPdf(RooAbsPdf &)
Set the Pdf, add to the the workspace if not already there.
void SetLeftSideTailFraction(Double_t leftSideFraction=0.)
fLeftSideTailFraction*fSize defines lower edge of acceptance region.
void UseAdaptiveSampling(bool flag=true)
adaptive sampling algorithm to speed up interval calculation
void AdditionalNToysFactor(double fact)
give user ability to ask for more toys
virtual ~NeymanConstruction()
default constructor if(fOwnsWorkspace && fWS) delete fWS; if(fConfBelt) delete fConfBelt;
virtual Double_t ConfidenceLevel() const
Get the Confidence level for the test.
ModelConfig & fModel
data set
void CreateConfBelt(bool flag=true)
should create confidence belt
RooAbsData & fData
size of the test (eg. specified rate of Type I error)
void SetParameterPointsToTest(RooAbsData &pointsToTest)
User-defined set of points to test.
NeymanConstruction(RooAbsData &data, ModelConfig &model)
NeymanConstruction();.
virtual Double_t Size() const
This class can make regularly spaced scans based on range stored in RooRealVars.
virtual void SetConfidenceLevel(Double_t cl)
set the confidence level for the interval (eg. 0.95 for a 95% Confidence Interval)
virtual void SetData(RooAbsData &data)
Set the DataSet.
PointSetInterval is a concrete implementation of the ConfInterval interface.
TestStatSampler is an interface class for a tools which produce RooStats SamplingDistributions.
Namespace for the RooStats classes.
Definition: Asimov.h:19