From 1c79b1492373dd66b17ea2530a63ec434396afa9 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 21 Aug 2023 13:17:24 -0500 Subject: [PATCH] Geant4Output2EDM4hep: allow reuse of collection names... again --- DDG4/edm4hep/Geant4Output2EDM4hep.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/DDG4/edm4hep/Geant4Output2EDM4hep.cpp b/DDG4/edm4hep/Geant4Output2EDM4hep.cpp index 6d4acdcc2..9d9ed446d 100644 --- a/DDG4/edm4hep/Geant4Output2EDM4hep.cpp +++ b/DDG4/edm4hep/Geant4Output2EDM4hep.cpp @@ -505,7 +505,7 @@ void Geant4Output2EDM4hep::saveCollection(OutputContext& /*ctxt*/, G4VH //------------------------------------------------------------------- if( typeid( Geant4Tracker::Hit ) == coll->type().type() ){ // Create the hit container even if there are no entries! - auto& hits = m_trackerHits[colName] = edm4hep::SimTrackerHitCollection(); + auto& hits = m_trackerHits[colName]; for(unsigned i=0 ; i < nhits ; ++i){ auto sth = hits->create(); const Geant4Tracker::Hit* hit = coll->hit(i); @@ -536,8 +536,7 @@ void Geant4Output2EDM4hep::saveCollection(OutputContext& /*ctxt*/, G4VH Geant4Sensitive* sd = coll->sensitive(); int hit_creation_mode = sd->hitCreationMode(); // Create the hit container even if there are no entries! - auto& hits = m_calorimeterHits[colName] = - std::make_pair(edm4hep::SimCalorimeterHitCollection(), edm4hep::CaloHitContributionCollection()); + auto& hits = m_calorimeterHits[colName]; for(unsigned i=0 ; i < nhits ; ++i){ auto sch = hits.first->create(); const Geant4Calorimeter::Hit* hit = coll->hit(i);