diff --git a/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp b/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp
index f038658b5498ebd258ef8ffbed8070c79e7f3833..9f63b7bfca2415a83ed32eea2ded30536ced9649 100644
--- a/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp
+++ b/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp
@@ -30,14 +30,7 @@ void
 Edm4hepWriterAnaElemTool::BeginOfEventAction(const G4Event* anEvent) {
     msg() << "Event " << anEvent->GetEventID() << endmsg;
 
-    // reset
-    m_track2primary.clear();
-
-}
-
-void
-Edm4hepWriterAnaElemTool::EndOfEventAction(const G4Event* anEvent) {
-    auto mcGenCol = m_mcParCol.get();
+    auto mcGenCol = m_mcParGenCol.get();
     mcCol = m_mcParCol.createAndPut();
 
     // copy the MC particle first
@@ -58,6 +51,14 @@ Edm4hepWriterAnaElemTool::EndOfEventAction(const G4Event* anEvent) {
     }
     
     msg() << "mcCol size: " << mcCol->size() << endmsg;
+
+    // reset
+    m_track2primary.clear();
+
+}
+
+void
+Edm4hepWriterAnaElemTool::EndOfEventAction(const G4Event* anEvent) {
     // save all data
 
     // create collections.