Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changes/337.feauture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add XGB-based gamma/hadron classification routines. Use with `* cutselection 52 0` in cut file.
12 changes: 12 additions & 0 deletions docs/changes/339.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Allow to choose energy and direction reconstruction methods:

```
Stereo reconstruction
---------------------
Method ids: 0 (DispBDT), 1 (LT Tables), 2 (XGB stereo)
* ENERGYRECONSTRUCTIONMETHOD 0
Method ids: 0 (DispBDT), 1 (Intersection Method), 2 (XGB stereo)
* DIRECTIONRECONSTRUCTIONMETHOD 0
```

Consistently use `CData` methods to get variables.
29 changes: 20 additions & 9 deletions inc/CData.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,19 +260,30 @@ class CData
TBranch* b_Xoff_intersect;
TBranch* b_Yoff_intersect;

TTree* fFriendTree; //!
float Dir_Xoff; //!
float Dir_Yoff; //!
float Dir_Erec; //!
TTree* fStereoFriendTree; //!
float Dir_Xoff; //!
float Dir_Yoff; //!
float Dir_Erec; //!
TTree* fGHFriendTree; //!
float GH_Gamma_Prediction; //!
UChar_t GH_Is_Gamma; //!
vector<TFile*> fXGBFiles; //!

CData( TTree* tree = 0, bool bMC = false, bool bShort = false, TTree* friendTree = 0 );
CData( TTree* tree = 0, bool bMC = false, bool bShort = false, TTree* stereoTree = 0, TTree* ghTree = 0 );
CData( TTree* tree, bool bMC, bool bShort, string file_name, string stereo_suffix, string gamma_hadron_suffix );
virtual ~CData();
virtual Int_t GetEntry( Long64_t entry );
float get_Erec( unsigned int method = 0 );
float get_Xoff( unsigned int method = 0 );
float get_Yoff( unsigned int method = 0 );
pair<float, float> get_XYoff_derot( unsigned int method = 0 );
float get_Erec( unsigned int method );
float get_ErecChi2( unsigned int method );
float get_ErecdE( unsigned int method );
float get_Xoff( unsigned int method );
float get_Yoff( unsigned int method );
void initialize_xgb_tree();
TTree* getXGBTree( string file_name, string suffix, string tree_name );
pair<float, float> get_XYoff_derot( unsigned int method );
virtual Long64_t LoadTree( Long64_t entry );
float get_GH_Gamma_Prediction();
bool is_GH_Gamma();
virtual void Init( TTree* tree );
virtual Bool_t Notify();
bool isMC()
Expand Down
6 changes: 5 additions & 1 deletion inc/VAnaSumRunParameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,15 @@ class VAnaSumRunParameter : public TNamed, public VGlobalRunParameter
double fEnergyEffectiveAreaSmoothingThreshold;
vector< double > fMCZe; // zenith angle interval for Monte Carlo

// direction reconstruction
unsigned int fDirectionReconstructionMethod;

// dead time calculation method
int fDeadTimeCalculationMethod;

// XGB reconstruction
string fXGB_file_suffix;
string fXGB_stereo_file_suffix;
string fXGB_gh_file_suffix;

int f2DAcceptanceMode ; // USE2DACCEPTANCE

Expand Down
9 changes: 9 additions & 0 deletions inc/VDataMCComparision.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ class VDataMCComparision
bool fCalculateMVAValues;
string fEpochATM;

// reconstruction methods
unsigned int fEnergyReconstructionMethod;
unsigned int fDirectionReconstructionMethod;

// lists with all histograms
TList* hisList;
vector<TH1D* > hTel;
Expand Down Expand Up @@ -143,6 +147,11 @@ class VDataMCComparision
{
fShowerMaxZe_deg = iZe;
}
void setStereoReconstructionMethod( unsigned int iEnergyMethod = 0, unsigned int iDirectionMethod = 0 )
{
fEnergyReconstructionMethod = iEnergyMethod;
fDirectionReconstructionMethod = iDirectionMethod;
}
bool setTelescopeCoordinates( double x, double y, double z = 0. );
void setWobbleFromDataTree()
{
Expand Down
7 changes: 1 addition & 6 deletions inc/VEffectiveAreaCalculator.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ class VEffectiveAreaCalculator
VInstrumentResponseFunctionRunParameter* fRunPara;

VGammaHadronCuts* fCuts;
bool fIgnoreEnergyReconstruction;
bool fIsotropicArrivalDirections;

// effective area calculation
Expand Down Expand Up @@ -316,7 +315,7 @@ class VEffectiveAreaCalculator
~VEffectiveAreaCalculator();

void cleanup();
bool fill( TH1D* hE0mc, CData* d, VEffectiveAreaCalculatorMCHistograms* iMC_histo, unsigned int iMethod );
bool fill( TH1D* hE0mc, CData* d, VEffectiveAreaCalculatorMCHistograms* iMC_histo, unsigned int iEnergyReconstructionMethod, unsigned int iDirectionReconstructionMethod );
TH1D* getHistogramhEmc();
TGraphErrors* getMeanSystematicErrorHistogram();
TTree* getTree()
Expand Down Expand Up @@ -363,10 +362,6 @@ class VEffectiveAreaCalculator
{
fEffectiveAreaVsEnergyMC = iMC;
}
void setIgnoreEnergyReconstructionCuts( bool iB = false )
{
fIgnoreEnergyReconstruction = iB;
}
void setIsotropicArrivalDirections( bool iB = false )
{
fIsotropicArrivalDirections = iB;
Expand Down
33 changes: 20 additions & 13 deletions inc/VGammaHadronCuts.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ using namespace std;
////////////////////////////////////////////////////////////////////////////////
// analysis types
////////////////////////////////////////////////////////////////////////////////
enum E_AnalysisType { GEO = 0, MVAAnalysis = 1 };
enum E_AnalysisType { GEO = 0, MVAAnalysis = 1, XGBoostAnalysis = 2 };

////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -107,6 +107,10 @@ class VGammaHadronCuts : public VAnalysisUtilities
double fTMVA_EvaluationResult;
VTMVAEvaluatorResults* fTMVAEvaluatorResults;

// reconstruction methods
unsigned int fEnergyReconstructionMethod;
unsigned int fDirectionReconstructionMethod;

// orbital phase analysis
TFile* fPhaseCut_File; //!
TTree* fPhaseCut_Tree; //!
Expand Down Expand Up @@ -186,18 +190,19 @@ class VGammaHadronCuts : public VAnalysisUtilities
VGammaHadronCuts();
~VGammaHadronCuts();

bool applyDirectionCuts( unsigned int iEnergyReconstructionMethod = 0, bool bCount = false, double x0 = -99999., double y0 = -99999. );
bool applyEnergyReconstructionQualityCuts( unsigned int iEnergyReconstructionMethod = 0, bool bCount = false );
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( unsigned int iEnergyReconstructionMethod = 0, bool bCount = false, int iEntry = 0, bool fIsOn = false );
bool applyStereoQualityCuts( bool bCount = false, int iEntry = 0, bool fIsOn = false );
bool applyStereoShapeCuts();
bool applyTMVACut( int i );
bool applyXGBoostCut( int i );

double getArrayCentre_X()
{
Expand All @@ -207,13 +212,6 @@ class VGammaHadronCuts : public VAnalysisUtilities
{
return fArrayCentre_Y;
}
double getReconstructedEnergy( unsigned int iEnergyReconstructionMethod = 0 );
double getReconstructedEnergyChi2( unsigned int iEnergyReconstructionMethod = 0 );
double getReconstructedEnergydE( unsigned int iEnergyReconstructionMethod = 0. );
double getReconstructedXoff();
double getReconstructedYoff();
double getReconstructedXcore();
double getReconstructedYcore();
int getGammaHadronCutSelector()
{
return fGammaHadronCutSelector;
Expand Down Expand Up @@ -253,7 +251,7 @@ class VGammaHadronCuts : public VAnalysisUtilities
{
return fTMVAEvaluatorResults;
}
void initialize();
void initialize( unsigned int iEnergyMethod, unsigned int iDirectionMethod );
bool isGamma( int i = 0, bool bCount = false, bool fIsOn = true );
bool isMCCuts()
{
Expand Down Expand Up @@ -304,6 +302,11 @@ class VGammaHadronCuts : public VAnalysisUtilities
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;
Expand All @@ -317,11 +320,15 @@ class VGammaHadronCuts : public VAnalysisUtilities
{
return ( fAnalysisType == MVAAnalysis );
}
bool useXGBoostCuts()
{
return ( fAnalysisType == XGBoostAnalysis );
}
bool useOrbitalPhaseCuts()
{
return fUseOrbitalPhaseCuts;
}

ClassDef( VGammaHadronCuts, 60 );
ClassDef( VGammaHadronCuts, 61 );
};
#endif
4 changes: 1 addition & 3 deletions inc/VInstrumentResponseFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ class VInstrumentResponseFunction
// histograms are not re-filled but duplicated
unsigned int fDuplicationID;

unsigned int fEnergyReconstructionMethod;

// histograms and data
vector< vector< VInstrumentResponseFunctionData* > > fIRFData;

Expand Down Expand Up @@ -115,7 +113,7 @@ class VInstrumentResponseFunction
bool initialize( string iName, string iType, unsigned int iNTel, double iMCMaxCoreRadius,
double iZe, int iNoise, double iPedvars, double iXoff, double iYoff );
void setDuplicationID( unsigned int iDuplicationID = 9999 );
void setEnergyReconstructionMethod( unsigned int iMethod );
void setStereoReconstructionMethod( unsigned int iEnergy, unsigned int iDirection );
void setCuts( VGammaHadronCuts* iCuts );
void setContainmentProbability( double iP = 0.68, double iPError = 0.95 )
{
Expand Down
5 changes: 5 additions & 0 deletions inc/VInstrumentResponseFunctionData.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class VInstrumentResponseFunctionData : public TObject, public VHistogramUtiliti
unsigned int fNTel;

unsigned int fEnergyReconstructionMethod;
unsigned int fDirectionReconstructionMethod;

// list of histograms
enum E_HISTOID { E_DIFF, E_DIFF2, E_LOGDIFF, E_NIMAG, E_DIST, E_ERROR, E_RELA,
Expand Down Expand Up @@ -106,6 +107,10 @@ class VInstrumentResponseFunctionData : public TObject, public VHistogramUtiliti
{
fEnergyReconstructionMethod = iMethod;
}
void setDirectionReconstructionMethod( unsigned int iMethod = 0 )
{
fDirectionReconstructionMethod = iMethod;
}
void setPlottingStyle( int icolor, double iwidth = 1., int imarker = 20, double isize = 1., int iFillStyle = 0, int iLineStyle = 1 );
void setHistogramEbinning( int iN = 60, double iMin = -2.0, double iMax = 4.0 )
{
Expand Down
4 changes: 3 additions & 1 deletion inc/VInstrumentResponseFunctionRunParameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class VInstrumentResponseFunctionRunParameter : public TNamed
int fGammaHadronCutSelector;

unsigned int fEnergyReconstructionMethod;
unsigned int fDirectionReconstructionMethod;
unsigned int fEnergyAxisBins_log10;
bool fIgnoreEnergyReconstructionQuality;
unsigned int fNSpectralIndex;
Expand Down Expand Up @@ -74,7 +75,8 @@ class VInstrumentResponseFunctionRunParameter : public TNamed
string fdatafile;
string fMCdatafile_tree;
string fMCdatafile_histo;
string fXGB_file_suffix;
string fXGB_stereo_file_suffix;
string fXGB_gh_file_suffix;

double fze;
int fnoise;
Expand Down
7 changes: 6 additions & 1 deletion inc/VRadialAcceptance.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class VRadialAcceptance
double fCut_CameraFiducialSize_max;

unsigned int fEnergyReconstructionMethod;
unsigned int fDirectionReconstructionMethod;

// regions excluded from background
vector<double> fXE;
Expand Down Expand Up @@ -154,10 +155,14 @@ class VRadialAcceptance
fAzCut_min = iAzMin; //!< cut on Az (shower directory)
fAzCut_max = iAzMax;
}
void setEnergyReconstructionMethod( unsigned int iEMethod = 1 )
void setEnergyReconstructionMethod( unsigned int iEMethod = 0 )
{
fEnergyReconstructionMethod = iEMethod;
}
void setDirectionReconstructionMethod( unsigned int iEMethod = 0 )
{
fDirectionReconstructionMethod = iEMethod;
}
void setSource( double x, double y, double r, double idist, double imaxdist = 5. ); //!< set source position, radius, and minimal distance between source and background
void setRegionToExcludeAcceptance( vector<double> x, vector<double> y, vector<double> r ); //set the region to be exclude in the analysis
// for ellipsoidal region
Expand Down
2 changes: 0 additions & 2 deletions inc/VStereoAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,6 @@ class VStereoAnalysis
CData* fDataRun;
TTree* fDataRunTree;
TFile* fDataFile;
TDirectory* fXGBFile;
TTree* fXGB_tree;
string fInstrumentEpochMinor;
vector< unsigned int > fTelToAnalyze;

Expand Down
5 changes: 3 additions & 2 deletions inc/VTMVAEvaluator.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class VTMVAEvaluator : public TNamed, public VPlotUtilities
vector< VTMVAEvaluatorData* > fTMVAData;

CData* fData;
unsigned int fEnergyReconstructionMethod;

map< unsigned int, double > fSignalEfficiencyMap; // from user: energy dependent signal efficiency
double fSignalEfficiencyNoVec;
Expand Down Expand Up @@ -171,7 +172,7 @@ class VTMVAEvaluator : public TNamed, public VPlotUtilities

public:

VTMVAEvaluator();
VTMVAEvaluator( unsigned int iEnergyReconstructionMethod = 0 );
~VTMVAEvaluator() {};

bool evaluate( bool interpolate_mva = false, bool use_average_zenith_angle = true );
Expand Down Expand Up @@ -241,7 +242,7 @@ class VTMVAEvaluator : public TNamed, public VPlotUtilities
}
void setTMVAMethod( string iMethodName = "BDT" );

ClassDef( VTMVAEvaluator, 37 );
ClassDef( VTMVAEvaluator, 38 );
};

#endif
3 changes: 2 additions & 1 deletion inc/VTMVARunDataEnergyCut.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ class VTMVARunDataEnergyCut : public TNamed
double fEnergyCut_Log10TeV_max;
TCut fEnergyCut;
unsigned int fEnergyReconstructionMethod;
unsigned int fDirectionReconstructionMethod;

VTMVARunDataEnergyCut();
~VTMVARunDataEnergyCut() {}

void print();

ClassDef( VTMVARunDataEnergyCut, 2 );
ClassDef( VTMVARunDataEnergyCut, 3 );
};

#endif
Loading
Loading