Skip to content

Commit f7a9832

Browse files
sawenzelclaude
andcommitted
AODBcRewriter: remap every index column an output table carries (O2-7098)
Stage 1b (added in #2370) reorders O2track_iu/O2mfttrack/O2fwdtrack to keep the "-1" ambiguous group contiguous, but wrote each table as soon as it was planned. O2fwdtrack references O2mfttrack (reordered later in the same loop) and itself (fIndexFwdTracks_MatchMCHTrack); neither permutation existed yet at write time, so both columns kept pre-reorder row numbers -- in range, so AODBcRewriterValidate passed, while every global muon got a foreign MFT/MCH leg (Maurice Coquet, sameParticle=0 on an anchored pO sample; patch proposal #2418). This fires whenever Stage 1b's regroup runs, independent of any BC/collision reorder, so every merged MC AO2D since 4 Jun is affected. Fix: * kIndexRefs: one registry of "which fIndex* column points at which table", used by the rewriter, the validator, and a new drift guard (an unregistered fIndex* column now fails the test instead of silently mis-linking data). * buildRemaps() derives a table's full remap set from that registry; the old "primary index + optional extras" split in rewriteTable is gone, so a stage can no longer forget a column the way Stage 1b forgot O2fwdtrack's. * Planning and writing are separate phases: every stage publishes its row permutation before anything is written, so forward/self references resolve correctly. New AODBcRewriterCheckLinks(in, out): fingerprints each row's non-index payload and checks, per table, that (row, referenced row) pairs survive the rewrite -- the only check that can see this bug class, since the corrupted indices were structurally valid. Needs only the input file, so it also runs on real production AO2Ds. MC/utils/tests/ adds the executable test this tool never had: a synthetic AO2D covering every pathology (duplicate/non-monotonic BCs, duplicate MC collisions, split -1 groups, fwd<->MFT and fwd->fwd references, ...), driven by run_aodbcrewriter_tests.sh -- ROOT only, seconds to run, nothing binary committed. Verified against the pre-fix rewriter and a real anchored pp production (run 553185, LHC24al apass1): sameParticle collapses to 0 with the shipped code and is fully restored with this fix, in every scenario tested, including one engineered to contain genuine duplicate BCs. Diagnosis and original patch: Maurice Coquet (#2418). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 9d7983a commit f7a9832

5 files changed

Lines changed: 1682 additions & 409 deletions

File tree

0 commit comments

Comments
 (0)