-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathVGammaHadronCuts.h
More file actions
334 lines (295 loc) · 10.4 KB
/
VGammaHadronCuts.h
File metadata and controls
334 lines (295 loc) · 10.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
//! VGammaHadronCuts: class for parameter cut definitions
#ifndef VGammaHadronCuts_H
#define VGammaHadronCuts_H
#include <algorithm>
#include <iostream>
#include <fstream>
#include <map>
#include <sstream>
#include <string>
#include <vector>
#include "CData.h"
#include "VAnalysisUtilities.h"
#include "VGammaHadronCutsStatistics.h"
#include "VInstrumentResponseFunctionData.h"
#include "VTMVAEvaluator.h"
#include "VUtilities.h"
#include "TF1.h"
#include "TFile.h"
#include "TGraph.h"
#include "TGraphErrors.h"
#include "TSystem.h"
#include "TTree.h"
#define VANACUTS_PROBSELECTIONCUTS_MAX 1000
using namespace std;
////////////////////////////////////////////////////////////////////////////////
// analysis types
////////////////////////////////////////////////////////////////////////////////
enum E_AnalysisType { GEO = 0, MVAAnalysis = 1, XGBoostAnalysis = 2 };
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/*
dummy class (for compatibility reasons)
*/
class VGammaHadronCutsStats : public TNamed
{
private:
vector< string > fName;
public:
vector< unsigned int > fN;
VGammaHadronCutsStats() {}
~VGammaHadronCutsStats() {}
void printCutStatistics() {}
void reset() {}
ClassDef( VGammaHadronCutsStats, 3 );
};
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
class VGammaHadronCuts : public VAnalysisUtilities
{
private:
bool fDebug; // lots of debug output
CData* fData; //! transient
string fDataDirectory;
string fInstrumentEpoch;
// cut selector
int fGammaHadronCutSelector; // see description at beginning of VGammaHadronCuts.cpp
E_AnalysisType fAnalysisType;
// array characteristics (number of telescopes, centre of array)
unsigned int fNTel;
double fArrayCentre_X;
double fArrayCentre_Y;
// number of possible telescope combinations
unsigned int fNLTrigs;
// telescope used in analysis (optional)
vector< unsigned int > fTelToAnalyze;
// values calculated from shower/image parameter
double fMeanImageDistance;
double fMeanImageLength;
double fMeanImageWidth;
//////////////////////////
// TMVA evaluator
VTMVAEvaluator* fTMVAEvaluator; //!
string fTMVA_MVAMethod;
string fTMVAWeightFile;
unsigned int fTMVAWeightFileIndex_Emin;
unsigned int fTMVAWeightFileIndex_Emax;
unsigned int fTMVAWeightFileIndex_Zmin;
unsigned int fTMVAWeightFileIndex_Zmax;
map< unsigned int, double > fTMVASignalEfficiency;
map< unsigned int, double > fTMVA_MVACut;
double fTMVA_EvaluationResult;
VTMVAEvaluatorResults* fTMVAEvaluatorResults;
// reconstruction methods
unsigned int fEnergyReconstructionMethod;
unsigned int fDirectionReconstructionMethod;
// orbital phase analysis
TFile* fPhaseCut_File; //!
TTree* fPhaseCut_Tree; //!
double fOrbitalPhase;
// cut statistics
VGammaHadronCutsStatistics* fStats; //!
bool initPhaseCuts( int irun );
bool initPhaseCuts( string iDir );
bool initTMVAEvaluator( string iTMVAFile, unsigned int iTMVAWeightFileIndex_Emin, unsigned int iTMVAWeightFileIndex_Emax, unsigned int iTMVAWeightFileIndex_Zmin, unsigned int iTMVAWeightFileIndex_Zmax );
string getTelToAnalyzeString();
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
public:
// stereo cuts
double fCut_MeanImageDistance_min;
double fCut_MeanImageDistance_max;
double fCut_MeanImageLength_min;
double fCut_MeanImageLength_max;
double fCut_MeanImageWidth_min;
double fCut_MeanImageWidth_max;
double fCut_Theta2_min;
double fCut_Theta2_max;
double fCut_Chi2_min;
double fCut_Chi2_max;
double fCut_Size_min;
double fCut_Size_max;
int fCut_Ntubes_min;
int fCut_Ntubes_max;
double fCut_MSCW_min;
double fCut_MSCW_max;
double fCut_MSCL_min;
double fCut_MSCL_max;
double fCut_MSW_min;
double fCut_MSW_max;
double fCut_MSL_min;
double fCut_MSL_max;
vector< int > fCut_ImgSelect;
double fCut_CameraFiducialSize_min;
double fCut_CameraFiducialSize_max;
bool bMCCuts;
double fCut_CameraFiducialSize_MC_min;
double fCut_CameraFiducialSize_MC_max;
double fCut_AverageCoreDistanceToTelescopes_min;
double fCut_AverageCoreDistanceToTelescopes_max;
double fCut_MinimumCoreDistanceToTelescopes_max;
double fCut_dE_min;
double fCut_dE_max;
double fCut_EChi2_min;
double fCut_EChi2_max;
double fCut_Erec_min;
double fCut_Erec_max;
double fCut_Emmission_min;
double fCut_Emmission_max;
int fCut_NImages_min;
int fCut_NImages_max;
double fCut_CoreDistanceToArrayCentreX_min;
double fCut_CoreDistanceToArrayCentreX_max;
double fCut_CoreDistanceToArrayCentreY_min;
double fCut_CoreDistanceToArrayCentreY_max;
double fCut_CoreDistanceEdgeSize;
double fCut_SizeSecondMax_min;
double fCut_SizeSecondMax_max;
double fCut_DispIntersectDiff_min;
double fCut_DispIntersectDiff_max;
int fCut_DispIntersectSuccess;
bool fUseOrbitalPhaseCuts;
double fOrbitalPhase_min;
double fOrbitalPhase_max;
VGammaHadronCuts();
~VGammaHadronCuts();
bool applyDirectionCuts( bool bCount = false, double x0 = -99999., double y0 = -99999. );
bool applyEnergyReconstructionQualityCuts( bool bCount = false );
bool applyInsideFiducialAreaCut( bool bCount = false );
bool applyInsideFiducialAreaCut( float Xoff, float Yoff, bool bCount = false );
bool applyMCXYoffCut( double x, double y, bool bCount = false );
bool applyMeanReducedScaledStereoShapeCuts();
bool applyMeanStereoShapeCuts();
bool applyMeanScaledStereoShapeCuts();
bool applyPhaseCut( int i );
bool applyStereoQualityCuts( bool bCount = false, int iEntry = 0, bool fIsOn = false );
bool applyStereoShapeCuts();
bool applyTMVACut( int i );
bool applyXGBoostCut( int i );
double getArrayCentre_X()
{
return fArrayCentre_X;
}
double getArrayCentre_Y()
{
return fArrayCentre_Y;
}
int getGammaHadronCutSelector()
{
return fGammaHadronCutSelector;
}
double getMeanImageDistance()
{
return fMeanImageDistance;
}
double getMeanImageLength()
{
return fMeanImageLength;
}
double getMeanImageWidth()
{
return fMeanImageWidth;
}
double getTheta2Cut_min( double e = 0.1 )
{
if( e > 0. )
{
return fCut_Theta2_min;
}
else
{
return 0.;
}
}
double getTheta2Cut_max()
{
return fCut_Theta2_max;
}
double getTMVA_EvaluationResult()
{
return fTMVA_EvaluationResult;
}
VTMVAEvaluatorResults* getTMVAEvaluatorResults()
{
return fTMVAEvaluatorResults;
}
void initialize( unsigned int iEnergyMethod, unsigned int iDirectionMethod );
bool isGamma( int i = 0, bool bCount = false, bool fIsOn = true );
bool isMCCuts()
{
return bMCCuts;
}
void newEvent( bool iFillStats = true );
void printCutSummary();
void printCutStatistics()
{
if( fStats )
{
fStats->printCutStatistics();
}
}
void printDirectionCuts();
void printSignalEfficiency();
void printTMVA_MVACut();
bool readCuts( string i_cutfilename, int iPrint = 1 );
void resetCutValues();
void resetCutStatistics();
void initializeCuts( int irun = -1, string iDir = "" );
void setArrayCentre( double iX = 0., double iY = 0. )
{
fArrayCentre_X = iX;
fArrayCentre_Y = iY;
}
void setDataDirectory( string id )
{
fDataDirectory = id;
}
bool setDataTree( CData* idata );
void setDebug( bool iB = false )
{
fDebug = iB;
}
void setEnergyCuts( double imin, double imax )
{
fCut_Erec_min = imin;
fCut_Erec_max = imax;
}
void setInstrumentEpoch( string iEpoch )
{
fInstrumentEpoch = iEpoch;
}
void setNTel( unsigned int itel, double iX = 0., double iY = 0. )
{
fNTel = itel;
fArrayCentre_X = iX;
fArrayCentre_Y = iY;
}
void setStereoReconstructionMethod( unsigned int iEnergyMethod = 0, unsigned int iDirectionMethod = 0 )
{
fEnergyReconstructionMethod = iEnergyMethod;
fDirectionReconstructionMethod = iDirectionMethod;
}
void setTelToAnalyze( vector< unsigned int > iTelToAnalyze )
{
fTelToAnalyze = iTelToAnalyze;
}
void setTheta2Cut( double it2 )
{
fCut_Theta2_max = it2;
}
void terminate();
bool useTMVACuts()
{
return ( fAnalysisType == MVAAnalysis );
}
bool useXGBoostCuts()
{
return ( fAnalysisType == XGBoostAnalysis );
}
bool useOrbitalPhaseCuts()
{
return fUseOrbitalPhaseCuts;
}
ClassDef( VGammaHadronCuts, 61 );
};
#endif