Skip to content

Commit 472061d

Browse files
authored
Merge pull request #334 from VERITAS-Observatory/v492-12-energy
v492-12 Add XGB energy reconstruction
2 parents 43b9e80 + 6eaecba commit 472061d

11 files changed

+113
-101
lines changed

docs/changes/334.feature.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add print out average run zenith angle to `printRunParameter` option `-runinfo`.

inc/CData.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,10 +263,12 @@ class CData
263263
TTree* fFriendTree; //!
264264
float Dir_Xoff; //!
265265
float Dir_Yoff; //!
266+
float Dir_Erec; //!
266267

267268
CData( TTree* tree = 0, bool bMC = false, bool bShort = false, TTree* friendTree = 0 );
268269
virtual ~CData();
269270
virtual Int_t GetEntry( Long64_t entry );
271+
float get_Erec( unsigned int method = 0 );
270272
float get_Xoff( unsigned int method = 0 );
271273
float get_Yoff( unsigned int method = 0 );
272274
pair<float, float> get_XYoff_derot( unsigned int method = 0 );

pytest.ini

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/CData.cpp

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ CData::CData( TTree* tree, bool bMC, bool bShort, TTree* friendTree )
2323
{
2424
fFriendTree->SetBranchAddress( "Dir_Xoff", &Dir_Xoff );
2525
fFriendTree->SetBranchAddress( "Dir_Yoff", &Dir_Yoff );
26+
fFriendTree->SetBranchAddress( "Dir_Erec", &Dir_Erec );
2627
}
2728
else
2829
{
2930
Dir_Xoff = -9999.;
3031
Dir_Yoff = -9999.;
32+
Dir_Erec = -9999.;
3133
}
3234
}
3335

@@ -636,8 +638,39 @@ Bool_t CData::Notify()
636638
return kTRUE;
637639
}
638640

641+
639642
/*
640-
* Get stereo Xoff depending on analysis results
643+
* Get energy depending on analysis method
644+
* Methods:
645+
*
646+
* 0: return friend tree result (if available) or Erec
647+
* 1: return ErecS
648+
* 2: return Erec
649+
* 3: return friend tree result
650+
*/
651+
float CData::get_Erec( unsigned iMethod )
652+
{
653+
if( iMethod == 0 && fFriendTree )
654+
{
655+
return Dir_Erec;
656+
}
657+
else if( iMethod == 1 )
658+
{
659+
return ErecS;
660+
}
661+
else if( iMethod == 2 )
662+
{
663+
return Erec;
664+
}
665+
else if( iMethod == 3 )
666+
{
667+
return Dir_Erec;
668+
}
669+
return Erec;
670+
}
671+
672+
/*
673+
* Get stereo Xoff depending on analysis method
641674
*
642675
* Methods:
643676
*
@@ -667,8 +700,9 @@ float CData::get_Xoff( unsigned iMethod )
667700
return ( float )Xoff;
668701
}
669702

703+
670704
/*
671-
* Get stereo Yoff depending on analysis results
705+
* Get stereo Yoff depending on analysis method
672706
*
673707
* Methods:
674708
*

src/VDataMCComparision.cpp

Lines changed: 46 additions & 46 deletions
Large diffs are not rendered by default.

src/VEffectiveAreaCalculator.cpp

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2244,24 +2244,22 @@ bool VEffectiveAreaCalculator::fill( TH1D* hE0mc, CData* d,
22442244

22452245
// skip event if no energy has been reconstructed
22462246
// get energy according to which reconstruction method
2247-
if( iMethod == 0 && d->Erec > 0. )
2248-
{
2249-
eRec = log10( d->Erec );
2250-
eRecLin = d->Erec;
2251-
}
2252-
else if( iMethod == 1 && d->ErecS > 0. )
2253-
{
2254-
eRec = log10( d->ErecS );
2255-
eRecLin = d->ErecS;
2256-
}
2257-
else if( fIgnoreEnergyReconstruction )
2247+
if( fIgnoreEnergyReconstruction )
22582248
{
22592249
eRec = log10( d->MCe0 );
22602250
eRecLin = d->MCe0;
22612251
}
22622252
else
22632253
{
2264-
continue;
2254+
eRecLin = d->get_Erec( iMethod );
2255+
if( eRecLin > 0. )
2256+
{
2257+
eRec = log10( eRecLin );
2258+
}
2259+
else
2260+
{
2261+
continue;
2262+
}
22652263
}
22662264

22672265
///////////////////////////////////////////

src/VGammaHadronCuts.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2534,15 +2534,7 @@ double VGammaHadronCuts::getReconstructedEnergy( unsigned int iEnergyReconstruct
25342534
{
25352535
return -99.;
25362536
}
2537-
if( iEnergyReconstructionMethod == 0 )
2538-
{
2539-
return fData->Erec;
2540-
}
2541-
else if( iEnergyReconstructionMethod == 1 )
2542-
{
2543-
return fData->ErecS;
2544-
}
2545-
return -99.;
2537+
return fData->get_Erec( iEnergyReconstructionMethod );
25462538
}
25472539

25482540
double VGammaHadronCuts::getReconstructedEnergyChi2( unsigned int iEnergyReconstructionMethod )

src/VInstrumentResponseFunctionData.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -446,15 +446,7 @@ void VInstrumentResponseFunctionData::fill( double iWeight )
446446
}
447447

448448
// get reconstructed energy
449-
double iErec_lin = -99.e6;
450-
if( fEnergyReconstructionMethod == 0 && fData->Erec > 0. )
451-
{
452-
iErec_lin = fData->Erec;
453-
}
454-
else if( fEnergyReconstructionMethod == 1 && fData->ErecS > 0. )
455-
{
456-
iErec_lin = fData->ErecS;
457-
}
449+
double iErec_lin = fData->get_Erec( fEnergyReconstructionMethod );
458450
if( iErec_lin < 0. )
459451
{
460452
return;

src/VStereoAnalysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2149,7 +2149,7 @@ void VStereoAnalysis::fill_TreeWithSelectedEvents( CData* c, double i_xderot, do
21492149
fTreeSelected_MLR = c->MLR;
21502150
fTreeSelected_Erec = c->Erec;
21512151
fTreeSelected_EChi2 = c->EChi2;
2152-
fTreeSelected_ErecS = c->ErecS;
2152+
fTreeSelected_ErecS = c->get_Erec();
21532153
fTreeSelected_EChi2S = c->EChi2S;
21542154
fTreeSelected_EmissionHeight = c->EmissionHeight;
21552155
fTreeSelected_EmissionHeightChi2 = c->EmissionHeightChi2;

src/VTMVAEvaluator.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -731,11 +731,11 @@ bool VTMVAEvaluator::evaluate( bool interpolate_mva, bool use_average_zenith_ang
731731
{
732732
i_ze = fAverageZenithPerRun;
733733
}
734-
if( fData->ErecS <= 0. )
734+
if( fData->get_Erec() <= 0. )
735735
{
736736
return false;
737737
}
738-
unsigned int iDataBin = getDataBin( log10( fData->ErecS ), i_ze );
738+
unsigned int iDataBin = getDataBin( log10( fData->get_Erec() ), i_ze );
739739
if( fDebug )
740740
{
741741
cout << "VTMVAEvaluator::evaluate: data bin " << iDataBin;
@@ -775,14 +775,14 @@ bool VTMVAEvaluator::evaluate( bool interpolate_mva, bool use_average_zenith_ang
775775
*/
776776
double VTMVAEvaluator::interpolate_mva_evaluation()
777777
{
778-
if(!fData || fData->ErecS <= 0 )
778+
if(!fData || fData->get_Erec() <= 0 )
779779
{
780780
return 9999.;
781781
}
782782
set<unsigned int> data_bins;
783783
for( unsigned int i = 0; i < fTMVAData.size(); i++ )
784784
{
785-
data_bins.insert( getDataBin( log10( fData->ErecS ), 0.5 * ( fTMVAData[i]->fZenithCut_max + fTMVAData[i]->fZenithCut_min ) ) );
785+
data_bins.insert( getDataBin( log10( fData->get_Erec() ), 0.5 * ( fTMVAData[i]->fZenithCut_max + fTMVAData[i]->fZenithCut_min ) ) );
786786
}
787787
TGraph iG(( int )data_bins.size() );
788788
unsigned int i = 0;
@@ -805,11 +805,11 @@ double VTMVAEvaluator::interpolate_mva_evaluation()
805805
*/
806806
unsigned int VTMVAEvaluator::getDataBin()
807807
{
808-
if(!fData || fData->ErecS <= 0 )
808+
if(!fData || fData->get_Erec() <= 0 )
809809
{
810810
return 9999;
811811
}
812-
return getDataBin( log10( fData->ErecS ), fData->Ze );
812+
return getDataBin( log10( fData->get_Erec() ), fData->Ze );
813813
}
814814

815815

0 commit comments

Comments
 (0)