Skip to content

Commit

Permalink
Update service retrieval after deprecations in Gaudi v39.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell committed Oct 31, 2024
1 parent b57ed3c commit 2e6da10
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions k4FWCore/src/PodioDataSvc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,12 @@ StatusCode PodioDataSvc::initialize() {
m_metadataframe = podio::Frame();
}

IProperty* property;
auto sc = service("ApplicationMgr", property);
if (sc == StatusCode::FAILURE) {
error() << "Could not get ApplicationMgr properties" << std::endl;
auto appMgr = service<IProperty>("ApplicationMgr", false);
if (!appMgr) {
throw std::runtime_error("Could not get ApplicationMgr");
}
Gaudi::Property<int> evtMax;
evtMax.assign(property->getProperty("EvtMax"));
evtMax.assign(appMgr->getProperty("EvtMax"));
m_requestedEventMax = evtMax;
m_requestedEventMax -= m_1stEvtEntry;

Expand Down Expand Up @@ -133,11 +132,15 @@ void PodioDataSvc::endOfRead() {
if (m_eventNum >= m_numAvailableEvents) {
info() << "Reached end of file with event " << m_eventNum << " (" << m_requestedEventMax << " events requested)"
<< endmsg;
IEventProcessor* eventProcessor;
sc = service("ApplicationMgr", eventProcessor);
auto eventProcessor = service<IEventProcessor>("ApplicationMgr", false);
if (!eventProcessor) {
throw std::runtime_error("Could not retrieve ApplicationMgr to schedule a stop");
}
sc = eventProcessor->stopRun();
if (sc.isFailure()) {
throw std::runtime_error("Failed to stop the run");
}
}
// todo: figure out sthg to do with sc (added to silence -Wunused-result)
}

/// Standard Constructor
Expand Down

0 comments on commit 2e6da10

Please sign in to comment.