diff --git a/test/read_events.h b/test/read_events.h index da675d5dd..d3a71d5ae 100644 --- a/test/read_events.h +++ b/test/read_events.h @@ -11,12 +11,10 @@ // podio specific includes #include "podio/Frame.h" +#include "podio/podioVersion.h" // STL -#include -#include #include -#include void processEvent(const podio::Frame& event) { auto& mcps = event.get("MCParticles"); @@ -240,7 +238,11 @@ void processEvent(const podio::Frame& event) { // throw std::runtime_error("Collection 'SimCalorimeterHitContributions' should be present"); // } +#if PODIO_BUILD_VERSION > PODIO_VERSION(0, 99, 0) + const auto evtType = event.getParameter("EventType").value(); +#else const auto& evtType = event.getParameter("EventType"); +#endif std::cout << "Event Type: " << evtType << std::endl; } diff --git a/utils/src/ParticleIDUtils.cc b/utils/src/ParticleIDUtils.cc index 43c1c61ab..8b6337642 100644 --- a/utils/src/ParticleIDUtils.cc +++ b/utils/src/ParticleIDUtils.cc @@ -3,8 +3,8 @@ #include "edm4hep/Constants.h" #include +#include -#include #include #include #include @@ -123,6 +123,20 @@ std::optional PIDHandler::getAlgoInfo(const podi const std::string& collName) { ParticleIDMeta pidInfo{}; +#if PODIO_BUILD_VERSION > PODIO_VERSION(0, 99, 0) + auto maybeAlgoName = metadata.getParameter(podio::collMetadataParamName(collName, edm4hep::pidAlgoName)); + if (!maybeAlgoName.has_value()) { + return std::nullopt; + } + + pidInfo.algoName = std::move(maybeAlgoName.value()); + pidInfo.algoType = metadata.getParameter(podio::collMetadataParamName(collName, edm4hep::pidAlgoType)).value(); + pidInfo.paramNames = + metadata + .getParameter>(podio::collMetadataParamName(collName, edm4hep::pidParameterNames)) + .value(); + +#else pidInfo.algoName = metadata.getParameter(podio::collMetadataParamName(collName, edm4hep::pidAlgoName)); // Use the algoName as proxy to see whether we could actually get the // information from the metadata @@ -133,6 +147,7 @@ std::optional PIDHandler::getAlgoInfo(const podi pidInfo.algoType = metadata.getParameter(podio::collMetadataParamName(collName, edm4hep::pidAlgoType)); pidInfo.paramNames = metadata.getParameter>( podio::collMetadataParamName(collName, edm4hep::pidParameterNames)); +#endif return pidInfo; }