BgStats.hh
1 |
#ifndef BGSTATS_HH
|
---|---|
2 |
#define BGSTATS_HH
|
3 |
|
4 |
#include <TH1D.h> |
5 |
#include <TH2D.h> |
6 |
#include <tools/EventStats.hh> |
7 |
#include <tools/Region.hh> |
8 |
#include <muon/ArrayMuonParameters.hh> |
9 |
#include <sash/MonitorBase.hh> |
10 |
#include <sash/Telescope.hh> |
11 |
#include <sash/PointerSet.hh> |
12 |
|
13 |
namespace Sash {
|
14 |
class HESSArray; |
15 |
} |
16 |
|
17 |
namespace Background {
|
18 |
|
19 |
typedef std::map<int,double> TelMap_t; |
20 |
|
21 |
/**
|
22 |
* \brief Background statistics (per-run or cumulative).
|
23 |
*
|
24 |
* These objects are
|
25 |
* generated by the BgMaker class for each run and may be added
|
26 |
* together (see Background::Accumulate()) to produce the combined
|
27 |
* statistics for a set of runs.
|
28 |
*
|
29 |
* \todo in constructor should by default set skipped flag, and only
|
30 |
* set it to non-skipped in the EndRun function of the BgMaker, so
|
31 |
* that if an exception is thrown the run is safely skipped.
|
32 |
*/
|
33 |
class BgStats : public Sash::MonitorBase |
34 |
{ |
35 |
|
36 |
public:
|
37 |
BgStats(Sash::HESSArray& |
38 |
#if defined(__CINT__) || defined(CINTOBJECT)
|
39 |
= hessdummy |
40 |
#endif
|
41 |
,const char * name=""); |
42 |
|
43 |
BgStats(Sash::HESSArray&, const BgStats &stats, const char * name); |
44 |
|
45 |
|
46 |
BgStats(const char *handleFunc, |
47 |
Sash::HESSArray& |
48 |
#if defined(__CINT__) || defined(CINTOBJECT)
|
49 |
= hessdummy |
50 |
#endif
|
51 |
,const char * name=""); |
52 |
|
53 |
~BgStats(); |
54 |
|
55 |
virtual void Clear( Option_t* = "E" ); |
56 |
virtual void print(std::ostream&) const; |
57 |
|
58 |
GETMEMBER( RateStats, Tools::RateStats ); |
59 |
GETMEMBER( OnRegion, Tools::Compound ); |
60 |
GETMEMBER( OffRegion, Tools::Compound ); |
61 |
GETMEMBER( OnExclusionRegion, Tools::Compound ); |
62 |
GETMEMBER( OffExclusionRegion, Tools::Compound ); |
63 |
GETMEMBER( IdNumber, int );
|
64 |
GETMEMBER( NumberOfTelescopes, int );
|
65 |
GETMEMBER( TelescopePattern, int );
|
66 |
GETMEMBER( SkippedFlag, bool );
|
67 |
GETMEMBER( OnFlag, bool );
|
68 |
GETMEMBER( OffFlag, bool );
|
69 |
GETMEMBER( NumOn, Int_t); |
70 |
GETMEMBER( NumOff, Int_t); |
71 |
GETMEMBER( NumSkippedOn, int );
|
72 |
GETMEMBER( NumSkippedOff, int );
|
73 |
GETMEMBER( BadFlag, bool );
|
74 |
GETMEMBER( NumBadOn, int );
|
75 |
GETMEMBER( NumBadOff, int );
|
76 |
|
77 |
GETMEMBER( ZenithDistOn, TH1D); |
78 |
GETMEMBER( ZenithDistOff,TH1D); |
79 |
GETMEMBER( AzimuthDistOn, TH1D); |
80 |
GETMEMBER( AzimuthDistOff,TH1D); |
81 |
GETMEMBER( OffsetDistOn, TH1D); |
82 |
GETMEMBER( OffsetDistOff,TH1D); |
83 |
|
84 |
GETMEMBER( ZenithOffsetDistOn, TH2D ); |
85 |
GETMEMBER( ZenithOffsetDistOff,TH2D ); |
86 |
|
87 |
GETMEMBER( IsCumulative, bool );
|
88 |
GETMEMBER( ObservationPosition, Stash::Coordinate ); |
89 |
GETMEMBER( MuonCorrections, Background::TelMap_t ); |
90 |
GETMEMBER( MuonEntry, int );
|
91 |
GETMEMBER( ArrayMuonParameters, Muon::ArrayMuonParameters ); |
92 |
|
93 |
GETMEMBER( ConfigName, std::string );
|
94 |
|
95 |
int GetNumTotal() const { return GetNumOn()+GetNumOff();} |
96 |
int GetNumValid() const { return GetNumTotal()-GetNumSkipped()-GetNumBad();} |
97 |
int GetNumSkipped() const { return GetNumSkippedOn()+GetNumSkippedOff();} |
98 |
int GetNumBad() const { return GetNumBadOn()+GetNumBadOff(); } |
99 |
|
100 |
void AddStatsFrom(const BgStats &stats, bool online=false); |
101 |
void ReplaceStatsFrom(const BgStats &stats, bool online=false); |
102 |
void FillDistributions(const Stash::Coordinate &obspos, |
103 |
const Sash::Time starttime,
|
104 |
const Sash::Time endtime,
|
105 |
double psicut=-1, |
106 |
bool fillon=true, |
107 |
bool filloff=true); |
108 |
Stash::Lambda GetMaximumOffset(); |
109 |
double GetFractionOfTimeAboveOffset( double maxoffs_deg ); |
110 |
|
111 |
double GetMeanMuonCorrection ();
|
112 |
|
113 |
void Draw(const Option_t* opt = ""); |
114 |
|
115 |
static double MeanAzimuth(const TH1& azimuthDist); |
116 |
|
117 |
double GetMeanZenithOn() const { return GetZenithDistOn().GetMean(); } |
118 |
double GetMeanZenithOff() const { return GetZenithDistOff().GetMean(); } |
119 |
double GetMeanOffsetOn() const { return GetOffsetDistOn().GetMean(); } |
120 |
double GetMeanOffsetOff() const { return GetOffsetDistOff().GetMean(); } |
121 |
double GetMeanAzimuthOn() const { return MeanAzimuth(GetAzimuthDistOn()); } |
122 |
double GetMeanAzimuthOff() const { return MeanAzimuth(GetAzimuthDistOff()); } |
123 |
|
124 |
private:
|
125 |
|
126 |
void SetHistNames(const char* name); |
127 |
|
128 |
Tools::RateStats fRateStats; //< Rate Statistics
|
129 |
|
130 |
Tools::Compound fOnRegion; //< On region, possibly compound
|
131 |
Tools::Compound fOffRegion; //< Off region, possibly compound
|
132 |
Tools::Compound fOnExclusionRegion;//< Exclusion region, possibly compound
|
133 |
Tools::Compound fOffExclusionRegion;//< Exclusion region, possibly compound
|
134 |
|
135 |
Int_t fIdNumber; //< Run number (or other identifier)
|
136 |
int fNumberOfTelescopes; //< number of telescopes in run (-1 if mixture) |
137 |
int fTelescopePattern; //< bit pattern of telescopes in run |
138 |
|
139 |
bool fSkippedFlag; //< Marker for skipped runs/ranges |
140 |
bool fBadFlag; //< Marker for runs which had an exception |
141 |
bool fOnFlag; //< Flag for ON-run |
142 |
bool fOffFlag; //< Flag for OFF-run |
143 |
|
144 |
Int_t fNumOn; |
145 |
Int_t fNumOff; |
146 |
int fNumSkippedOn;
|
147 |
int fNumSkippedOff;
|
148 |
int fNumBadOn;
|
149 |
int fNumBadOff;
|
150 |
|
151 |
TH1D fZenithDistOn; //< Zenith angle distribution for the On region
|
152 |
TH1D fZenithDistOff; //< Zenith angle distribution for the Off regions
|
153 |
TH1D fAzimuthDistOn; //< Azimuth angle distribution for the On region
|
154 |
TH1D fAzimuthDistOff; //< Azimuth angle distribution for the Off regions
|
155 |
TH1D fOffsetDistOn; //< Offset angle distribution for the On region
|
156 |
TH1D fOffsetDistOff; //< Offset angle distribution for the Off regions
|
157 |
|
158 |
TH2D fZenithOffsetDistOn; //< combined zenith and offset distribution for the On region
|
159 |
TH2D fZenithOffsetDistOff; //< combined zenith and offset distribution for the Off region
|
160 |
|
161 |
bool fIsCumulative; //< |
162 |
|
163 |
Stash::Coordinate fObservationPosition; //< Observation position of run
|
164 |
TelMap_t fMuonCorrections; //< Muon efficiencies used per tel
|
165 |
int fMuonEntry; //< Run number from Monitor_Run_Muon database table, corresponding to optical efficiencies in MC |
166 |
Muon::ArrayMuonParameters fArrayMuonParameters; //< Array-level muon info required for exposure calculation
|
167 |
|
168 |
std::string fConfigName; //<stores the config name used to generate the stats |
169 |
|
170 |
ClassDef(Background::BgStats,9)
|
171 |
// changes Version 3 to 4:
|
172 |
// add fZenithOffsetDistOff
|
173 |
// change version 6 to 7:
|
174 |
// add number of telescopes in run
|
175 |
// change version 7 to 8:
|
176 |
// add bit pattern of telescopes and muon entry in run
|
177 |
// change version 8 to 9:
|
178 |
// added another constructor for online analysis
|
179 |
}; |
180 |
} |
181 |
|
182 |
#endif
|