From 9cbdc744f1a5e809422633c96fd0dd8aab9e7d97 Mon Sep 17 00:00:00 2001 From: lintao <lintao51@gmail.com> Date: Thu, 17 Dec 2020 23:46:58 +0800 Subject: [PATCH] WIP: when a hit is created by a secondary track, set this flag. --- Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp b/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp index 2af4cc41..a9d739a6 100644 --- a/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp +++ b/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp @@ -207,6 +207,11 @@ Edm4hepWriterAnaElemTool::EndOfEventAction(const G4Event* anEvent) { } edm_trk_hit.setMCParticle(mcCol->at(pritrkid-1)); + + if (pritrkid != trackID) { + // If the track is a secondary, then the primary track id and current track id is different + edm_trk_hit.setProducedBySecondary(true); + } } dd4hep::sim::Geant4CalorimeterHit* cal_hit = dynamic_cast<dd4hep::sim::Geant4CalorimeterHit*>(h); -- GitLab