Skip to content

TrkCrvMatcher: refuse Sigma* lists that do not describe the CRV geometry - #2147

Merged
oksuzian merged 1 commit into
Mu2e:mainfrom
RobMina:trkcrv-sigma-guard
Nov 20, 2026
Merged

oksuzian merged 1 commit into
Mu2e:mainfrom
RobMina:trkcrv-sigma-guard

Conversation

@RobMina

@RobMina RobMina commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

What

With DoGeometric: true, TrkCrvMatcher (through TrkCrvMatchTool::beginRun) now checks SigmaV, SigmaU and
SigmaT against the sector types of the loaded CosmicRayShield. Each list must have either one entry, used for every
sector type, or one entry per sector type 1 to N, type 1 first. Otherwise the job stops with a CONFIG exception that
names the list, its entries and the geometry's sector types:

TrkCrvMatchTool: SigmaV has 4 entries [7, 13, 7, 17], but the loaded CRV geometry has sector types 1 (CRV_T1 CRV_T2).
With DoGeometric true, each of SigmaV, SigmaU and SigmaT needs one entry per sector type 1-1, type 1 first, or a single
entry for all types. The TrkCrvMatcher defaults in CRVReco/fcl/prolog_v12.fcl describe the extracted geometry only.
The above exception was thrown while processing module TrkCrvMatcher/TrkCrvMatchCHmu run: 1430

Time-only instances (DoGeometric: false) do not use the lists and are not checked. The SigmaV comment in
TrkCrvMatchTool.hh and the TrkCrvMatcher comment in prolog_v12.fcl state the rule.

Why

The lists are indexed by sectorType - 1, and the last entry covers higher types, so a list written for one geometry
runs silently on another. The defaults (SigmaV: [ 7, 13, 7, 17 ]) describe the extracted geometry (EX, T1, T2, muon
taggers). In the Run 1 geometries T1 and T2 are both sector type 1, so they took the EX value, 7 mm. That was found in
the review of Mu2e/Production#595 and fixed there by configuration (SigmaV: [ 13 ]). This PR is the follow-up promised
in that thread: the module now refuses such a configuration.

Sector types of the geometries in use: Run 1A/1B (crv_counters_run1a_v01.txt): 1; extracted v04 and later: 1-4;
extracted v01-v03: 1-3; Run 2 (crv_counters_v10.txt): 1-7. So the 4-entry default would now throw on extracted v01-v03
and on Run 2 if a job ran the geometric matcher there with it; none of the Production or EventNtuple jobs does.

Tests (Offline main 30088f39, the CI build as base; Production#595 with its reco cluster-tag fix in both arms)

  • Every TrkCrvMatcher instance in the Production reco and recoMC configurations, with its geometry, from fhicl-dump:
    all accepted. The geometric ones have SigmaV: [ 13 ] on Run 1A/1B or the 4-entry list on extracted v04; the
    LoopHelix ones are time only.
  • Base and this branch, the same inputs: reco and recoMC OffSpill (300 events, MDC2025an CosmicSignalOffSpill),
    NoField and recoMC NoFieldRun1B (300 events of the same digis), Extracted (300 events, MDC2025au
    CosmicCRYExtracted) and recoMC OnSpill (100 events, MDC2025au CeMLeadingLogMix1BB). Every job exits with status 0.
    Every TrkCrvMatchs collection is bit-identical. So is every other product, apart from RecoCount::_ncc and _cce
    in the input RecoCount_*__Digitize products, which are not initialised and differ between two runs of the same code.
  • Mismatched lists, this branch: Run 1A with the 4-entry SigmaV on TrkCrvMatchCHmu, extracted with a 3-entry
    SigmaV and with a 2-entry SigmaT on TrkCrvMatchLine: each stops at the first beginRun with the message above
    (exit status 1). Extracted with SigmaV: [ 10 ], and Run 1A with the 4-entry list on TrkCrvMatchCHmu with
    DoGeometric: false, both run. On main, the first case runs silently.

Related: Mu2e/Production#595, #2106.

🤖 Generated with Claude Code

With DoGeometric true, TrkCrvMatchTool::beginRun checks SigmaV, SigmaU and SigmaT against the sector types of the loaded CosmicRayShield: one entry for all types, or one per sector type 1 to N; otherwise a CONFIG exception names the list and the geometry's sector types. Follow-up to Mu2e/Production#595.
@FNALbuild

Copy link
Copy Markdown
Collaborator

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

  • CRVReco

which require these tests: build.

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

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

About FNALbuild. Code review on Mu2e/Offline.

@FNALbuild

Copy link
Copy Markdown
Collaborator

☀️ The build tests passed at 4914d1d.

Test Result Details
test with ✅ Command did not list any other PRs to include
merge ✅ Merged 4914d1d at 30088f3
build (prof) ✅ Log file. Build time: 13 min 27 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 2 files
clang-tidy ➡️ 1 errors 46 warnings
whitespace check ✅ no whitespace errors found

N.B. These results were obtained from a build of this Pull Request at 4914d1d after being merged into the base branch at 30088f3.

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 — #2147

Reviewed at head 4914d1de3d62f83bbe8ad0d9017326544a4796e7. First pass.

Decision

  • 🟢 approve. The check does what the description says. It runs only where the lists are used, and every job that schedules a geometric matcher today passes it. FNALbuild build 3604 built this head, merged on main 30088f39. The prof build and all validation jobs passed. trigger shows "Return Code 2", but its log has only the four apr_proton rename messages from mu2e-trig-config#191, which merged before the reference was regenerated.

Scope understood

  • With DoGeometric: true, TrkCrvMatchTool::beginRun now requires SigmaV, SigmaU and SigmaT to have either one entry or one entry per sector type of the loaded CRV geometry. Otherwise it throws CONFIG with the list and the geometry's sector types.
  • Time-only instances are not checked. The comments in TrkCrvMatchTool.hh and prolog_v12.fcl state the rule.

Checked

  • 🟢 The lists enter only the geometric χ². resolution() is called only inside if(doGeometric_) (CRVReco/src/TrkCrvMatchTool.cc:227, :299-300), so skipping the check for time-only instances loses nothing.
  • 🟢 The check reads the same sector types the matcher uses. Both come from CosmicRayShield::getCRSScintillatorShields(), and the check runs in beginRun because the geometry is not available before then.
  • 🟢 The sector types in the description match the geometry files:
    • crv_counters_run1a_v01.txt has T1 and T2 both type 1. Run 1A, Run 1B v40 (geom_run1_b_v40.txt includes geom_run1_a_stickman.txt) and today's geom_common.txt all load it.
    • crv_counters_extracted_v01 to v03 have types 1-3. v04 adds the muon taggers as type 4. Today's geom_common_extracted.txt is v06, which includes v04.
    • crv_counters_v10.txt has types 1-7.
  • 🟢 Every geometric matcher scheduled today passes the check:
    • EventNtuple main 428345c:
      • TrkCrvMatchLineNtuple keeps the 4-entry default and runs in from_mcs-extracted.fcl and from_rec-combined.fcl. Both load geom_cosmic_extracted.txt, which has 4 sector types.
      • TrkCrvMatchCHmuNtuple sets SigmaV: [ 13 ].
      • The four LoopHelix matchers are time only.
    • Production#595 at cb49c71a:
      • TrkCrvMatchLine and TrkCrvMatchCHmu set SigmaV: [ 13 ] for Run 1.
      • reco/Extracted.fcl and recoMC/Extracted.fcl put the 4-entry list back on the extracted geometry.
      • The LoopHelix matchers are time only.
    • Production main does not schedule the matcher yet.
  • As the description says, the 4-entry default now stops a geometric matcher on crv_counters_extracted_v01 to v03, even though its first three entries would be right there. No current job uses those geometries with a geometric matcher; from_rec-crv-kpp-MC.fcl loads v02 but schedules no matcher. Requiring the exact count is what catches the Run 1 case, so this looks like the right trade.

Validation check

  • Build/tests run: no local build or jobs. I read the code at this head and the geometry include chains, and grepped Offline, Production (main and #595), EventNtuple and mu2e-trig-config for every TrkCrvMatcher use. FNALbuild build 3604 (15:50 UTC) is green apart from the trigger row explained above. Its clang-tidy error is in cetlib's LibraryManager.h. The one new warning on changed lines is cosmetic: a C-style array at TrkCrvMatchTool.cc:49.
  • Config contract check: pass.
  • Cross-repo consistency: pass. Production#595 and EventNtuple main already set lists that pass the check.

Residual risk

  • Not re-run by me: your mismatched-list jobs and the bit-identical comparison of TrkCrvMatchs.

@FNALbuild

Copy link
Copy Markdown
Collaborator

📝 The HEAD of main has changed to 7024300. Tests are now out of date.

@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 4914d1d: build (Build queue - API unavailable)

@FNALbuild

Copy link
Copy Markdown
Collaborator

☀️ The build tests passed at 4914d1d.

Test Result Details
test with ✅ Command did not list any other PRs to include
merge ✅ Merged 4914d1d at 7024300
build (prof) ✅ Log file. Build time: 04 min 36 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 2 files
clang-tidy ➡️ 1 errors 46 warnings
whitespace check ✅ no whitespace errors found

N.B. These results were obtained from a build of this Pull Request at 4914d1d 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.

@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 is a good added check.

Outside the scope of this PR; While track matching is clearly the prime use case for CRV spatial resolution, it is not tied to this algorithm and seems more natural to be described as an intrinsic property of CRV clusters. I suggest moving these resolutions to a more general class, perhaps CrvCoincidenceCluster itself.

@oksuzian
oksuzian merged commit e772902 into Mu2e:main Nov 20, 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