Skip to content

Flatten calo-entrant truth into calohitsmc.entrantSimIds - #392

Draft
zwl0331 wants to merge 1 commit into
Mu2e:mainfrom
zwl0331:calo-entrant-truth-main
Draft

Flatten calo-entrant truth into calohitsmc.entrantSimIds#392
zwl0331 wants to merge 1 commit into
Mu2e:mainfrom
zwl0331:calo-entrant-truth-main

Conversation

@zwl0331

@zwl0331 zwl0331 commented Jul 31, 2026

Copy link
Copy Markdown

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 entrantSimIds branch to calohitsmc: per hit, the calo-entrant SimParticle ID for each contribution, aligned one-to-one with simParticleIds. A value of -1 means the producer had no entrant for that deposit.

The fill is controlled by a new calo.mc.entrantTag config 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: entrantSimIds is aligned within calohitsmc. Matching calohits entries to calohitsmc entries is a separate, pre-existing question (caloHitIdx_ / crystalID_, cf. 125a71a); this branch does not depend on that join and does not change it. If the calohitsmc ordering 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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant