Fixes for issue 1974 - #1975
Fixes for issue 1974#1975
Conversation
|
☀️ The build tests passed at e525b16.
N.B. These results were obtained from a build of this Pull Request at e525b16 after being merged into the base branch at 8a78d2f. For more information, please check the job page here. |
oksuzian
left a comment
There was a problem hiding this comment.
PR Review Summary — #1975
Reviewed at head e525b162829d67421d54b34bdea08153084459cb. First pass.
Disclosure: I opened issue #1974, so this review is of the answer to my own report. All three fixes are correct as written; the comments below are validation asks, not objections.
Decision
- 🟢 approve
Scope understood
- Answers all three findings of #1974: the
goodFitomission inKinematicLineFit, thefieldGradrow/column convention inKKBField, and the backward-only short-piece fallback inExtrapolateCRVRegion. - Behaviour actually changes in two of the three:
goodFitcan now reject KL fits, and forward CRV extrapolation now continues past a short piece.fieldGradis a no-op in practice.
Verified
- 🟢
KKBField::fieldGrad— the fix is correct and its blast radius is genuinely zero.Grad(i,j) = dB_i/dx_jperKinKal/General/BFieldMap.hh:19, andPlace_in_col(v,row,col)writesvdown columncolstarting atrow, soPlace_in_col(dBdxv,0,0)gives column 0 =(dBx/dx, dBy/dx, dBz/dx)— the convention. Searching both repos for consumers: in Offline only the two overrides and the two declarations; in KinKal onlyBFieldMap.hh(pure virtual,NullBFieldMapandGradientBFieldMapoverrides) andCompositeBFieldMap::fieldGradinBFieldMap.cc:13, which only sums the children. Nothing reads the matrix, so no fit result moves. - 🟢
KinematicLineFit::goodFit— the new body matchesCentralHelixFit_module.cc:397-405line for line (sameactive()guard, sameposition3(shptr->time()), same earlybreak), andOffline/Mu2eKinKal/inc/KKFitUtilities.hhwas already included at line 53, so nothing was added speculatively. The stale charge/helicity comment is gone rather than left describing a test that is not run, which was the half of finding 1 that mattered most. - 🟢 The
ExtrapolateCRVRegionchange is direction-symmetric, which was the question in finding 3. Both quantities in the surviving comparison are already direction-normalised:normvelcarriestimeDirSign(tdir)sotime_to_sectoris a positive time-to-surface in the extrapolation direction, andpiece_spanisfabs(stime-etime). Dropping thetdirgate therefore applies the same test forward that it applied backward, with no sign to get wrong. The identical edit in the strongback-plane loop matches. - 🟢 CI is green at this head (build 3355).
triggerreturning 1 is not this PR: it isJob completed with warningover path-count deltas of 0.02-1.03 σ, and the same:question:appears on #1969, #1970, #1971 and #1972. The clang-tidy warnings inKinematicLineFit_module.ccandKKBField.ccare all on lines the diff does not touch (110, 137, 175, 202-213, 333-343, 383; andKKBField.cc:37). - Not checked: I did not run a reco job, so the yield and timing numbers asked for below are yours, not mine.
Findings
-
🟡 [S2] Two behaviour changes ship with a qualitative validation statement and no numbers.
- Evidence: PR body says "Tested against main, no significant differences for production jobs."
goodFitgates three things inKinematicLineFit_module.cc:308-316— extension, extrapolation, and whether the seed is saved at all — and the new check can only ever move a track from saved to dropped. The CRV change can only ever add forward-leg crossings. The CI cosmic jobs (cosmicSimReco,cosmicOffSpill) grade on job success, not on track yield or intersection count, so nothing in the build result covers either. - Suggested fix: quote the two counts you already have — KL tracks saved before/after on a cosmic sample, and CRV
KalIntersectioncount before/after on the CentralHelix sample. If the KL delta is exactly zero, that is worth saying explicitly, since it tells the next reader the check is a guard rather than a filter.
- Evidence: PR body says "Tested against main, no significant differences for production jobs."
-
🟡 [S2] Forward CRV extrapolation now runs to
maxDton tracks that will never reach a sector.- Evidence:
ExtrapolateCRVRegion.hh:126-131. The sector planes are unbounded for the purposes oftime_to_sector = signed_perp/normvel, so any track withnormvelabove theminvnorm_floor gets a positive time-to-surface and now setsretval = trueforward as well as backward. Termination falls back tomaxDt_and to the!addedbreak inKKExtrap.hh, so there is no runaway — but the work is roughly doubled for tracks that previously stopped at the first short piece. - Impact: reco CPU, on every extrapolated track, not only the ones that gain a crossing.
- Suggested fix: quote the per-event reco time from the same comparison run against main. If it is in the noise, say so in the PR body and this is settled.
- Evidence:
-
⚪ [S3] The new comment restates the code rather than the reason, and the three fixes share one commit.
// keep going, in BOTH time directionssays what the line does; the useful sentence is the one in your PR body — that forward is needed to recover CRV crossings on the CentralHelix forward leg withbfcorr=true. Putting that in the comment is what finding 3 was asking for either way.- Separately,
e525b162squashes all three fixes together. ThefieldGradandgoodFitchanges are independent of the CRV one, and only the CRV one can plausibly regress, so splitting the commits would let it be reverted alone. Not worth re-pushing for on its own, but worth doing if you touch the branch again.
Validation check
- Build/tests run: yes — FNALbuild build 3355 at
e525b162, all targets green includingceSimReco,cosmicSimReco,cosmicOffSpill,g4surfaceCheckandrootOverlaps. No independent build run by me. - Config contract check: n/a — no FHiCL and no module parameters change.
- Cross-repo consistency: pass.
fieldGradhas no consumer in Offline or KinKal, and the KL and CRV changes alter no data-product layout, module label or parameter name, so noProductionormu2e-trig-configcompanion is needed. The KinKal work you mention for stablebfcorr=trueis upstream and separate, as you say.
Residual risk
- The
inDetectorenvelope is the hardcodedRho < 900 && |Z| < 1800ofKKFitUtilities.cc:20-22, carrying its ownnumbers should come from Tracker TODO. KL now depends on it, so if that envelope is ever tightened it silently becomes a cosmic-track filter. Pre-existing, and not something to fix here. - The short-piece test is a straight-line estimate of the time to a curved trajectory's surface crossing. Forward pieces under
bfcorr=trueare the curved ones, so the estimate is loosest exactly where the new branch now fires. It errs toward extrapolating too far rather than stopping too early, which is the safe direction.
Author follow-ups
- Add the before/after KL track count and CRV intersection count to the PR body.
- Add the per-event reco timing delta, or state that it was below noise.
- Replace the
BOTH time directionscomment with thebfcorr=trueforward-leg reason from the PR body.
brownd1978
left a comment
There was a problem hiding this comment.
Thanks for the fixes Rob.
Issue #1974
Tested against main, no significant differences for production jobs.
For CentralHelix extrapolation with bfcorr=true, the needsExtrapolation fix is necessary to recover some CRV crossings on the forward leg. It is still not possible to run stably with bfcorr=true without upstream modifications to KinKal, which are in a separate PR. This limited fix can safely be merged now.
Edit: no change in track numbers and CRV crossings across KL/CH, no measurable change in reco time (<0.1% CPU time difference before/after).
There are a few additional TT_Outer crossings for the CH bfcorr=false run. These represent helices that loop several times around the tracker volume, an unphysical trajectory that can be resolved by setting bfcorr=true. But that fix requires significant upstream changes.