Skip to content

Commit

Permalink
Move the check for the end of file before getting the next event (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell authored Oct 15, 2024
1 parent 286ecfe commit f93b00e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions k4Reco/Overlay/components/OverlayTiming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,13 @@ retType OverlayTiming::operator()(const edm4hep::EventHeaderCollection&
for (int k = 0; k < NOverlay_to_this_BX; ++k) {
info() << "Overlaying background event " << m_bkgEvents->m_nextEntry[groupIndex] << " from group " << groupIndex
<< " to BX " << bxInTrain << endmsg;
auto backgroundEvent =
m_bkgEvents->m_rootFileReaders[groupIndex].readEvent(m_bkgEvents->m_nextEntry[groupIndex]);
m_bkgEvents->m_nextEntry[groupIndex]++;
if (m_bkgEvents->m_nextEntry[groupIndex] >= m_bkgEvents->m_totalNumberOfEvents[groupIndex] &&
!m_allowReusingBackgroundFiles) {
throw GaudiException("No more events in background file", name(), StatusCode::FAILURE);
}
auto backgroundEvent =
m_bkgEvents->m_rootFileReaders[groupIndex].readEvent(m_bkgEvents->m_nextEntry[groupIndex]);
m_bkgEvents->m_nextEntry[groupIndex]++;
m_bkgEvents->m_nextEntry[groupIndex] %= m_bkgEvents->m_totalNumberOfEvents[groupIndex];
auto availableCollections = backgroundEvent.getAvailableCollections();

Expand Down

0 comments on commit f93b00e

Please sign in to comment.