Skip to content

Commit 9380fc7

Browse files
authored
Merge pull request #298 from VERITAS-Observatory/492-dev7
Limit number of errors. Add min pedestal event command line parameter.
2 parents e45083b + 48f8e9b commit 9380fc7

File tree

10 files changed

+29
-10
lines changed

10 files changed

+29
-10
lines changed

docs/changes/298.bugfix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Limit number of errors printed when reading faulty VBF files to avoid TB large log files.

docs/changes/298.feature.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add new command line parameter `--minpedestalevents` to set the minimum number of required pedestal events (default: 50).

inc/VDetectorTree.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class VDetectorTree
2828
VDetectorTree();
2929
~VDetectorTree();
3030
bool fillDetectorTree( VDetectorGeometry* iDet );
31-
bool readDetectorTree( VDetectorGeometry* iDet, TTree* iTree);
31+
bool readDetectorTree( VDetectorGeometry* iDet, TTree* iTree );
3232
TTree* getTree()
3333
{
3434
return fTreeDet;

inc/VEvndispRunParameter.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ class VEvndispRunParameter : public TNamed, public VGlobalRunParameter
141141
bool fWriteImagePixelList; // write image pixel list to tpars tree
142142
string fLowGainCalibrationFile; // file with file name for low-gain calibration
143143
int fNCalibrationEvents; // events to be used for calibration
144+
int fNMinimumNumberOfPedestalEvents; // minimum number of pedestal events required for pedestal calculation
144145
float faverageTZeroFiducialRadius; // fiducial radius for average tzero calculation (DST), in fraction of FOV
145146
unsigned int fCombineChannelsForPedestalCalculation; // combine all channels per telescope type for the pedestal calculation
146147
vector< int > fGainFileNumber;
@@ -297,6 +298,7 @@ class VEvndispRunParameter : public TNamed, public VGlobalRunParameter
297298
// functions
298299
void print();
299300
void print( int iEV );
301+
void printCTA_DST();
300302

301303
VEvndispRunParameter( bool bSetGlobalParameter = true );
302304
~VEvndispRunParameter();
@@ -331,6 +333,6 @@ class VEvndispRunParameter : public TNamed, public VGlobalRunParameter
331333
return ( fDBTextDirectory.size() > 0 );
332334
}
333335

334-
ClassDef( VEvndispRunParameter, 2007 ); //(increase this number)
336+
ClassDef( VEvndispRunParameter, 2008 ); //(increase this number)
335337
};
336338
#endif

src/VBFDataReader.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ bool VBFDataReader::getNextEvent()
4343
}
4444
bool bSimulations = false;
4545

46+
unsigned int n_error_prints = 0;
47+
4648
try
4749
{
4850
if( fDebug )
@@ -63,10 +65,15 @@ bool VBFDataReader::getNextEvent()
6365
}
6466
catch( const std::exception& e )
6567
{
66-
std::cout << "VBFDataReader::getNextEvent: exception while reading file: "
67-
<< e.what() << std::endl;
68+
// corrupt files otherwise generated 100s of GB of log files
69+
if( n_error_prints < 5000 )
70+
{
71+
std::cout << "VBFDataReader::getNextEvent: exception while reading file: "
72+
<< e.what() << std::endl;
73+
}
6874
pack = old_pack;
6975
setEventStatus( 0 );
76+
n_error_prints++;
7077
return false;
7178
}
7279
delete old_pack;

src/VBaseRawDataReader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ bool VBaseRawDataReader::getHiLo( uint32_t i )
265265
{
266266
return fEvent[fTelID]->getHiLo( i );
267267
}
268-
catch(...)
268+
catch( ... )
269269
{
270270
cout << "EXCEPTION " << i << endl;
271271
return false;

src/VCalibrator.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -431,16 +431,15 @@ void VCalibrator::writePeds( bool iLowGain, VPedestalCalculator* iPedestalCalcul
431431
for( unsigned int i = 0; i < hped_vec[telType][0].size(); i++ )
432432
{
433433
// get pedestal and pedestal variances from pedestal histograms
434-
// (require at least 100 entries in pedestal events)
435434
os << t << " " << i << " ";
436435
if( hped_vec[telType][fRunPar->fCalibrationSumWindow - 1][i]
437-
&& hped_vec[telType][fRunPar->fCalibrationSumWindow - 1][i]->GetEntries() > 50 )
436+
&& hped_vec[telType][fRunPar->fCalibrationSumWindow - 1][i]->GetEntries() > fRunPar->fNMinimumNumberOfPedestalEvents )
438437
{
439438
os << hped_vec[telType][fRunPar->fCalibrationSumWindow - 1][i]->GetMean() / ( double )fRunPar->fCalibrationSumWindow << " ";
440439
}
441440
else
442441
{
443-
cout << "VCalibrator::writePeds(): WARNING, less than 50 events ";
442+
cout << "VCalibrator::writePeds(): WARNING, less than " << fRunPar->fNMinimumNumberOfPedestalEvents << " events ";
444443
if( hped_vec[telType][fRunPar->fCalibrationSumWindow - 1][i] )
445444
{
446445
cout << "(";
@@ -454,7 +453,7 @@ void VCalibrator::writePeds( bool iLowGain, VPedestalCalculator* iPedestalCalcul
454453
// loop over all window sizes
455454
for( unsigned int j = 0; j < hped_vec[telType].size(); j++ )
456455
{
457-
if( hped_vec[telType][j][i] && hped_vec[telType][j][i]->GetEntries() > 50 )
456+
if( hped_vec[telType][j][i] && hped_vec[telType][j][i]->GetEntries() > fRunPar->fNMinimumNumberOfPedestalEvents )
458457
{
459458
os << hped_vec[telType][j][i]->GetRMS() << " ";
460459
}

src/VDetectorTree.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ bool VDetectorTree::fillDetectorTree( VDetectorGeometry* iDet )
187187
}
188188

189189

190-
bool VDetectorTree::readDetectorTree( VDetectorGeometry* iDet, TTree* iTree)
190+
bool VDetectorTree::readDetectorTree( VDetectorGeometry* iDet, TTree* iTree )
191191
{
192192
if(!iDet || !iTree )
193193
{

src/VEvndispRunParameter.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ VEvndispRunParameter::VEvndispRunParameter( bool bSetGlobalParameter ) : VGlobal
8585
fLowGainCalibrationFile = "calibrationlist.LowGain.dat";
8686
fcalibrationrun = false;
8787
fNCalibrationEvents = -1;
88+
fNMinimumNumberOfPedestalEvents = 50;
8889
fLaserSumMin = 50000.;
8990
fGainFileNumber.push_back( 0 );
9091
fTOffFileNumber.push_back( 0 );
@@ -527,6 +528,10 @@ void VEvndispRunParameter::print( int iEv )
527528
{
528529
cout << "number of events in calibration analysis: " << fNCalibrationEvents << endl;
529530
}
531+
if( frunmode == 1 )
532+
{
533+
cout << "Minimum number of required pedestal events: " << fNMinimumNumberOfPedestalEvents << endl;
534+
}
530535
if( frunmode == 4 )
531536
{
532537
cout << "dstfile: " << fdstfile << " (mintubes: " << fdstminntubes << ")" << endl;

src/VReadRunParameter.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,10 @@ bool VReadRunParameter::readCommandline( int argc, char* argv[] )
675675
{
676676
fRunPara->fNCalibrationEvents = atoi( iTemp.substr( iTemp.rfind( "=" ) + 1, iTemp.size() ).c_str() );
677677
}
678+
else if( iTemp.find( "minpedestalevents" ) < iTemp.size() )
679+
{
680+
fRunPara->fNMinimumNumberOfPedestalEvents = atoi( iTemp.substr( iTemp.rfind( "=" ) + 1, iTemp.size() ).c_str() );
681+
}
678682
// first event number (skip to this point)
679683
else if( iTemp.rfind( "firstevent" ) < iTemp.size() )
680684
{

0 commit comments

Comments
 (0)