Skip to content

Commit

Permalink
remove try/catch clause in castor analyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuan CHAO committed Nov 15, 2023
1 parent 7d99d30 commit 492a434
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 35 deletions.
22 changes: 10 additions & 12 deletions CalibCalorimetry/CastorCalib/src/CastorLedAnalysis.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
45 changes: 22 additions & 23 deletions CalibCalorimetry/CastorCalib/src/CastorPedestalAnalysis.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 492a434

Please sign in to comment.