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.
33 class TRolke : public TObject
34 {
35 
36 private:
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 
112 public:
113 
114  /* Constructor */
115  TRolke(Double_t CL = 0.9, Option_t *option = "");
116 
117  /* Destructor */
118  virtual ~TRolke();
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
141  void SetGaussBkgGaussEff(Int_t x, Double_t bm, Double_t em, Double_t sde, Double_t sdb);
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;
193 
194  ClassDef(TRolke, 2)
195 };
196 
197 //calculate confidence limits using the Rolke method
198 #endif
199 
m
auto * m
Definition: textangle.C:8
n
const Int_t n
Definition: legend1.C:16
TRolke::SetSwitch
void SetSwitch(bool bnd)
Deprecated name for SetBounding.
Definition: TRolke.cxx:579
e
#define e(i)
Definition: RSha256.hxx:121
TRolke::GetSensitivity
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
TRolke::SetPoissonBkgKnownEff
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
TRolke::ComputeInterval
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
TRolke::fNumWarningsDeprecated1
Int_t fNumWarningsDeprecated1
Definition: TRolke.h:42
TRolke::SetKnownBkgGaussEff
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
TRolke::GetLimits
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
TRolke::LikeMod1
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
TRolke::EvalLikeMod2
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
TRolke::Likelihood
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
TRolke::~TRolke
virtual ~TRolke()
Destructor.
Definition: TRolke.cxx:189
TMath::Sqrt
Double_t Sqrt(Double_t x)
Definition: TMath.h:680
TRolke::GetLowerLimit
Double_t GetLowerLimit()
Calculate and get lower limit for the pre-specified model.
Definition: TRolke.cxx:407
TRolke::LikeMod2
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
int Int_t
Definition: RtypesCore.h:45
TRolke::f_e
Double_t f_e
Definition: TRolke.h:52
N
#define N
TRolke::LikeMod3
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
x
Double_t x[n]
Definition: legend1.C:17
TMath::Erf
Double_t Erf(Double_t x)
Computation of the error function erf(x).
Definition: TMath.cxx:184
TRolke::EvalLikeMod5
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
TRolke::fCL
Double_t fCL
Definition: TRolke.h:37
TRolke::fBounding
bool fBounding
Definition: TRolke.h:40
v
@ v
Definition: rootcling_impl.cxx:3635
TRolke::f_mid
Int_t f_mid
Definition: TRolke.h:53
b
#define b(i)
Definition: RSha256.hxx:118
TRolke::f_sdb
Double_t f_sdb
Definition: TRolke.h:55
TRolke::Print
void Print(Option_t *) const
Dump internals. Print members.
Definition: TRolke.cxx:593
TRolke::ProfLikeMod1
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
TRolke::fLowerLimit
Double_t fLowerLimit
Definition: TRolke.h:39
TRolke::SetModelParameters
void SetModelParameters()
Definition: TRolke.cxx:691
TRolke::LikeMod5
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
TRolke::SetPoissonBkgGaussEff
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
TRolke::f_tau
Double_t f_tau
Definition: TRolke.h:56
TRolke::Interval
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
TRolke::f_z
Int_t f_z
Definition: TRolke.h:49
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TRolke::EvalLikeMod3
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
TRolke::LikeGradMod1
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::GetCL
Double_t GetCL() const
Definition: TRolke.h:121
TRolke::LogFactorial
Double_t LogFactorial(Int_t n)
LogFactorial function (use the logGamma function via the relation Gamma(n+1) = n!
Definition: TRolke.cxx:1448
TRolke::f_em
Double_t f_em
Definition: TRolke.h:51
TRolke::EvalLikeMod7
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
TRolke::SetCL
void SetCL(Double_t CL)
Definition: TRolke.h:124
TRolke::GetUpperLimit
Double_t GetUpperLimit()
Calculate and get upper limit for the pre-specified model.
Definition: TRolke.cxx:397
TRolke::GetBounding
bool GetBounding() const
Definition: TRolke.h:178
TRolke::TRolke
TRolke(Double_t CL=0.9, Option_t *option="")
Constructor with optional Confidence Level argument.
Definition: TRolke.cxx:175
TRolke::LikeMod4
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
what
static const char * what
Definition: stlLoader.cc:6
TRolke::SetBounding
void SetBounding(const bool bnd)
Definition: TRolke.h:184
y
Double_t y[n]
Definition: legend1.C:17
TRolke::LikeMod7
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
TRolke::GetLimitsQuantile
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
TRolke::f_sde
Double_t f_sde
Definition: TRolke.h:54
TRolke::f_x
Int_t f_x
Definition: TRolke.h:47
TRolke::fNumWarningsDeprecated2
Int_t fNumWarningsDeprecated2
Definition: TRolke.h:43
TRolke::SetGaussBkgKnownEff
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
TRolke::f_y
Int_t f_y
Definition: TRolke.h:48
TRolke::SetCLSigmas
void SetCLSigmas(Double_t CLsigmas)
Definition: TRolke.h:129
Double_t
double Double_t
Definition: RtypesCore.h:59
TRolke::SetKnownBkgBinomEff
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
TRolke::fUpperLimit
Double_t fUpperLimit
Definition: TRolke.h:38
TObject.h
TRolke::GetCriticalNumber
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
TObject
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TRolke::EvalLikeMod6
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
TRolke::SetGaussBkgGaussEff
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
TRolke::SetPoissonBkgBinomEff
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
TRolke::f_b
Double_t f_b
Definition: TRolke.h:57
TRolke::LikeMod6
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
TRolke::f_m
Int_t f_m
Definition: TRolke.h:58
TRolke::EvalLikeMod1
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
TRolke::EvalMonomial
static Double_t EvalMonomial(Double_t x, const Int_t coef[], Int_t N)
Evaluate mononomial.
Definition: TRolke.cxx:1429
TRolke::f_bm
Double_t f_bm
Definition: TRolke.h:50
TRolke::CalculateInterval
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
TRolke::GetLimitsML
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
TRolke::EvalLikeMod4
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
TRolke::EvalPolynomial
static Double_t EvalPolynomial(Double_t x, const Int_t coef[], Int_t N)
Evaluate polynomial.
Definition: TRolke.cxx:1412
TRolke::GetBackground
Double_t GetBackground()
Return a simple background value (estimate/truth) given the pre-specified model.
Definition: TRolke.cxx:417
TMath.h
int
TRolke
Definition: TRolke.h:33