Logo ROOT  
Reference Guide
TRolke.h
Go to the documentation of this file.
1
2//////////////////////////////////////////////////////////////////////////////
3//
4// TRolke
5//
6// This class computes confidence intervals for the rate of a Poisson
7// in the presence of background and efficiency with a fully frequentist
8// treatment of the uncertainties in the efficiency and background estimate
9// using the profile likelihood method.
10//
11// Author: Jan Conrad (CERN) 2004
12// Updated: Johan Lundberg (CERN) 2009
13//
14// Copyright CERN 2004,2009 Jan.Conrad@cern.ch,
15// Johan.Lundberg@cern.ch
16//
17// For information about the statistical meaning of the parameters
18// and the syntax, consult TRolke.cxx
19// ------------------
20//
21// Examples are found in the file Rolke.C
22// --------------------------------------
23//
24//////////////////////////////////////////////////////////////////////////////
25
26#ifndef ROOT_TRolke
27#define ROOT_TRolke
28
29#include "TObject.h"
30#include "TMath.h"
31
32// Class definition. This class is not intended to be used as a base class.
33class TRolke : public TObject
34{
35
36private:
37 Double_t fCL; // confidence level as a fraction [0.9 for 90% ]
38 Double_t fUpperLimit; // the calculated upper limit
39 Double_t fLowerLimit; // the calculated lower limit
40 bool fBounding; // false for unbounded likelihood
41 // true for bounded likelihood
44
45 /* ----------------------------------------------------------------- */
46 /* These variables are set by the Set methods for the various models */
59
60 /* ----------------------------------------------------------------- */
61 /* Internal helper functions and methods */
62 // The Calculator
64
65 // LIKELIHOOD ROUTINE
67
68 //MODEL 1
73
74 //MODEL 2
76
78
79 //MODEL 3
82
83 //MODEL 4
86
87 //MODEL 5
90
91 //MODEL 6
94
95 //MODEL 7
98
99 //MISC
100 static Double_t EvalPolynomial(Double_t x, const Int_t coef[], Int_t N);
101 static Double_t EvalMonomial(Double_t x, const Int_t coef[], Int_t N);
103
105
107
108 void SetModelParameters();
109
111
112public:
113
114 /* Constructor */
115 TRolke(Double_t CL = 0.9, Option_t *option = "");
116
117 /* Destructor */
118 ~TRolke() override;
119
120 /* Get and set the Confidence Level */
121 Double_t GetCL() const {
122 return fCL;
123 }
124 void SetCL(Double_t CL) {
125 fCL = CL;
126 }
127
128 /* Set the Confidence Level in terms of Sigmas. */
129 void SetCLSigmas(Double_t CLsigmas) {
130 fCL = TMath::Erf(CLsigmas / TMath::Sqrt(2.0)) ;
131 }
132
133 // The Set methods for the different models are described in Rolke.cxx
134 // model 1
136
137 // model 2
139
140 // model 3
142
143 // model 4
145
146 // model 5
148
149 // model 6
151
152 // model 7
154
155 /* Deprecated interface method (read Rolke.cxx). May be removed from future releases */
157
158 // get the upper and lower limits based on the specified model
159 bool GetLimits(Double_t& low, Double_t& high);
162
163 // get the upper and lower average limits
164 bool GetSensitivity(Double_t& low, Double_t& high, Double_t pPrecision = 0.00001);
165
166 // get the upper and lower limits for the outcome corresponding to
167 // a given quantile.
168 bool GetLimitsQuantile(Double_t& low, Double_t& high, Int_t& out_x, Double_t integral = 0.5);
169
170 // get the upper and lower limits for the most likely outcome.
171 bool GetLimitsML(Double_t& low, Double_t& high, Int_t& out_x);
172
173 // get the value of x corresponding to rejection of the null hypothesis.
174 bool GetCriticalNumber(Int_t& ncrit,Int_t maxtry=-1);
175
176 /* Get the bounding mode flag. True activates bounded mode. Read
177 TRolke.cxx and the references therein for details. */
178 bool GetBounding() const {
179 return fBounding;
180 }
181
182 /* Get the bounding mode flag. True activates bounded mode. Read
183 TRolke.cxx and the references therein for details. */
184 void SetBounding(const bool bnd) {
185 fBounding = bnd;
186 }
187
188 /* Deprecated name for SetBounding. */
189 void SetSwitch(bool bnd) ;
190
191 /* Dump internals. Option is not used */
192 void Print(Option_t*) const override;
193
195};
196
197//calculate confidence limits using the Rolke method
198#endif
199
#define e(i)
Definition: RSha256.hxx:103
int Int_t
Definition: RtypesCore.h:45
double Double_t
Definition: RtypesCore.h:59
const char Option_t
Definition: RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
#define N
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t b
Mother of all ROOT objects.
Definition: TObject.h:37
This class computes confidence intervals for the rate of a Poisson process in the presence of uncerta...
Definition: TRolke.h:34
Double_t f_sdb
Definition: TRolke.h:55
Double_t GetCL() const
Definition: TRolke.h:121
Double_t EvalLikeMod3(Double_t mu, Int_t x, Double_t bm, Double_t em, Double_t sde, Double_t sdb, Int_t what)
Calculates the Profile Likelihood for MODEL 3: Gauss background/ Gauss Efficiency.
Definition: TRolke.cxx:1148
void SetGaussBkgKnownEff(Int_t x, Double_t bm, Double_t sdb, Double_t e)
Model 5: Background - Gaussian, Efficiency - known (x,bm,sdb,e.
Definition: TRolke.cxx:302
Double_t Interval(Int_t x, Int_t y, Int_t z, Double_t bm, Double_t em, Double_t e, Int_t mid, Double_t sde, Double_t sdb, Double_t tau, Double_t b, Int_t m)
Internal helper function 'Interval'.
Definition: TRolke.cxx:754
bool GetLimitsML(Double_t &low, Double_t &high, Int_t &out_x)
get the upper and lower limits for the most likely outcome.
Definition: TRolke.cxx:511
Double_t LikeMod7(Double_t mu, Double_t b, Double_t e, Int_t x, Double_t em, Double_t v)
Profile Likelihood function for MODEL 6: background known/ Efficiency gaussian.
Definition: TRolke.cxx:1397
Double_t EvalLikeMod6(Double_t mu, Int_t x, Int_t z, Double_t b, Int_t m, Int_t what)
Calculates the Profile Likelihood for MODEL 6: Background known/Efficiency binomial.
Definition: TRolke.cxx:1306
Double_t f_sde
Definition: TRolke.h:54
bool GetCriticalNumber(Int_t &ncrit, Int_t maxtry=-1)
get the value of x corresponding to rejection of the null hypothesis.
Definition: TRolke.cxx:546
Double_t f_em
Definition: TRolke.h:51
static Double_t EvalPolynomial(Double_t x, const Int_t coef[], Int_t N)
Evaluate polynomial.
Definition: TRolke.cxx:1412
Double_t f_b
Definition: TRolke.h:57
void Print(Option_t *) const override
Dump internals. Print members.
Definition: TRolke.cxx:593
void SetKnownBkgBinomEff(Int_t x, Int_t z, Int_t m, Double_t b)
Model 6: Background - known, Efficiency - Binomial (x,z,m,b)
Definition: TRolke.cxx:327
bool fBounding
Definition: TRolke.h:40
Double_t Likelihood(Double_t mu, Int_t x, Int_t y, Int_t z, Double_t bm, Double_t em, Int_t mid, Double_t sde, Double_t sdb, Double_t tau, Double_t b, Int_t m, Int_t what)
Internal helper function Chooses between the different profile likelihood functions to use for the di...
Definition: TRolke.cxx:933
Int_t fNumWarningsDeprecated1
Definition: TRolke.h:42
Double_t LikeMod1(Double_t mu, Double_t b, Double_t e, Int_t x, Int_t y, Int_t z, Double_t tau, Int_t m)
Profile Likelihood function for MODEL 1: Poisson background/ Binomial Efficiency.
Definition: TRolke.cxx:1003
Double_t EvalLikeMod4(Double_t mu, Int_t x, Int_t y, Double_t tau, Int_t what)
Calculates the Profile Likelihood for MODEL 4: Poiss background/Efficiency known.
Definition: TRolke.cxx:1216
void SetPoissonBkgKnownEff(Int_t x, Int_t y, Double_t tau, Double_t e)
Model 4: Background - Poisson, Efficiency - known (x,y,tau,e)
Definition: TRolke.cxx:277
Double_t LikeMod5(Double_t mu, Double_t b, Int_t x, Double_t bm, Double_t u)
Profile Likelihood function for MODEL 5: Gauss background/Efficiency known.
Definition: TRolke.cxx:1287
Double_t GetUpperLimit()
Calculate and get upper limit for the pre-specified model.
Definition: TRolke.cxx:397
void SetBounding(const bool bnd)
Definition: TRolke.h:184
void SetKnownBkgGaussEff(Int_t x, Double_t em, Double_t sde, Double_t b)
Model 7: Background - known, Efficiency - Gaussian (x,em,sde,b)
Definition: TRolke.cxx:352
void SetGaussBkgGaussEff(Int_t x, Double_t bm, Double_t em, Double_t sde, Double_t sdb)
Model 3: Background - Gaussian, Efficiency - Gaussian (x,bm,em,sde,sdb)
Definition: TRolke.cxx:252
void SetPoissonBkgGaussEff(Int_t x, Int_t y, Double_t em, Double_t tau, Double_t sde)
Model 2: Background - Poisson, Efficiency - Gaussian.
Definition: TRolke.cxx:226
static Double_t EvalMonomial(Double_t x, const Int_t coef[], Int_t N)
Evaluate mononomial.
Definition: TRolke.cxx:1429
Double_t EvalLikeMod5(Double_t mu, Int_t x, Double_t bm, Double_t sdb, Int_t what)
Calculates the Profile Likelihood for MODEL 5: Gauss background/Efficiency known.
Definition: TRolke.cxx:1262
bool GetSensitivity(Double_t &low, Double_t &high, Double_t pPrecision=0.00001)
get the upper and lower average limits based on the specified model.
Definition: TRolke.cxx:446
Double_t LikeGradMod1(Double_t e, Double_t mu, Int_t x, Int_t y, Int_t z, Double_t tau, Int_t m)
Gradient model likelihood.
Definition: TRolke.cxx:1062
TRolke(Double_t CL=0.9, Option_t *option="")
Constructor with optional Confidence Level argument.
Definition: TRolke.cxx:175
void ProfLikeMod1(Double_t mu, Double_t &b, Double_t &e, Int_t x, Int_t y, Int_t z, Double_t tau, Int_t m)
Helper for calculation of estimates of efficiency and background for model 1.
Definition: TRolke.cxx:1029
Double_t LikeMod3(Double_t mu, Double_t b, Double_t e, Int_t x, Double_t bm, Double_t em, Double_t u, Double_t v)
Profile Likelihood function for MODEL 3: Gauss background/Gauss Efficiency.
Definition: TRolke.cxx:1194
Double_t EvalLikeMod7(Double_t mu, Int_t x, Double_t em, Double_t sde, Double_t b, Int_t what)
Calculates the Profile Likelihood for MODEL 7: background known/Efficiency Gauss.
Definition: TRolke.cxx:1365
Int_t f_x
Definition: TRolke.h:47
Double_t fUpperLimit
Definition: TRolke.h:38
Int_t f_m
Definition: TRolke.h:58
void SetSwitch(bool bnd)
Deprecated name for SetBounding.
Definition: TRolke.cxx:579
Int_t f_z
Definition: TRolke.h:49
Double_t fCL
Definition: TRolke.h:37
void SetModelParameters()
Definition: TRolke.cxx:691
bool GetLimitsQuantile(Double_t &low, Double_t &high, Int_t &out_x, Double_t integral=0.5)
get the upper and lower limits for the outcome corresponding to a given quantile.
Definition: TRolke.cxx:481
Double_t CalculateInterval(Int_t x, Int_t y, Int_t z, Double_t bm, Double_t em, Double_t e, Int_t mid, Double_t sde, Double_t sdb, Double_t tau, Double_t b, Int_t m)
Deprecated and error prone model selection interface.
Definition: TRolke.cxx:637
bool GetLimits(Double_t &low, Double_t &high)
Calculate and get the upper and lower limits for the pre-specified model.
Definition: TRolke.cxx:373
void SetPoissonBkgBinomEff(Int_t x, Int_t y, Int_t z, Double_t tau, Int_t m)
Model 1: Background - Poisson, Efficiency - Binomial.
Definition: TRolke.cxx:201
void SetCL(Double_t CL)
Definition: TRolke.h:124
Double_t LogFactorial(Int_t n)
LogFactorial function (use the logGamma function via the relation Gamma(n+1) = n!
Definition: TRolke.cxx:1448
Double_t ComputeInterval(Int_t x, Int_t y, Int_t z, Double_t bm, Double_t em, Double_t e, Int_t mid, Double_t sde, Double_t sdb, Double_t tau, Double_t b, Int_t m)
ComputeInterval, the internals.
Definition: TRolke.cxx:713
Int_t f_mid
Definition: TRolke.h:53
void SetCLSigmas(Double_t CLsigmas)
Definition: TRolke.h:129
Double_t EvalLikeMod1(Double_t mu, Int_t x, Int_t y, Int_t z, Double_t tau, Int_t m, Int_t what)
Calculates the Profile Likelihood for MODEL 1: Poisson background/ Binomial Efficiency.
Definition: TRolke.cxx:967
Double_t GetLowerLimit()
Calculate and get lower limit for the pre-specified model.
Definition: TRolke.cxx:407
Int_t fNumWarningsDeprecated2
Definition: TRolke.h:43
Double_t LikeMod2(Double_t mu, Double_t b, Double_t e, Int_t x, Int_t y, Double_t em, Double_t tau, Double_t v)
Profile Likelihood function for MODEL 2: Poisson background/Gauss Efficiency.
Definition: TRolke.cxx:1126
Int_t f_y
Definition: TRolke.h:48
Double_t GetBackground()
Return a simple background value (estimate/truth) given the pre-specified model.
Definition: TRolke.cxx:417
~TRolke() override
Destructor.
Definition: TRolke.cxx:189
Double_t f_tau
Definition: TRolke.h:56
bool GetBounding() const
Definition: TRolke.h:178
Double_t fLowerLimit
Definition: TRolke.h:39
Double_t LikeMod6(Double_t mu, Double_t b, Double_t e, Int_t x, Int_t z, Int_t m)
Profile Likelihood function for MODEL 6: background known/ Efficiency binomial.
Definition: TRolke.cxx:1342
Double_t EvalLikeMod2(Double_t mu, Int_t x, Int_t y, Double_t em, Double_t sde, Double_t tau, Int_t what)
Calculates the Profile Likelihood for MODEL 2: Poisson background/ Gauss Efficiency.
Definition: TRolke.cxx:1081
Double_t f_e
Definition: TRolke.h:52
Double_t LikeMod4(Double_t mu, Double_t b, Int_t x, Int_t y, Double_t tau)
Profile Likelihood function for MODEL 4: Poiss background/Efficiency known.
Definition: TRolke.cxx:1242
Double_t f_bm
Definition: TRolke.h:50
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
const Int_t n
Definition: legend1.C:16
Double_t Erf(Double_t x)
Computation of the error function erf(x).
Definition: TMath.cxx:190
Double_t Sqrt(Double_t x)
Returns the square root of x.
Definition: TMath.h:660
static const char * what
Definition: stlLoader.cc:6
TMarker m
Definition: textangle.C:8