Auxiliary progrom to determine number of signal events for given background and number of standard deviations.
20{
23
25 double stdev;
26 double precision;
28
29 try {
30
31 JParser<> zap(
"Auxiliary progrom to determine number of signal events for given background and number of standard deviations.");
32
37
38 zap(argc, argv);
39 }
40 catch(const exception &error) {
41 FATAL(error.what() << endl);
42 }
43
44 const double STDEV_MIN = 1.0;
45 const double STDEV_MAX = 7.0;
46
47 if (stdev < STDEV_MIN || stdev > STDEV_MAX) {
48 FATAL(
"Number of standard deviations out of range [" << STDEV_MIN <<
"," << STDEV_MAX <<
"]" << endl);
49 }
50
51 const double P =
getP(stdev);
52
53 cout <<
"probability: " <<
SCIENTIFIC(12,3) << P << endl;
54
55
57
58 TH1D h0("h0", NULL, 500, -2.0, 2.0);
59 TH1D h1("h1", NULL, 500, -2.0, 2.0);
60
61 for (Int_t ix = 1; ix <= h1.GetXaxis()->GetNbins(); ++ix) {
62
63 const double x =
pow(10.0, h1.GetXaxis()->GetBinCenter(ix));
64
65 const size_t n =
getNs(x, P);
66 const double f =
getFs(x, P, precision);
67
69 <<
" n = " <<
FIXED(7,3) << n - x
70 <<
" f = " <<
FIXED(7,3) << f - x << endl);
71
72 h1.SetBinContent(ix, n - x);
73 h1.SetBinContent(ix, f - x);
74 }
75
76 out.Write();
77 out.Close();
78}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Utility class to parse command line options.
double getP(const double expval, bool hit)
Get Poisson probability to observe a hit or not for given expectation value for the number of hits.
size_t getNs(const double background, const double P)
Get minimal number of events to exceed Poisson probability given number of background events.
T pow(const T &x, const double y)
Power .
double getFs(const double background, const double P, const double precision)
Get minimal number of events to exceed Poisson probability given number of background events.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.
Auxiliary data structure for floating point format specification.