From 3beea52b59379fc095ec3fce5adf75cb291db857 Mon Sep 17 00:00:00 2001 From: Andre Sailer Date: Wed, 18 Dec 2024 15:19:26 +0100 Subject: [PATCH] ReadEDM4hep: use generic Reader, but need podio 01.02 for this --- DDG4/CMakeLists.txt | 2 +- DDG4/edm4hep/EDM4hepFileReader.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/DDG4/CMakeLists.txt b/DDG4/CMakeLists.txt index 0a341469d..04f6f6fae 100644 --- a/DDG4/CMakeLists.txt +++ b/DDG4/CMakeLists.txt @@ -105,7 +105,7 @@ ENDIF() IF(TARGET EDM4HEP::edm4hep) dd4hep_add_plugin(DDG4EDM4HEP SOURCES edm4hep/*.cpp - USES DD4hep::DDG4 EDM4HEP::edm4hep EDM4HEP::edm4hepDict podio::podio podio::podioDict podio::podioRootIO + USES DD4hep::DDG4 EDM4HEP::edm4hep EDM4HEP::edm4hepDict podio::podio podio::podioDict podio::podioRootIO podio::podioIO ) install(TARGETS DDG4EDM4HEP EXPORT DD4hep LIBRARY DESTINATION lib) set_target_properties(DDG4EDM4HEP PROPERTIES VERSION ${DD4hep_VERSION} SOVERSION ${DD4hep_SOVERSION}) diff --git a/DDG4/edm4hep/EDM4hepFileReader.cpp b/DDG4/edm4hep/EDM4hepFileReader.cpp index f21441fef..563f8ce66 100644 --- a/DDG4/edm4hep/EDM4hepFileReader.cpp +++ b/DDG4/edm4hep/EDM4hepFileReader.cpp @@ -32,7 +32,7 @@ #include #include -#include +#include typedef dd4hep::detail::ReferenceBitMask PropertyMask; @@ -85,7 +85,7 @@ namespace dd4hep::sim { class EDM4hepFileReader : public Geant4EventReader { protected: /// Reference to reader object - podio::ROOTReader m_reader {}; + podio::Reader m_reader; /// Name of the MCParticle collection to read std::string m_collectionName; /// Name of the EventHeader collection to read @@ -108,11 +108,11 @@ namespace dd4hep::sim { /// Initializing constructor dd4hep::sim::EDM4hepFileReader::EDM4hepFileReader(const std::string& nam) : Geant4EventReader(nam) + , m_reader(podio::makeReader(nam)) , m_collectionName("MCParticles") , m_eventHeaderCollectionName("EventHeader") { printout(INFO,"EDM4hepFileReader","Created file reader. Try to open input %s",nam.c_str()); - m_reader.openFile(nam); m_directAccess = true; } @@ -120,7 +120,7 @@ namespace dd4hep::sim { try { auto *parameters = new RunParameters(); try { - podio::Frame runFrame = m_reader.readEntry("runs", 0); + podio::Frame runFrame = m_reader.readFrame("runs", 0); parameters->ingestParameters(runFrame.getParameters()); } catch (std::runtime_error& e) { // we ignore if we do not have runs information @@ -128,7 +128,7 @@ namespace dd4hep::sim { // we ignore if we do not have runs information } try { - podio::Frame metaFrame = m_reader.readEntry("metadata", 0); + podio::Frame metaFrame = m_reader.readFrame("metadata", 0); parameters->ingestParameters(metaFrame.getParameters()); } catch (std::runtime_error& e) { // we ignore if we do not have metadata information @@ -156,7 +156,7 @@ namespace dd4hep::sim { EDM4hepFileReader::EventReaderStatus EDM4hepFileReader::readParticles(int event_number, Vertices& vertices, std::vector& particles) { m_currEvent = event_number; - podio::Frame frame = m_reader.readEntry("events", event_number); + podio::Frame frame = m_reader.readFrame("events", event_number); const auto& primaries = frame.get(m_collectionName); int eventNumber = event_number, runNumber = 0; if (primaries.isValid()) {