ROOT  6.06/09
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
71  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);
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 
106  void SetModelParameters(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);
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 
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)
Definition: TRolke.cxx:732
TRolke(Double_t CL=0.9, Option_t *option="")
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:1239
Double_t LogFactorial(Int_t n)
LogFactorial function (use the logGamma function via the relation Gamma(n+1) = n! ...
Definition: TRolke.cxx:1445
Double_t f_em
Definition: TRolke.h:51
const char Option_t
Definition: RtypesCore.h:62
bool GetLimitsQuantile(Double_t &low, Double_t &high, Int_t &out_x, Double_t integral=0.5)
Definition: TRolke.cxx:474
Int_t f_y
Definition: TRolke.h:48
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)
Definition: TRolke.cxx:613
Double_t f_sdb
Definition: TRolke.h:55
#define N
bool GetBounding() const
Definition: TRolke.h:178
void SetModelParameters()
Definition: TRolke.cxx:683
Int_t f_x
Definition: TRolke.h:47
Int_t fNumWarningsDeprecated2
Definition: TRolke.h:43
bool GetSensitivity(Double_t &low, Double_t &high, Double_t pPrecision=0.00001)
Definition: TRolke.cxx:445
int Int_t
Definition: RtypesCore.h:41
void SetPoissonBkgGaussEff(Int_t x, Int_t y, Double_t em, Double_t tau, Double_t sde)
Definition: TRolke.cxx:241
void SetPoissonBkgBinomEff(Int_t x, Int_t y, Int_t z, Double_t tau, Int_t m)
Definition: TRolke.cxx:218
Int_t f_z
Definition: TRolke.h:49
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:254
static Double_t EvalMonomial(Double_t x, const Int_t coef[], Int_t N)
evaluate mononomial
Definition: TRolke.cxx:1426
Double_t f_bm
Definition: TRolke.h:50
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 what = 1: Maximum...
Definition: TRolke.cxx:1078
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 what = 1: Maximum...
Definition: TRolke.cxx:1303
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)
Definition: TRolke.cxx:922
void SetGaussBkgGaussEff(Int_t x, Double_t bm, Double_t em, Double_t sde, Double_t sdb)
Definition: TRolke.cxx:265
Double_t f_b
Definition: TRolke.h:57
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:1339
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 what = 1: Maximum li...
Definition: TRolke.cxx:1213
Double_t EvalLikeMod1(Double_t mu, Int_t x, Int_t y, Int_t z, Double_t tau, Int_t m, Int_t what)
Definition: TRolke.cxx:954
void SetCL(Double_t CL)
Definition: TRolke.h:124
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:1394
bool GetLimitsML(Double_t &low, Double_t &high, Int_t &out_x)
Definition: TRolke.cxx:506
Double_t f_sde
Definition: TRolke.h:54
static const char * what
Definition: stlLoader.cc:6
void SetGaussBkgKnownEff(Int_t x, Double_t bm, Double_t sdb, Double_t e)
Definition: TRolke.cxx:312
void SetCLSigmas(Double_t CLsigmas)
Definition: TRolke.h:129
void SetKnownBkgBinomEff(Int_t x, Int_t z, Int_t m, Double_t b)
Definition: TRolke.cxx:335
bool fBounding
Definition: TRolke.h:40
SVector< double, 2 > v
Definition: Dict.h:5
Double_t Erf(Double_t x)
Computation of the error function erf(x).
Definition: TMath.cxx:187
void SetSwitch(bool bnd)
Definition: TRolke.cxx:572
Double_t fUpperLimit
Definition: TRolke.h:38
TMarker * m
Definition: textangle.C:8
void SetPoissonBkgKnownEff(Int_t x, Int_t y, Double_t tau, Double_t e)
Definition: TRolke.cxx:289
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)
Definition: TRolke.cxx:995
Double_t f_tau
Definition: TRolke.h:56
virtual ~TRolke()
Definition: TRolke.cxx:213
Int_t f_m
Definition: TRolke.h:58
void SetKnownBkgGaussEff(Int_t x, Double_t em, Double_t sde, Double_t b)
Definition: TRolke.cxx:358
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:1191
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:1059
Double_t GetLowerLimit()
Definition: TRolke.cxx:411
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:1123
double Double_t
Definition: RtypesCore.h:55
Double_t GetUpperLimit()
Definition: TRolke.cxx:403
Double_t f_e
Definition: TRolke.h:52
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 what = 1: Maximum li...
Definition: TRolke.cxx:1362
Double_t y[n]
Definition: legend1.C:17
void SetBounding(const bool bnd)
Definition: TRolke.h:184
Int_t f_mid
Definition: TRolke.h:53
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 what = 1: Maximum li...
Definition: TRolke.cxx:1259
Mother of all ROOT objects.
Definition: TObject.h:58
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)
Definition: TRolke.cxx:1022
static Double_t EvalPolynomial(Double_t x, const Int_t coef[], Int_t N)
evaluate polynomial
Definition: TRolke.cxx:1409
Double_t GetBackground()
Definition: TRolke.cxx:419
Double_t fCL
Definition: TRolke.h:37
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)
Definition: TRolke.cxx:691
Definition: TRolke.h:33
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:1284
void Print(Option_t *) const
This method must be overridden when a class wants to print itself.
Definition: TRolke.cxx:584
Double_t Sqrt(Double_t x)
Definition: TMath.h:464
bool GetCriticalNumber(Int_t &ncrit, Int_t maxtry=-1)
Definition: TRolke.cxx:538
Int_t fNumWarningsDeprecated1
Definition: TRolke.h:42
Double_t GetCL() const
Definition: TRolke.h:121
Double_t fLowerLimit
Definition: TRolke.h:39
const Int_t n
Definition: legend1.C:16
bool GetLimits(Double_t &low, Double_t &high)
Definition: TRolke.cxx:381
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 what = 1: Maximum l...
Definition: TRolke.cxx:1145