Repository navigation
Conversation
|
Currently, the track propagation in the magnetic field is done with the swimmer. Therefore the changes to the helix-based propagation would have no effect. The change that may be critical is the check on the matrix H. What problem was found with the swimmer? |
helical/KFitter.smooth() returns null when setStateVecPosAtMeasSite fails,
i.e. when the swimmer cannot place the smoothed helix on that measurement
surface. Three places then consume smoothed states behind only a `skip`
check, and AMeasVecs.dh returns Double.NaN by contract for a null state:
if (stateVec == null || ...) return value; // Double.NaN
1. AKFitter.calc_chi2 null-checks only the first and last smoothed states,
then evaluates every one of them. An intermediate null makes chisq NaN,
runFitter sets setFitFailed, and the filtered fit is abandoned for the
whole track. One unreachable intermediate surface discards a track whose
other six measurements are good. A measurement can be excluded from the
chi2 sum via `skip`; a null smoothed state could not be.
2. helical/KFitter.getChi2(1), the secondary (no-beamspot) chi2 published
through Track.setSecondaryChi2, has the same loop and would return NaN.
3. AKFitter.setTrajectory computes a smoothed residual per measurement and
would store the NaN in HitOnTrack, reachable from Track's KF trajectories.
Treat a null smoothed state as a measurement that contributed nothing:
excluded from chi2 and NDF in (1) and (2), and reported in (3) as -999 with
isUsed=false, which is the convention already used for a passive surface.
(1) is the behavioural fix. (2) and (3) are latent today - they are only
reached by tracks that (1) previously discarded - and are included so the
three sites agree. Verified behaviour-neutral: with (2) and (3) added, all
15,258 published tracks are identical to (1) alone, in both arms.
Measured on this branch. CLAS12 RG-D run 19060, 20,000 events, full CVT
chain (CVTFP/CTOF/EBHB/CVTSP), beamSpotConst=2, 15,258 tracks:
before after
failed filtered fits (nKFIters==1) 745 587
as a fraction 4.881% 3.847%
rescued (nKFIters 1 -> >1) 162
broken (nKFIters >1 -> 1) 0
median chi2/NDF, tracks already fine 1.7428 1.7428
The gain is one-directional: no track's fit is broken by this. The rescued
tracks are ordinary rather than marginal - median NDF 5, median chi2/NDF
3.02, median pT 0.438 GeV. Only 1.33% of tracks change at all, and 162 of
those 203 are the rescues. No NaN appears in any FLOAT or DOUBLE field of
CVTRec::Tracks, CVTRec::Trajectory or CVTRec::UTracks, before or after
(4.16 M values scanned per arm).
nKFIters is the observable here rather than the published covariance. A
failed filtered fit falls back to runFitterNoFiltFailSafe, which publishes
the unfiltered seed prior, so cov_d02 is positive for every track on this
branch and cannot distinguish a real fit from a fail-safe one. runFitter's
iteration loop always runs a second pass after a successful first, so
nKFIters == 1 is exactly equivalent to a failed filtered fit.
The former behaviour is available as -Dkf.legacyNullSmoothFail=true for A/B
comparison; it should be removed once this has been exercised on more data.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A2ymgxW5EqAmsepqFxb3XG
3a83bde to
37140ae
Compare
3a574e1 to
5b1f63a
Compare
|
Dear Raffaella, Thanks, and sorry for the slow reply. I did not see your comment and did not get email notification about it. No problem was found with the swimmer used for normal state propagation. You are right that The analytic helix is nevertheless used in production when the projector matrix H is evaluated. sv.setStateVecPosAtMeasSite(SVplus, mv, null);
sv.setStateVecPosAtMeasSite(SVminus, mv, null);That selects the analytic branch in The geometry fix keeps swimmer-based nominal propagation and changes only that analytic projector: it now Is the H null check responsible?I tested your suggestion directly on RG-D run 18528, first 20,001 events, decoded with 13.0.0,
The geometry-only arm is indistinguishable from the full PR. The null check therefore accounts for The old-projector arm has nearly identical track yield, but its median chi2/NDF is four times worse The SVT effect is present in all six layers:
Residual widths are MAD = median( |x_i − median(x)| ) The factor converts that into something on the same scale as a Gaussian σ. For a normal distribution, the absolute deviation from the mean is exceeded by exactly half the sample at the 75th percentile, so MAD = Φ⁻¹(0.75) · σ = 0.674490 · σ → σ = MAD / 0.674490 = 1.4826 · MAD So 1.4826 × MAD is a robust estimator of σ: for a truly Gaussian sample it returns the same number as the standard deviation, but it is computed only from medians, so it is almost completely insensitive to outliers. Run 18528 is a production-target run at about three times the occupancy of empty-target run 19060, Why not use the swimmer inside H as well?I tested that too, as the diagnostic that first established the mismatch. That variant is slightly On run 19060, 5 T, delivered alignment, SVT-only, 5,000 events, across the same 2,187 matched seed Those absolute widths are smaller than the 18528 numbers above because this is an SVT-only fit on This confirms the geometry mismatch independently, but finite differences amplify the swimmer's |
Fix CVT Kalman projectors for aligned geometry and harden failure reporting
With alignment constants enabled, CVT transport used the aligned detector surfaces while the
analytic Kalman Jacobian projected perturbed states to idealized SVT planes and beam-axis BMT
cylinders. The filter therefore differentiated a different measurement function from the one used
for transport and residuals. In 5 T run-19060 data this produced broad, sector-dependent SVT
residuals and many failed filtered fits; ideal-geometry MC and 0 T data did not expose the defect.
This branch makes the analytic projector use the complete SVT plane and BMT cylinder geometry. It
also makes the resulting failure paths and output reporting explicit, fixes BMT status precedence,
and adds two independent ClusterFinder safety corrections.
Commits
c2d49aed86bcc0a905d1f41beeaeec27e687-999sentinela0081aaf737140ae545b1f63ac5CLAS12DIRThe commits are separated by mechanism and can be reviewed independently.
Projector defect and fix
Normal state transport swims through the field map to an aligned measurement surface. The numerical
Jacobian in
MeasVecs.H()perturbs the state and uses the analytic helix projector because swimmingten perturbed states for every measurement and iteration is both expensive and numerically noisy.
The former analytic projector simplified the detector geometry:
cylinder.getAxis().The new SVT solver finds the helix path length satisfying the complete plane equation
n dot (r(l)-p) = 0. The BMT solver finds the crossing of the actual cylinder defined by its axisand radius. It uses a Newton solve with a bounded bracket/bisection fallback and preserves the exact
legacy closed form when the cylinder axis is the beam line.
If a perturbed state cannot reach the requested surface,
H()returns failure and the measurementis skipped. It no longer substitutes a result on a different nominal surface.
The Jacobian remains approximate: it is an analytic uniform-field helix derivative while the
nominal state is swum through the measured field map. A swimmer finite-difference variant was
tested and performed worse because finite differences amplify swimmer noise. This change removes
the detector-geometry inconsistency; it does not claim to make the Jacobian field-map exact.
Null smoothing and covariance reporting
A single null smoothed state formerly propagated
NaNinto the track chi2 and discarded the entirefiltered fit. Null states are now treated like other unused measurements: they contribute neither
chi2 nor NDF, and their trajectory residual is reported as unavailable.
When a filtered fit still fails, reconstruction publishes the existing unfiltered seed as its
fail-safe track. That object formerly retained the seed-prior covariance, making it indistinguishable
from a fitted covariance. The bank writer now publishes
-999for unavailable covariance elements.It does not discard the fail-safe track or alter its physics parameters.
BMT status precedence
HitReaderfirst applied BMT timing/channel rejection statuses 1–4 and then overwrote them with HVannotations 5 or 6. Because 5 and 6 are non-rejecting, enabling
hvCutscould resurrect a hit thathad already failed timing. Rejection status now takes precedence over an HV annotation.
This makes masking the persistently unavailable BMT sector 1 layer 5 module safe. It does not
recover that missing measurement; it only prevents sparse off-module noise from being admitted.
ClusterFinder safety
The fixed-size hit map rejected strip 1200 through
w < NSTRIP, while the scan would access beyondthe array if that guard were changed in isolation. The fill and scan bounds are now consistent, and
invalid strip/layer/sector coordinates fail explicitly. If more than 64 concurrent calls exhaust
the map pool,
poll()allocates a fallback map instead of dereferencing null.These changes are behavior-neutral for the production sample: real SVT strips stop at 256, the
largest BMT module stops at 1152, and the serial replay does not exhaust the pool.
Order-dependent energy smoothing and duplicate SVT-cell policy are deliberately not changed here.
Controlled tests found no residual-width benefit from snapshot smoothing and a small loss of
filtered tracks. Reversing all duplicate row pairs changed seven tracks but no track outcome or
good-track count.
Controlled validation
Run 19060, first 5,001 events, full CVT,
rgd_fall2023, explicitbeamSpotConst=2:The layerwise SVT
cos(2phi)width amplitudes fall from 26–64 um to 0.7–4.7 um. The few trackslost by the geometry change were overwhelmingly pathological legacy fits; the gain is hundreds of
previously failed seeds becoming valid filtered fits.
On the complete 556,309-event run-19060 comparison, the isolated SVT plane correction reduces the
robust SVT width from 118.8 to 57.6 um and raises valid covariance from 87.39% to 94.93%. Track yield
is unchanged within 0.02%; the improvement is fit quality and track usability.
The same comparison on the first 5,001 events of run 19040 provides an independent 5 T
physics-target test under higher occupancy:
The SVT width
cos(2phi)amplitude falls from 30–71 um to 1.3–4.3 um in all six layers. Matched byevent and seed, 1,134 tracks change from fail-safe to filtered while 181 change in the opposite
direction. This confirms that the correction generalizes beyond the low-occupancy empty-target
run 19060. Layer 6 retains a small median modulation without a corresponding width modulation;
that is a separate alignment or calibration observable.
Additional checks:
beam-axis BMT cylinders, fallback behavior, and degenerate input.
strip, and pool exhaustion.
20,000-event reference sample.
relative to the preceding branch head.
Remaining detector limitation
BMT sector 1 layer 5 was effectively off throughout the studied running. Its raw occupancy is below
0.5% of neighboring modules, and CCDB reports 0.5 V with zero strip voltage. Masking that module in
low-pT MC reproduces the localized 180–240 degree fit-validity loss at the observed scale while the
SVT residual width remains stable. That acceptance hole is separate from the projector defect and
cannot be repaired in reconstruction.