Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dispEnergy reconstruction #218

Merged
merged 17 commits into from
Dec 14, 2022
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
36 changes: 36 additions & 0 deletions inc/CData.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ class CData
//[NTelPairs]
Float_t EmissionHeightT[VDST_MAXTELESCOPES* VDST_MAXTELESCOPES];
Double_t DispDiff; // from disp method
Float_t Xoff_intersect;
Float_t Yoff_intersect;

// List of branches
TBranch* b_runNumber; //!
Expand Down Expand Up @@ -236,6 +238,8 @@ class CData
TBranch* b_NTelPairs; //!
TBranch* b_EmissionHeightT; //!
TBranch* b_DispDiff; //disp
TBranch* b_Xoff_intersect;
TBranch* b_Yoff_intersect;

CData( TTree* tree = 0, bool bMC = false, int iVersion = 5, bool bShort = false );
virtual ~CData();
Expand Down Expand Up @@ -811,6 +815,22 @@ void CData::Init( TTree* tree )
{
DispDiff = 0.;
}
if( fChain->GetBranchStatus( "Xoff_intersect" ) )
{
fChain->SetBranchAddress( "Xoff_intersect", &Xoff_intersect );
}
else
{
Xoff_intersect = 0.;
}
if( fChain->GetBranchStatus( "Yoff_intersect" ) )
{
fChain->SetBranchAddress( "Yoff_intersect", &Yoff_intersect );
}
else
{
Yoff_intersect = 0.;
}

Notify();
}
Expand Down Expand Up @@ -962,6 +982,22 @@ Bool_t CData::Notify()
{
b_DispDiff = 0;
}
if( fChain->GetBranchStatus( "Xoff_intersect" ) )
{
b_Xoff_intersect = fChain->GetBranch( "Xoff_intersect" );
}
else
{
b_Xoff_intersect = 0;
}
if( fChain->GetBranchStatus( "Yoff_intersect" ) )
{
b_Yoff_intersect = fChain->GetBranch( "Yoff_intersect" );
}
else
{
b_Yoff_intersect = 0;
}

return kTRUE;
}
Expand Down
48 changes: 28 additions & 20 deletions inc/VDispAnalyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class VDispAnalyzer
unsigned int fNImages_min;
float fdistance_max;
float floss_max;
float fFui_min;
bool fDispErrorWeighting;
float fDispErrorExponential;

Expand Down Expand Up @@ -66,16 +67,16 @@ class VDispAnalyzer
vector<ULong64_t> fTelescopeTypeList;
vector<float> fTelescopeFOV;

void calculateMeanShowerDirection( vector< float > v_x, vector< float > v_y, vector< float > v_weight,
void calculateMeanShowerDirection( vector< float >& v_x, vector< float >& v_y, vector< float >& v_weight,
float& xs, float& ys, float& dispdiff, unsigned int iMaxN );

unsigned int find_smallest_diff_element(
vector< vector< float > > i_sign,
vector< float > x, vector< float > y,
vector< float > cosphi, vector< float > sinphi,
vector< float > tel_pointing_dx, vector< float > tel_pointing_dy,
vector< float > v_disp, vector< float > v_weight );
vector< vector< float > > get_sign_permuation_vector( unsigned int x_size );
vector< vector< float > >& i_sign,
vector< float >& x, vector< float >& y,
vector< float >& cosphi, vector< float >& sinphi,
vector< float >& tel_pointing_dx, vector< float >& tel_pointing_dy,
vector< float >& v_disp, vector< float >& v_weight );
vector< vector< float > > get_sign_permutation_vector( unsigned int x_size );

public:

Expand All @@ -93,7 +94,9 @@ class VDispAnalyzer
double xoff_4, double yoff_4,
double* iR,
double xcore, double ycore,
double xs, double ys );
double xs, double ys,
double* img_fui,
float* img_pedvar );

void calculateEnergies( unsigned int i_ntel, float iArrayElevation, float iArrayAzimuth,
ULong64_t* iTelType,
Expand All @@ -104,16 +107,18 @@ class VDispAnalyzer
double* img_weight,
double xoff_4, double yoff_4,
double* iR, double iEHeight,
double iMCEnergy = -1. );
double iMCEnergy,
double* img_fui,
float* img_pedvar );

void calculateMeanDirection( float& xs, float& ys,
vector< float > x, vector< float > y,
vector< float > cosphi, vector< float > sinphi,
vector< float > v_disp, vector< float > v_weight,
vector< float > tel_pointing_dx,
vector< float > tel_pointing_dy,
vector< float >& x, vector< float >& y,
vector< float >& cosphi, vector< float >& sinphi,
vector< float >& v_disp, vector< float >& v_weight,
vector< float >& tel_pointing_dx,
vector< float >& tel_pointing_dy,
float& dispdiff,
float x_off4 = -999., float yoff_4 = -999.,
float x_off4, float yoff_4,
bool UseIntersectForHeadTail = false );

void calculateMeanDispDirection( unsigned int i_ntel, float iArrayElevation, float iArrayAzimuth,
Expand All @@ -124,8 +129,9 @@ class VDispAnalyzer
double* img_tgrad, double* img_loss, int* img_ntubes,
double* img_weight,
double xoff_4, double yoff_4,
vector< float > dispErrorT,
vector< float > dispSignT,
vector< float >& dispErrorT,
vector< float >& dispSignT,
double* img_fui,
float* img_pedvar,
double* pointing_dx, double* pointing_dy,
bool UseIntersectForHeadTail );
Expand All @@ -138,12 +144,12 @@ class VDispAnalyzer
double* img_tgrad, double* img_loss, int* img_ntubes,
double* img_weight,
double xoff_4, double yoff_4,
float* img_pedvar );
double* img_fui, float* img_pedvar );

float evaluate( float iWidth, float iLength, float iAsymm, float iDist,
float iSize, float iPedvar, float itgrad, float iLoss,
float icen_x, float icen_y, float xoff_4, float yoff_4, ULong64_t iTelType,
float iZe, float iAz, float iRcore = -99., float iNtubes = -1.,
float iZe, float iAz, float iRcore, float iFui, float iNtubes,
bool b2D = true );
float getAngDiff()
{
Expand Down Expand Up @@ -234,12 +240,14 @@ class VDispAnalyzer
fDispErrorExponential = iWeight;
}
void setQualityCuts( unsigned int iNImages_min = 0, float iAxesAngles_min = 0.,
float imaxdist = 1.e5, float imaxloss = 1. )
float imaxdist = 1.e5, float imaxloss = 1.,
float iminfui = 0. )
{
fAxesAngles_min = iAxesAngles_min;
fNImages_min = iNImages_min;
fdistance_max = imaxdist;
floss_max = imaxloss;
fFui_min = iminfui;
}
void setTelescopeTypeList( vector<ULong64_t> iTelescopeTypeList );
void setTelescopeFOV( vector< float > iTelFOV )
Expand Down
6 changes: 3 additions & 3 deletions inc/VEffectiveAreaCalculator.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class VEffectiveAreaCalculator

// angular resolution graphs (vector in az)
vector< TGraphErrors* > fGraph_AngularResolution68p;
vector< TGraphErrors* > fGraph_AngularResolution80p;
vector< TGraphErrors* > fGraph_AngularResolution95p;
/*
vector< vector< TH2F* > > hVAngularDiff_2D;
vector< vector< TH2F* > > hVAngularDiffEmc_2D;
Expand Down Expand Up @@ -307,7 +307,7 @@ class VEffectiveAreaCalculator
bool binomialDivide( TGraphAsymmErrors* g, TH1D* hrec, TH1D* hmc );
void copyProfileHistograms( TProfile*, TProfile* );
void copyHistograms( TH1*, TH1*, bool );
void fillAngularResolution( unsigned int i_az, bool iContaintment_80p );
void fillAngularResolution( unsigned int i_az, bool iContaintment_95p );
double getAzMean( double azmin, double azmax );
double getCRWeight( double iEMC_TeV_log10, TH1* h, bool for_back_map = false );
template <typename T> vector< T > get_irf_vector( int i_nbins, T* i_e0, T* i_irf );
Expand Down Expand Up @@ -382,7 +382,7 @@ class VEffectiveAreaCalculator
void resetHistograms( unsigned int iZe );
void resetHistogramsVectors( unsigned int iZe );
void setAngularResolution2D( unsigned int i_az, vector< TH2D* > );
void setAngularResolutionGraph( unsigned int i_az, TGraphErrors* g, bool iAngContainment_80p );
void setAngularResolutionGraph( unsigned int i_az, TGraphErrors* g, bool iAngContainment_95p );

void setAzimuthCut( int iAzBin, double iAzMin, double iAzMax );
void setEffectiveArea( int iMC )
Expand Down
4 changes: 3 additions & 1 deletion inc/VGammaHadronCuts.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ class VGammaHadronCuts : public VAnalysisUtilities
double fCut_CoreDistanceEdgeSize;
double fCut_SizeSecondMax_min;
double fCut_SizeSecondMax_max;
double fCut_DispIntersectDiff_min;
double fCut_DispIntersectDiff_max;
double fProbabilityCut;
vector <double> fProbabilityCutRangeLower;
vector <double> fProbabilityCutRangeUpper;
Expand Down Expand Up @@ -433,6 +435,6 @@ class VGammaHadronCuts : public VAnalysisUtilities
return fUseOrbitalPhaseCuts;
}

ClassDef( VGammaHadronCuts, 56 );
ClassDef( VGammaHadronCuts, 57 );
};
#endif
6 changes: 3 additions & 3 deletions inc/VGammaHadronCutsStatistics.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class VGammaHadronCutsStatistics : public TNamed

// enum for efficiency counting of the different types of cuts
enum EN_AnaCutsStats { eTot, eMC_XYoff, eXYoff, eStereoQuality, eArrayChi2, eNImages, eMSC_Quality,
eErec, eCorePos, eLTrig, eSizeSecondMax, eTelType, eDirection, eIsGamma, eEnergyRec,
ePointing, eError
eErec, eCorePos, eLTrig, eArrayDispDiff, eSizeSecondMax, eTelType, eDirection,
eIsGamma, eEnergyRec, ePointing, eError
};


Expand All @@ -48,7 +48,7 @@ class VGammaHadronCutsStatistics : public TNamed
void terminate();
void updateCutCounter( unsigned int iCut );

ClassDef( VGammaHadronCutsStatistics, 3 );
ClassDef( VGammaHadronCutsStatistics, 4 );
};


Expand Down
5 changes: 3 additions & 2 deletions inc/VTMVADispAnalyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class VTMVADispAnalyzer
float fAz;
float fLoss;
float fDist;
float fFui;
float fAsymm;
float fXcore;
float fYcore;
Expand All @@ -56,8 +57,8 @@ class VTMVADispAnalyzer
float evaluate( float iWidth, float iLength, float iSize, float iAsymm, float iLoss,
float iTGrad, float icen_x, float icen_y, float xoff_4, float yoff_4,
ULong64_t iTelType, float iZe, float iAz, float iRcore,
float iEHeight = -1., float iDist = -1., float iNtubes = -1,
float iPedVar = -1. );
float iEHeight, float iDist, float iFui, float iNtubes,
float iPedVar );
bool isZombie()
{
return bZombie;
Expand Down
65 changes: 53 additions & 12 deletions inc/VTableLookupDataHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class VTableLookupDataHandler
VDispAnalyzer* fDispAnalyzerDirection;
VDispAnalyzer* fDispAnalyzerDirectionError;
VDispAnalyzer* fDispAnalyzerDirectionSign;
VDispAnalyzer* fDispAnalyzerEnergy;

double fSelectRandom;
int fSelectRandomSeed;
Expand Down Expand Up @@ -233,6 +234,7 @@ class VTableLookupDataHandler
float fmeanPedvar_ImageT[VDST_MAXTELESCOPES];
float fmeanPedvar_Image;
double fdist [VDST_MAXTELESCOPES];
double ffui [VDST_MAXTELESCOPES];
double fdist_telType[VDST_MAXTELESCOPES];
double fsize [VDST_MAXTELESCOPES];
double fsize2 [VDST_MAXTELESCOPES];
Expand Down Expand Up @@ -268,11 +270,14 @@ class VTableLookupDataHandler
int fFitstat [VDST_MAXTELESCOPES];
// {-1}
double fR [VDST_MAXTELESCOPES]; //!< distance from each telescope to reconstructed shower core
double fRTel [VDST_MAXTELESCOPES]; //!< distance from each telescope to reconstructed shower core
double fR_telType[VDST_MAXTELESCOPES]; //!< distance from each telescope to reconstructed shower core (depending on tel type)
// double fMCR [VDST_MAXTELESCOPES]; //!< distance from each telescope to reconstructed shower core
// double fMCR_telType[VDST_MAXTELESCOPES]; //!< distance from each telescope to reconstructed shower core
double fE [VDST_MAXTELESCOPES]; //!< energy assigned to each telescope (method 0)
double fES [VDST_MAXTELESCOPES]; //!< energy assigned to each telescope (method 1)
int fnenergyT; //!< number of images used for the energy calculation
int fenergyQL; //!< quality label for energy calculation
double ftmscw [VDST_MAXTELESCOPES]; //!< mscw assigned to each telescope
double ftmscl [VDST_MAXTELESCOPES]; //!< mscl assigned to each telescope
float ftmscw_sigma[VDST_MAXTELESCOPES]; //!< mscw sigma assigned to each telescope
Expand Down Expand Up @@ -346,6 +351,10 @@ class VTableLookupDataHandler
{
return fR;
}
double* getDistanceToCoreTel()
{
return fRTel;
}
double* getDistanceToCore( ULong64_t iTelType );
int getEventNumber()
{
Expand Down Expand Up @@ -548,30 +557,54 @@ class VTableLookupDataHandler
bool readRunParameter();
void reset(); //!< reset a few output variables
void resetAll();
void setChi2( double iChi2, double iChi2S )
void setChi2( double iChi2, bool iTableErecS = true )
{
fechi2 = iChi2;
fechi2S = iChi2S;
if( iTableErecS )
{
fechi2S = iChi2;
}
else
{
fechi2 = iChi2;
}
}
void setdE( double idE, double idES )
void setdE( double idE, bool iTableErecS = true )
{
fdE = idE ;
fdES = idES;
if( iTableErecS )
{
fdES = idE ;
}
else
{
fdE = idE;
}
}
//!< no check of boundaries!!
void setDistanceToCore( int itel, double iR )
{
fR[itel] = iR;
}
void setEnergy( double iE, double iES )
void setEnergy( double iE, bool iTableErecS = true )
{
fenergy = iE;
fenergyS = iES;
if( iTableErecS )
{
fenergyS = iE;
}
else
{
fenergy = iE;
}
}
void setEnergyT( int i, double iET, double iETS )
void setEnergyT( int i, double iET, bool iTableErecS = true )
{
fE[i] = iET;
fES[i] = iETS;
if( iTableErecS )
{
fES[i] = iET;
}
else
{
fE[i] = iET;
}
}
bool setInputFile( vector< string > ); //!< set input file
void setMCMinEnergy( double iB )
Expand Down Expand Up @@ -600,6 +633,14 @@ class VTableLookupDataHandler
ftmscl[i] = iMSLC;
ftmscl_sigma[i] = iMSLC_T;
}
void setNEnergyT( int in )
{
fnenergyT = in;
}
void setNEnergyQuality( int in )
{
fenergyQL = in;
}
void setNMSCW( int in )
{
fnmscw = in;
Expand Down
2 changes: 2 additions & 0 deletions inc/VTableLookupRunParameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class VTableLookupRunParameter : public TNamed, public VGlobalRunParameter
double fMC_distance_to_cameracenter_max;
double fmaxdist; // note: same for all telescope types
double fmaxloss; // note: same for all telescope types
double fminfui ; // note: same for all telescope types
double fminsize; // note: same for all telescope times
// seed for random selection of showers before table filling
double fSelectRandom;
Expand All @@ -95,6 +96,7 @@ class VTableLookupRunParameter : public TNamed, public VGlobalRunParameter
double fRerunStereoReconstruction_minAngle;
string fRerunStereoReconstruction_BDTFileName;
unsigned int fRerunStereoReconstruction_BDTNImages_max;
string fEnergyReconstruction_BDTFileName;
string fDispError_BDTFileName;
float fDispError_BDTWeight;
string fDispSign_BDTFileName;
Expand Down
Loading