Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
9e05851
readme
GernotMaier May 17, 2026
c1cfa14
fix release link
GernotMaier May 27, 2026
24887ca
CTA alignment
GernotMaier May 29, 2026
48c2d20
A1
GernotMaier May 29, 2026
90e0d4f
A6
GernotMaier May 29, 2026
cef8981
A7
GernotMaier May 29, 2026
31e6eb3
A8
GernotMaier May 29, 2026
b0d30e1
A9
GernotMaier May 29, 2026
3461a59
A10
GernotMaier May 29, 2026
a3cde89
A11
GernotMaier May 29, 2026
fede3fc
A12
GernotMaier May 29, 2026
7b23c7d
A13
GernotMaier May 29, 2026
43fac3f
A14
GernotMaier May 29, 2026
db2075f
A15
GernotMaier May 29, 2026
dd5629f
A17
GernotMaier May 29, 2026
3e036fa
A4
GernotMaier May 30, 2026
d5da3d7
B1
GernotMaier May 30, 2026
f0d7588
B5
GernotMaier May 30, 2026
311a727
B8
GernotMaier May 30, 2026
05aed05
B9
GernotMaier May 30, 2026
7f829f7
B13
GernotMaier May 30, 2026
5b3a611
B14
GernotMaier May 30, 2026
975b6cc
B13
GernotMaier May 30, 2026
030c14c
B15
GernotMaier May 30, 2026
8675442
changelog
GernotMaier May 30, 2026
303042f
A2: fix sliding-window fRaw branch returning FADC[1] instead of charge
GernotMaier May 31, 2026
7906bda
A2: fix sliding-window fRaw branch returning FADC[1] instead of charge
GernotMaier May 31, 2026
e59d587
Merge pull request #353 from VERITAS-Observatory/v492-17-v2
GernotMaier May 31, 2026
70982af
fix(E4): guard XGB sidecar file opens by reconstruction method and cu…
GernotMaier May 31, 2026
219f1d4
docs: shorten E4 changelog entry
GernotMaier May 31, 2026
ef29c8e
Merge pull request #355 from VERITAS-Observatory/fix-E4-xgb-guard
GernotMaier May 31, 2026
8386431
fix: explicit NegWeightTreatment=Pray for BoostType=Grad in TMVA angu…
GernotMaier May 31, 2026
e3a370a
Merge pull request #357 from VERITAS-Observatory/fix-tmva-negweight
GernotMaier May 31, 2026
d24c1b6
Potential fix for pull request finding
GernotMaier Jun 1, 2026
a820596
Potential fix for pull request finding
GernotMaier Jun 1, 2026
94f00c1
Potential fix for pull request finding
GernotMaier Jun 1, 2026
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
All notable changes to the Eventdisplay_v4 project will be documented in this file.
Changes for upcoming releases can be found in the [docs/changes](docs/changes) directory.
Note that changes before release v492.0 are not documented here, but can be found in the
[GitHub repository](https://github.com/VERITAS-Observatory/VTS-SimPipe/releases).
[GitHub repository](https://github.com/VERITAS-Observatory/EventDisplay_v4/releases).

This changelog is generated using [Towncrier](https://towncrier.readthedocs.io/).

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
## Overview

Eventdisplay is a reconstruction and analysis pipeline for data of
Imaging Atmospheric Cherenkov Telescopes.
Imaging Atmospheric Cherenkov Telescopes (IACT).
It has been primarily developed for the analysis of VERITAS and CTAO data to generate results for scientific publications.
This repository contains the Eventdisplay version used for VERITAS analysis ([CTAO version](https://github.com/Eventdisplay/Eventdisplay))

* Original developers: Gernot Maier and Jamie Holder
* Authors and contributors: [CITATION.cff](CITATION.cff)
* Authors and contributors: [CITATION.cff](CITATION.cff) and [CONTRIBUTORS.md](CONTRIBUTORS.md)
* License: [LICENSE](LICENSE)
* Contributing: [CONTRIBUTING.md](CONTRIBUTING.md)
* Changelog: [CHANGELOG.md](CHANGELOG.md)
Expand Down
2 changes: 2 additions & 0 deletions docs/changes/351.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fixes long list of bugs listed in [Issue #352](https://github.com/VERITAS-Observatory/EventDisplay_v4/issues/352).
Fix A2: `VTraceHandler::calculateTraceSum_slidingWindow()` fRaw branch returned `FADC[1]` (second FADC sample, ped-subtracted) instead of the accumulated raw charge sum. Affected pedestal calculation path.
5 changes: 5 additions & 0 deletions docs/changes/352.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Bug fix: non-XGB jobs no longer probe XGB sidecar files (E4)

XGB sidecar files (stereo and gamma-hadron) are now opened only when the active
reconstruction method and gamma-hadron cut type actually require them, eliminating
spurious ROOT file-open errors in non-XGB jobs.
7 changes: 7 additions & 0 deletions docs/changes/353.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Bug fix: explicit NegWeightTreatment for TMVA Gradient BDT angular reconstruction

Added `NegWeightTreatment=Pray` to the default TMVA options in
`trainTMVAforAngularReconstruction` to match actual TMVA behaviour:
`BoostType=Grad` does not support `InverseBoostNegWeights` (TMVA's global
default) and silently replaces it with `Pray`; the options string now
declares this explicitly so the training configuration matches what is used.
2 changes: 2 additions & 0 deletions inc/CData.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class CData
vector< double > fTelX;
vector< double > fTelY;
vector< double > fTelZ;
string fDataFileName;

void reconstruct_3tel_images( long unsigned int );
void reconstruct_3tel_images_direction();
Expand Down Expand Up @@ -280,6 +281,7 @@ class CData
float get_Yoff( unsigned int method );
void initialize_xgb_tree();
TTree* getXGBTree( string file_name, string suffix, string tree_name );
bool loadGHXGBTree( string gh_suffix );
pair<float, float> get_XYoff_derot( unsigned int method );
virtual Long64_t LoadTree( Long64_t entry );
float get_GH_Gamma_Prediction();
Expand Down
33 changes: 32 additions & 1 deletion src/CData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ CData::CData( TTree* tree, bool bMC, bool bShort, string file_name, string stere
fShort = bShort;
fVersion = 6;
fTelescopeCombination = 0;
fDataFileName = file_name;
Init( tree );

fStereoFriendTree = getXGBTree( file_name, stereo_suffix, "StereoAnalysis" );
Expand Down Expand Up @@ -1077,7 +1078,15 @@ TTree* CData::getXGBTree( string file_name, string file_suffix, string tree_name
return 0;
}

file_name = file_name.replace( file_name.find( ".root" ), 5, "." + file_suffix + ".root" );
size_t iRootPos = file_name.rfind( ".root" );
if( iRootPos != string::npos && iRootPos + 5 == file_name.size() )
{
file_name.replace( iRootPos, 5, "." + file_suffix + ".root" );
}
else
{
file_name += "." + file_suffix + ".root";
}
TFile *iFile = TFile::Open( file_name.c_str() );
if(!iFile || iFile->IsZombie() )
{
Expand Down Expand Up @@ -1126,3 +1135,25 @@ void CData::initialize_xgb_tree()
GH_Is_Gamma = false;
}
}

/*
* Deferred loading of the XGB gamma-hadron friend tree.
* Call this after the analysis type is known (e.g. after readCuts()),
* when the caller has confirmed that XGB gamma-hadron cuts are active.
* Idempotent: a second call is a no-op if the tree is already loaded.
*/
bool CData::loadGHXGBTree( string gh_suffix )
{
if( fGHFriendTree )
{
return true;
}
if( fDataFileName.empty() )
{
cout << "CData::loadGHXGBTree error: no data file name stored" << endl;
return false;
}
fGHFriendTree = getXGBTree( fDataFileName, gh_suffix, "Classification" );
initialize_xgb_tree();
return ( fGHFriendTree != 0 );
}
4 changes: 2 additions & 2 deletions src/VArrayAnalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ int VArrayAnalyzer::rcs_method_0( unsigned int iMethod )
bool VArrayAnalyzer::fillShowerCore( unsigned int iMeth, float ximp, float yimp )
{
// check validity
if(!isnormal( ximp ) || !isnormal( ximp ) )
if(!isnormal( ximp ) || !isnormal( yimp ) )
{
ximp = -99999.;
yimp = -99999.;
Expand Down Expand Up @@ -1243,7 +1243,7 @@ int VArrayAnalyzer::rcs_method_3( unsigned int iMethod )
iangdiff = sin( fabs( atan( m[jj] ) - atan( m[ii] ) ) );

// discard all pairs with almost parallel lines
float i_diff = fabs( atan( m[0] ) - atan( m[1] ) );
float i_diff = fabs( atan( mm[0] ) - atan( mm[1] ) );
if( i_diff < fEvndispReconstructionParameter->fAxesAngles_min[iMethod] / TMath::RadToDeg() ||
fabs( 180. / TMath::RadToDeg() - i_diff ) < fEvndispReconstructionParameter->fAxesAngles_min[iMethod] / TMath::RadToDeg() )
{
Expand Down
1 change: 1 addition & 0 deletions src/VCalibrationData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ void VCalibrationData::setAverageTZero( double iAverageTzero, bool iLowGain )
if( iLowGain )
{
fAverageTZero_lowgain = iAverageTzero;
return;
}

fAverageTZero_highgain = iAverageTzero;
Expand Down
14 changes: 13 additions & 1 deletion src/VEmissionHeightCalculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,18 @@ double VEmissionHeightCalculator::getEmissionHeight( float* cen_x, float* cen_y,
fImageDistance = TMath::Tan( imageDistance( cen_x[i], cen_x[j], cen_y[i], cen_y[j] ) / TMath::RadToDeg() );
if( fImageDistance > 0. )
{
double iLogSizeI = log10( size[i] );
double iLogSizeJ = log10( size[j] );
if( iLogSizeI <= 0. || iLogSizeJ <= 0. )
{
continue;
}
// get distance between the two telescopes in shower coordinates
fTelescopeDistanceSC = getTelescopeDistanceSC( i, j, az, el );
// calculate emission height [km]
iEmissionHeightTemp = fTelescopeDistanceSC / fImageDistance / 1.e3;
// weight for pairwise emission height calculation
iEmissionHeightWeightTemp = 1. / (( 1. / log10( size[i] ) ) + ( 1. / log10( size[j] ) ) );
iEmissionHeightWeightTemp = 1. / (( 1. / iLogSizeI ) + ( 1. / iLogSizeJ ) );
iEmissionHeightWeight += iEmissionHeightWeightTemp;
iEmissionHeight += iEmissionHeightTemp * iEmissionHeightWeightTemp;
iEmissionHeight2 += iEmissionHeightTemp * iEmissionHeightTemp * iEmissionHeightWeightTemp;
Expand Down Expand Up @@ -105,6 +111,9 @@ void VEmissionHeightCalculator::setTelescopePositions( vector< float > x, vector
{
return;
}
fTelX.clear();
fTelY.clear();
fTelZ.clear();
for( unsigned int i = 0; i < fNTel; i++ )
{
fTelX.push_back( x[i] );
Expand All @@ -121,6 +130,9 @@ void VEmissionHeightCalculator::setTelescopePositions( vector< float > x, vector
void VEmissionHeightCalculator::setTelescopePositions( unsigned int ntel, double* x, double* y, double* z )
{
fNTel = ntel;
fTelX.clear();
fTelY.clear();
fTelZ.clear();
for( unsigned int i = 0; i < ntel; i++ )
{
fTelX.push_back( x[i] );
Expand Down
8 changes: 8 additions & 0 deletions src/VImageParameterCalculation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,10 @@ float VImageParameterCalculation::correctSizeInMuonRing()
{

float xi_tmp = ( float )i / ( float )numSteps;
if( xi_tmp <= 0. )
{
continue;
}
float kTest_tmp = 2.0 * ngExi[i] * kRatio / xi_tmp;

if( fabs( 1.0 - kTest_tmp ) < fabs( 1.0 - kTest ) )
Expand Down Expand Up @@ -1544,11 +1548,13 @@ vector<bool> VImageParameterCalculation::calcLL( bool iUseSums2 )
// image centroid should not be outside of the FOV (by more than 10%)
if( fData->getDetectorGeometry() && fData->getTelID() < fData->getDetectorGeometry()->getFieldofView().size() )
{
fdistXmin = -1.1 * 0.5 * fData->getDetectorGeometry()->getFieldofView()[fData->getTelID()];
fdistXmax = 1.1 * 0.5 * fData->getDetectorGeometry()->getFieldofView()[fData->getTelID()];
}
// should never land here
else
{
fdistXmin = -5.;
fdistXmax = 5.;
}
}
Expand Down Expand Up @@ -1590,11 +1596,13 @@ vector<bool> VImageParameterCalculation::calcLL( bool iUseSums2 )
// image centroid should not be outside of the FOV (by more than 10%)
if( fData->getDetectorGeometry() && fData->getTelID() < fData->getDetectorGeometry()->getFieldofView().size() )
{
fdistYmin = -1.1 * 0.5 * fData->getDetectorGeometry()->getFieldofView()[fData->getTelID()];
fdistYmax = 1.1 * 0.5 * fData->getDetectorGeometry()->getFieldofView()[fData->getTelID()];
}
else
{
// should never land here
fdistYmin = -5.;
fdistYmax = 5.;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/VInstrumentResponseFunctionData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ void VInstrumentResponseFunctionData::fill( double iWeight )
iDiff = sqrt(( fData->Xcore - fData->MCxcore ) * ( fData->Xcore - fData->MCxcore ) +
( fData->Ycore - fData->MCycore ) * ( fData->Ycore - fData->MCycore ) );
// core error
iError = sqrt( fData->Xcore* fData->Xcore + fData->Xcore* fData->Xcore ) -
iError = sqrt( fData->Xcore* fData->Xcore + fData->Ycore* fData->Ycore ) -
sqrt( fData->MCxcore* fData->MCxcore + fData->MCycore* fData->MCycore );
// relative error
if( sqrt( fData->MCxcore * fData->MCxcore + fData->MCycore * fData->MCycore ) > 0. )
Expand Down
6 changes: 6 additions & 0 deletions src/VInstrumentResponseFunctionRunParameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,12 @@ bool VInstrumentResponseFunctionRunParameter::readRunParameterFromTextFile( stri
is_stream >> fRerunStereoReconstruction_3telescopes;
}
}
else
{
cout << "VInstrumentResponseFunctionRunParameter::readRunParameterFromTextFile error: unknown run parameter key " << temp << endl;
cout << "line: " << is_line << endl;
return false;
}
Comment thread
GernotMaier marked this conversation as resolved.
}
}
cout << "========================================" << endl << endl;
Expand Down
19 changes: 17 additions & 2 deletions src/VStereoAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,20 @@ double VStereoAnalysis::fillHistograms( int icounter, int irun, double iAzMin, d
// initialize cuts
setCuts( fRunPara->fRunList[fHisCounter], irun );

// load XGB gamma-hadron friend tree now that the analysis type is known
if( fCuts && fCuts->useXGBoostCuts()
&& fDataRun
&& !fRunPara->fXGB_gh_file_suffix.empty() )
{
if(!fDataRun->loadGHXGBTree( fRunPara->fXGB_gh_file_suffix ) )
{
cout << "VStereoAnalysis::fillHistograms error: failed to load XGB gamma-hadron friend tree" << endl;
cout << "suffix: " << fRunPara->fXGB_gh_file_suffix << endl;
cout << "exiting..." << endl;
exit( EXIT_FAILURE );
}
}
Comment thread
GernotMaier marked this conversation as resolved.

// define histograms
fDirTotRun[fHisCounter]->cd();
fHisto[fHisCounter]->setRunNumber( irun );
Expand Down Expand Up @@ -1967,8 +1981,9 @@ CData* VStereoAnalysis::getDataFromFile( int i_runNumber )
false,
false,
iFileName,
fRunPara->fXGB_stereo_file_suffix,
fRunPara->fXGB_gh_file_suffix
( fRunPara->fEnergyReconstructionMethod == 2 || fRunPara->fDirectionReconstructionMethod == 2 )
? fRunPara->fXGB_stereo_file_suffix : "",
"" // GH XGB tree loaded later, after analysis type is known from cut file
);
// read current (major) epoch from data file
VEvndispRunParameter* i_runPara = ( VEvndispRunParameter* )fDataFile->Get( "runparameterV2" );
Expand Down
4 changes: 2 additions & 2 deletions src/VTMVARunData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ bool VTMVARunData::readConfigurationFile( char* iC )
// check sanity
if( iZenithCut_min.size() < 2 )
{
cout << "VTMVARunData::readConfigurationFile error: need at least one zenith bin ";
cout << "VTMVARunData::readConfigurationFile error: insufficient number of zenith bins ";
cout << iZenithCut_min.size() << endl;
return false;
}
Expand Down Expand Up @@ -795,7 +795,7 @@ bool VTMVARunData::fillEnergyCutData(
// check sanity
if( iEnergyCut_Log10TeV_min.size() < 1 )
{
cout << "VTMVARunData::readConfigurationFile error: need at least two energy bins ";
cout << "VTMVARunData::readConfigurationFile error: insufficient number of energy bins ";
cout << iEnergyCut_Log10TeV_min.size() << endl;
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/VTableLookupRunParameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ bool VTableLookupRunParameter::fillParameters( int argc, char* argv[] )
}
else
{
cout << "unknown parameter, choose 1=fill or 2=read lookup tables" << endl;
cout << "unknown parameter, choose 1=fill or 0=read lookup tables" << endl;
return false;
}
}
Expand Down
27 changes: 24 additions & 3 deletions src/VTraceHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,19 @@ vector< float >& VTraceHandler::getPulseTiming( int fFirst, int fLast, int fTFir
{
fFirst = 0;
}
int nTrace = ( int )fpTrace.size();
if( nTrace < 2 )
{
return fpulsetiming;
}
if( fTFirst < 0 )
{
fTFirst = 0;
}
if( fTLast > nTrace - 1 )
{
fTLast = nTrace - 1;
}
// reset pulse timing vector
for( unsigned int i = 0; i < fpulsetiming.size(); i++ )
{
Expand All @@ -343,7 +356,12 @@ vector< float >& VTraceHandler::getPulseTiming( int fFirst, int fLast, int fTFir
// (loop backwards over pulse)
bool bBreak = false;
fFindPulseTiming = false;
for( int i = maxpos; i >= fTFirst ; i-- )
int i_start = maxpos;
if( i_start > nTrace - 2 )
{
i_start = nTrace - 2;
}
for( int i = i_start; i >= fTFirst ; i-- )
{
i_trace = fpTrace[i] - fPed;
// loop over all pulse level
Expand Down Expand Up @@ -753,7 +771,7 @@ double VTraceHandler::calculateTraceSum_slidingWindow( unsigned int iSearchStart
fSumWindowFirst = n - iIntegrationWindow;
fSumWindowLast = n;

return FADC[1];
return charge;
}

////////////////////////////////////////
Expand All @@ -780,7 +798,10 @@ double VTraceHandler::calculateTraceSum_slidingWindow( unsigned int iSearchStart
fSumWindowLast = n;
}
}
xmax = xmax - FADC[i] + FADC[i + iIntegrationWindow];
if( i + iIntegrationWindow < n )
{
xmax = xmax - FADC[i] + FADC[i + iIntegrationWindow];
}
}
// arrival times (weighted average)
float tcharge = 0.;
Expand Down
2 changes: 1 addition & 1 deletion src/anasum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ int main( int argc, char* argv[] )
// stereo analysis (default)
if( analysisType == 3 || analysisType == 4 )
{
anasum->doStereoAnalysis(( analysisType == 3 ) || ( analysisType == 5 ) );
anasum->doStereoAnalysis( analysisType == 3 );
}
else
{
Expand Down
Loading
Loading