Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
28#include <map>
29
30class RooAbsData;
31
32namespace RooStats {
33
34 class ConfInterval;
35
37
38 public:
39
40 /// NeymanConstruction();
42
43 ~NeymanConstruction() override;
44
45 /// Main interface to get a ConfInterval (will be a PointSetInterval)
46 PointSetInterval* GetInterval() const override;
47
48 /// in addition to interface we also need:
49 /// Set the TestStatSampler (eg. ToyMC or FFT, includes choice of TestStatistic)
51 /// fLeftSideTailFraction*fSize defines lower edge of acceptance region.
52 /// Unified limits use 0, central limits use 0.5,
53 /// for upper/lower limits it is 0/1 depends on sign of test statistic w.r.t. parameter
54 void SetLeftSideTailFraction(double leftSideFraction = 0.) {fLeftSideFraction = leftSideFraction;}
55
56 /// User-defined set of points to test
58 fPointsToTest = &pointsToTest;
59 fConfBelt = new ConfidenceBelt("ConfBelt",pointsToTest);
60 }
61 /// This class can make regularly spaced scans based on range stored in RooRealVars.
62 /// Choose number of steps for a rastor scan (common for each dimension)
63 /// void SetNumSteps(Int_t);
64 /// This class can make regularly spaced scans based on range stored in RooRealVars.
65 /// Choose number of steps for a rastor scan (specific for each dimension)
66 /// void SetNumSteps(std::map<RooAbsArg, Int_t>)
67
68 /// Get the size of the test (eg. rate of Type I error)
69 double Size() const override {return fSize;}
70
71 /// Get the Confidence level for the test
72 double ConfidenceLevel() const override {return 1.-fSize;}
73
74 /// Set ModelConfig
75 void SetModel(const ModelConfig &model) override {fModel = model;}
76
77 /// Set the DataSet
78 void SetData(RooAbsData& data) override { fData = data; }
79
80 /// Set the Pdf, add to the workspace if not already there
81 virtual void SetPdf(RooAbsPdf& /*pdf*/) {
82 std::cout << "DEPRECATED, use ModelConfig"<<std::endl;
83 }
84
85 /// specify the parameters of interest in the interval
86 virtual void SetParameters(const RooArgSet& /*set*/) {
87 std::cout << "DEPRECATED, use ModelConfig"<<std::endl;
88 }
89
90 /// specify the nuisance parameters (eg. the rest of the parameters)
91 virtual void SetNuisanceParameters(const RooArgSet& /*set*/) {
92 std::cout << "DEPRECATED, use ModelConfig"<<std::endl;
93 }
94
95 /// set the size of the test (rate of Type I error) ( Eg. 0.05 for a 95% Confidence Interval)
96 void SetTestSize(double size) override {fSize = size;}
97 /// set the confidence level for the interval (eg. 0.95 for a 95% Confidence Interval)
98 void SetConfidenceLevel(double cl) override {fSize = 1.-cl;}
99
100 /// Get confidence belt. This requires that CreateConfBelt() has been called.
102
103 /// adaptive sampling algorithm to speed up interval calculation
104 void UseAdaptiveSampling(bool flag=true){fAdaptiveSampling=flag;}
105
106 /// give user ability to ask for more toys
108
109 /// save the confidence belt to a file
110 void SaveBeltToFile(bool flag=true){
111 fSaveBeltToFile = flag;
112 if(flag) fCreateBelt = true;
113 }
114 /// should create confidence belt
115 void CreateConfBelt(bool flag=true){fCreateBelt = flag;}
116
117 /// Returns instance of TestStatSampler. Use to change properties of
118 /// TestStatSampler, e.g. GetTestStatSampler.SetTestSize(double size);
120
121
122 private:
123
124 double fSize; ///< size of the test (eg. specified rate of Type I error)
125 RooAbsData& fData; ///< data set
127
132 bool fAdaptiveSampling; ///< controls use of adaptive sampling algorithm
133 double fAdditionalNToysFactor; ///< give user ability to ask for more toys
134 bool fSaveBeltToFile; ///< controls use if ConfidenceBelt should be saved to a TFile
135 bool fCreateBelt; ///< controls use if ConfidenceBelt should be saved to a TFile
136
137 protected:
138 ClassDefOverride(NeymanConstruction,1) ///< Interface for tools setting limits (producing confidence intervals)
139 };
140}
141
142
143#endif
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition RooAbsData.h:59
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:55
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:35
NeymanConstruction is a concrete implementation of the NeymanConstruction interface that,...
bool fAdaptiveSampling
controls use of adaptive sampling algorithm
double fSize
size of the test (eg. specified rate of Type I error)
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)
PointSetInterval * GetInterval() const override
Main interface to get a ConfInterval (will be a PointSetInterval)
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 SaveBeltToFile(bool flag=true)
save the confidence belt to a file
void SetConfidenceLevel(double cl) override
set the confidence level for the interval (eg. 0.95 for a 95% Confidence Interval)
ConfidenceBelt * GetConfidenceBelt()
Get confidence belt. This requires that CreateConfBelt() has been called.
~NeymanConstruction() override
default constructor if(fOwnsWorkspace && fWS) delete fWS; if(fConfBelt) delete fConfBelt;
void SetTestStatSampler(TestStatSampler &sampler)
in addition to interface we also need: Set the TestStatSampler (eg.
void SetLeftSideTailFraction(double leftSideFraction=0.)
fLeftSideTailFraction*fSize defines lower edge of acceptance region.
double ConfidenceLevel() const override
Get the Confidence level for the test.
virtual void SetPdf(RooAbsPdf &)
Set the Pdf, add to the workspace if not already there.
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
bool fSaveBeltToFile
controls use if ConfidenceBelt should be saved to a TFile
double Size() const override
This class can make regularly spaced scans based on range stored in RooRealVars.
void CreateConfBelt(bool flag=true)
should create confidence belt
void SetParameterPointsToTest(RooAbsData &pointsToTest)
User-defined set of points to test.
void SetData(RooAbsData &data) override
Set the DataSet.
double fAdditionalNToysFactor
give user ability to ask for more toys
void SetModel(const ModelConfig &model) override
Set ModelConfig.
bool fCreateBelt
controls use if ConfidenceBelt should be saved to a TFile
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