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/298.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Limit number of errors printed when reading faulty VBF files to avoid TB large log files.
1 change: 1 addition & 0 deletions docs/changes/298.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add new command line parameter `--minpedestalevents` to set the minimum number of required pedestal events (default: 50).
2 changes: 1 addition & 1 deletion inc/VDetectorTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class VDetectorTree
VDetectorTree();
~VDetectorTree();
bool fillDetectorTree( VDetectorGeometry* iDet );
bool readDetectorTree( VDetectorGeometry* iDet, TTree* iTree);
bool readDetectorTree( VDetectorGeometry* iDet, TTree* iTree );
TTree* getTree()
{
return fTreeDet;
Expand Down
4 changes: 3 additions & 1 deletion inc/VEvndispRunParameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ class VEvndispRunParameter : public TNamed, public VGlobalRunParameter
bool fWriteImagePixelList; // write image pixel list to tpars tree
string fLowGainCalibrationFile; // file with file name for low-gain calibration
int fNCalibrationEvents; // events to be used for calibration
int fNMinimumNumberOfPedestalEvents; // minimum number of pedestal events required for pedestal calculation
float faverageTZeroFiducialRadius; // fiducial radius for average tzero calculation (DST), in fraction of FOV
unsigned int fCombineChannelsForPedestalCalculation; // combine all channels per telescope type for the pedestal calculation
vector< int > fGainFileNumber;
Expand Down Expand Up @@ -297,6 +298,7 @@ class VEvndispRunParameter : public TNamed, public VGlobalRunParameter
// functions
void print();
void print( int iEV );
void printCTA_DST();

VEvndispRunParameter( bool bSetGlobalParameter = true );
~VEvndispRunParameter();
Expand Down Expand Up @@ -331,6 +333,6 @@ class VEvndispRunParameter : public TNamed, public VGlobalRunParameter
return ( fDBTextDirectory.size() > 0 );
}

ClassDef( VEvndispRunParameter, 2007 ); //(increase this number)
ClassDef( VEvndispRunParameter, 2008 ); //(increase this number)
};
#endif
11 changes: 9 additions & 2 deletions src/VBFDataReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ bool VBFDataReader::getNextEvent()
}
bool bSimulations = false;

unsigned int n_error_prints = 0;
Copy link

Copilot AI Jun 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The n_error_prints counter is reset on each call since it's a local variable. Consider making it static or a class member so it persists across multiple invocations and effectively limits log output.

Copilot uses AI. Check for mistakes.

try
{
if( fDebug )
Expand All @@ -63,10 +65,15 @@ bool VBFDataReader::getNextEvent()
}
catch( const std::exception& e )
{
std::cout << "VBFDataReader::getNextEvent: exception while reading file: "
<< e.what() << std::endl;
// corrupt files otherwise generated 100s of GB of log files
if( n_error_prints < 5000 )
{
std::cout << "VBFDataReader::getNextEvent: exception while reading file: "
<< e.what() << std::endl;
}
pack = old_pack;
setEventStatus( 0 );
n_error_prints++;
return false;
}
delete old_pack;
Expand Down
2 changes: 1 addition & 1 deletion src/VBaseRawDataReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ bool VBaseRawDataReader::getHiLo( uint32_t i )
{
return fEvent[fTelID]->getHiLo( i );
}
catch(...)
catch( ... )
{
cout << "EXCEPTION " << i << endl;
return false;
Expand Down
7 changes: 3 additions & 4 deletions src/VCalibrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,16 +431,15 @@ void VCalibrator::writePeds( bool iLowGain, VPedestalCalculator* iPedestalCalcul
for( unsigned int i = 0; i < hped_vec[telType][0].size(); i++ )
{
// get pedestal and pedestal variances from pedestal histograms
// (require at least 100 entries in pedestal events)
os << t << " " << i << " ";
if( hped_vec[telType][fRunPar->fCalibrationSumWindow - 1][i]
&& hped_vec[telType][fRunPar->fCalibrationSumWindow - 1][i]->GetEntries() > 50 )
&& hped_vec[telType][fRunPar->fCalibrationSumWindow - 1][i]->GetEntries() > fRunPar->fNMinimumNumberOfPedestalEvents )
{
os << hped_vec[telType][fRunPar->fCalibrationSumWindow - 1][i]->GetMean() / ( double )fRunPar->fCalibrationSumWindow << " ";
}
else
{
cout << "VCalibrator::writePeds(): WARNING, less than 50 events ";
cout << "VCalibrator::writePeds(): WARNING, less than " << fRunPar->fNMinimumNumberOfPedestalEvents << " events ";
if( hped_vec[telType][fRunPar->fCalibrationSumWindow - 1][i] )
{
cout << "(";
Expand All @@ -454,7 +453,7 @@ void VCalibrator::writePeds( bool iLowGain, VPedestalCalculator* iPedestalCalcul
// loop over all window sizes
for( unsigned int j = 0; j < hped_vec[telType].size(); j++ )
{
if( hped_vec[telType][j][i] && hped_vec[telType][j][i]->GetEntries() > 50 )
if( hped_vec[telType][j][i] && hped_vec[telType][j][i]->GetEntries() > fRunPar->fNMinimumNumberOfPedestalEvents )
{
os << hped_vec[telType][j][i]->GetRMS() << " ";
}
Expand Down
2 changes: 1 addition & 1 deletion src/VDetectorTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ bool VDetectorTree::fillDetectorTree( VDetectorGeometry* iDet )
}


bool VDetectorTree::readDetectorTree( VDetectorGeometry* iDet, TTree* iTree)
bool VDetectorTree::readDetectorTree( VDetectorGeometry* iDet, TTree* iTree )
{
if(!iDet || !iTree )
{
Expand Down
5 changes: 5 additions & 0 deletions src/VEvndispRunParameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ VEvndispRunParameter::VEvndispRunParameter( bool bSetGlobalParameter ) : VGlobal
fLowGainCalibrationFile = "calibrationlist.LowGain.dat";
fcalibrationrun = false;
fNCalibrationEvents = -1;
fNMinimumNumberOfPedestalEvents = 50;
Comment thread
GernotMaier marked this conversation as resolved.
fLaserSumMin = 50000.;
fGainFileNumber.push_back( 0 );
fTOffFileNumber.push_back( 0 );
Expand Down Expand Up @@ -527,6 +528,10 @@ void VEvndispRunParameter::print( int iEv )
{
cout << "number of events in calibration analysis: " << fNCalibrationEvents << endl;
}
if( frunmode == 1 )
{
cout << "Minimum number of required pedestal events: " << fNMinimumNumberOfPedestalEvents << endl;
}
if( frunmode == 4 )
{
cout << "dstfile: " << fdstfile << " (mintubes: " << fdstminntubes << ")" << endl;
Expand Down
4 changes: 4 additions & 0 deletions src/VReadRunParameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,10 @@ bool VReadRunParameter::readCommandline( int argc, char* argv[] )
{
fRunPara->fNCalibrationEvents = atoi( iTemp.substr( iTemp.rfind( "=" ) + 1, iTemp.size() ).c_str() );
}
else if( iTemp.find( "minpedestalevents" ) < iTemp.size() )
Comment thread
GernotMaier marked this conversation as resolved.
{
fRunPara->fNMinimumNumberOfPedestalEvents = atoi( iTemp.substr( iTemp.rfind( "=" ) + 1, iTemp.size() ).c_str() );
}
// first event number (skip to this point)
else if( iTemp.rfind( "firstevent" ) < iTemp.size() )
{
Expand Down
Loading