diff --git a/DDG4/edm4hep/Geant4Output2EDM4hep.cpp b/DDG4/edm4hep/Geant4Output2EDM4hep.cpp index 02ca17daab2c196caa97be016d5d9f831fa359ff..8d80de675ac5386f6a4e9c813ac1ffac50759104 100644 --- a/DDG4/edm4hep/Geant4Output2EDM4hep.cpp +++ b/DDG4/edm4hep/Geant4Output2EDM4hep.cpp @@ -442,7 +442,7 @@ void Geant4Output2EDM4hep::saveCollection(OutputContext<G4Event>& /*ctxt*/, G4VH //------------------------------------------------------------------- if( typeid( Geant4Tracker::Hit ) == coll->type().type() ){ // Create the hit container even if there are no entries! - auto& hits = m_trackerHits[colName] = {}; + auto& hits = m_trackerHits[colName] = edm4hep::SimTrackerHitCollection(); for(unsigned i=0 ; i < nhits ; ++i){ auto sth = hits->create(); const Geant4Tracker::Hit* hit = coll->hit(i); @@ -473,7 +473,8 @@ void Geant4Output2EDM4hep::saveCollection(OutputContext<G4Event>& /*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] = {}; + auto& hits = m_calorimeterHits[colName] = + std::make_pair(edm4hep::SimCalorimeterHitCollection(), edm4hep::CaloHitContributionCollection()); for(unsigned i=0 ; i < nhits ; ++i){ auto sch = hits.first->create(); const Geant4Calorimeter::Hit* hit = coll->hit(i);