Jpp 20.0.0-rc.9-22-g74b57fa79
the software that should make you happy
Loading...
Searching...
No Matches
JExperiment.hh
Go to the documentation of this file.
1#ifndef __JASTRONOMY__JEXPERIMENT__
2#define __JASTRONOMY__JEXPERIMENT__
3
4#include "TObject.h"
5#include "TH1.h"
6#include "TH2.h"
7#include "TH3.h"
8#include "TAxis.h"
9#include "TMath.h"
10
11
12/**
13 * \file
14 *
15 * Experiment.
16 * \author mdejong
17 */
18namespace JASTRONOMY {}
19namespace JPP { using namespace JASTRONOMY; }
20
21namespace JASTRONOMY {
22
23 /**
24 * Auxiliary base class for experiment.
25 */
27 {
28 /**
29 * Get minimal signa-to-noise ratio.
30 *
31 * \return signa-to-noise ratio.
32 */
33 static double getSNR()
34 {
35 return get_snr();
36 }
37
38
39 /**
40 * Set minimal signa-to-noise ratio.
41 *
42 * \param value signa-to-noise ratio.
43 */
44 static void setSNR(const double value)
45 {
46 get_snr() = value;
47 }
48
49
50 /**
51 * Check validity of signal and background.
52 *
53 * \param s signal
54 * \param b background
55 * compare significance expectation for 1 bin with cut value
56 * \return true if signal and backgroud are valid; else false
57 */
58 static bool check(const double s, const double b)
59 {
60 return (s > 0.0 && b > 0.0 && (s+s*s)/(b+b*b) >= getSNR()); //E(S^2) / E(B^2) for Poisson distribution
61 }
62
63
64 /**
65 * Check histogram bins.
66 *
67 * \param ha histogram axis
68 * \param hb histogram axis
69 * \return true if same binning; else false
70 */
71 static bool check(const TAxis* ha, const TAxis* hb)
72 {
73 return (ha->GetNbins() == hb->GetNbins() &&
74 ha->GetXmin() == hb->GetXmin() &&
75 ha->GetXmax() == hb->GetXmax());
76 }
77
78 /**
79 * Check histogram bins.
80 *
81 * \param ha histogram
82 * \param hb histogram
83 * \return true if same binning; else false
84 */
85 static bool check(const TH1& ha, const TH1& hb)
86 {
87 return check(ha.GetXaxis(), hb.GetXaxis());
88 }
89
90
91 /**
92 * Check histogram bins.
93 *
94 * \param ha histogram
95 * \param hb histogram
96 * \return true if same binning; else false
97 */
98 static bool check(const TH2& ha, const TH2& hb)
99 {
100 return (check(ha.GetXaxis(), hb.GetXaxis()) &&
101 check(ha.GetYaxis(), hb.GetYaxis()));
102 }
103
104
105 /**
106 * Check histogram bins.
107 *
108 * \param ha histogram
109 * \param hb histogram
110 * \return true if same binning; else false
111 */
112 static bool check(const TH3& ha, const TH3& hb)
113 {
114 return (check(ha.GetXaxis(), hb.GetXaxis()) &&
115 check(ha.GetYaxis(), hb.GetYaxis()) &&
116 check(ha.GetZaxis(), hb.GetZaxis()));
117 }
118
119 private:
120 /**
121 * Get minimal signa-to-noise ratio.
122 *
123 * \return signa-to-noise ratio.
124 */
125 static double& get_snr()
126 {
127 static double value = 0.0;
128
129 return value;
130 }
131 };
132}
133
134#endif
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary base class for experiment.
static double getSNR()
Get minimal signa-to-noise ratio.
static bool check(const TH1 &ha, const TH1 &hb)
Check histogram bins.
static bool check(const TAxis *ha, const TAxis *hb)
Check histogram bins.
static bool check(const TH3 &ha, const TH3 &hb)
Check histogram bins.
static bool check(const TH2 &ha, const TH2 &hb)
Check histogram bins.
static double & get_snr()
Get minimal signa-to-noise ratio.
static void setSNR(const double value)
Set minimal signa-to-noise ratio.
static bool check(const double s, const double b)
Check validity of signal and background.