Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
CombinedCalculator.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_CombinedCalculator
12#define ROOSTATS_CombinedCalculator
13
14
16
18
20
21#include "RooAbsPdf.h"
22
23#include "RooAbsData.h"
24
25#include "RooArgSet.h"
26
27// #ifndef ROO_WORKSPACE
28// #include "RooWorkspace.h"
29// #endif
30
31namespace RooStats {
32
33/** \class CombinedCalculator
34 \ingroup Roostats
35
36CombinedCalculator is an interface class for a tools which can produce both RooStats
37HypoTestResults and ConfIntervals. The interface currently assumes that any such
38calculator can be configured by specifying:
39
40 - a model common model (eg. a family of specific models which includes both the null and alternate),
41 - a data set,
42 - a set of parameters of which specify the null (including values and const/non-const status),
43 - a set of parameters of which specify the alternate (including values and const/non-const status),
44 - a set of parameters of nuisance parameters (including values and const/non-const status).
45
46The interface allows one to pass the model, data, and parameters via a workspace
47and then specify them with names. The interface also allows one to pass the model,
48data, and parameters without a workspace (which is created internally).
49
50After configuring the calculator, one only needs to ask GetHypoTest() (which will
51return a HypoTestResult pointer) or GetInterval() (which will return an ConfInterval pointer).
52
53The concrete implementations of this interface should deal with the details of how
54the nuisance parameters are dealt with (eg. integration vs. profiling) and which test-statistic is used (perhaps this should be added to the interface).
55
56The motivation for this interface is that we hope to be able to specify the problem
57in a common way for several concrete calculators.
58
59*/
60
61
63
64 public:
65
67 fSize(0.),
68 fPdf(nullptr),
69 fData(nullptr)
70 {}
71
72 CombinedCalculator(RooAbsData& data, RooAbsPdf& pdf, const RooArgSet& paramsOfInterest,
73 double size = 0.05, const RooArgSet* nullParams = nullptr, const RooArgSet* altParams = nullptr, const RooArgSet* nuisParams = nullptr) :
74
75 fPdf(&pdf),
76 fData(&data),
77 fPOI(paramsOfInterest)
78 {
79 if (nullParams) fNullParams.add(*nullParams);
80 if (altParams) fAlternateParams.add(*altParams);
81 if (nuisParams) fNuisParams.add(*nuisParams);
83 }
84
85 /// constructor from data and model configuration
87 double size = 0.05) :
88 fPdf(nullptr),
89 fData(&data)
90 {
91 SetModel(model);
93 }
94
95 /// destructor.
96 ~CombinedCalculator() override { }
97
98 /// Main interface to get a ConfInterval, pure virtual
99 ConfInterval* GetInterval() const override = 0;
100 /// main interface to get a HypoTestResult, pure virtual
101 HypoTestResult* GetHypoTest() const override = 0;
102
103 /// set the size of the test (rate of Type I error) ( Eg. 0.05 for a 95% Confidence Interval)
104 void SetTestSize(double size) override {fSize = size;}
105 /// set the confidence level for the interval (eg. 0.95 for a 95% Confidence Interval)
106 void SetConfidenceLevel(double cl) override {fSize = 1.-cl;}
107 /// Get the size of the test (eg. rate of Type I error)
108 double Size() const override {return fSize;}
109 /// Get the Confidence level for the test
110 double ConfidenceLevel() const override {return 1.-fSize;}
111
112 /// Set the DataSet, add to the workspace if not already there
113 void SetData(RooAbsData & data) override {
114 fData = &data;
115 }
116
117 /// set the model (in this case can set only the parameters for the null hypothesis)
118 void SetModel(const ModelConfig & model) override {
119 fPdf = model.GetPdf();
121 if (model.GetSnapshot()) SetNullParameters(*model.GetSnapshot());
125 }
126
127 void SetNullModel( const ModelConfig &) override { // to be understood what to do
128 }
129 void SetAlternateModel(const ModelConfig &) override { // to be understood what to do
130 }
131
132 /* specific setting - keep for convenience- some of them could be removed */
133
134 /// Set the Pdf
135 virtual void SetPdf(RooAbsPdf& pdf) { fPdf = &pdf; }
136
137 /// specify the parameters of interest in the interval
138 virtual void SetParameters(const RooArgSet& set) { fPOI.removeAll(); fPOI.add(set); }
139
140 /// specify the nuisance parameters (eg. the rest of the parameters)
142
143 /// set parameter values for the null if using a common PDF
145
146 /// set parameter values for the alternate if using a common PDF
148
149 /// set conditional observables needed for computing the NLL
151
152 /// set global observables needed for computing the NLL
154
155
156 protected:
157
158 RooAbsPdf * GetPdf() const { return fPdf; }
159 RooAbsData * GetData() const { return fData; }
160
161 double fSize; ///< size of the test (eg. specified rate of Type I error)
162
165 RooArgSet fPOI; ///< RooArgSet specifying parameters of interest for interval
166 RooArgSet fNullParams; ///< RooArgSet specifying null parameters for hypothesis test
167 RooArgSet fAlternateParams; ///< RooArgSet specifying alternate parameters for hypothesis test
168 RooArgSet fNuisParams; ///< RooArgSet specifying nuisance parameters for interval
169 RooArgSet fConditionalObs; ///< RooArgSet specifying the conditional observables
170 RooArgSet fGlobalObs; ///< RooArgSet specifying the global observables
171
172
173 ClassDefOverride(CombinedCalculator,2) // A base class that is for tools that can be both HypoTestCalculators and IntervalCalculators
174
175 };
176}
177
178
179#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
virtual void removeAll()
Remove all arguments from our set, deleting them if we own them.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
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
CombinedCalculator is an interface class for a tools which can produce both RooStats HypoTestResults ...
virtual void SetNullParameters(const RooArgSet &set)
set parameter values for the null if using a common PDF
void SetModel(const ModelConfig &model) override
set the model (in this case can set only the parameters for the null hypothesis)
CombinedCalculator(RooAbsData &data, const ModelConfig &model, double size=0.05)
constructor from data and model configuration
void SetNullModel(const ModelConfig &) override
Set the model for the null hypothesis.
RooArgSet fNuisParams
RooArgSet specifying nuisance parameters for interval.
RooArgSet fNullParams
RooArgSet specifying null parameters for hypothesis test.
void SetTestSize(double size) override
set the size of the test (rate of Type I error) ( Eg. 0.05 for a 95% Confidence Interval)
ConfInterval * GetInterval() const override=0
Main interface to get a ConfInterval, pure virtual.
virtual void SetGlobalObservables(const RooArgSet &set)
set global observables needed for computing the NLL
double Size() const override
Get the size of the test (eg. rate of Type I error)
RooArgSet fPOI
RooArgSet specifying parameters of interest for interval.
double ConfidenceLevel() const override
Get the Confidence level for the test.
RooArgSet fGlobalObs
RooArgSet specifying the global observables.
CombinedCalculator(RooAbsData &data, RooAbsPdf &pdf, const RooArgSet &paramsOfInterest, double size=0.05, const RooArgSet *nullParams=nullptr, const RooArgSet *altParams=nullptr, const RooArgSet *nuisParams=nullptr)
virtual void SetParameters(const RooArgSet &set)
specify the parameters of interest in the interval
void SetData(RooAbsData &data) override
Set the DataSet, add to the workspace if not already there.
virtual void SetPdf(RooAbsPdf &pdf)
Set the Pdf.
virtual void SetAlternateParameters(const RooArgSet &set)
set parameter values for the alternate if using a common PDF
virtual void SetConditionalObservables(const RooArgSet &set)
set conditional observables needed for computing the NLL
~CombinedCalculator() override
destructor.
virtual void SetNuisanceParameters(const RooArgSet &set)
specify the nuisance parameters (eg. the rest of the parameters)
double fSize
size of the test (eg. specified rate of Type I error)
RooArgSet fConditionalObs
RooArgSet specifying the conditional observables.
void SetConfidenceLevel(double cl) override
set the confidence level for the interval (eg. 0.95 for a 95% Confidence Interval)
HypoTestResult * GetHypoTest() const override=0
main interface to get a HypoTestResult, pure virtual
RooArgSet fAlternateParams
RooArgSet specifying alternate parameters for hypothesis test.
void SetAlternateModel(const ModelConfig &) override
Set the model for the alternate hypothesis.
ConfInterval is an interface class for a generic interval in the RooStats framework.
HypoTestCalculator is an interface class for a tools which produce RooStats HypoTestResults.
HypoTestResult is a base class for results from hypothesis tests.
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
const RooArgSet * GetConditionalObservables() const
get RooArgSet for conditional observables (return nullptr if not existing)
const RooArgSet * GetGlobalObservables() const
get RooArgSet for global observables (return nullptr if not existing)
const RooArgSet * GetParametersOfInterest() const
get RooArgSet containing the parameter of interest (return nullptr if not existing)
const RooArgSet * GetNuisanceParameters() const
get RooArgSet containing the nuisance parameters (return nullptr if not existing)
const RooArgSet * GetSnapshot() const
get RooArgSet for parameters for a particular hypothesis (return nullptr if not existing)
RooAbsPdf * GetPdf() const
get model PDF (return nullptr if pdf has not been specified or does not exist)
Namespace for the RooStats classes.
Definition Asimov.h:19