diff --git a/k4FWCore/components/EventHeaderCreator.cpp b/k4FWCore/components/EventHeaderCreator.cpp index 1326e62a..182e1efc 100644 --- a/k4FWCore/components/EventHeaderCreator.cpp +++ b/k4FWCore/components/EventHeaderCreator.cpp @@ -26,13 +26,13 @@ EventHeaderCreator::EventHeaderCreator(const std::string& name, ISvcLocator* svc "Name of the EventHeaderCollection that will be stored in the output root file."); } -StatusCode EventHeaderCreator::execute(const EventContext&) const { - static int eventNumber = 0; +StatusCode EventHeaderCreator::execute(const EventContext& ctx) const { + auto eventNumber = ctx.evt(); debug() << "Filling EventHeader with runNumber " << int(m_runNumber) << " and eventNumber " << eventNumber + m_eventNumberOffset << endmsg; auto headers = m_headerCol.createAndPut(); auto header = headers->create(); header.setRunNumber(m_runNumber); - header.setEventNumber(eventNumber++ + m_eventNumberOffset); + header.setEventNumber(eventNumber + m_eventNumberOffset); return StatusCode::SUCCESS; }