diff --git a/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp b/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp
index b5b2ae7fb3277d1b13c2f3ce7aecb55426859620..0a266b801be9532b1d51ac35498af790a48f86c8 100644
--- a/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp
+++ b/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp
@@ -283,7 +283,38 @@ Edm4hepWriterAnaElemTool::PreUserTrackingAction(const G4Track* track) {
 }
 
 void
-Edm4hepWriterAnaElemTool::PostUserTrackingAction(const G4Track*) {
+Edm4hepWriterAnaElemTool::PostUserTrackingAction(const G4Track* track) {
+    int curtrkid = track->GetTrackID(); // starts from 1
+    int curparid = track->GetParentID();
+
+    if (curparid == 0) {
+        // select the primary tracks (parentID == 0)
+        auto mcCol = m_mcParCol.get();
+
+        if (curtrkid-1>=mcCol->size()) {
+            error() << "out of range: curtrkid is " << curtrkid
+                    << " while the MCParticle size is " << mcCol->size() << endmsg;
+            return;
+        }
+        auto primary_particle = mcCol->at(curtrkid-1);
+
+        const G4ThreeVector& stop_pos  = track->GetPosition();
+        edm4hep::Vector3d endpoint(stop_pos.x()/CLHEP::mm,
+                                   stop_pos.y()/CLHEP::mm,
+                                   stop_pos.z()/CLHEP::mm);
+        primary_particle.setEndpoint(endpoint);
+
+        const G4ThreeVector& stop_mom = track->GetMomentum();
+
+        edm4hep::Vector3f mom_endpoint(stop_mom.x()/CLHEP::GeV,
+                                       stop_mom.y()/CLHEP::GeV,
+                                       stop_mom.z()/CLHEP::GeV);
+        primary_particle.setMomentumAtEndpoint(mom_endpoint);
+
+
+    } else {
+        // TODO: select other interested tracks
+    }
 
 }