Store calo SimParticle ancestor chain in SimInfo::ancestorSimIds#366
Open
Store calo SimParticle ancestor chain in SimInfo::ancestorSimIds#366
Conversation
Add a std::vector<int> ancestorSimIds field to SimInfo and populate it for calorimeter SimInfos in fillCaloSimInfos. After fillSimInfo returns, walk edep.sim()->parent() until hasParent() is false (or the parent pointer is null in compressed events) and push each ancestor's id() into the vector. The vector lists ancestors from the immediate parent up to the root: [parentId, grandparentId, ...]. Motivation. The existing prirel / trkrel MCRelationships are populated for tracker SimInfos but not for calorimeter SimInfos, and they only capture the relationship to the primary particle anyway. For calorimeter showering analyses we need the full Geant4 parent chain so each hit can be grouped under its calo-entrant ancestor (the highest ancestor that also deposited in the same disk). This recovers true shower membership for downstream truth labelling: a primary electron's secondary photons (eBrem dominates at ~50% process share) deposit independently in adjacent crystals and otherwise look like independent truth clusters under the existing "dominant SimParticle per crystal" rule. No breaking change. Default-initialised empty vector for any SimInfo that fillCaloSimInfos doesn't touch (i.e. all tracker SimInfos); ROOT serialises std::vector<int> inside the already-registered SimInfo automatically, no dictionary entry needed. Validated by reprocessing 50 MDC2025af MCS art files via FermiGrid: zero broken chains over 9,000 events / 203,971 SimParticles, mean chain length 1.90 (median 1, max 14). Switching a downstream GNN calorimeter-clustering analysis to use "calo-entrant ancestor" truth via this field cut merge errors in half and lifted truth match rate by +6.2 pp on the val split with no model retraining.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a std::vector ancestorSimIds field to SimInfo and populate it for calorimeter SimInfos in fillCaloSimInfos. After fillSimInfo returns, walk edep.sim()->parent() until hasParent() is false (or the parent pointer is null in compressed events) and push each ancestor's id() into the vector. The vector lists ancestors from the immediate parent up to the root: [parentId, grandparentId, ...].
Motivation. The existing prirel / trkrel MCRelationships are populated for tracker SimInfos but not for calorimeter SimInfos, and they only capture the relationship to the primary particle anyway. For calorimeter showering analyses we need the full Geant4 parent chain so each hit can be grouped under its calo-entrant ancestor (the highest ancestor that also deposited in the same disk). This recovers true shower membership for downstream truth labelling: a primary electron's secondary photons (eBrem dominates at ~50% process share) deposit independently in adjacent crystals and otherwise look like independent truth clusters under the existing "dominant SimParticle per crystal" rule.
No breaking change. Default-initialised empty vector for any SimInfo that fillCaloSimInfos doesn't touch (i.e. all tracker SimInfos); ROOT serialises std::vector inside the already-registered SimInfo automatically, no dictionary entry needed.
Validated by reprocessing 50 MDC2025af MCS art files via FermiGrid: zero broken chains over 9,000 events / 203,971 SimParticles, mean chain length 1.90 (median 1, max 14). Switching a downstream GNN calorimeter-clustering analysis to use "calo-entrant ancestor" truth via this field cut merge errors in half and lifted truth match rate by +6.2 pp on the val split with no model retraining.