SpectrumStats.hh
1 |
#ifndef FLUX_SPECTRUMSTATS_HH
|
---|---|
2 |
#define FLUX_SPECTRUMSTATS_HH
|
3 |
|
4 |
#include "SpectrumConstants.hh" |
5 |
|
6 |
namespace Flux {
|
7 |
|
8 |
/**
|
9 |
* \brief Container for counts and exposure information in an energy / time bin.
|
10 |
*
|
11 |
* \author Heidelberg team
|
12 |
*
|
13 |
* \todo SpectrumStats should be a subclass of Tools::EventStats,
|
14 |
* instead of copy & pasting code.
|
15 |
* There is some subtle error handling in methods like SignificanceUnchecked
|
16 |
* or Excess and copying will eventually lead to different behavior of
|
17 |
* calling this method on a SpectrumStats and an EventStats, which is bad.
|
18 |
*
|
19 |
*/
|
20 |
class SpectrumStats { |
21 |
|
22 |
public:
|
23 |
|
24 |
SpectrumStats(); |
25 |
inline virtual ~SpectrumStats() {} |
26 |
|
27 |
virtual void Clear(); |
28 |
|
29 |
virtual double GetField(std::string field) const; |
30 |
virtual void SetField(std::string field, double value); |
31 |
|
32 |
bool Compare(const SpectrumStats& rhs) const; |
33 |
bool operator==(const SpectrumStats& rhs) const; |
34 |
bool operator!=(const SpectrumStats& rhs) const; |
35 |
void Add(const SpectrumStats& rhs); |
36 |
SpectrumStats& operator+=(const SpectrumStats& rhs); |
37 |
SpectrumStats operator+(const SpectrumStats& rhs) const; |
38 |
|
39 |
double Alpha() const; |
40 |
double AlphaUnchecked() const; |
41 |
double Significance() const; |
42 |
double SignificanceUnchecked() const; |
43 |
double Excess() const; |
44 |
double ExcessError() const; |
45 |
double ExcessErrorUp() const; |
46 |
double ExcessErrorDown() const; |
47 |
double FracError() const; |
48 |
double FracErrorUp() const; |
49 |
double FracErrorDown() const; |
50 |
double ExcessSensitivity(double cl=DEFAULT_CL) const; |
51 |
void ExcessLimits(double& excess_down, double& excess_up, double cl=DEFAULT_CL) const; |
52 |
void ZeroExcessLimits(double& excess_down, double& excess_up, double cl=DEFAULT_CL) const; |
53 |
double Background() const; |
54 |
|
55 |
void SetPrintPrefix(std::string prefix){ fPrintPrefix = prefix; } |
56 |
virtual void print(std::ostream& os) const; |
57 |
|
58 |
public:
|
59 |
// Counts
|
60 |
int nOn; ///< On region event count |
61 |
int nOff; ///< Off region event count |
62 |
|
63 |
// Relative background exposure
|
64 |
double exposureOn; ///< On region hadron exposure |
65 |
double exposureOff; ///< Off region hadron exposure |
66 |
|
67 |
// Gamma exposure
|
68 |
double trueAreaTimeOn; ///< On region gamma true exposure |
69 |
double trueAreaTimeOff; ///< Off region gamma true exposure |
70 |
|
71 |
double recoAreaTimeOn; ///< On region gamma reco exposure |
72 |
double recoAreaTimeOff; ///< Off region gamma reco exposure |
73 |
|
74 |
// For EventWeighted flux point computation
|
75 |
double liveTime; ///< Livetime |
76 |
double offLiveTime; ///< offLiveTime |
77 |
// The following two numbers are sums of inverse effective
|
78 |
// areas of events collected in the given livetime.
|
79 |
double invRecoAreaOn; ///< On region Sum(1/A_i) |
80 |
double invRecoAreaOff; ///< Off region Sum(1/A_i) |
81 |
|
82 |
protected:
|
83 |
mutable std::string fPrintPrefix; //! not streamed, just for pretty printing |
84 |
|
85 |
private:
|
86 |
ClassDef(Flux::SpectrumStats,2)
|
87 |
}; |
88 |
|
89 |
} |
90 |
|
91 |
std::ostream& operator<<( std::ostream& stream, const Flux::SpectrumStats&); |
92 |
|
93 |
#endif
|