Skip to content

Please consider the following formatting changes to #15915 - #23

Closed
alibuild wants to merge 3 commits into
matthias-kleiner:cosmics-matcher-writer-cleanfrom
alibuild:alibot-cleanup-15915
Closed

alibuild wants to merge 3 commits into
matthias-kleiner:cosmics-matcher-writer-cleanfrom
alibuild:alibot-cleanup-15915

Conversation

@alibuild

@alibuild alibuild commented Oct 8, 2026

Copy link
Copy Markdown

Your PR AliceO2Group#15915 cannot be merged as is. You should either run clang-format yourself and update the pull request, or merge this PR in yours.
You can find the AliceO2 coding conventions at https://github.com/AliceO2Group/CodingGuidelines.

matthias-kleiner and others added 3 commits October 8, 2026 08:58
A TPC-only track has no time measurement: its time0 is the tracker's guess
(GPUTPCGMTrackParam::ShiftZ: z = 0 at the beam line if the helix can come
from it, otherwise the latest cluster at z = 0.521 * x, then clamped to the
drift volume). For a cosmic, which does not come from the beam line, the
two legs get independent guesses, typically tens of mus apart, so their
clusters were distortion-corrected at different z and the legs disagree
(y, snp, q/pt) although they are one track. For legs on opposite sides the
time comes from z continuity, but legs on the same side were compared as
tracked.

New MatchCosmicsParams refitSameSideAtCommonTime (default false, not in
the preset physics-v1, see below): after the cheap cuts (tgl, q/pt, same half), same-side
TPC-only legs are refitted at the centre of their brackets' overlap (the
time the refit of the winners uses) and compared there
(MatchCosmics::refitSeedAtTime: TPC refit from the outer parameters, then the
propagation to the DCA as for the seeds; energy loss along the muon's flight
as in refitWinners). The TPC refitter is created once per TF in process() and
shared with refitWinners. The matcher debug tree writes the legs compared
and a commonTime flag.

Cosmic MC with PbPb-like distortions (190 TFs, preset physics-v1, off -> on):
correctly matched muons 6848 -> 7324 of 8639 (79.3 -> 84.8 %); same side
77.0 -> 84.2 %, its loss to the crude chi2 cut 6.9 -> 0.8 %; A×C unchanged;
0 wrong-muon pairs in both; matcher +12 ms per TF (~100 refits). With the
true MC time instead of the window centre the same-side pass rate of the
chi2 cut would be 99.2 % (centre 98.0 %, legs at their own time0s 84.7 %).
PbPb 2025 (4 TFs): ~530 refits per TF, +15 ms per TF.

Not in the preset: in PbPb (568041, 310 CTFs, 16541 TFs) it adds mostly
pairs of collision tracks, whose time0 was about right and which the
refit at the window centre mis-corrects: +352 same-side cosmics but only
+5 TOF-tagged (2.6 % of the new ones vs 15.3 % of the common ones), and
~35 A×C cosmics lose a leg to a refitted same-side pair.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
New MatchCosmicsParams tofFlightSelection (default off, on in the preset
physics-v1; needs TOF clusters, the workflow then adds them to the
matcher's inputs): every pair of TPC-only legs accepted by checkPair is
tested for a top / bottom TOF cluster pair along the outward
continuations of its legs whose time difference matches the muon's
flight between them along the helix (tofFlightTolerance), with the mean
time in the pair's time window and both legs' y and z within tofRoad at
that time (the test of the cluster collector). A confirmed pair takes
the TOF time as its common time (error tofTimeError), so the winner is
refitted at it, and is put in front of all unconfirmed partners of both
legs (chi2 order within each group): the mutual-best selection prefers
it, and a random pair can no longer take a leg of a TOF-confirmed cosmic.

If the refit of a confirmed winner at the TOF time fails (in practice
chi2Match > maxChi2Match), it is refitted at the time it has without its
TOF flight pair (z-continuity time of legs on opposite sides, else the
centre of the overlap of the legs' time brackets): the winner selection
has already released the other candidates of both legs, so dropping the
winner loses both legs. PbPb 568041: 24 TOF-tagged same-side cosmics,
all real (legs on one line far from the beam line, TOF pair in the
physical order without a reversed-order alternative), mostly on the C
side nearer the readout at the TOF time; A-C cosmics show no TOF-TPC
time offset there. The refit loop body is a lambda refitting a winner at
a given time.

The TOF candidates of a leg are searched once per TF, in the time-sorted
TOF clusters of its time bracket and in the sector it points to and its
neighbours. Debug tree "match": tofScore.

Distorted cosmic MC (19 x 10 TFs, PbPb-like distortions, physics-v1
without the common-time refit, without -> with tofFlightSelection):
matched muons 6848 -> 6871 of 8639, 0 wrong pairs both, 2134 confirmed
pairs, 9 fallbacks.

PbPb 568041 reconstructed from CTF (310 CTFs, 16541 TFs, vs. the same
CTFs without the TOF selection, older code, before the fallback):
cosmics 4782 -> 4760, TOF-tagged 681 -> 697; A-C: 11 untagged pairings
replaced by 12 TOF-tagged ones. Matcher CPU 0.536 -> 0.545 s per TF.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@matthias-kleiner
matthias-kleiner force-pushed the cosmics-matcher-writer-clean branch from 18a44b6 to 9a493f4 Compare October 8, 2026 14:04
@alibuild alibuild closed this Oct 8, 2026
@alibuild
alibuild deleted the alibot-cleanup-15915 branch October 8, 2026 14:05
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.

2 participants