-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathREADME
More file actions
578 lines (417 loc) · 18.4 KB
/
README
File metadata and controls
578 lines (417 loc) · 18.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
**************************************************
* *
* Created : 2006-02-16 *
* Author : Fredrik Tegenfeldt, CERN *
* Modified : 2006-11-07 *
* Major revision. *
* *
**************************************************
This is a short version of a 'manual'. The intention is to include this in the doxygen
documentation with somewhat more fancy layout.
The contents for now is:
I Installation
II Tools
III Input options, polelim
IV Input options, polecov
V Example, polelim
VI Example, polecov
VII Scripts
VIII Known issues
I. INSTALLATION
==============
1. untar file. The files will be created in current directory.
tar -xzvf polelib.tgz
2. compile
make
3. to run the code, you need to make the library available.
This can be done by copying libPole++.so to /usr/lib or similar (need to be root).
Otherwise, you can add the current directory to the library path:
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:.
or in bash:
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:.
Now it should be possible to run polelim or polecov.
4. To clean up:
make clean
II. TOOLS
==========
1. polelim: limit calculator
2. polecov: coverage calculator
3. poleconst: calculates only the likelihood ratio construction in (s_hyp,N) plane
4. polebelt: calculates the confidence belt
To create these tools, do
make tools
III. INPUT OPTIONS, POLELIM
============================
The tools polelim, poleconst and polebelt all have the same options.
Their options are all defined in the file argsPole.cxx.
Running polelim with option --help yields:
USAGE:
./polelim [-l <int>] [-f <string>] [-V <int>] [--poisnx <int>]
[--poisnm <int>] [--poismax <float>] [--poismin <float>]
[--bkgintn <int>] [--bkgintscale <float>] [--effintn <int>]
[--effintscale <float>] [--hstep <float>] [--hmax <float>]
[--hmin <float>] [--threshprec <float>] [--threshbs <float>]
[--nmus <float>] [--dmus <float>] [--corr <float>]
[--bkgscale <float>] [--bkgdist <int>] [--bkgmeas <float>]
[--bkgsigma <float>] [--effscale <float>] [--effdist <int>]
[--effmeas <float>] [--effsigma <float>] [--minp <float>]
[-K] [-m <int>] [--strue <float>] [--cl <float>] [--nobs
<int>] [--] [-v] [-h]
III.1 Minimum requirements
--------------------------
Pole calculates the confidence interval of a given confidence level from the following information:
* Number of observed events
--nobs <int> : default is 1
* Method
-m or --method <int> : 1 - FHC2 (default), 2 - MBT
* Confidence level
--cl <float> : default is 0.90
* Efficiency
--effmeas <float> : measured mean
--effdist <float> : assumed distribution
--effsigma <float> : measured uncertainty
* Background
--bkgmeas <float> : measured mean
--bkgdist <float> : assumed distribution
--bkgsigma <float> : measured uncertainty
* Correlation coefficient between eff and bkg:
--corr <float> : is in the range of [-1,1]
The distributions above are:
0 - none
1 - poisson
2 - gauss
3 - flat
4 - log normal
5 - 2d gauss, that is, use --corr; eff and bkg correlated
------------------------------------------------------------------
An alternative way of inputting data is by file. This is not yet well developed.
See the function Pole::exeFromFile().
* Filename
-f <string> : data file name - see/modify Pole::exeFromFile()
-l <int> : number of lines to read from input file
If -f is used --nobs, --eff/bkg{meas,dist,sigma} are ignored
III.2 Precision related
-----------------------
There are several other parameters to control the precision of integrals, limit scan etc.
* Integral over aposteriori efficiency distribution:
--effn <float : number of points, default = 21
--effscale <float> : integrate between [ mean-scale*sigma, mean+scale*sigma ]
where mean == --effmeas and sigma = --effsigma
default = 5.0
* Ditto for background integration:
--bkgn <float> : see above
--bkgscale <float> : see above
* Finding s_best - only used when method is FHC2
--dmus <float> : step size in search, usually fine with 0.01
increase or reduce depending on requirements in precision or speed.
--nmus <float> : maximum number of steps - using the given step size, the number of steps is not allowed
to be greater than nmus. default = 100
* Search threshholds
--threshbs <float> : minimum relative change in hypothesis in the binary search for the limit
default = 0.0001
--threshalpha <float> : minimum relative diff in alpha to required alpha = 1-cl
default = 0.0001
The binary search stops whenever one of the above conditions are met.
* Probability threshhold
--minp <float> : minimum probability p(n|H) considered when calculating the belt
automatically set depending on the selected CL
* Poisson table; for speed, the poisson table is tabulated for a range of N and mean values.
This only makes sense if many points are to be caclulated.
When reading the table, 2nd order derivative corrections are applied.
--poisnx <int> : maximum N
default = 200
--poisnm <int> : number of mean values
default = 100000
--poismin <float> : minimum mean
default = 0.0
--poismax <float> : maximum mean
default = 100.0
NOTE: if large N or mean values are used, it might fail due to limited memory.
-K : do not tabulate poisson - rarely needed but can be good to check that the
poisson table is accurate enough
III.3 Various options
---------------------
-V or --verbose <int> : verbose mode; mainly for debugging. Output may be confusing...
-v or --version : print version
-h or --help : print help
III.4 Extras - NOT USED WHEN CALCULATING LIMITS
-----------------------------------------------
* Confidence belt construct.
Relevant when calculating the construct or belt (polebelt and poleconst tools).
--hstep <float> : hypothesis step size
--hmin <float> : minimum
--hmax <float> : maximum
The following options are now obsolete:
--strue
IV. INPUT OPTIONS, POLECOV
===========================
Running polecov --help gives:
USAGE:
./polecov [--poisnx <int>] [--poisnm <int>] [--poismax <float>]
[--poismin <float>] [--bkgn <int>] [--bscale <float>] [--effn
<int>] [--effscale <float>] [--hstep <float>] [--hmax
<float>] [--hmin <float>] [--threshalpha <float>] [--threshbs
<float>] [--nmus <float>] [--dmus <float>] [--corr <float>]
[--bkgstep <float>] [--bkgmax <float>] [--bkgmin <float>]
[--bkgsigma <float>] [--bkgdist <int>] [--effstep <float>]
[--effmax <float>] [--effmin <float>] [--effsigma <float>]
[--effdist <int>] [--sstep <float>] [--smax <float>] [--smin
<float>] [-P <int>] [-V <int>] [--dump <string>] [--minp
<float>] [-S] [-C] [-K] [-m <int>] [--cl <float>] [--rseedofs
<int>] [--rseed <int>] [--nloops <int>] [--] [-v] [-h]
polecov calculates the coverage over a given range of parameters.
It accepts largely the same arguments as for polelim.
The specifics for polecov are described below.
*The program can scan over:
1. true signal
--smin : min signal
--smax : max signal
--sstep : step size
2. efficiency:
--emin, --emax, --estep
--effdist: distribution (not scanable...)
3. background
--bmin, --bmax, --bstep, --bkgdist
Number of loops
--nloops : number of MC experiments (default = 1), usually 1000 is enough, increase the number for increased precision
Random number generator
--rseed : set the random number seed; if not set, a seed is set based on the time
--rseedofs : seed offset (not really used)
It is possible to fix the N(obs) in each experiment:
-S or --fixsig
Control the usage of tabulated poisson:
-K or --notab : do not use the table
Verbosity:
-P or --verbpol : set verbosity level for the pole part
-V or --verbcov : ditto for the coverage
Statistics:
--dump : dump file prefix
-C, --stats : collect statistics - will take longer time since it will always calculate the full limits
* The output
For each point calculated a line is printed as follows:
DATA: <s(true)> <eff> <sigma(eff)> <bkg> <sigma(bkg)> <corr> <coverage> <coverage uncertainty> <number of loops done> <max n(loops)> <time in ms>
From the logfile, a tabulated file can be obtained using the following:
grep "DATA:" <logfile> | cut -d ":" -f 2 > output.dat
The coverage can then be plotted using, e.g, gnuplot.
* Special features
1. Process signal handling:
SIGINT (ctrl-c) : stops the program and prints out the latest result
SIGUSR1 : prints out a "STATUS:" line which has the same contents as "DATA:"
2. Run time estimations:
After a certain time, the code will print out a time estimation based on the performance so far.
This estimation is rather a lower limit as the time per point varies with the values of the parameters.
V. EXAMPLE POLELIM
===================
* Running the polelim with default parameters:
---------------------------------------------------------------------
--- Tabulating pdf <Poisson>
--- N(X) = 201
--- min = 0
--- max = 200
--- N(mean) = 100000
--- min = 0
--- max = 100
--- N(sigma) = 1
--- min = 0
--- max = 0
---------------------------------------------------------------------
--- Tabulating ... be patient
--- Tabulating DONE!
================ P O L E ==================
1.0 - conf. level : 0.1
N observed : 1
----------------------------------------------
Coverage friendly : No
True signal : 1
----------------------------------------------
Efficiency meas : 1
Efficiency sigma : 0.2
Efficiency dist : Gauss
Efficiency scale : 1
----------------------------------------------
Background meas : 0
Background sigma : 0
Background dist : None
Background scale : 1
----------------------------------------------
Bkg-Eff correlation: 0
----------------------------------------------
Int. eff. min : 0
Int. eff. max : 2
Int. eff. N pts : 21
----------------------------------------------
Int. bkg. min : 0
Int. bkg. max : 0
Int. bkg. N pts : 1
----------------------------------------------
Binary search thr. : 0.0001
1-CL threshold : 0.0001
Min prob in belt : 0.001
----------------------------------------------
*Test hyp. min : 0
*Test hyp. max : 35
*Test hyp. step : 0.01
----------------------------------------------
Step mu_best : 0.002
Max N, mu_best : 100
----------------------------------------------
Method : FHC2
----------------------------------------------
Verbosity : 0
----------------------------------------------
Parameters prefixed with a * above are not
relevant for limit calculations.
==============================================
*--------------------------------------------------*
* Precision of lower limit = 0.000007
* upper limit = 0.002139
*
* Limits = [ 0.105591, 4.639010 ]
*--------------------------------------------------*
* Fixed efficiency, gaussian backgound:
./polelim --effdist 0 --bkgdist 2 --bkgmeas 2 --bkgsigma 0.5 --nobs 4
=> [0.00,6.94]
* Very large N(obs)
./polelim --nobs 30
=> Used to fail in previous versions. Due to the binary search approach, this does not fail anymore.
=> [ 17.81, 47.66 ]
VI. EXAMPLE POLECOV
====================
* Running polecov with default settings:
---------------------------------------------------------------------
--- Tabulating pdf <Poisson>
--- N(X) = 201
--- min = 0
--- max = 200
--- N(mean) = 100000
--- min = 0
--- max = 100
--- N(sigma) = 1
--- min = 0
--- max = 0
---------------------------------------------------------------------
--- Tabulating ... be patient
--- Tabulating DONE!
==============C O V E R A G E=================
Random seed : 1162916891
Number of loops : 1
Collect statistics : No
----------------------------------------------
Signal min : 1
Signal max : 1
Signal step : 0
Signal N : 1
Signal fixed : No
----------------------------------------------
Efficiency min : 1
Efficiency max : 1
Efficiency step : 0
Efficiency sigma : 0.2
Efficiency dist : Gauss
----------------------------------------------
Background min : 0
Background max : 0
Background step : 0
Background sigma : 0
Background dist : None
----------------------------------------------
Correlated bkg,eff : No
==============================================
Start of run: 07/11/2006 17:28:12
#==================================================================================================================
# Signal | Efficiency | Background | Coverage | Loops | Time
# | mean sigma | mean sigma | mean sigma | done max | [ms]
#==================================================================================================================
COVERAGE: 1.000000 1.000000 0.200000 0.000000 0.000000 1.000000 0.000000 1 1 10.00
>>>Limit calculation failure rate: 0
End of run: 07/11/2006 17:28:12
* Scanning several parameters:
> ./polecov --smin 1.0 --smax 5.0 --sstep 1.0 --dmus 0.1 --nloops 1000
---------------------------------------------------------------------
--- Tabulating pdf <Poisson>
--- N(X) = 201
--- min = 0
--- max = 200
--- N(mean) = 100000
--- min = 0
--- max = 100
--- N(sigma) = 1
--- min = 0
--- max = 0
---------------------------------------------------------------------
--- Tabulating ... be patient
--- Tabulating DONE!
==============C O V E R A G E=================
Random seed : 1157036928
Number of loops : 1000
Collect statistics : No
----------------------------------------------
Signal min : 1
Signal max : 5
Signal step : 1
Signal N : 5
Signal fixed : No
----------------------------------------------
Efficiency min : 1
Efficiency max : 1
Efficiency step : 0
Efficiency sigma : 0.2
Efficiency dist : Gauss
----------------------------------------------
Background min : 0
Background max : 0
Background step : 0
Background sigma : 0
Background dist : None
----------------------------------------------
Correlated bkg,eff : No
==============================================
tart of run: 07/11/2006 17:29:51
#==================================================================================================================
# Signal | Efficiency | Background | Coverage | Loops | Time
# | mean sigma | mean sigma | mean sigma | done max | [ms]
#==================================================================================================================
COVERAGE: 1.000000 1.000000 0.200000 0.000000 0.000000 0.946000 0.007147 1000 1000 250.00
COVERAGE: 2.000000 1.000000 0.200000 0.000000 0.000000 0.979000 0.004534 1000 1000 490.00
COVERAGE: 3.000000 1.000000 0.200000 0.000000 0.000000 0.944000 0.007271 1000 1000 740.00
COVERAGE: 4.000000 1.000000 0.200000 0.000000 0.000000 0.945000 0.007209 1000 1000 1050.00
COVERAGE: 5.000000 1.000000 0.200000 0.000000 0.000000 0.961000 0.006122 1000 1000 1430.00
>>>Limit calculation failure rate: 0
End of run: 07/11/2006 17:29:55
* A long run first checked with kill -USR1 <process id>
polecov --nloops 10000
---------------------------------------------------------------------
< SAME BEGINNING AS BEFORE>
Estimated end of run: 31/08/2006 17:12:19 ( 0h 0m 23s )
#==================================================================================================================
# Signal | Efficiency | Background | Coverage | Loops | Time
# | mean sigma | mean sigma | mean sigma | done max | [ms]
#==================================================================================================================
STATUS: 1.000000 0.668974 0.200000 0.000000 0.000000 0.944142 0.003791 3670 10000 8540.00
WARNING (31/08/2006 17:12:08 ) Job aborting (signal = 2 ). Will output data from unfinnished loop.
DATA: 1.000000 1.103927 0.200000 0.000000 0.000000 0.943144 0.003220 5171 10000 12090.00
---------------------------------------------------------------------
The STATUS: line is printed whenever polecov receives a SIGUSR1 signal (eg through kill -USR1 <pid> ).
With a ctrl-c (or kill -2 <pid>) the running is aborted and the current result is printed out.
VII. SCRIPTS
=============
The tools polebelt and poleconst produces output which needs processing for plotting.
A few scripts exists which will do the processing and plotting.
1. log2construct.csh <log file>
The script processes the log file containing the output from poleconst and produces
a ROOT readable text file (construct.dat)
2. log2confbelt.csh <log file>
The script processes the log file containing the output from polebelt and produces
a ROOT readable text file (confbelt.dat)
3. plotconst.C
Reads <construct.dat> and plots the likelihood ratio construction in (s_hyp,N) plane
4. plotconfbelt.C
Reads <confbelt.dat> and plots the confidence belt.
Takes as arguments (Nobs, lower limit, upper limit).
If given, the intersection lines are drawn -> useful to verify result.
5. plotprob.C
Reads <construct.dat> and plots the probability at each point in (s_hyp,N) plane
VIII. KNOWN ISSUES
==================
The previous issues have been fixed.
1. Combined measurements - numerically tricky - does not work now