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