ROOT
master
Reference Guide
Loading...
Searching...
No Matches
Rolke.C
Go to the documentation of this file.
1
/// \file
2
/// \ingroup tutorial_math_legacy
3
/// Example of the usage of the TRolke class
4
/// The TRolke class computes the profile likelihood
5
/// confidence limits for 7 different model assumptions
6
/// on systematic/statistical uncertainties
7
///
8
/// Please read TRolke.cxx and TRolke.h for more docs.
9
///
10
/// \macro_output
11
/// \macro_code
12
///
13
/// \authors Jan Conrad, Johan Lundberg
14
15
#include "
TROOT.h
"
16
#include "
TSystem.h
"
17
#include "
TRolke.h
"
18
#include "
Riostream.h
"
19
20
void
Rolke
()
21
{
22
// variables used throughout the example
23
Double_t
bm
;
24
Double_t
tau;
25
Int_t
mid
;
26
Int_t
m
;
27
Int_t
z;
28
Int_t
y
;
29
Int_t
x
;
30
Double_t
e
;
31
Double_t
em
;
32
Double_t
sde
;
33
Double_t
sdb
;
34
Double_t
b
;
35
36
Double_t
alpha;
//Confidence Level
37
38
// make TRolke objects
39
TRolke
tr
;
//
40
41
Double_t
ul
;
// upper limit
42
Double_t
ll ;
// lower limit
43
44
//-----------------------------------------------
45
// Model 1 assumes:
46
//
47
// Poisson uncertainty in the background estimate
48
// Binomial uncertainty in the efficiency estimate
49
//
50
cout << endl<<
" ======================================================== "
<<endl;
51
mid
=1;
52
x
= 5;
// events in the signal region
53
y
= 10;
// events observed in the background region
54
tau = 2.5;
// ratio between size of signal/background region
55
m
= 100;
// MC events have been produced (signal)
56
z = 50;
// MC events have been observed (signal)
57
58
alpha=0.9;
//Confidence Level
59
60
tr
.SetCL(alpha);
61
62
tr
.SetPoissonBkgBinomEff(
x
,
y
,z,tau,
m
);
63
tr
.GetLimits(ll,
ul
);
64
65
cout <<
"For model 1: Poisson / Binomial"
<< endl;
66
cout <<
"the Profile Likelihood interval is :"
<< endl;
67
cout <<
"["
<< ll <<
","
<<
ul
<<
"]"
<< endl;
68
69
//-----------------------------------------------
70
// Model 2 assumes:
71
//
72
// Poisson uncertainty in the background estimate
73
// Gaussian uncertainty in the efficiency estimate
74
//
75
cout << endl<<
" ======================================================== "
<<endl;
76
mid
=2;
77
y
= 3 ;
// events observed in the background region
78
x
= 10 ;
// events in the signal region
79
tau = 2.5;
// ratio between size of signal/background region
80
em
= 0.9;
// measured efficiency
81
sde
= 0.05;
// standard deviation of efficiency
82
alpha =0.95;
// Confidence L evel
83
84
tr
.SetCL(alpha);
85
86
tr
.SetPoissonBkgGaussEff(
x
,
y
,
em
,tau,
sde
);
87
tr
.GetLimits(ll,
ul
);
88
89
cout <<
"For model 2 : Poisson / Gaussian"
<< endl;
90
cout <<
"the Profile Likelihood interval is :"
<< endl;
91
cout <<
"["
<< ll <<
","
<<
ul
<<
"]"
<< endl;
92
93
//-----------------------------------------------
94
// Model 3 assumes:
95
//
96
// Gaussian uncertainty in the background estimate
97
// Gaussian uncertainty in the efficiency estimate
98
//
99
cout << endl<<
" ======================================================== "
<<endl;
100
mid
=3;
101
bm
= 5;
// expected background
102
x
= 10;
// events in the signal region
103
sdb
= 0.5;
// standard deviation in background estimate
104
em
= 0.9;
// measured efficiency
105
sde
= 0.05;
// standard deviation of efficiency
106
alpha =0.99;
// Confidence Level
107
108
tr
.SetCL(alpha);
109
110
tr
.SetGaussBkgGaussEff(
x
,
bm
,
em
,
sde
,
sdb
);
111
tr
.GetLimits(ll,
ul
);
112
cout <<
"For model 3 : Gaussian / Gaussian"
<< endl;
113
cout <<
"the Profile Likelihood interval is :"
<< endl;
114
cout <<
"["
<< ll <<
","
<<
ul
<<
"]"
<< endl;
115
116
cout <<
"***************************************"
<< endl;
117
cout <<
"* some more example's for gauss/gauss *"
<< endl;
118
cout <<
"* *"
<< endl;
119
Double_t
slow
,
shigh
;
120
tr
.GetSensitivity(
slow
,
shigh
);
121
cout <<
"sensitivity:"
<< endl;
122
cout <<
"["
<<
slow
<<
","
<<
shigh
<<
"]"
<< endl;
123
124
int
outx
;
125
tr
.GetLimitsQuantile(
slow
,
shigh
,
outx
,0.5);
126
cout <<
"median limit:"
<< endl;
127
cout <<
"["
<<
slow
<<
","
<<
shigh
<<
"] @ x ="
<<
outx
<<endl;
128
129
tr
.GetLimitsML(
slow
,
shigh
,
outx
);
130
cout <<
"ML limit:"
<< endl;
131
cout <<
"["
<<
slow
<<
","
<<
shigh
<<
"] @ x ="
<<
outx
<<endl;
132
133
tr
.GetSensitivity(
slow
,
shigh
);
134
cout <<
"sensitivity:"
<< endl;
135
cout <<
"["
<<
slow
<<
","
<<
shigh
<<
"]"
<< endl;
136
137
tr
.GetLimits(ll,
ul
);
138
cout <<
"the Profile Likelihood interval is :"
<< endl;
139
cout <<
"["
<< ll <<
","
<<
ul
<<
"]"
<< endl;
140
141
Int_t
ncrt
;
142
143
tr
.GetCriticalNumber(
ncrt
);
144
cout <<
"critical number: "
<<
ncrt
<< endl;
145
146
tr
.SetCLSigmas(5);
147
tr
.GetCriticalNumber(
ncrt
);
148
cout <<
"critical number for 5 sigma: "
<<
ncrt
<< endl;
149
150
cout <<
"***************************************"
<< endl;
151
152
//-----------------------------------------------
153
// Model 4 assumes:
154
//
155
// Poisson uncertainty in the background estimate
156
// known efficiency
157
//
158
cout << endl<<
" ======================================================== "
<<endl;
159
mid
=4;
160
y
= 7;
// events observed in the background region
161
x
= 1;
// events in the signal region
162
tau = 5;
// ratio between size of signal/background region
163
e
= 0.25;
// efficiency
164
165
alpha =0.68;
// Confidence L evel
166
167
tr
.SetCL(alpha);
168
169
tr
.SetPoissonBkgKnownEff(
x
,
y
,tau,
e
);
170
tr
.GetLimits(ll,
ul
);
171
172
cout <<
"For model 4 : Poissonian / Known"
<< endl;
173
cout <<
"the Profile Likelihood interval is :"
<< endl;
174
cout <<
"["
<< ll <<
","
<<
ul
<<
"]"
<< endl;
175
176
//-----------------------------------------------
177
// Model 5 assumes:
178
//
179
// Gaussian uncertainty in the background estimate
180
// Known efficiency
181
//
182
cout << endl<<
" ======================================================== "
<<endl;
183
mid
=5;
184
bm
= 0;
// measured background expectation
185
x
= 1 ;
// events in the signal region
186
e
= 0.65;
// known eff
187
sdb
= 1.0;
// standard deviation of background estimate
188
alpha =0.799999;
// Confidence Level
189
190
tr
.SetCL(alpha);
191
192
tr
.SetGaussBkgKnownEff(
x
,
bm
,
sdb
,
e
);
193
tr
.GetLimits(ll,
ul
);
194
195
cout <<
"For model 5 : Gaussian / Known"
<< endl;
196
cout <<
"the Profile Likelihood interval is :"
<< endl;
197
cout <<
"["
<< ll <<
","
<<
ul
<<
"]"
<< endl;
198
199
//-----------------------------------------------
200
// Model 6 assumes:
201
//
202
// Known background
203
// Binomial uncertainty in the efficiency estimate
204
//
205
cout << endl<<
" ======================================================== "
<<endl;
206
mid
=6;
207
b
= 10;
// known background
208
x
= 25;
// events in the signal region
209
z = 500;
// Number of observed signal MC events
210
m
= 750;
// Number of produced MC signal events
211
alpha =0.9;
// Confidence L evel
212
213
tr
.SetCL(alpha);
214
215
tr
.SetKnownBkgBinomEff(
x
, z,
m
,
b
);
216
tr
.GetLimits(ll,
ul
);
217
218
cout <<
"For model 6 : Known / Binomial"
<< endl;
219
cout <<
"the Profile Likelihood interval is :"
<< endl;
220
cout <<
"["
<< ll <<
","
<<
ul
<<
"]"
<< endl;
221
222
//-----------------------------------------------
223
// Model 7 assumes:
224
//
225
// Known Background
226
// Gaussian uncertainty in the efficiency estimate
227
//
228
cout << endl<<
" ======================================================== "
<<endl;
229
mid
=7;
230
x
= 15;
// events in the signal region
231
em
= 0.77;
// measured efficiency
232
sde
= 0.15;
// standard deviation of efficiency estimate
233
b
= 10;
// known background
234
alpha =0.95;
// Confidence L evel
235
236
y
= 1;
237
238
tr
.SetCL(alpha);
239
240
tr
.SetKnownBkgGaussEff(
x
,
em
,
sde
,
b
);
241
tr
.GetLimits(ll,
ul
);
242
243
cout <<
"For model 7 : Known / Gaussian "
<< endl;
244
cout <<
"the Profile Likelihood interval is :"
<< endl;
245
cout <<
"["
<< ll <<
","
<<
ul
<<
"]"
<< endl;
246
247
//-----------------------------------------------
248
// Example of bounded and unbounded likelihood
249
// Example for Model 1
250
251
bm
= 0.0;
252
tau = 5;
253
mid
= 1;
254
m
= 100;
255
z = 90;
256
y
= 15;
257
x
= 0;
258
alpha = 0.90;
259
260
tr
.SetCL(alpha);
261
tr
.SetPoissonBkgBinomEff(
x
,
y
,z,tau,
m
);
262
tr
.SetBounding(
true
);
//bounded
263
tr
.GetLimits(ll,
ul
);
264
265
cout <<
"Example of the effect of bounded vs unbounded, For model 1"
<< endl;
266
cout <<
"the BOUNDED Profile Likelihood interval is :"
<< endl;
267
cout <<
"["
<< ll <<
","
<<
ul
<<
"]"
<< endl;
268
269
270
tr
.SetBounding(
false
);
//unbounded
271
tr
.GetLimits(ll,
ul
);
272
273
cout <<
"the UNBOUNDED Profile Likelihood interval is :"
<< endl;
274
cout <<
"["
<< ll <<
","
<<
ul
<<
"]"
<< endl;
275
}
b
#define b(i)
Definition
RSha256.hxx:100
e
#define e(i)
Definition
RSha256.hxx:103
Riostream.h
Int_t
int Int_t
Definition
RtypesCore.h:45
Double_t
double Double_t
Definition
RtypesCore.h:59
TRangeDynCast
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Definition
TCollection.h:358
TROOT.h
TRolke.h
TSystem.h
ROOT::Detail::TRangeCast
Definition
TCollection.h:311
TRolke
<div class="legacybox"><h2>Legacy Code</h2> TRolke is a legacy interface: there will be no bug fixes ...
Definition
TRolke.h:34
y
Double_t y[n]
Definition
legend1.C:17
x
Double_t x[n]
Definition
legend1.C:17
m
TMarker m
Definition
textangle.C:8
tutorials
legacy
math
Rolke.C
ROOT master - Reference Guide Generated on Mon Apr 28 2025 16:34:46 (GVA Time) using Doxygen 1.10.0