Repository navigation
Extend end trajectory piece to the edge of the outermost domain - #232
Merged
Merged
Conversation
oksuzian
approved these changes
Oct 30, 2026
oksuzian
left a comment
There was a problem hiding this comment.
PR Review Summary — #232
Reviewed at head 435af80df31d9b9896578a46b00f51f3a6f2b102. First pass.
Decision
- 🟢 Approve. The change is small and private. It only extends the end piece's time range to a domain edge that the first
DomainWallalready samples. In Mu2e it removes a real failure, and it changes nothing where it is not needed.
Scope understood
Track::coverEndDomain(TimeDir)is new and private (Fit/Track.hh:166). It is called at the start of the field-corrected branch ofTrack::extrapolate. If the end piece stops short of the outermost domain edge, it extends the piece's range to that edge. It is header-only.
Findings
- ⚪ [S3] KinKal's own tests do not cover this
- No test under
Tests/callsTrack::extrapolate, so the green CI on this PR does not reach the new code. All the evidence is from Mu2e. A unit test would protect the change: fit with field correction, a last domain that extends past the last hit, then extrapolate and check that the end piece reaches the domain edge.
- No test under
Checked, no action needed
- 🟢 No effect where it is not needed. I built Mu2e/Offline#2084 (
e27cd7fa) twice, with release KinKal v3.9.0 and with this PR'sFit/Track.hhin place of the release header. I confirmed that the module compiles against the PR's header.- On all 16,508 events of the nightly
reco_03job (on-spill CE reconstruction, four LoopHelix fits with field correction on), everyKalSeedprintout is identical with and without this change. - On 9,314 off-spill cosmics with the production
KKCHmusetting (field correction off), they are also identical.
- On all 16,508 events of the nightly
- 🟢 It fixes the failure it targets. On the same cosmics with
KKCHmufield correction on (Validation/offSpill.fcl), without this change 367 of 4,876KKCHmutracks end their extrapolation with "material crossing ( 85: DS_CryoInner ):0 at 9996.62 is not owned by the end piece Range [9995.52,9996.52]" (event 1430:0:310). With it, none do, and each DS shell gains 360 to 369 crossings. - 🟢 It works with KinKal#231.
- The two PRs touch different files, and
git mergeof #231 into this head is clean. - Offline#2084 builds against the merged headers (
Fit/Track.hh,General/TimeRange.hh,Trajectory/PiecewiseTrajectory.hh, each identical to the git merge). - The 16,508-event
reco_03job runs with exit code 0. Its output matches this PR alone except for one fit that is already unusable (1430:737:2858KKDmu, whose t0 changes).
- The two PRs touch different files, and
- 🟢 Shared pieces are safe. The end piece is shared through
shared_ptrwith crossings that reference it, but the range only grows and no parameters change, so those references stay valid. It is a no-op without domains, and the field-correction-off path is untouched.
Validation check
- Build/tests run: two Offline#2084 muse builds (p109), with this header overlaid on the release headers, alone and together with #231. I ran the full
reco_03job and the off-spill jobs listed above. I did not run KinKal's own test suite locally; CI ran it at this head (4 jobs, all pass). - Not run: Offline
main(without #2084) with this change. The description's numbers for that case are taken as reported.
Residual risk
- A Mu2e build needs a KinKal tag with this change and a new envset. Mu2e/Offline#2084 depends on it for its field-corrected
KKCHmuvalidation.
Author follow-ups
- Optional: add a KinKal unit test for the end-domain gap.
brownd1978
approved these changes
Oct 30, 2026
brownd1978
left a comment
Collaborator
There was a problem hiding this comment.
This change makes logical sense. Thanks Rob and Claude!
This was referenced Oct 30, 2026
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#2084
Problem
After a fit, the trajectory ends at its last active effect, but the outermost field domain usually extends
farther, because domains are built over the detector range including inactive hits. With field correction on,
Track::extrapolatestarts the domain walk at the outermost domain edge (domains_.crbegin()->end()). The firstDomainWallstretches the old end piece across the gap and appends a new piece beyond it.An extrapolation predicate that searches the end piece never sees the gap: before the first step the end piece
stops short of it, and afterwards the gap is on an interior piece. A material surface there is missed, and even
if found,
Track::extrapolate(EXINGPTR)cannot add it, since its time is not in the end piece. With fieldcorrection off the end piece is extended from its own end, so there is no gap.
In 10,000 Mu2e nightly off-spill cosmic events (CentralHelix, field correction on), the gap is positive at the
start of 1,408 forward and 9,350 backward extrapolations; 565 and 555 of them exceed 1 ns, enough to skip a
detector-solenoid shell (measured with a temporary print, not part of this PR).
Change
A private
Track::coverEndDomain(TimeDir), called at the start of the field-corrected branch ofTrack::extrapolate: if the end piece stops short of the outermost domain edge, its time range is extended tothat edge. The first
DomainWall::extrapolatealready samples the same piece at the edge, so no trajectoryparameter, nominal field or domain changes; only the predicate now searches the gap, and a crossing there is
inside the end piece, so its material can be added. No-op without domains or when the trajectory already reaches
the edge. The field-correction-off path is unchanged. Header-only (18 lines).
Validation
Mu2e Offline
473a2c54, KinKal v3.9.0 with and without this change, same 10,000 events. The same 1,175 tracks(matched by raw hits) are fitted with identical fit status, chi-square, probability, hit counts and hit times.
Detector-solenoid shells per extrapolated leg, predicted from the leg's measured position and momentum (p > 500
MeV/c, shells more than 100 mm from an end), for legs whose identity-matched truth muon traverses the barrel:
Over all scored legs, inner-shell misses fall from 65 to 6. The remaining outer-shell misses come from a separate
Mu2e search defect, addressed in Mu2e/Offline (companion PR); this change does not claim complete shell coverage.
The Mu2e/Offline#2076 LoopHelix event runs successfully with the change.
Together with the companion Offline PR, 5,000 conversion-electron events with 1BB pileup (four LoopHelix fits) run
without errors, and every fit summary matches Offline main, apart from 24 muon-hypothesis fits that the Offline PR's
range-out makes usable. On all 8 traced tracks where Offline main misses the TS downstream absorber plane, the cause
is this gap: the last domain step past the plane is not on the saved trajectory.
🤖 Generated with Claude Code