3333
3434using namespace o2 ::emcal::reco_workflow;
3535
36+ RawToCellConverterSpec::~RawToCellConverterSpec ()
37+ {
38+ if (mErrorMessagesSuppressed ) {
39+ LOG (WARNING) << " Suppressed further " << mErrorMessagesSuppressed << " error messages" ;
40+ }
41+ }
42+
3643void RawToCellConverterSpec::init (framework::InitContext& ctx)
3744{
3845 LOG (DEBUG) << " [EMCALRawToCellConverter - init] Initialize converter " ;
@@ -58,6 +65,9 @@ void RawToCellConverterSpec::init(framework::InitContext& ctx)
5865 mRawFitter = std::unique_ptr<CaloRawFitter>(new o2::emcal::CaloRawFitterGamma2);
5966 }
6067
68+ mMaxErrorMessages = ctx.options ().get <int >(" maxmessage" );
69+ LOG (INFO) << " Suppressing error messages after " << mMaxErrorMessages << " messages" ;
70+
6171 mRawFitter ->setAmpCut (mNoiseThreshold );
6272 mRawFitter ->setL1Phase (0 .);
6373}
@@ -153,7 +163,15 @@ void RawToCellConverterSpec::run(framework::ProcessingContext& ctx)
153163 default :
154164 break ;
155165 }
156- LOG (ERROR) << " EMCAL raw task: " << errormessage << " in Supermodule " << feeID << std::endl;
166+ if (mNumErrorMessages < mMaxErrorMessages ) {
167+ LOG (ERROR) << " EMCAL raw task: " << errormessage << " in Supermodule " << feeID << std::endl;
168+ mNumErrorMessages ++;
169+ if (mNumErrorMessages == mMaxErrorMessages ) {
170+ LOG (ERROR) << " Max. amount of error messages (" << mMaxErrorMessages << " reached, further messages will be suppressed" ;
171+ }
172+ } else {
173+ mErrorMessagesSuppressed ++;
174+ }
157175 // fill histograms with error types
158176 mOutputDecoderErrors .push_back (errornum);
159177 continue ;
@@ -192,7 +210,15 @@ void RawToCellConverterSpec::run(framework::ProcessingContext& ctx)
192210 fitResults.setTime (0 .);
193211 }
194212 } catch (CaloRawFitter::RawFitterError_t& fiterror) {
195- LOG (ERROR) << " Failure in raw fitting: " << CaloRawFitter::createErrorMessage (fiterror);
213+ if (mNumErrorMessages < mMaxErrorMessages ) {
214+ LOG (ERROR) << " Failure in raw fitting: " << CaloRawFitter::createErrorMessage (fiterror);
215+ mNumErrorMessages ++;
216+ if (mNumErrorMessages == mMaxErrorMessages ) {
217+ LOG (ERROR) << " Max. amount of error messages (" << mMaxErrorMessages << " reached, further messages will be suppressed" ;
218+ }
219+ } else {
220+ mErrorMessagesSuppressed ++;
221+ }
196222 mOutputDecoderErrors .emplace_back (feeID, -1 , CaloRawFitter::getErrorNumber (fiterror));
197223 }
198224 currentCellContainer->emplace_back (CellID, fitResults.getAmp () * CONVADCGEV, fitResults.getTime (), chantype);
@@ -234,5 +260,6 @@ o2::framework::DataProcessorSpec o2::emcal::reco_workflow::getRawToCellConverter
234260 outputs,
235261 o2::framework::adaptFromTask<o2::emcal::reco_workflow::RawToCellConverterSpec>(),
236262 o2::framework::Options{
237- {" fitmethod" , o2::framework::VariantType::String, " standard" , {" Fit method (standard or gamma2)" }}}};
263+ {" fitmethod" , o2::framework::VariantType::String, " standard" , {" Fit method (standard or gamma2)" }},
264+ {" maxmessage" , o2::framework::VariantType::Int, 100 , {" Max. amout of error messages to be displayed" }}}};
238265}
0 commit comments