From ec8d2ed3d6a8f2e7c6f7d4f88997117def1d6800 Mon Sep 17 00:00:00 2001
From: Wouter Deconinck <wdconinc@gmail.com>
Date: Sun, 7 May 2023 19:01:31 -0400
Subject: [PATCH] Geant4Output2EDM4hep: extract iterator, write mapped

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

diff --git a/DDG4/edm4hep/Geant4Output2EDM4hep.cpp b/DDG4/edm4hep/Geant4Output2EDM4hep.cpp
index 335392f8f..1a7020376 100644
--- a/DDG4/edm4hep/Geant4Output2EDM4hep.cpp
+++ b/DDG4/edm4hep/Geant4Output2EDM4hep.cpp
@@ -235,8 +235,8 @@ void Geant4Output2EDM4hep::commit( OutputContext<G4Event>& /* ctxt */)   {
     G4AutoLock protection_lock(&action_mutex);
     m_frame.put( std::move(m_particles), "MCParticles");
     while ( ! m_trackerHits.empty() ) {
-      auto trackerHits = m_trackerHits.back().extract();
-      m_frame.put( std::move(trackerHits), trackerHits.key());
+      auto trackerHits = m_trackerHits.extract(m_trackerHits.begin());
+      m_frame.put( std::move(trackerHits.mapped()), trackerHits.key());
     }
     while ( ! m_calorimeterHits.empty() ) {
       const auto colName = m_calorimeterHits.back().key();
-- 
GitLab