xeboris / polepp Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/polepp
Automatically exported from code.google.com/p/polepp
************************************************** * * * 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
On a Linux box I typed 'make', which created 'libpolelib.so'.
Typing 'make tools' as suggested in the README file did not
create any binaries in the bin directory, as I imagine it should.
lfs1> make
make[1]: Entering directory
`/lfs/l1/hess/users/deil/bin/HESSSurveyBin/POLEPP-1.0.0'
**** src ****
make[2]: Entering directory
`/lfs/l1/hess/users/deil/bin/HESSSurveyBin/POLEPP-1.0.0/src'
Compiling Pdf.cxx
Compiling Coverage.cxx
Compiling Random.cxx
Compiling Tools.cxx
Linking libpolelib.so
make[2]: Leaving directory
`/lfs/l1/hess/users/deil/bin/HESSSurveyBin/POLEPP-1.0.0/src'
**** tools/polelim ****
make[2]: Entering directory
`/lfs/l1/hess/users/deil/bin/HESSSurveyBin/POLEPP-1.0.0/tools/polelim'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory
`/lfs/l1/hess/users/deil/bin/HESSSurveyBin/POLEPP-1.0.0/tools/polelim'
make[1]: Leaving directory
`/lfs/l1/hess/users/deil/bin/HESSSurveyBin/POLEPP-1.0.0'
lfs1> make tools
make: Nothing to be done for `tools'.
lfs1> ls -lh bin/
total 0
lfs1> ls -lh lib/
total 0
-rwxr-xr-x 1 deil hfm 775K 2011-06-23 12:42 libpolelib.so
Original issue reported on code.google.com by [email protected]
on 23 Jun 2011 at 10:46
It would be nice if the documentation of the tools were available from the
doxygen html page, which explains the statistical method used.
As a newcomer I find it hard to understand what tools are available and what
they do.
E.g. the doxygen html page lists (but doesn't describe) four tools:
polelim
polecov
polebelt
poleconst
The README explains two tools: polelim, polecov
Actually there are six tools:
$ ls -1 tools
polebelt
polecomb
poleconst
polecov
polelim
polepow
But only polelim and polecov are build by default.
What do the other tools do? Are they only for internal debugging or useful for
users?
Original issue reported on code.google.com by [email protected]
on 1 Jul 2011 at 3:52
I tried running the polelim example in the README file, which resulted in the
following error:
$ ./polelim --effdist 0 --bkgdist 2 --bkgmeas 2 --bkgsigma 0.5 --nobs 4
Tools::calcIntRange() -> Unknown pdf type = 999
================ P O L E ==================
1.0 - conf. level : 0.1
N observed : 4
----------------------------------------------
Coverage friendly : No
True signal : 1
----------------------------------------------
Efficiency meas : 1
Efficiency sigma : 0.2
Efficiency dist : Undefined
Efficiency scale : 1
----------------------------------------------
Background meas : 2
Background sigma : 0.5
Background dist : Gauss
Background scale : 1
----------------------------------------------
Bkg-Eff correlation: 0
----------------------------------------------
GSL int. N(calls) : 100
----------------------------------------------
Int. eff. min : 0
max : 5
----------------------------------------------
Int. bkg. min : 0
max : 5
----------------------------------------------
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.01
Max N, mu_best : 20
----------------------------------------------
Method : FHC2
----------------------------------------------
Verbosity : 0
----------------------------------------------
Parameters prefixed with a * above are not
relevant for limit calculations.
==============================================
gsl: vegas.c:128: ERROR: xu must be greater than xl
Default GSL error handler invoked.
Abort trap
For some of the other examples I get slightly different output, in some cases
because default values have changed,
For one example I get a slightly different upper limit:
./polelim --nobs 30
result in [ 17.812500, 47.708691 ]
whereas the README file states [ 17.81, 47.66 ]
Original issue reported on code.google.com by [email protected]
on 1 Jul 2011 at 3:56
There seems to be a slight system dependancy on the result. Need to nail this
down...
Original issue reported on code.google.com by [email protected]
on 8 Jul 2011 at 9:38
I am trying to build polepp on Mac OS 10.6.
--- Issue 1:
make results in the following errors:
**** src ****
Compiling Pdf.cxx
In file included from Pdf.cxx:2:
Pdf.h: In member function 'const double PDF::Gamma::raw(double, double, double)
const':
Pdf.h:822: error: 'isinf' was not declared in this scope
Pdf.h:822: error: 'isnan' was not declared in this scope
Pdf.h: In member function 'const double PDF::Poisson::raw(int, double) const':
Pdf.h:866: error: 'isinf' was not declared in this scope
Pdf.h:866: error: 'isnan' was not declared in this scope
Pdf.h:871: error: 'isnan' was not declared in this scope
make[2]: *** [.linux/Pdf.o] Error 1
make[1]: *** [src] Error 2
make: *** [all] Error 2
The problem is that isinf and isnan are in namespace std, writing std::isinf
and std::isnan everywhere solves this problem.
--- Issue 2:
GSL is installed on my system in /opt/local/include and /opt/local/lib.
At the moment I get the following error:
**** src ****
Compiling Coverage.cxx
In file included from Pole.h:52,
from Coverage.h:19,
from Coverage.cxx:13:
Integrator.h:8:26: error: gsl/gsl_math.h: No such file or directory
...
How can I include that info in the Makefile?
Can you add this info to the install instructions?
--- Issue 3:
make doc fails with the following error:
Doxygenating
warning: Tag `MAX_DOT_GRAPH_WIDTH' at line 146 of file Doxyfile has become
obsolete.
To avoid this warning please update your configuration file using "doxygen -u"
warning: Tag `MAX_DOT_GRAPH_HEIGHT' at line 147 of file Doxyfile has become
obsolete.
To avoid this warning please update your configuration file using "doxygen -u"
error: tag OUTPUT_DIRECTORY: Output directory
`/afs/cern.ch/user/t/tegen/www/statistics/PoleLibDoxy' does not exist and
cannot be created
Exiting...
make: *** [doc] Error 1
Removing the hardcoded directory fixes the problem, i.e. change line 8 of
Doxyfile to
OUTPUT_DIRECTORY =
and the doc will be built in doxy-html.
I'm looking forward to using the tools once I manage to build them. :-)
Original issue reported on code.google.com by [email protected]
on 22 Jun 2011 at 10:24
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.