Skip to content

TrkCrvMatch: geometric candidates for straight-line tracks that miss every CRV sector - #2149

Merged
oksuzian merged 2 commits into
Mu2e:mainfrom
RobMina:trkcrv-f1-projection
Nov 17, 2026
Merged

oksuzian merged 2 commits into
Mu2e:mainfrom
RobMina:trkcrv-f1-projection

Conversation

@RobMina

@RobMina RobMina commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #2106 (track-CRV association).

Problem

TrkCrvMatchTool forms a geometric candidate only by projecting from one of the track's CRV crossings (CRV
KalIntersections). The extrapolation records a CRV intersection only when the track crosses a sector rectangle. A track
whose line passes just outside every sector therefore has no crossing at all. The cluster the muon did make at the
sector edge is then stored as a time-only candidate (xing = -1, no residuals, no chi2).

In the extracted-cosmic samples below, about 1 in 80 tracks without a CRV crossing has such a cluster: 553 of 45,417
in MC and 315 of 19,396 in CRT data. Tracks that miss one sector but cross another are not affected: they are
projected from the other sector's crossing, and the candidate is flagged outOfBounds. Without a residual and a chi2,
these edge clusters cannot be used in the geometric matching, or in efficiency and residual studies near the sector
edges.

Change

For a straight-line fit (KalSeed::kinematicLineFit()) with no CRV crossing, and with DoGeometric on:

  • For each sector holding a cluster of the event, the line is projected from the track's KalIntersection nearest in
    path onto the sector's extended mid-plane. If that crossing is outside the sector rectangle, it is recorded as a
    TrkCrvXing with inBounds_ = false, its edge distances dEdgeU_/dEdgeV_ (negative outside), and inter_
    pointing at the intersection it starts from. In-bounds crossings stay the extrapolation's job and are not
    projected.
  • Each cluster is projected from the crossing on its own sector, through the existing candidate code: residuals, the
    space+time chi2, the storage windows and the flags (outOfBounds when the point on the cluster plane is outside the
    sector, sameSector). The candidate covariance is the starting intersection's covariance carried over the whole
    straight step.
  • Projected crossings that no geometric candidate refers to are dropped, so xings_ holds only crossings in use.

Unchanged:

  • Tracks with at least one CRV crossing: the code path and output are identical.
  • Helix fits: a straight line from a tracker intersection is not valid in the field, so KKCHmu and the LoopHelix fits
    are not projected.
  • Configuration: no new FHiCL parameter, no change to prolog_v12.fcl.
  • Data products: TrkCrvMatch.hh changes in comments only, and EventNtuple needs no change. In <trk>crvxings,
    inbounds == false marks a projected crossing, since extrapolated CRV crossings are always in bounds. The truth
    (TrkCrvMatchMCMaker) matches reco crossings by sector, so projected crossings get their true crossing too.

Summaries that count crossings keep the projections apart, so their crossing counts still describe the extrapolation:

  • TrkCrvMatchMCMaker end-of-job summary: reco and found/missed count only crossings the extrapolation found.
    New columns: proj and proj:true (projected crossings, and those with a true crossing in the same sector), and
    miss:proj (true crossings the extrapolation missed but a projection matched). In the cluster line, chi2nd sums
    only candidates from extrapolated crossings, and noxing / chi2ndNoXing hold the projected ones.
  • TrkCrvMatchMCMaker diagLevel > 0 pull printout: the step to the plane starts at the KalIntersection the crossing
    comes from, which is the crossing itself for an extrapolated one.
  • Validation (ValTrkCrvMatch, ValTrkCrvMatchMC, version 2): NXing, XingShield, the layer-probe histograms,
    chi2ndof, RecoXing, RecoXingTrue, TrueXingFound, XingDist and XingDt use extrapolated crossings only.
    New histograms: NXingProj, XingProjShield, chi2ndofProj, RecoXingProj, RecoXingProjTrue, TrueXingProj,
    XingDistProj.
  • The parallel cut on |direction · normal| is one constant, trkCrvMinCosToNormal in TrkCrvPlaneError.hh, used by
    the matcher, the covariance and the MC maker.

Files: CRVReco/src/TrkCrvMatchTool.cc, CRVReco/inc/TrkCrvMatchTool.hh, CRVReco/inc/TrkCrvPlaneError.hh,
CRVReco/src/TrkCrvMatcher_module.cc (description), RecoDataProducts/inc/TrkCrvMatch.hh (comments),
CRVResponse/src/TrkCrvMatchMCMaker_module.cc, Validation/{inc,src}/ValTrkCrvMatch{,MC}.{hh,cc}.

EventNtuple: documentation only, in Mu2e/EventNtuple#447. It updates the crvxings / nxings / recoxing comments
and doc/branches.md, and utils/trkcrv_example.py now selects tracks that reach the CRV with inbounds.

Validation

A/B on the FNAL grid with the same inputs through both arms: reco (reco_kkts_extrap_v06.fcl for MC, Combined_Pass1
with KPP_reco v1_3 for data) and the ntuple with the association (from_mcs-extracted.fcl, from_rec-combined.fcl).

  • Base: Offline main 30088f3 (CI build) + EventNtuple main 428345cf.
  • Candidate: the same commits + this PR.
  • Inputs: CRT run 125483 subruns 1-3; extracted-cosmic MC (MDC2025bb dig, v06 geometry) files 1-3.

All jobs processed every event, with no failures. Both arms have the same entry counts and the same event sequence.

events tracks tracks with a CRV crossing tracks without recovered geometric candidates near the peak¹
MC (3 files) 90,880 64,432 19,015 45,417 593 (on 553 tracks) 296
CRT data (3 subruns) 81,277 25,606 6,210 19,396 337 (on 315 tracks) 181

¹ |dtXing| < 30 ns, |dv| < 250 mm and, for two-ended clusters, |du| < 1.5 m.

  • Unchanged output: in every file, all branches other than trkcrv* are bit-identical (386 leaves in MC, 185 in data).
    So are all trkcrv* leaves of the tracks that have a CRV crossing.
  • The recovered candidates are the existing time-only candidates of the no-crossing tracks, now geometric. The
    candidate cluster sets are unchanged in every file: no cluster outside the DtRefWindow enters through the geometric
    windows.
  • Every projected crossing is out of bounds (inbounds == false), as intended, and every recovered candidate is
    projected onto its own sector (sameSector). 98 % are also flagged outOfBounds at the cluster plane; the rest are
    inside the sector there because the line is inclined.
  • MC truth: 75 % of the recovered clusters come from the track's own particle (447 of 593), and 82 % of those near the
    peak (243 of 296). Most of the rest come from the particle's parent, or from an earlier simulation stage of the same
    particle. 96 % of the projected crossings (569 of 593) match a true crossing of the same sector.
  • On the sector with most of them (497 MC, 298 data), the recovered candidates are centred: dv median 1.5 mm (MC)
    and −0.7 mm (data), dtXing median 0.2 ns (MC) and 1.0 ns (data), chi2 median 10.1 (MC) and 9.3 (data), mostly
    for 3 degrees of freedom. Lines far outside a sector (metres past the bar ends) give large residuals and chi2, and
    are removed by the analysis's own windows.

Notes

  • A track crossing no CRV sector can now have entries in xings_ (projected, inBounds_ = false). An analysis that
    counted nxings > 0 as "the track reached a CRV sector" should add inbounds.
  • Projected candidates have a larger chi2 than extrapolated ones. Over the three MC files, take own-particle candidates
    near the peak (cuts as in the table). The 243 projected ones have median chi2/ndof 1.92 and median |dv| 51 mm. The
    24,038 extrapolated same-sector ones have 0.57 and 22 mm. The error model (TrackErrorScale, TrackPosErrQuad) was
    tuned on extrapolated crossings, so a chi2 cut tuned on those removes more projected candidates. resolve() also
    compares the two scales directly when they share a cluster. Analyses should separate them by inbounds. A possible
    cause, not investigated here: the straight step from the starting intersection adds no multiple scattering.
  • The projection is a straight line from the nearest intersection, as for other-sector projections. That is exact for
    the field-off line fits it applies to.

🤖 Generated with Claude Code

@FNALbuild

Copy link
Copy Markdown
Collaborator

Hi @RobMina,
You have proposed changes to files in these packages:

  • CRVReco
  • RecoDataProducts

which require these tests: build.

@Mu2e/fnalbuild-users, @Mu2e/write have access to CI actions on main.

⌛ The following tests have been triggered for 5913529: build (Build queue - API unavailable)

About FNALbuild. Code review on Mu2e/Offline.

@FNALbuild

Copy link
Copy Markdown
Collaborator

☀️ The build tests passed at 5913529.

Test Result Details
test with ✅ Command did not list any other PRs to include
merge ✅ Merged 5913529 at 7024300
build (prof) ✅ Log file. Build time: 09 min 24 sec
ceSimReco ✅ Log file.
g4test_03MT ✅ Log file.
transportOnly ✅ Log file.
POT ✅ Log file.
g4study ✅ Log file.
cosmicSimReco ✅ Log file.
cosmicOffSpill ✅ Log file.
ceSteps ✅ Log file.
ceDigi ✅ Log file.
muDauSteps ✅ Log file.
ceMix ✅ Log file.
rootOverlaps ✅ Log file.
g4surfaceCheck ✅ Log file.
trigger ❌ Log file. Return Code 2.
check_cmake ✅ Log file.
FIXME, TODO ✅ TODO (0) FIXME (0) in 4 files
clang-tidy ➡️ 2 errors 58 warnings
whitespace check ✅ no whitespace errors found

N.B. These results were obtained from a build of this Pull Request at 5913529 after being merged into the base branch at 7024300.

For more information, please check the job page here.
Build artifacts are deleted after 5 days. If this is not desired, select Keep this build forever on the job page.

@oksuzian oksuzian left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review Summary — #2149

Reviewed at head 591352984eda31df998c4ab28813df3f0ceb4ee4. First pass.

Decision

  • 🟢 approve

Scope understood

  • For a KKLine fit (KalSeed::kinematicLineFit()) with no CRV KalIntersection and DoGeometric true, TrkCrvMatchTool::match projects the line from the intersection nearest in path onto the extended mid-plane of each sector that holds a cluster. Out-of-bounds projections become TrkCrvXings with inBounds_ = false, candidates are formed by the existing code, and projected crossings that no geometric candidate uses are dropped.
  • Tracks with a CRV crossing, helix fits and the FHiCL configuration are unchanged; TrkCrvMatch.hh changes in comments only.

Findings

  1. 🟡 [S2] Offline's own summaries, and EventNtuple's documentation, still treat every crossing as one the extrapolation found

    • Evidence: CRVResponse/src/TrkCrvMatchMCMaker_module.cc:385 counts every xings_ entry as a reco crossing, and :398 counts a true crossing as found when any reco crossing matched it. In my A/B below, its end-of-job summary goes from found 8188 / missed 1309 to found 8410 / missed 1087 over all sectors. On CRV_EX, "missed" drops from 438 to 229, so the column no longer measures the extrapolation. Validation fills the same way (ValTrkCrvMatch.cc:67, :108; ValTrkCrvMatchMC.cc:47, :60). In EventNtuple main (428345c), utils/trkcrv_example.py:83-87 prints nxings > 0 as "crossing the CRV". inc/TrkCrvInfo.hh:11, inc/TrkCrvXingInfo.hh:2, inc/TrkCrvTrueXingInfoMC.hh:29 and doc/branches.md:78 describe crvxings as the extrapolation's crossings.
    • Suggested fix: in the MC maker summary, skip !inBounds_ crossings or give them their own column. In EventNtuple, update the comments, doc/branches.md and the example to use inbounds. The EventNtuple code needs no change, but its documentation does.
  2. 🟡 [S2] The chi2 of projected candidates is on a different scale from extrapolated ones

    • Evidence: in the head ntuples, I took own-particle candidates inside the description's peak cuts. The 126 projected candidates have median chi2/ndof 1.17 and median |dv| 83.5 mm. The 7,158 extrapolated same-sector candidates have median chi2/ndof 0.54 and median |dv| 23.3 mm. The error model (prolog_v12.fcl:421-422) was fitted on extrapolated crossings (:393). So a chi2 cut tuned on extrapolated candidates removes more projected ones, and resolve() compares the two scales directly when they share a cluster.
    • Suggested fix: no code change asked. Please state this in the description or in the TrkCrvXing comment, so analyses separate the two by inbounds. One possible cause, which I did not investigate: the straight step from the starting intersection adds no scattering.
  3. ⚪ [S3] A few comments and one diagnostic still describe only extrapolated crossings

    • Three comments are out of date for projections:
      • The DoGeometric Comment (TrkCrvMatchTool.hh:42) still reads "from CRV KalIntersections".
      • TrkCrvCandidate::cov_ (TrkCrvMatch.hh:78) says the covariance is "carried from the reference crossing". For a projected candidate it starts at the intersection (TrkCrvMatchTool.cc:330).
      • TrkCrvXing::mom_ (TrkCrvMatch.hh:53) is described as the momentum "at the crossing". For a projection it is the starting intersection's (TrkCrvMatchTool.cc:189).
    • The diagLevel > 0 pull printout in TrkCrvMatchMCMaker_module.cc:448-457 steps from rx.pos_. For a projected crossing that point is already on the plane, so teu/tev print the starting intersection's error without the step.
    • The parallel cut 1e-3 now appears in four places: TrkCrvMatchTool.cc:168 and :309, TrkCrvPlaneError.hh:26, and TrkCrvMatchMCMaker_module.cc:453. One named constant would keep them in step.

Verified

  • 🟢 Crossing indices after the drop. cand.xing_ is remapped before the candidates are sorted, and each candidate keeps its xing_ through the sort (TrkCrvMatchTool.cc:359-368). x.best_ is set after the remap (:390-393). The MC maker and EventNtuple build their crossing-parallel arrays from the final xings_. Two tests confirmed this:
    • A/B (below): every candidate that points at a projected crossing has the same sector as that crossing. No projected crossing is left unused. best always points at a geometric candidate of its own sector. crvxingsmc has the same length as crvxings. crvtruexingsmc.recoxing always lands on a crossing of the same sector.
    • Remap test: the head build with KeepAllClusters : true keeps all 1,451 projected crossings, on 970 tracks. With the windows on, 1,171 of them are dropped, and 706 tracks lose all of theirs. The 280 kept are the matching subset, in order, with identical content. Each of the 280 candidates has the same crossing, residuals, chi2 and covariance as with KeepAllClusters.
  • 🟢 Unchanged paths. The new code runs only under doGeometric_ && m.xings_.empty() && ks.kinematicLineFit() (:270). Every other track takes the old loop (:302-313). For an extrapolated crossing, dsCov equals ds, because x.sid_ is the intersection's own SurfaceId (:247, :330). In the A/B, all 5,849 tracks with a crossing are identical in every trkcrv* field, and every other ntuple branch is identical.
  • 🟢 Geometry.
    • The step to the plane is signed (:169). Position, time (:185), crossing covariance (:187) and candidate step (:330) all use that sign, as trkCrvPlaneCovariance expects. Units are mm and ns.
    • The dEdgeU_/dEdgeV_ convention (:177) matches :261-262 and the MC maker (:277-278).
    • A line parallel to a sector cannot divide by zero: intersections with |d·w| < 1e-3 are skipped (:168), and the candidate uses the same plane.
    • In the A/B, every new crossing has inbounds == false, and no extrapolated crossing does.
  • 🟢 kinematicLineFit() tests TrkFitFlag::KKLine (KalSeed.hh:70), which only KinematicLineFit_module.cc:324,328 sets.
    • RegrowKinematicLine keeps the flag, but its output is still a line.
    • Helix fits take their flags from helix or line-finder seeds, which never carry the flag.
    • Production runs KKLine only in Reconstruction.NoFieldPath (JobConfig/reco/prolog.fcl:283-285, :352-354).
  • 🟢 Data product: with the // comments removed, TrkCrvMatch.hh is identical to its base. classes_def.xml is untouched.
  • 🟢 Offline#2147:
    • git merge-tree of 591352984 with 4914d1de reports no conflict.
    • CRVReco with both PRs merged on main 70243009 builds cleanly.
    • Projected candidates use the same resolution() calls (:332-333) under the same doGeometric_ condition, so #2147's beginRun check covers them.

Validation check

  • CI: FNALbuild build 3606 is green at this head. It merged into 70243009 and posted at 2026-11-12 19:46:02 UTC. The whitespace check passed, and the FIXME/TODO count is 0. The two clang-tidy errors are in cetlib. The trigger row fails with return code 2. Its block of 36 path messages is identical to build 3605 (Offline#2148, ExtMon shielding) at the same base, apart from the timing lines. Those messages are the four apr_proton renames plus count changes on 32 paths. No TrkCrv module runs in that job, so nothing in the row comes from this PR.
  • Local A/B:
    • Builds: CRVReco as sparse muse workdirs on CI build main/70243009_dc19af05_1dc8ee40, once at 70243009 and once with this PR merged, each with EventNtuple main 428345c.
    • Reco: Production/JobConfig/recoMC/Extracted.fcl on one MDC2025bb extracted-cosmic dig file, read in place (30,311 events).
    • Ntuple: EventNtuple/fcl/from_mcs-extracted.fcl in both workdirs on that same reco output.
    • Result: 20,296 tracks, of which 5,849 have a crossing and are unchanged. 264 of the 14,447 tracks without a crossing gain 280 projected crossings and 280 geometric candidates; these were time-only candidates before. The candidate cluster sets and time fields are unchanged. 79% of the new candidates come from the track's own particle; the description reports 75%.
  • Config contract: pass (no FHiCL change).
  • Cross-repo consistency: needs a follow-up in EventNtuple (finding 1).

Residual risk

  • Not checked:
    • CRT data, the description's data arm.
    • Non-extracted geometries.
    • The layer-probe content of projected crossings.
    • A projection that lands in bounds when the extrapolation recorded no crossing. That cluster stays time-only, as before.

Author follow-ups

  1. Keep projected crossings out of the MC maker's found/missed summary, or give them their own column. Update the EventNtuple comments, doc/branches.md and utils/trkcrv_example.py to use inbounds (finding 1).
  2. Note the chi2 scale of projected candidates in the description or in the TrkCrvXing comment (finding 2).
  3. Optional: the comments, the diagnostic printout and the shared parallel cut (finding 3).

…idation; comments, shared parallel cut (review)
@RobMina

RobMina commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review. All three findings are addressed in 8775fa3:

  1. Summaries and documentation
    • TrkCrvMatchMCMaker summary: reco and found/missed count only crossings the extrapolation found.
      Projections have their own columns: proj, proj:true and miss:proj. The cluster line's chi2nd sums only
      candidates from extrapolated crossings; the projected ones go to noxing / chi2ndNoXing.
    • ValTrkCrvMatch and ValTrkCrvMatchMC (version 2): the crossing and found histograms are in-bounds only, with
      separate *Proj histograms for projections.
    • EventNtuple comments, doc/branches.md and utils/trkcrv_example.py now use inbounds, in Track-CRV association: document projected crossings in <trk>crvxings EventNtuple#447.
  2. chi2 scale: the description now has the numbers from our MC A/B (median chi2/ndof 1.92 projected, 0.57 extrapolated).
    The TrkCrvXing::inBounds_ comment says projected candidates run to larger chi2. No code change.
  3. The DoGeometric Comment and the TrkCrvCandidate::cov_ and TrkCrvXing::mom_ comments now cover projections. The
    pull printout steps from the KalIntersection. The parallel cut is trkCrvMinCosToNormal in TrkCrvPlaneError.hh,
    used in all four places.

@RobMina

RobMina commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

@FNALbuild run build test

@FNALbuild

Copy link
Copy Markdown
Collaborator

⌛ The following tests have been triggered for 8775fa3: build (Build queue - API unavailable)

@FNALbuild

Copy link
Copy Markdown
Collaborator

☀️ The build tests passed at 8775fa3.

Test Result Details
test with ✅ Command did not list any other PRs to include
merge ✅ Merged 8775fa3 at 7024300
build (prof) ✅ Log file. Build time: 04 min 40 sec
ceSimReco ✅ Log file.
g4test_03MT ✅ Log file.
transportOnly ✅ Log file.
POT ✅ Log file.
g4study ✅ Log file.
cosmicSimReco ✅ Log file.
cosmicOffSpill ✅ Log file.
ceSteps ✅ Log file.
ceDigi ✅ Log file.
muDauSteps ✅ Log file.
ceMix ✅ Log file.
rootOverlaps ✅ Log file.
g4surfaceCheck ✅ Log file.
trigger ✅ Log file.
check_cmake ✅ Log file.
FIXME, TODO ✅ TODO (0) FIXME (0) in 10 files
clang-tidy ➡️ 4 errors 222 warnings
whitespace check ✅ no whitespace errors found

N.B. These results were obtained from a build of this Pull Request at 8775fa3 after being merged into the base branch at 7024300.

For more information, please check the job page here.
Build artifacts are deleted after 5 days. If this is not desired, select Keep this build forever on the job page.

@oksuzian oksuzian left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review Summary — #2149

Reviewed at head 8775fa36352fc73ff7df755fd442613b8e08ba84. Re-review of 5913529.

Decision

  • 🟢 approve

What changed since 5913529

  • One commit, 8775fa36, in 9 files. The track-CRV products do not change: on my A/B sample every TrkCrvMatch and TrkCrvMatchMC element is byte-identical to the previous head.
  • The TrkCrvMatchMCMaker end-of-job summary and ValTrkCrvMatch / ValTrkCrvMatchMC (now version 2) count projected crossings apart from extrapolated ones.
  • Comments in TrkCrvMatchTool.hh and TrkCrvMatch.hh are updated, the pull printout steps from the KalIntersection, and the parallel cut is one constant, trkCrvMinCosToNormal.
  • The description now has the chi2 note. The EventNtuple part is in Mu2e/EventNtuple#447.

Prior findings

  1. 🟢 [was S2] Offline's summaries counted projections as extrapolated crossings — FIXED in 8775fa3, verified.
    • MC maker: projections skip the extrapolation's counts (TrkCrvMatchMCMaker_module.cc:389, :402-407). Summed over my A/B sample, the 12 columns that base prints are identical to base in all 11 sectors: reco 9,748, found 8,188, missed 1,309, miss:nbr 180. The projections appear only in the new columns: proj 280, proj:true 272, miss:proj 222. The previous head's counts (reco 10,028, found 8,410, missed 1,087) are exactly the new head's plus these.
    • On the cluster line, chi2nd, proj and chi2ndProj equal base in every sector. The projected candidates are in noxing (209 on CRV_EX, 4 on CRV_T1, 9 on CRV_T2).
    • Validation: identical to base for the in-bounds histograms; see the Validation check.
    • EventNtuple: addressed in Mu2e/EventNtuple#447, which I review separately.
  2. 🟢 [was S2] The chi2 of projected candidates is on a different scale — ADDRESSED. No code change was asked. The description's Notes give the numbers (median chi2/ndof 1.92 for 243 projected candidates, 0.57 for 24,038 extrapolated ones) and say to separate them by inbounds. The TrkCrvXing::inBounds_ comment says the same (TrkCrvMatch.hh:55), and Validation now fills chi2ndofProj apart.
  3. 🟢 [was S3] Comments, the pull printout and the parallel cut — FIXED in 8775fa3, verified by reading.
    • The DoGeometric Comment (TrkCrvMatchTool.hh:42), TrkCrvXing::mom_ (TrkCrvMatch.hh:53) and TrkCrvCandidate::cov_ (:78) now cover projections.
    • The pull printout steps from the KalIntersection (TrkCrvMatchMCMaker_module.cc:455). For an extrapolated crossing that point is the crossing itself. I did not run it with diagLevel > 0.
    • trkCrvMinCosToNormal (TrkCrvPlaneError.hh:13, 1e-3 as before) is used at TrkCrvPlaneError.hh:27, TrkCrvMatchTool.cc:168 and :309, and TrkCrvMatchMCMaker_module.cc:459. One more copy, ValTrkCrvMatch.cc:101, comes from base and was not in my first list. Optional.

Findings

  1. ⚪ [S3] Optional: a few places still mix projected candidates with extrapolated ones, and proj now names two things
    • The cluster line's geom, exclusive and best still count projected candidates, but chi2nd no longer sums them (TrkCrvMatchMCMaker_module.cc:417-428). On CRV_EX, geom goes from 4,952 at base to 5,161, which is 4,952 plus 209 noxing. So the mean chi2/ndof is now chi2nd / (geom - noxing), not chi2nd / geom.
    • In the same printout, proj in the sector table is a projected crossing (:485, :490). proj on the cluster line is a candidate from another sector's crossing (:110, :424, :496), and the cluster line calls projected candidates noxing. One name for one thing would remove the clash, for example noxing in the table too.
    • ValTrkCrvMatch.cc:85 splits chi2ndof, but dtXing, du, dv (:86-88) and dvVsSlope_* (:101), filled for the same candidates, still include the projected ones. dv has 8,415 entries against 8,135 for chi2ndof. The projected candidates have a larger |dv| (finding 2 of my first review), so a split would keep dv equal to base, as chi2ndof now is.

Validation check

  • CI: FNALbuild build 3610 passed every row at this head, merged into 70243009 (posted 2026-11-13 14:17:01 UTC), including trigger. The whitespace check passes, and the FIXME/TODO count is 0 in 10 files. The 4 clang-tidy errors are all the same cetlib error (LibraryManager.h:43), once per checked file. Its 222 warnings are mostly the setw widths and narrowing conversions of the summary printout, in the style of the code around them.
  • Local A/B, on the sample of my first review:
    • Builds: sparse muse workdirs on CI build main/70243009_dc19af05_1dc8ee40. Base and the previous head (CRVReco) use EventNtuple main 428345c. This head, merged onto 70243009 (CRVReco, CRVResponse, Validation), uses EventNtuple#447's head 1395fed4. It builds with no compiler warnings.
    • Jobs: Production/JobConfig/recoMC/Extracted.fcl at this head on one MDC2025bb extracted-cosmic dig file, read in place (30,311 events). The matcher and the MC maker run only in the ntuple job. So I ran EventNtuple/fcl/from_mcs-extracted.fcl in all three workdirs on the same reco output, adding the Validation analyzer and an output that keeps the two TrkCrv products. On the reco output of this head and of base, the ntuple job gives identical TrkCrvMatch products (4 of 4 files).
    • Products: I compared an MD5 hash of each element's ROOT serialization. All 20,296 TrkCrvMatch and all 20,296 TrkCrvMatchMC elements are identical to the previous head. Against base, 264 elements of each differ: the tracks that gain projections.
    • MC summary: as in prior finding 1.
    • Validation version 2, summed over the four files:
      • Identical to base, bin for bin: NXing, XingShield, XingGeomShield, chi2ndof, the seven Probe* histograms, RecoXing, RecoXingTrue, TrueXingFound, XingDist and XingDt.
      • The new histograms fill only from projections. For XingShield, chi2ndof, RecoXing, RecoXingTrue, TrueXingFound and XingDist, the in-bounds histogram plus its *Proj partner equals the previous head's mixed histogram, bin for bin. Entries: XingProjShield 280, chi2ndofProj 280, NXingProj 264 tracks holding 280 projections, RecoXingProj 280, RecoXingProjTrue 272, TrueXingProj 222, XingDistProj 222.
      • Ver goes from 1 to 2. The candidate histograms (dtXing, du, dv, dvVsSlope_*, NGeom, Flags, PredMatched, dtRefBest, TrueCluGeom, TrueCluBest and the relation histograms) differ from base, as they did at the previous head, because the projected candidates are new geometric candidates.
    • Nightly validation: no nightly job makes a TrkCrvMatch today. Production/Validation/nightly/extracted_*.fcl runs JobConfig/recoMC/Extracted.fcl, and no Production config schedules a TrkCrv module, at the CI build's dc19af05 or at current main. These histograms will appear once Mu2e/Production#595 schedules the matcher. valCompare will not break then: TValCompare::Analyze compares only histograms present in both files and skips the others (Validation/root/TValCompare.cc:166-177). Against an older reference, a new *Proj histogram is not compared, and Ver is flagged, which is what the version number is for. Other Validation classes change it the same way: dd63eb174 added one histogram to ValKalSeed and moved Ver from 2 to 3.
  • Config contract: no FHiCL change.
  • Cross-repo: Mu2e/EventNtuple#447 carries the documentation. It should merge with or after this PR.

Residual risk

  • inBounds_ == false marks a projection because the extrapolation keeps only in-bounds CRV crossings (ExtrapolateSweep.hh:70, :428) and the line fit samples only tracker surfaces (Mu2eKinKal/fcl/prolog.fcl:467-471). A line fit configured to sample CRV sectors with SampleInBounds : false would break that. On this sample, every crossing at base is in bounds.
  • Not checked: the diagLevel > 0 printout, CRT data and other geometries.

Author follow-ups

  1. Optional: the cluster-line counts, the two meanings of proj, and the candidate histograms in Validation (finding 1).

@oksuzian
oksuzian requested a review from brownd1978 November 15, 2026 16:51

@brownd1978 brownd1978 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds a valid fix for 'near miss' extrapolation intersection. I expect that fix will be mostly unnecessary after a planned upgrade to KinKal::Intersect to allow recording 'near the edge' intersections is implemented; in particular the projectXing method should become native to Intersect. I suggest marking that function at least as a stand-in for an upcoming core KinKal extension.

@oksuzian
oksuzian merged commit 17345e6 into Mu2e:main Nov 17, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants