Repository navigation
KKExtrap rangeout truncate - #2111
Conversation
|
Hi @RobMina,
which require these tests: build. @Mu2e/write, @Mu2e/fnalbuild-users have access to CI actions on main. ⌛ The following tests have been triggered for 18a24ee: build (Build queue - API unavailable) |
|
☔ The build is failing at 18a24ee.
N.B. These results were obtained from a build of this Pull Request at 18a24ee after being merged into the base branch at b24d416. For more information, please check the job page here. |
oksuzian
left a comment
There was a problem hiding this comment.
PR Review Summary — #2111
Reviewed at head 18a24eeef753a82c0c5358974864226789aacdac. First pass.
Decision
- 🟡 comment now, approve when green. I would approve this code. I built it with KFTrack/KinKal#234 and ran it on two samples. On the nightly
reco_03sample, everyKalSeedis unchanged. On off-spill cosmics, the ranged-out tracks lose what lay past the stop and nothing else. One finding: KinKal refuses 10 of the 229 off-spill cuts, including one of the three tracks from my #2084 review, and only aDebugprint says so (finding 1). It does not block. - FNALbuild build 3567 fails at this head, as expected (checked 22:02 UTC). The six
Mu2eKinKalmodules that includeKKExtrap.hhdo not compile against KinKal v3.9.1, which has noTrack::truncate. I will approve once a KinKal tag with #234 is in an envset this branch builds with, and FNALbuild is green.
Scope understood
- Only the last commit,
18a24eee(Mu2eKinKal/inc/KKExtrap.hh+3 −1), is new. The other 29 files belong to #2084 and #2109, which I reviewed there. - After
setRangedOut(),KKExtrap::rangeOutnow callsktrk.truncate(TimeDir::forwards, inter.time_)(KKExtrap.hh:129).- It runs in the sweep after
Track::extrapolatehas returned, and the sweep stops right after it (:407). - The crossing is always on the end piece (
:459), so the cut only shortens the last piece and the last domain. - Range-out is forwards only (
KKShellXing.hh:133), which matches the fixedTimeDir::forwards.
- It runs in the sweep after
- Merge order: #2084, then #2109, then KinKal#234 merged and tagged, then an envset with that tag and
.musemoved to it, then this PR.
Prior finding (from my #2084 review at 445cd49a, finding 1, crossings after the stop)
- 🟡 Partly fixed. Three ranged-out
KKCHmutracks gained sampled tracker crossings after the stop: 5 on 1430:0:3926, 10 on 19224 and 12 on 24052.- The first two now lose all of them.
- 24052 keeps its 12, because KinKal refuses the cut (finding 1).
- The coplanar-crossing half of that finding is #2109's.
Findings
- 🟡 [S2] KinKal refuses 10 of 229 range-out cuts on my off-spill sample, and only a
Debugprint records it.- Evidence: I ran with
ExtrapolationSettings.Debug: 1on every KK fit.- Off-spill cosmics, 9,314 events. With the validation setting (field correction on), 1 of 80 stops is refused: 1430:0:24052. With the production setting (off), 9 of 149 are refused: 1430:0:7696, 8803, 12368, 18707, 26159, 49486, 50657, 86758 and 93112.
- Nightly
reco_03: 236 stops, none refused. - The cause, from a temporary print placed before the call (not committed): in all 10, the only effects after the stop are 1 to 8 active straw-material crossings of the fit. The last active hit is 2.1 to 3.9 ns before the stop.
- With
ProcessEnds: false, the fit does not process sites after the last hit. In the 9 production cases, these crossings lie even after the end of the trajectory, by up to 39 ns. - I raised the guard itself on KinKal#234.
- Impact:
- On 24052, 56 ns of trajectory and 12 sampled tracker crossings stay past the stop: the fitted trajectory re-enters the tracker 2.3 ns after it. Its saved segments still end 56 ns past the stop.
- In the 9 production cases the overrun is 0.04 to 0.95 ns, and 2 of them still save a segment past the stop.
- The description says every range-out stop is truncated. That does not hold on this sample, and with
Debug0 a production job cannot tell.
- Suggested fix: record a refused cut somewhere a production job reports it, for example a count printed at the end of the job, and give these numbers in the description. The guard itself can be relaxed in KinKal#234.
- Evidence: I ran with
Measured: this head with KinKal#234 against #2109 7fcbd6a7, same inputs
- 🟢 Nightly
reco_03, all 16,508 events: everyKalSeedprintout is identical in every collection. That covers the fit summaries including t0, the flags (236KKUmuRangedOut, 1KKDmuExtrapolationFailed) and every crossing. All 236 stops are cut. - 🟢 Off-spill, validation setting: 15
TT_Outercrossings are removed, on 3926 and 19224, and none is added. Nothing else changes in any collection, except the printed cos θ of 19224 (0.052 to 0.050). Tracks saving a segment past the stop: 6 of 80 before (0.16 to 56.4 ns), 1 now (24052). - 🟢 Off-spill, production setting: every crossing is the same. The printed cos θ of 7 ranged-out
KKCHmutracks differs by 0.001. Tracks saving a segment past the stop: 50 of 149 before (0.03 to 1.0 ns), 2 now. - Why cos θ moves: the printed direction comes from the saved segment that holds t0. On these tracks that segment is the last one, which is now shorter, and a segment stores the state at the middle of its range (
KKFit.hh:926). Momentum, t0, fit consistency and segment counts are unchanged.
Validation check
- Build/tests run: yes.
muse buildof this head (Production94a4d81f, mu2e-trig-config5999ffa2, p110), with KinKal#234'sFit/Track.hhandFit/Domain.hhplaced over the release headers. The release headers are byte-identical to gitv3.9.1. Exit status 0, no warnings, and all 1168 compile lines used the overlay.ExtrapolateSweepTest: all checks passed.- The off-spill sample in both settings and
reco_03in 6 chunks: every job exited with status 0. The baselines are the #2109 runs, with the same inputs and job files.
- Config contract check: pass. No fcl or data-product change.
- Cross-repo consistency: needs follow-up. This PR needs a KinKal tag with #234 and an envset.
Residual risk
- KinKal's compiled libraries in my build are the v3.9.1 release. The change is header-only, so this matches what a tag would give, but FNALbuild has not built it.
- Not checked: the Regrow modules, KinematicLine fits, and the calorimeter options.
Author follow-ups
brownd1978
left a comment
There was a problem hiding this comment.
Could you please update this PR to reference the current Offline head? that would remove a lot of changes that were already merged.
|
|
||
| namespace { | ||
| // axis-aligned box in Mu2e coordinates | ||
| struct MuBox { |
There was a problem hiding this comment.
MuBox strikes me as being more natural as part of KinKal/Geometry.
| } | ||
| return box; | ||
| } | ||
| CLHEP::HepRotation inverseRotation(std::string const& orientation) { |
There was a problem hiding this comment.
Did you consider using Rotation3D and XYZVector for these operations instead? Those are native to root and so more natural for interfacing with KinKal.
brownd1978
left a comment
There was a problem hiding this comment.
My recollection is this additional test will become unnecessary after an update to KinKal propagates to Offline, is that correct? If so, could you put in an appropriate comment so we don't forget to remove it later. thanks.
oksuzian
left a comment
There was a problem hiding this comment.
PR Review Summary — #2111
Reviewed at head cac2266d58dc64c5dcee7cd7da939ab6a9edb0e1. Re-review of 18a24ee.
Decision
- 🟡 comment now, approve when green, as before.
cac2266dmergesmain(8628ceb7) and changes nothing of its own. The PR's own change, 18 lines inMu2eKinKal/inc/KKExtrap.hh, is the same as at18a24eee, which I reviewed and would approve. - It still cannot build in CI.
Track::truncatearrived in KinKal v3.9.2 (KinKal/Fit/Track.hh:121,:1084at tagv3.9.2, the KFTrack/KinKal#234 merged19623fe); v3.9.1 does not have it. Offlinemainstill names envsetp110in.muse, andp110provideskinkal@v03_09_01. A build at this head would fail in the same sixMu2eKinKalmodules as build 3567, so I have not asked for one. Once an envset with KinKal v3.9.2 is in use, FNALbuild can be triggered and I will approve when it passes.
What changed since 18a24ee
- One merge commit,
cac2266d"Merge branch 'Mu2e:main' into kkextrap-rangeout-truncate", bringing inmainup to8628ceb7. - The PR's own diff against
mainis line-for-line identical before and after:git diff $(git merge-base <head> main) <head>gives the same 18 lines at both heads.
Prior findings
- 🟡 [S2] KinKal refuses 10 of the 229 off-spill cuts, and only a
Debugprint says so — still open, unchanged (the code did not change). Non-gating.
Validation check
- Build/tests run: no. The increment is a merge of
mainonly. The envset check:muse statuson the CI backingmain/8628ceb7_b2ef90eb_5f221e50reportsMUSE_ENVSET = p110withkinkal@v03_09_01. - FNALbuild:
mu2e/buildtestat this head reads "This test has not been triggered yet" (23:56 UTC). The only build of this PR, 3567 at18a24eee, failed for the reason above.
Author follow-ups
- The PR needs an envset with KinKal v3.9.2, or a
.musechange that selects one, together with or before it. Is ap111(or similar) planned?
|
@FNALbuild run build test |
|
⌛ The following tests have been triggered for 609ff61: build (Build queue - API unavailable) |
|
☀️ The build tests passed at 609ff61.
N.B. These results were obtained from a build of this Pull Request at 609ff61 after being merged into the base branch at 554ef9f. For more information, please check the job page here. |
oksuzian
left a comment
There was a problem hiding this comment.
PR Review Summary — #2111
Reviewed at head 609ff61ec12d7997f77d99c783de59a4d5ea0ef2. Re-review of cac2266.
Decision
- 🟢 approve. The envset now provides KinKal v3.9.2, so the PR builds, and FNALbuild passed at this head. My one open finding is fixed: refused truncations are now counted and reported at the end of the job. The temporary plane workaround is now marked for removal, as brownd1978 asked.
What changed since cac2266
- One commit,
609ff61e"Address review comments, bump envset" (9 files, +44 −4). .muse:ENVSET p110becomesp111.KKExtrap::rangeOutcounts tracks that range out, and how many of them KinKal would not truncate. A newprintSummaryprints both numbers at the end of the job. All six modules that own aKKExtrapcall it fromendJob:CentralHelixFit,KKTruthSeed,KinematicLineFit,LoopHelixFit,RegrowKinematicLineandRegrowLoopHelix.ExtrapolateSweep.hhgains a TEMPORARY note: once Offline uses a KinKal release with KFTrack/KinKal#235, removevisitPlaneExtremaandplaneCrossingand useKinKal::intersectfor planes.
Prior findings
- 🟢 [was S2] KinKal refused some cuts, and only a
Debugprint said so. FIXED in 609ff61.- Each refusal is now counted (
KKExtrap.hh,rangeOut). - The count is printed once per module at the end of the job, whenever at least one track ranged out, whatever the debug level.
- I checked that all six modules holding a
std::unique_ptr<KKExtrap>callprintSummary. No repository other than Offline usesKKExtrap.
- Each refusal is now counted (
- 🟢 [follow-up] The PR needed an envset with KinKal v3.9.2. Done.
p111differs fromp110in two lines only: the spack environment name andKINKAL_VERSION(v03_09_01tov03_09_02).- KinKal
v3.9.1...v3.9.2is the KFTrack/KinKal#234 merge only. It addsTrack::truncate,Domain::setEdgeand a unit test, and changes no existing line. So the bump brings in the function this PR needs and nothing else from KinKal.
Validation check
- FNALbuild: build 3635 at this head, merged onto
main554ef9f9, passed at 13:07 UTC on 17 November, with every validation job green.- The
triggerrow is ❌ (Return Code 2). Its log lists the same four path changes, with the same counts, as #2163's build 3634 on the samemain:apr_TC_calo2078 against 1947, plus three smallcpr_*changes. So the trigger counts do not change with this PR, even though the trigger paths run KinKal fits. The red comes frommain; #2116 changedTZClusterFinderin the trigger paths. - The six clang-tidy errors are all in cetlib's
LibraryManager.h:43. No clang-tidy warning points at a line this PR changes.
- The
- Build/tests run locally: none. The increment builds in CI, and I read every changed line.
- Not checked: whether the CI validation jobs print the new summary. None of the logs I read shows a
KKExtrapline (ceSimReco,cosmicSimReco,cosmicOffSpill). I did not compare the full spack environmentsp110andp111, only the envset files. - Config contract check: pass, no fcl change.
- Cross-repo consistency: pass.
Productionandmu2e-trig-configdo not set an envset in their.musefiles.
Residual risk
- After merge, everyone who builds
mainmoves top111. Per the two points above, that changes only the KinKal version.
Author follow-ups
- None from me. brownd1978's change request at 18a24ee asked for the branch to be brought up to date with
main.cac2266ddid that, but the request stays on the PR until he updates his review.
brownd1978
left a comment
There was a problem hiding this comment.
My principle request of asking to mark some of these changes as temporary is met. My comments about geometric structures being more natural as part of core KinKal remain, but they refer to earlier already-merged codes and so are out-of-scope for this PR.
Follow-up to #2084 and #2109, both merged. Based on
current
main. Needs KFTrack/KinKal#234 (Track::truncate, in KinKal v3.9.2), so this PR moves.musefrom envsetp110 to p111, which differs from p110 only by KinKal v03_09_02.
Problem
When
KKExtrapfinds that the particle ranges out in a material it is about to cross, the forwards extrapolationstops and the KalSeed gets
TrkFitFlag::RangedOut(#2084). The trajectory itself still runs past the stop: KinKalextends the end piece in field-domain steps (field correction on) or
MaxDtStepsteps (off) before asking the sweep,so it can end up to one domain or step beyond the crossing, and the saved segments and the domain bounds follow it.
Change
KKExtrap::rangeOutcallsKinKal::Track::truncate(TimeDir::forwards, crossing time)aftersetRangedOut(). Thefit trajectory ends at the crossing where the particle stops, and the field domains beyond it are dropped.
the fit uses loses its trajectory piece. Inactive hits beyond the stop keep their own reference pieces.
KKExtrap <module label>: N tracks ranged out, M of them not truncated at the stop (KinKal refused the cut). Themodules are
LoopHelixFit,CentralHelixFit,KinematicLineFit,KKTruthSeed,RegrowLoopHelixandRegrowKinematicLine. WithDebug> 0, each refused cut is also printed.processed), and KKExtrap: process all requested surfaces in one time-ordered sweep per direction #2084's plane workaround in
ExtrapolateSweep(visitPlaneExtrema,planeCrossing) is markedtemporary until Offline uses a KinKal release with Bracketed refinement in stepIntersect; helix-plane window when the axis starts past the plane KFTrack/KinKal#235.
.muse:ENVSET p111.No data-product or configuration change.
Validation
At this head (envset p111, KinKal v3.9.2):
ExtrapolateSweepTestpasses. On 10,000 nightly off-spill cosmics(MDC2025an), the end-of-job line agrees with the per-track
Debugprints:KKCHmuranged outKKUmuranged outRefused cuts do occur: on oksuzian's 9,314 off-spill events (reviewing the #2109 build), KinKal refused 1 of 80 cuts
with field correction (1430:0:24052) and 9 of 149 in the production setting. In all 10 the only effects after the
stop were active straw-material crossings of the fit.
Against #2109 (
7fcbd6a7b, envset p110, with KinKal#234'sTrack::truncateplaced over v3.9.1; the candidatediffered only by the
truncatecall). KinKalctest28/28.KKCHmuwithDebug: 1:This includes 1430:4376:429727, which has inactive hits about 20 ns after its stop: with field correction, its 9
sampled tracker crossings after the stop are gone (8 on the tracker outer surface, 1 on its back face, none of them in
truth).
Outputs:
crvextrap abidentical,crvextrap rangeout --reference):in the forwards tail after the stop (the 9 crossings above removed, none added).
over all truth stops; off: 0.980 and 0.149.
forwards tail (4 sampled tracker outer-surface crossings after a stop removed, none added).
crvextrap kalseedab, every collection; fit summaries and intersections):reco_03events 0-1,999: identical, including the 27RangedOutKKUmu.RangedOutKKCHmu(1430:5744:325716). Its printed t0moves from 21544.5 to 21544.2 ns, because
PiecewiseTrajectory::t0starts its search from the end pieces and thelast one is now shorter. Its momentum, fit consistency, segments and 28 intersections are unchanged.
So in these samples the change ends ranged-out trajectories at their stop, and changes no sampled quantity except the
post-stop crossings and one t0.
🤖 Generated with Claude Code