From 973dba96aa667d8baf867592f4b372664d74bf93 Mon Sep 17 00:00:00 2001
From: tmadlener <thomas.madlener@desy.de>
Date: Thu, 16 May 2024 11:01:04 +0200
Subject: [PATCH] Make EDM4hep output work with optional parameters

---
 DDG4/edm4hep/Geant4Output2EDM4hep.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/DDG4/edm4hep/Geant4Output2EDM4hep.cpp b/DDG4/edm4hep/Geant4Output2EDM4hep.cpp
index ef0235b86..450550546 100644
--- a/DDG4/edm4hep/Geant4Output2EDM4hep.cpp
+++ b/DDG4/edm4hep/Geant4Output2EDM4hep.cpp
@@ -444,7 +444,11 @@ void Geant4Output2EDM4hep::saveEvent(OutputContext<G4Event>& ctxt)  {
     parameters->extractParameters(m_frame);
 #if PODIO_BUILD_VERSION > PODIO_VERSION(0, 16, 2)
     // This functionality is only present in podio > 0.16.2
+#if PODIO_BUILD_VERSION > PODIO_VERSION(0, 99, 0)
+    eventWeight = m_frame.getParameter<double>("EventWeights").value_or(0.0);
+#else
     eventWeight = m_frame.getParameter<double>("EventWeights");
+#endif
 #endif
   } else { // ... or from DD4hep framework
     runNumber = m_runNo + runNumberOffset;
-- 
GitLab