Skip to content
Snippets Groups Projects
Commit 115d355d authored by lintao@ihep.ac.cn's avatar lintao@ihep.ac.cn
Browse files

WIP: associate the tracker hit and the primary particle.

parent ea835485
No related branches found
No related tags found
No related merge requests found
......@@ -193,6 +193,17 @@ Edm4hepWriterAnaElemTool::EndOfEventAction(const G4Event* anEvent) {
trk_hit->momentum.z()/CLHEP::GeV};
edm_trk_hit.setMomentum(edm4hep::Vector3f(mom));
// get the truth or contribution
auto& truth = trk_hit->truth;
int trackID = truth.trackID;
int pritrkid = m_track2primary[trackID];
if (pritrkid <= 0) {
error() << "Failed to find the primary track for trackID #" << trackID << endmsg;
pritrkid = 1;
}
edm_trk_hit.setMCParticle(mcCol->at(pritrkid-1));
}
dd4hep::sim::Geant4CalorimeterHit* cal_hit = dynamic_cast<dd4hep::sim::Geant4CalorimeterHit*>(h);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment