From 492a4341282b137852698fb440f1e0f149471f0f Mon Sep 17 00:00:00 2001 From: Yuan CHAO Date: Wed, 15 Nov 2023 03:48:30 +0100 Subject: [PATCH] remove try/catch clause in castor analyzer --- .../CastorCalib/src/CastorLedAnalysis.cc | 22 +++++---- .../CastorCalib/src/CastorPedestalAnalysis.cc | 45 +++++++++---------- 2 files changed, 32 insertions(+), 35 deletions(-) diff --git a/CalibCalorimetry/CastorCalib/src/CastorLedAnalysis.cc b/CalibCalorimetry/CastorCalib/src/CastorLedAnalysis.cc index cb3bffd829827..598f3f36eacbf 100644 --- a/CalibCalorimetry/CastorCalib/src/CastorLedAnalysis.cc +++ b/CalibCalorimetry/CastorCalib/src/CastorLedAnalysis.cc @@ -527,19 +527,17 @@ void CastorLedAnalysis::processLedEvent(const CastorDigiCollection& castor, cons evt_curr = m_nevtsample; // HF/Castor - try { - if (castor.empty()) - throw (int)castor.size(); - for (CastorDigiCollection::const_iterator j = castor.begin(); j != castor.end(); ++j) { - const CastorDataFrame digi = (const CastorDataFrame)(*j); - _meol = castorHists.LEDTRENDS.find(digi.id()); - if (_meol == castorHists.LEDTRENDS.end()) { - SetupLEDHists(2, digi.id(), castorHists.LEDTRENDS); - } - LedCastorHists(digi.id(), digi, castorHists.LEDTRENDS, cond); + if (castor.empty()) { + edm::LogError("CastorLedAnalysis") << "Event with " << (int)castor.size() << "Castor Digis passed." << std::endl; + return; + } + for (CastorDigiCollection::const_iterator j = castor.begin(); j != castor.end(); ++j) { + const CastorDataFrame digi = (const CastorDataFrame)(*j); + _meol = castorHists.LEDTRENDS.find(digi.id()); + if (_meol == castorHists.LEDTRENDS.end()) { + SetupLEDHists(2, digi.id(), castorHists.LEDTRENDS); } - } catch (int i) { - // m_logFile << "Event with " << i<<" Castor Digis passed." << std::endl; + LedCastorHists(digi.id(), digi, castorHists.LEDTRENDS, cond); } // Call the function every m_nevtsample events diff --git a/CalibCalorimetry/CastorCalib/src/CastorPedestalAnalysis.cc b/CalibCalorimetry/CastorCalib/src/CastorPedestalAnalysis.cc index 41fa9ed6fc598..eb5977282490c 100644 --- a/CalibCalorimetry/CastorCalib/src/CastorPedestalAnalysis.cc +++ b/CalibCalorimetry/CastorCalib/src/CastorPedestalAnalysis.cc @@ -105,32 +105,31 @@ void CastorPedestalAnalysis::processEvent(const CastorDigiCollection& castor, co m_shape = cond.getCastorShape(); // HF - try { - if (castor.empty()) - throw (int)castor.size(); - for (CastorDigiCollection::const_iterator j = castor.begin(); j != castor.end(); ++j) { - const CastorDataFrame digi = (const CastorDataFrame)(*j); - m_coder = cond.getCastorCoder(digi.id()); - for (int i = m_startTS; i < digi.size() && i <= m_endTS; i++) { - for (int flag = 0; flag < 4; flag++) { - if (i + flag < digi.size() && i + flag <= m_endTS) { - per2CapsHists(flag, 2, digi.id(), digi.sample(i), digi.sample(i + flag), castorHists.PEDTRENDS, cond); - } + if (castor.empty()) { + edm::LogError("CastorLedAnalysis") << "Event with " << (int)castor.size() << "Castor Digis passed." << std::endl; + return; + } + + for (CastorDigiCollection::const_iterator j = castor.begin(); j != castor.end(); ++j) { + const CastorDataFrame digi = (const CastorDataFrame)(*j); + m_coder = cond.getCastorCoder(digi.id()); + for (int i = m_startTS; i < digi.size() && i <= m_endTS; i++) { + for (int flag = 0; flag < 4; flag++) { + if (i + flag < digi.size() && i + flag <= m_endTS) { + per2CapsHists(flag, 2, digi.id(), digi.sample(i), digi.sample(i + flag), castorHists.PEDTRENDS, cond); } } - if (m_startTS == 0 && m_endTS > 4) { - AllChanHists(digi.id(), - digi.sample(0), - digi.sample(1), - digi.sample(2), - digi.sample(3), - digi.sample(4), - digi.sample(5), - castorHists.PEDTRENDS); - } } - } catch (int i) { - // m_logFile << "Event with " << i<<" Castor Digis passed." << std::endl; + if (m_startTS == 0 && m_endTS > 4) { + AllChanHists(digi.id(), + digi.sample(0), + digi.sample(1), + digi.sample(2), + digi.sample(3), + digi.sample(4), + digi.sample(5), + castorHists.PEDTRENDS); + } } // Call the function every m_nevtsample events if (m_nevtsample > 0) {