Flatten calo-entrant truth into calohitsmc.entrantSimIds - #392
Draft
zwl0331 wants to merge 1 commit into
Draft
Conversation
New optional column: per-deposit calo-entrant (shower originator) SimParticle id, aligned with calohitsmc.simParticleIds. Filled from the CaloHitEntrantCollection produced by Offline's CaloEntrantTruthMaker when calo.mc.entrantTag is set; the collection is index-parallel to the CaloHitMCCollection, so the flat calohitsmc fill zips by index. Fail-closed: a nonempty tag with a missing product, a collection size mismatch, or a per-hit entrant/deposit count mismatch throws. Empty tag (the default) leaves the branch empty and existing configs unaffected. Unresolvable deposits are stored as -1. Replaces the ancestorSimIds approach (PR Mu2e#366, closed): the ancestry walk runs in an art module and only its result is flattened here. EventNtuple stays definition-agnostic; purity cuts and grouping remain analysis-side.
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.
Companion to Mu2e/Offline#1911, and requires it (this uses the new CaloHitEntrant product), so I am leaving this as a draft until that one merges. The two together replace #366.
This adds an
entrantSimIdsbranch tocalohitsmc: per hit, the calo-entrant SimParticle ID for each contribution, aligned one-to-one withsimParticleIds. A value of -1 means the producer had no entrant for that deposit.The fill is controlled by a new
calo.mc.entrantTagconfig which defaults to empty, meaning off. Existing configs are untouched and produce identical output. When the tag is set the fill is strict: a missing product, a wrong collection size, or a per-hit count mismatch is an exception, not a warning, so you cannot silently end up with half-filled truth.One scope note:
entrantSimIdsis aligned withincalohitsmc. Matchingcalohitsentries tocalohitsmcentries is a separate, pre-existing question (caloHitIdx_/crystalID_, cf. 125a71a); this branch does not depend on that join and does not change it. If thecalohitsmcordering or the join ever changes, the new column just follows along.Validation: 200 MDC2025 events (run 001430) with the producer plus this fill on current main. The flattened entrant IDs agree with my published Python pipeline for all 6,554 contributions (3,903/3,903 MC hits matched across ntuple formats). I also checked the April-format version of this change, where the downstream GNN graph labels come out byte-identical (341/341 disk-graphs); on current main I validated at the entrant-root level, since the reco/MC hit join is the separate question above.