Fix CaloHitSelector pseudo TOF correction and RealisticCaloReco cellID truncation - #18
Open
trholmes wants to merge 1 commit into
Open
Fix CaloHitSelector pseudo TOF correction and RealisticCaloReco cellID truncation#18trholmes wants to merge 1 commit into
trholmes wants to merge 1 commit into
Conversation
…D truncation - CaloHitSelector: remove the r/TMath::C() pseudo time-of-flight correction. The digitized hit time is already TOF-corrected by RealisticCaloDigi (timingCorrectForPropagation), so a correct second correction would double-count; the existing term mixed units (mm vs m/s) and was numerically a no-op (~1e-6 ns). - RealisticCaloReco: keep the full 64-bit cellID instead of truncating to int, which dropped fields above bit 31 (e.g. the x/y cell indices of the MAIA calorimeter encoding) from all reconstructed hits. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ULyACwf2HvYWmUYczJrxA3
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.
This fixes two small but consequential issues found while auditing the calorimeter
timing cuts of the MAIA reconstruction chain (simhit-level timing study, validated
against chain re-runs in the
mucoll-sim-ubuntu24:v3.0stack).1.
CaloHitSelector: remove the pseudo time-of-flight correctionk4Reco/BIBUtils/src/CaloHitSelector.cppsubtractedr / TMath::C()from the hittime before applying the time window. Two problems compound there:
RealisticCaloDigi(withtimingCorrectForPropagation)is already corrected for the time of flight from the IP — it is the earliest
accepted contribution's corrected time — so subtracting a TOF again would
double-count it.
ris in mm whileTMath::C()is in m/s, soit actually evaluates to ~7×10⁻⁶ ns instead of the ~6 ns a real TOF would be —
a numerical no-op that made the double correction invisible.
The two bugs cancel, which is exactly why this is worth fixing: if someone later
"fixes" the units alone, the selector silently starts double-correcting and the
time window moves by the full TOF. This PR removes the term and documents that the
input time is already TOF-corrected, cutting on
hit.getTime()directly.2.
RealisticCaloReco: keep the full 64-bit cellIDk4Reco/CaloDigi/src/RealisticCaloReco.cchadint cellid = hit->getCellID(),truncating the 64-bit cellID to 32 bits before writing it to the output hit. With
cellID encodings that use the upper word — e.g. the MAIA calorimeter encoding
system:0:5,side:5:-2,module:7:8,stave:15:4,layer:19:9,submodule:28:4,x:32:-16,y:48:-16— every reconstructed (and downstream Coned/Sel) calorimeter hit loses its
x/ycell indices, and hits from different cells become indistinguishable by cellID.
Fixed by using
std::uint64_t.Validation: outputs are unchanged (except the intended cellID repair)
Rebuilt this branch inside
ghcr.io/muoncollidersoft/mucoll-sim-ubuntu24:v3.0andre-ran the full MAIAConfig digi+reco chain (no BIB, same seeds) on two 100-event
MAIA_v0 samples, comparing every calorimeter hit collection (Digi/Rec/Coned/Sel ×
ECAL/HCAL × barrel/endcap: cellID, energy, time, hit-by-hit) and all Pandora
cluster/PFO energies against the unpatched code:
and times to the last bit, identical Pandora clusters/PFOs. Rec/Coned/Sel
cellIDs now carry the full 64 bits (their 32-bit truncation equals the old
values, and they match the digitized hits' cellIDs).
each sitting within the removed ~7×10⁻⁶ ns pseudo-term of the +0.3 ns selector
edge (t = 0.300007 and 0.300003 ns). The old code kept them by accident; the
fixed code correctly rejects them (t ≥ TimeWindowMax). Knock-on effect: one
Pandora cluster shifts by 0.17 GeV in each of those two events; everything else
is bit-identical.
So behavior is preserved to float precision by construction, and the only decision
changes are hits within ~10⁻⁵ ns of the window edge, where the new behavior is the
correct one.
🤖 Generated with Claude Code
https://claude.ai/code/session_01ULyACwf2HvYWmUYczJrxA3
Generated by Claude Code