Jpp 20.0.0-rc.8
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
10
11/**
12 * \file
13 *
14 * Experiment.
15 * \author mdejong
16 */
17namespace JASTRONOMY {}
18namespace JPP { using namespace JASTRONOMY; }
19
20namespace JASTRONOMY {
21
22 /**
23 * Auxiliary base class for experiment.
24 */
26 {
27 /**
28 * Get minimal signa-to-noise ratio.
29 *
30 * \return signa-to-noise ratio.
31 */
32 static double getSNR()
33 {
34 return get_snr();
35 }
36
37
38 /**
39 * Set minimal signa-to-noise ratio.
40 *
41 * \param value signa-to-noise ratio.
42 */
43 static void setSNR(const double value)
44 {
45 get_snr() = value;
46 }
47
48
49 /**
50 * Check validity of signal and background.
51 *
52 * \param s signal
53 * \param b background
54 * \return true if signal and backgroud are valid; else false
55 */
56 static bool check(const double s, const double b)
57 {
58 return (s > 0.0 && b > 0.0 && s/b >= getSNR());
59 }
60
61
62 /**
63 * Check histogram bins.
64 *
65 * \param ha histogram axis
66 * \param hb histogram axis
67 * \return true if same binning; else false
68 */
69 static bool check(const TAxis* ha, const TAxis* hb)
70 {
71 return (ha->GetNbins() == hb->GetNbins() &&
72 ha->GetXmin() == hb->GetXmin() &&
73 ha->GetXmax() == hb->GetXmax());
74 }
75
76 /**
77 * Check histogram bins.
78 *
79 * \param ha histogram
80 * \param hb histogram
81 * \return true if same binning; else false
82 */
83 static bool check(const TH1& ha, const TH1& hb)
84 {
85 return check(ha.GetXaxis(), hb.GetXaxis());
86 }
87
88
89 /**
90 * Check histogram bins.
91 *
92 * \param ha histogram
93 * \param hb histogram
94 * \return true if same binning; else false
95 */
96 static bool check(const TH2& ha, const TH2& hb)
97 {
98 return (check(ha.GetXaxis(), hb.GetXaxis()) &&
99 check(ha.GetYaxis(), hb.GetYaxis()));
100 }
101
102
103 /**
104 * Check histogram bins.
105 *
106 * \param ha histogram
107 * \param hb histogram
108 * \return true if same binning; else false
109 */
110 static bool check(const TH3& ha, const TH3& hb)
111 {
112 return (check(ha.GetXaxis(), hb.GetXaxis()) &&
113 check(ha.GetYaxis(), hb.GetYaxis()) &&
114 check(ha.GetZaxis(), hb.GetZaxis()));
115 }
116
117 private:
118 /**
119 * Get minimal signa-to-noise ratio.
120 *
121 * \return signa-to-noise ratio.
122 */
123 static double& get_snr()
124 {
125 static double value = 0.0;
126
127 return value;
128 }
129 };
130}
131
132#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.