Skip to content

Commit a593c94

Browse files
committed
save lastStoredAncestor instead of primary in the simTrack
1 parent 6c25e34 commit a593c94

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

SimG4Core/Notification/src/SimTrackManager.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ void SimTrackManager::addTrack(TrackWithHistory* iTrack, const G4Track* track, b
7676
auto info = static_cast<const TrackInformation*>(track->GetUserInformation());
7777
if (info->isInTrkFromBackscattering())
7878
iTrack->setFromBackScattering();
79-
// set there for the *non-primary* tracks the genParticle ID associated with the G4Track
80-
// for the primaries this is done in the TrackWithHistory constructor.
79+
// set there for the *non-primary* tracks the G4Track ID of the last stored ancestor
80+
// for the primaries the genparticle id is saved in the TrackWithHistory constructor.
8181
// In the constructor of TrackWithHistory the info isPrimary is saved and used
8282
// to give -1 if the track is not a primary.
8383
if (not iTrack->isPrimary())
84-
iTrack->setGenParticleID(info->mcTruthID());
84+
iTrack->setGenParticleID(info->idLastStoredAncestor());
8585
m_trackContainer.push_back(iTrack);
8686
const auto& v = track->GetStep()->GetPostStepPoint()->GetPosition();
8787
std::pair<int, math::XYZVectorD> p(iTrack->trackID(),

0 commit comments

Comments
 (0)