Skip to content

Add optional TS5 face intersection to KinKal upstream extrapolation - #2152

Merged
oksuzian merged 7 commits into
Mu2e:mainfrom
michaelmackenzie:kkextrap-ts5-face
Nov 20, 2026
Merged

oksuzian merged 7 commits into
Mu2e:mainfrom
michaelmackenzie:kkextrap-ts5-face

Conversation

@michaelmackenzie

@michaelmackenzie michaelmackenzie commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds a record-only surface, TS5_Face, that records where the extrapolated helix reaches the TSDA inside the DS bore. The crossing is saved as a regular KalIntersection with the new SurfaceId TS5_Face. The surface is sampled through SampleSurfaces after the upstream extrapolation, which ends on the TSDA plane.

It is on by default for the drift fits (KKDe/KKDmu/KKUe/KKUmu, via LHDriftFit) and for Mu2eKinKal.RegrowLH. The latter also covers the Production RefRegrow and RefExtrapSelect configs. Mu2e/Production#606 removes the reco RegrowLH's SampleSurfaces override so it inherits the same list; the two PRs can merge in either order. Trigger configurations are unchanged.

This is not by itself a cosmic tag. For downstream fits (KKDe/KKDmu), the upstream sweep runs backwards in time, so the record comes from the backwards extrapolation. For a conversion electron, that extrapolation continues upstream past the stopping target. In a 300-event test, TS5_Face is on 22% of CE KKDe tracks and 46% of cosmic KKDe tracks. Inside the DS bore it repeats the TSDA crossing; the reviewer's sample has one TS5_Face record per TSDA crossing.

Changes

  • DataProducts: new SurfaceId TS5_Face = 97, next to TSDA. No existing enum values change. nSurfaceIds goes from 76 to 77.
  • GeometryService / BeamlineGeom / Mu2eG4:
    • The KinKal TSDA annulus and TS5_Face are built from GeomHandle<TSdA> instead of hard-coded numbers.
    • The TSDA plane is the absorber mid-plane. TS5_Face is a disk out to the DS inner radius on the absorber's downstream face.
    • TSdA gains rIn(). TSdAMaker fills it from tsda.rin, or from the TS5 inner cryostat radius if that is not set. constructTSdA now uses it.
    • Geometries without a TSdA (e.g. geom_run1_b_v01) keep the previous nominal plane. The extracted geometry does have a TSdA, so its plane now follows it (see below).
  • Mu2eKinKal:
    • TS5_Face is added to SampleSurfaces for LHDriftFit and RegrowLH.
    • KKFit::sampleFit now starts each surface's search at the beginning of the time range, as CentralHelixFit and KinematicLineFit already do. Before, the search start time carried over from one surface to the next. So a surface crossed earlier than the previous surface's last crossing was never sampled, which affected TS5_Face and ST_Front/ST_Back on downstream fits.

Behaviour changes

  • New TS5_Face intersections on drift-fit KalSeeds. The validation NInter histogram and EventNtuple trksegs gain entries.
  • More ST_Front/ST_Back samples on LoopHelix drift fits, regrow fits and KKTruthSeed. On 300 CE events, KKDe goes from 0 to 32 ST_Front samples and from 22 to 38 ST_Back samples. Trigger fits sample no surfaces (or only TT_Mid), so they don't change.
  • TSDA surface for Run 1A/Run 2 (TSdA_v02): the plane moves from z = −5967 to −5966.4 mm. Radii are unchanged.
  • TSDA surface for Run 1B (geom_run1_b_v40, geom_run1_b_ds_on_v40): it now follows the 17.5 mm Al plate. The plane moves 9 mm upstream, from z = −5967 to −5976.0 mm, and TS5_Face is at −5967.25 mm. The radii become 135–600 mm, where the previous surface used 235–525 mm, so inBounds() changes for crossings at 135–235 mm and 525–600 mm.
  • TSDA surface for the extracted geometry (geom_common_extracted): it includes TSdA_v02, so the plane moves from z = −5967.0 to −18730.4 mm in detector coordinates, at the absorber. TS5_Face is at −18705.0 mm. No Production job is affected today: reco/Extracted.fcl runs only the field-off KKLine fit, without the upstream extrapolation. A LoopHelix fit on the extracted geometry would see the new plane.
  • avggap is computed over the whole trajectory, including the extrapolation, so it changes slightly when the TSDA plane moves. In the reviewer's 2000-event samples it changed on 2–3% of drift fits, with a median change of 0.16%. Fit status, chi-squared, hits and momentum are unchanged.
  • A track that turns around (pz ≈ 0) between the old and new TSDA plane now stops at the TSDA instead of turning back. The reviewer found 2 such fits in 4000 events.
  • The four drift fits use 1–5% more CPU, and output grows by about 0.1–0.2% per event.
  • regrowKL (KinematicLine) does not record TS5_Face.

Validation

  • Built Offline (envset p110) with no warnings.
  • Ran Production recoMC/OnSpill.fcl (Sim_best v1_5) on 300 CeMLeadingLogOnSpill and 300 CosmicSignalOnSpill MDC2025au events.
    • Every drift-fit track with a TSDA crossing also has TS5_Face, for both fit directions.
    • All TS5_Face records are in bounds, at z = −5941.0 mm.
    • Counts are in the review thread.
  • Not run: a Run 1B geometry job.

🤖 Generated with Claude Code

michaelmackenzie and others added 2 commits November 13, 2026 10:33
Add a TS5_Face SurfaceId and a KinKalGeom disk filling the TSDA hole, 1 mm
downstream of the TSDA back face. With ExtrapolationSettings.ToTS5 (default
false, requires Upstream) the upstream sweep records crossings of it before
the TSDA ends the sweep. Tracks reaching the TS this way are highly
cosmic-like.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mirror the KKExtrap ToTS5 targets (record-only TS5 disk 1 mm downstream of
the terminal TSDA plane) and check, for a line and a LoopHelix in both time
directions, that a track through the TSDA hole records TS5_Face just before
the TSDA, while one hitting the TSDA body or passing outside it records only
the TSDA.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@FNALbuild

Copy link
Copy Markdown
Collaborator

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

  • GeometryService
  • Mu2eKinKal
  • DataProducts
  • KinKalGeom

which require these tests: build.

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

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

About FNALbuild. Code review on Mu2e/Offline.

@FNALbuild

Copy link
Copy Markdown
Collaborator

☀️ The build tests passed at 69765ec.

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

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

Make the TS5_Face disk cover the whole TS5 face out to the DS inner radius
instead of only the TSDA hole, so tracks reaching the TS end of the DS are
recorded whether they then pass the TSDA hole, body or outside it. Update the
ExtrapolateSweepTest case to match, with a track beyond the DS inner radius
recording only the TSDA.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@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 — #2152

Reviewed at head 7cf7d7792a467c3fe80489b1588a34204935e5f6. First pass.

Decision

  • 🟡 comment only. With the flag off (the default) the output is byte-identical to main, so nothing changes at merge. But the record does not do what the comments say: for the fits an analysis keeps, about one CE track in five has it (finding 1).

Scope understood

  • The PR adds SurfaceId TS5_Face = 97 and a KinKal disk 1 mm downstream of the KinKal TSDA plane. The disk reaches out to the DS inner radius (950 mm).
  • A new flag, ExtrapolationSettings.ToTS5, turns on a record-only target for this disk in the upstream sweep. The flag is off by default and needs Upstream. A crossing is saved as a normal KalIntersection.
  • The stated purpose is to tag cosmic-like tracks that reach the TS end of the DS.
  • I also built and ran the previous head, 69765ec, where the disk only filled the TSDA hole. Everything below is about 7cf7d77.

Findings

  1. 🟠 [S1] For downstream fits, the record is not "highly cosmic-like": about one CE track in five has it

    • Evidence: I ran Production/JobConfig/recoMC/OnSpill.fcl (Sim_best v1_5) with ToTS5 : true for KKDe, KKUe, KKDmu and KKUmu. The input was 4000 events of dig.mu2e.CosmicSignalOnSpill.MDC2025au_best_v1_5 and 2000 events of dig.mu2e.CeMLeadingLogOnSpill.MDC2025au_best_v1_5. I took KKDe fits with 95 < p < 110 MeV/c at TT_Front, with no fit-quality cut. A TS5_Face crossing is on 322 of 1718 CE fits (18.7%) and on 148 of 309 cosmic fits (47.9%). For KKDe and KKDmu the upstream sweep runs backwards in time, so every one of their records has pz > 0. These records come from the backwards sweep, which for a CE electron continues upstream past the stopping target where it was made.
    • The code comments say the opposite. KKExtrap.hh:203 says "A crossing inside its bounds means the track reaches the TS end of the DS, which is highly cosmic-like". DetectorSolenoid.hh:75, KinKalGeomMaker.cc:377, KKFitSettings.hh:132 and prolog.fcl:392 say the same.
    • Impact: The flag's only stated use is a cosmic tag. A veto that trusts these comments would remove about 19% of CE in this sample. The PR's validation used only the cosmic sample.
    • Suggested fix: Describe the record as what it is: the extrapolated helix reaches the TSDA plane inside the DS bore. Say that for downstream fits the crossing comes from the backwards extrapolation, which for CE runs past the target. Show the separation on a CE sample for the fit direction an analysis keeps. If only upstream-moving tracks are wanted, add the target only in the forwards-in-time sweep.
  2. 🟡 [S2] TS5_Face repeats the TSDA intersection one for one

    • Evidence: The TSDA sweep target (KKExtrap.hh:210-217, inbounds_ = false) already records every crossing of the TSDA plane at any radius. With ToTS5 : false my sample has 8889 TSDA crossings, at radii up to 879 mm.
    • With the option on, every TSDA crossing gets a TS5_Face crossing 1 mm before it: 7561 of 7561 in the cosmic sample and 1328 of 1328 in the CE sample. There are only 2 extra TS5_Face records. Both come from tracks that turn around between the two planes (|pz| ≈ 1 MeV/c). The PR body reports the same result: 366 crossings for 366.
    • EventNtuple main already saves the TSDA crossing, both as TrkInfo::tsdainter (InfoStructHelper.cc:101-108) and as a trksegs entry with sid 96. Its radius and inBounds() flag already separate the hole from the body. Of the 1986 crossings at r < 235 mm, 1985 are out of bounds; the other one is within 0.1 mm of the edge. All 6428 crossings at 235–525 mm are in bounds.
    • Cost: The PR adds an enum value, which becomes permanent once files carry it. It also adds a geometry surface, a configuration flag and a unit test. With the option on, 82–89% of TSDA crossings move, by up to 10.8 µm. That shift is harmless: inBounds() does not change, and the momentum changes by at most 0.006 MeV/c.
    • Suggested fix: Use the TSDA intersection (or tsdainter) for the tag and drop the new surface. Otherwise, say what TS5_Face records that the TSDA intersection does not. This is a simplification point and does not gate.
  3. ⚪ [S3] The face is inside the TSDA, not downstream of it. In the default geometry (TSdA_v02.txt: z0 = 4204.6 mm, half-length 25.4 mm, detector origin at 10171 mm), the TSDA spans z = −5991.8 to −5941.0 mm. So the KinKal TSDA plane at −5967 mm is its mid-plane. The // back surface comment at KinKalGeomMaker.cc:375 was already wrong before this PR. The face at −5966 mm is 25 mm inside the absorber. If the surface stays, fix "just downstream of the TSDA" in the new comments and reconsider the name.

Validation check

  • Build/tests run: yes.
    • FNALbuild passed at 69765ec, merged on 7024300 (16:56 UTC). At 7cf7d77, mu2e/buildtest reads "This test has not been triggered yet" (17:31 UTC), so I am requesting a build.
    • I built DataProducts, KinKalGeom, GeometryService and Mu2eKinKal at the base and at 7cf7d77, on CI backing main/70243009_b2ef90eb_afc847f9. The build gave no warnings.
    • ExtrapolateSweepTest passes. I made two changes to the new ts5Face case: moving the face upstream of the TSDA, and dropping the in-bounds requirement. The test fails for both, as it should.
  • 🟢 With the flag off (the default), nothing changes. Base and 7cf7d77 give byte-identical products for all 6000 events: 36000 of 36000 KalSeed (KKDe/KKDmu/KKUe/KKUmu), KalSeedMC and Assns collections.
  • 🟢 With the flag on, only the new records and the TSDA crossings change.
    • All 21425 KalSeeds are identical once their intersections are removed, and all other intersections are identical.
    • Every TS5_Face record is in bounds and lies within 0.1 mm of z = −5966 mm. Where the track also crosses the TSDA, the face comes first in sweep order.
    • The identical seeds show that the target adds no material. With drives_ = false, it does not drive the extension.
    • CPU time is the same within noise.
  • 🟢 SurfaceId: the enum, the name table and nSurfaceIds = 77 agree, and the static_assert at SurfaceId.cc:100 enforces this. Existing values are unchanged (TSDA is still 96), so files already written read the same. Only ValKalSeed.cc:71 and ValTrkCrvSectorAxis.hh:17 loop over the names, and both keep CRV ids only. EventNtuple writes sid as an int and needs no change.
  • 🟢 Config contract check: pass.
    • The fhicl-dump of recoMC/OnSpill.fcl differs from base only by ToTS5: false in KKDe, KKDmu, KKUe, KKUmu and RegrowLH.
    • digitize/OnSpill.fcl, which includes the trigger menu, dumps identically. mu2e-trig-config sets no ExtrapolationSettings.
    • ToTS5 : true with Upstream : false stops the job when the module is built, with the message "mu2e::KKExtrap: ToTS5 requires Upstream extrapolation". A misspelt key fails fhicl validation.
  • Cross-repo consistency: pass. No companion change is needed.

Residual risk

  • The CE and cosmic numbers come from one file of each sample, with no fit-quality or best-direction selection.
  • Not checked: a Run 1B geometry job.
  • A note for anyone testing this on a partial muse build: the backing libmu2e_DbTables.so loads the backing libmu2e_DataProducts.so, so with ToTS5 : true the job stops with "SurfaceIdEnum invalid enum name : TS5_Face". Building DbTables in the work area, or preloading the work-area libraries, avoids it.

Author follow-ups

  1. Correct the comments and the PR description about what a TS5_Face crossing means for downstream fits, and show its separation on a CE sample (finding 1).
  2. Say what TS5_Face adds over the TSDA intersection and tsdainter, or use those instead (finding 2).

@oksuzian

Copy link
Copy Markdown
Collaborator

@FNALbuild run build test

@FNALbuild

Copy link
Copy Markdown
Collaborator

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

@FNALbuild

Copy link
Copy Markdown
Collaborator

☀️ The build tests passed at 7cf7d77.

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

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

Describe the TS5_Face record as what it is: the extrapolated helix reaching
the TSDA plane inside the DS bore. For downstream fits it comes from the
backwards extrapolation, which for CE continues past the stopping target, so
it is not by itself a cosmic tag. The KinKal TSDA plane is the absorber
mid-plane, not its back surface, so the disk sits inside the absorber; fix
that comment and stop calling the disk "downstream of the TSDA".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@michaelmackenzie

Copy link
Copy Markdown
Contributor Author

For finding 2: this extrapolation should cover the cosmic events that extrapolate to the hole in the TSDA, which may be rare in general but is relevant to the most signal-like cosmic background events. So I don't think this surface is redundant with the TSDA surface in that regard.

Turn on the TS5_Face record in the LoopHelix drift extrapolation settings, so
the default LoopHelix fits and the Production regrows that use LHDRIFTXTRAP
record it. The fhicl default stays false, so LHSEEDXTRAP, KLXTRAP and CHXTRAP
(Upstream false) are unaffected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@michaelmackenzie

Copy link
Copy Markdown
Contributor Author

I turned this on by default as it's need for all field-on loop helices in analysis.

@oksuzian

Copy link
Copy Markdown
Collaborator

@FNALbuild run build test

@FNALbuild

Copy link
Copy Markdown
Collaborator

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

@FNALbuild

Copy link
Copy Markdown
Collaborator

☀️ The build tests passed at 6c0ab8a.

Test Result Details
test with ✅ Command did not list any other PRs to include
merge ✅ Merged 6c0ab8a at 70c66d1
build (prof) ✅ Log file. Build time: 09 min 26 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 (1) FIXME (3) in 7 files
clang-tidy ➡️ 1 errors 361 warnings
whitespace check ✅ no whitespace errors found

N.B. These results were obtained from a build of this Pull Request at 6c0ab8a after being merged into the base branch at 70c66d1.

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.

KKFit::sampleFit carried the search start time from one sample surface to
the next, so a surface crossed earlier than the previous surface's last
crossing was never sampled (e.g. TS5_Face and ST_Front on downstream fits).
Start each surface from the beginning of the range, as CentralHelixFit and
KinematicLineFit already do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@michaelmackenzie

Copy link
Copy Markdown
Contributor Author

Thanks Dave, both are done.

SampleSurfaces instead of a new KKExtrap target. The ToTS5 flag and the new KKExtrap code are removed, together with the DetectorSolenoid accessor and the ExtrapolateSweepTest case. TS5_Face is now in SampleSurfaces for LHDriftFit (KKDe/KKDmu/KKUe/KKUmu) and for Mu2eKinKal.RegrowLH. sampleFit runs after extrapolate, over the extended trajectory, so it picks up the face. The extra sweep target no longer moves the TSDA crossings by ~10 µm.

Adding the surface turned up a bug in KKFit::sampleFit. The search start time tbeg was carried from one sample surface to the next. So any surface crossed earlier than the previous surface's last crossing was never sampled. For downstream fits, the ST_* crossings come after the face in time, so they hid it: TS5_Face was on 1 of the 60 CE KKDe tracks with a TSDA crossing. The same bug was already dropping ST_Front/ST_Back samples. The second commit starts each surface's search at the start of the range, as CentralHelixFit and KinematicLineFit already do. Trigger fits sample no surfaces, and LHSeedFit samples only TT_Mid, so they don't change.

Geometry from GeometryService. KinKalGeomMaker::makeDS now builds both the TSDA annulus and TS5_Face from GeomHandle<TSdA>.

  • TSdA gains rIn(). TSdAMaker fills it from tsda.rin, or from the TS5 inner cryostat radius if that is not set, and constructTSdA now uses it.
  • The TSDA plane stays at the absorber mid-plane.
  • TS5_Face is a disk out to the DS inner radius on the absorber's downstream face. This replaces the hard-coded 1 mm offset.
  • Geometries with no TSdA (hasTSdA = false, extracted) keep the old nominal plane, because the upstream extrapolation still ends on it.

This changes the existing TSDA surface slightly:

  • Run 1A/Run 2 (TSdA_v02): the plane moves from z = −5967 to −5966.4 mm, the true mid-plane. The face is at −5941.0 mm. Radii are unchanged.
  • Run 1B (geom_run1_b_v40): the TSDA is a 17.5 mm Al plate at z0 = 4195 mm with r = 135–600 mm. The KinKal surface used −5967 mm and 235–525 mm before. It now follows the plate, so inBounds() changes for crossings at 135–235 mm and 525–600 mm. I did not run a Run 1B job.

Test. I ran Production recoMC/OnSpill.fcl (Sim_best v1_5) on 300 CeMLeadingLog and 300 CosmicSignal MDC2025au events, with and without the sampleFit fix.

sample, fit tracks with TSDA with TS5_Face TSDA without TS5_Face
CE KKDe 278 60 60 (1 before fix) 0 (59)
CE KKUe 273 55 57 0
cosmic KKDe 281 130 130 (116) 0 (14)
cosmic KKUe 302 143 144 0

All TS5_Face records are in bounds and sit at z = −5941.0 mm. A few tracks have a TS5_Face record but no TSDA crossing; they turn around between the face and the mid-plane. On CE KKDe, the sampleFit fix raises ST_Front samples from 0 to 32 and ST_Back from 22 to 38. ST_Outer is unchanged.

Companion Production PR, Mu2e/Production#606: reco/prolog.fcl RegrowLH overrides SampleSurfaces, so it gets TS5_Face added. It must merge after this PR, because an Offline without TS5_Face rejects the name. regrowKL (KinematicLine) no longer records TS5_Face.

@michaelmackenzie

Copy link
Copy Markdown
Contributor Author

@FNALbuild run build test

@FNALbuild

Copy link
Copy Markdown
Collaborator

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

@FNALbuild

Copy link
Copy Markdown
Collaborator

☀️ The build tests passed at 6259129.

Test Result Details
test with ✅ Command did not list any other PRs to include
merge ✅ Merged 6259129 at 554ef9f
build (prof) ✅ Log file. Build time: 09 min 23 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 (15) FIXME (4) in 10 files
clang-tidy ➡️ 3 errors 116 warnings
whitespace check ✅ no whitespace errors found

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

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.

@michaelmackenzie

Copy link
Copy Markdown
Contributor Author

@FNALbuild run build test with Mu2e/Production#606

@FNALbuild

Copy link
Copy Markdown
Collaborator

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

@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.

Thanks for following my suggestion and for upgrading the TSDA construction!

@FNALbuild

Copy link
Copy Markdown
Collaborator

☀️ The build tests passed at 6259129.

Test Result Details
test with ✅ Included Mu2e/Production#606 @ ab896bddc5c79fdcadf9784b482cb5168600efca by merge
merge ✅ Merged 6259129 at 554ef9f
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.
check_cmake ✅ Log file.
FIXME, TODO ➡️ TODO (15) FIXME (4) in 10 files
clang-tidy ➡️ 3 errors 116 warnings
whitespace check ✅ no whitespace errors found

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

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

Reviewed at head 62591297a48828d9290b32d2fc1e5b6ba04460d6. Re-review of 6c0ab8a.

Decision

  • 🟢 approve. The rework follows both of Dave's points, and the new design is simpler than the one I approved. The Geant4 geometry is unchanged. Fit results (status, chi-squared, hits, momentum and t0) are unchanged. The only reco changes are the new and moved intersection records and a small change in avggap, all explained below. I have one minor finding about the extracted geometry and one set of optional cleanups. Neither blocks.

Scope understood

  • The ToTS5 extrapolation option is gone. TS5_Face is now a sample surface, added to SampleSurfaces for LHDriftFit (Mu2eKinKal/fcl/prolog.fcl:508) and RegrowLH (:671).
  • The KinKal TSDA annulus and the TS5_Face disk are now built from GeomHandle<TSdA> (GeometryService/src/KinKalGeomMaker.cc:376-406). TSdA gains rIn(), and constructTSdA now reads it instead of working out the radius itself.
  • KKFit::sampleFit now restarts the search at the start of the time range for each surface (Mu2eKinKal/inc/KKFit.hh:1047).
  • The net diff (gh pr diff) touches 11 files. It no longer touches KKExtrap.hh, KKFitSettings.hh, the KinKalGeom DetectorSolenoid.hh or ExtrapolateSweepTest.

Prior findings (from my review at 6c0ab8a)

  1. 🟢 [was S1] The "highly cosmic-like" wording. FIXED, and still fixed at this head. The new comments at prolog.fcl:506-507 and KinKalGeomMaker.cc:391-394, and the PR body, all say the record is not by itself a cosmic tag.
  2. 🟢 [was S2] TS5_Face repeats the TSDA crossing. CLOSED. You took the second option I offered: the PR body now says that inside the DS bore it repeats the TSDA crossing. The data at this head agree. In every drift fit, 0 tracks have a TSDA record without a TS5_Face record.
  3. 🟢 [was S3] The KinKal TSDA plane is the mid-plane. FIXED, and now exactly true. For TSdA_v02 the plane is at the absorber center, z = −5966.4 mm.
  • OBSOLETE: the TSDA shift of up to 11 µm that I reported at 6c0ab8a came from the old sweep target, which no longer exists. It is replaced by the 0.6 mm geometry move described below.

Findings

  1. 🟡 [S2] The extracted geometry has a TSdA, so its KinKal TSDA plane moves.
    • Evidence: your 16:04 UTC comment says geometries with no TSdA, "extracted", keep the old nominal plane. But geom_common_extracted.txt includes geom_common (through geom_common_extracted_v06.txt and _v04.txt), which uses TSdA_v02, so hasElement<TSdA>() is true. I printed the KinKal surfaces for that geometry. The TSDA plane moves from z = −5967.0 to −18730.4 mm in detector coordinates, and TS5_Face is at −18705.0 mm. The code comment at KinKalGeomMaker.cc:377 is accurate.
    • Impact: none for Production today. reco/Extracted.fcl runs only the field-off KKLine fit, with the upstream extrapolation off. The old value was not at the absorber either, so following the geometry is arguably more correct.
    • Suggested fix: correct the statement in the thread or the PR body, so that whoever next runs a LoopHelix fit on the extracted geometry knows the plane moved.
  2. ⚪ [S3] Optional cleanups on lines this PR touches.
    • Mu2eG4/src/constructTSdA.cc:22-23 still includes Beamline.hh and StraightSection.hh. Nothing in the file uses them now.
    • KinKalGeomMaker.cc:384 repeats the version-1 placement from constructTSdA (ATSD4Offset). The two agree today. No version-1 geometry loads at base or at head (geom_2019_PhaseI fails on a missing calorimeter_CsI.txt), so this branch cannot be tested. A TSdA accessor for the placed z would keep the two in one place.
    • The fallback numbers at KinKalGeomMaker.cc:378 could be named constants. clang-tidy flags them.

Validation check

  • Build: I rebuilt the six affected packages at base (main 554ef9f) and at head (this PR merged onto 554ef9f), on the CI backing main/554ef9f9_7672e815_57e663ce. Both builds had no warnings.
  • 🟢 Geant4 geometry. I wrote GDML at base and at head for geom_common (Run 1A, the default), geom_run1_a, geom_run2, geom_run1_b_v40 and geom_run1_b_v01. After removing pointer suffixes, 0 lines differ in all five. constructTSdA prints the same inner radius and center at both (235 mm and z = 4204.6 mm for v02; 135 mm and 4195 mm for v40).
  • 🟢 KinKal surfaces, printed from the KinKal geometry at base and head:
    • Default, Run 1A and Run 2: TSDA moves from z = −5967.0 to −5966.4 mm, r = 235-525 mm. TS5_Face is at −5941.0 mm, r ≤ 950 mm. This matches the PR body.
    • Run 1B (geom_run1_b_v40 and ds_on_v40): TSDA is at −5976.0 mm with r = 135-600 mm, and TS5_Face at −5967.25 mm. The radii match the PR body. The plane also moves 9 mm upstream, which the body does not say.
    • geom_run1_b_v01 (no TSdA): the fallback plane at −5967.0 mm, with TS5_Face at −5941.6 mm.
  • 🟢 The sampleFit fix is correct. It now matches CentralHelixFit_module.cc:429-434 and KinematicLineFit_module.cc:378-386, which already restart for each surface. Each search stays inside the fit range. In about 27,000 reco fits and 938 regrow fits there are 0 duplicate records (same surface within 1e-6 ns). Every record that base wrote for a sampled surface is still there at head, bit-identical, except in the two turn-around fits described below. ST_Outer comes first in the list, so the fix cannot change it.
  • 🟢 Reco, base against head. I ran Production recoMC/OnSpill.fcl as committed (Sim_best v1_5) on 2000 CE and 2000 cosmic events.
    • Every product other than the four drift-fit KalSeed collections is identical (414,000 CE and 420,000 cosmic product instances).
    • Fit status, chi-squared, ndof, fit consistency, maxgap, hits, straws, segments and domain bounds are identical for every drift fit. Only _avggap changes, on 145 of 7366 CE fits and 233 of 6981 cosmic fits, by a median of 0.16% and at most 55%. It is computed over the whole trajectory, including the extrapolation (KKFit.hh:788-791), so it moves when the TSDA plane moves. EventNtuple stores it as trk.avggap. A code search of the Mu2e organization finds no selection that uses it.
    • Added records: CE TS5_Face +1362, ST_Front +726, ST_Back +540. Cosmic TS5_Face +3750, ST_Front +56, ST_Back +46. All TS5_Face records are in bounds at z = −5941.0 mm.
    • Every TSDA record moves by 0.50-0.70 mm in z, with no change in momentum magnitude (below 1e-12 MeV/c). The inBounds() flag changes for 5 CE and 10 cosmic crossings, all within 4 mm of the 235 mm or 525 mm edges.
    • Two fits (CE 1430:1270:3700 KKDe, cosmic 1430:4988:458374 KKUmu) turn around (pz near 0) between the old and new plane. At head their extrapolation stops at the TSDA instead of turning back. They lose 3 and 2 ST_Foils records and 2 ST_Outer records, and gain TSDA and TS5_Face.
    • Your 300-event table: for CE I get exactly your numbers (KKDe 278 tracks, 60 with TSDA, 60 with TS5_Face, ST_Front 0 to 32, ST_Back 22 to 38; KKUe 273/55/57). For cosmics I get KKDe 284/132/132 and KKUe 308/146/147, against your 281/130/130 and 302/143/144. My build is on a newer main.
    • CPU of the four drift fits rises by 1-5% in all 8 chunks, about 0.4-0.8 ms per fit per event. Output size rises by 350 bytes per CE event (+0.13%) and 533 bytes per cosmic event (+0.21%).
  • 🟢 Regrow. I ran Production reco/regrowLH.fcl (Offline Mu2eKinKal.RegrowLH) on 500 CE and 500 cosmic reco events. Only the RegrowLH collection changes. Every regrow fit with a TSDA record also gets TS5_Face (92 CE, 230 cosmic). The sampleFit fix also adds 1054 ST_Inner records on CE.
  • 🟢 EventNtuple. I ran EventNtuple main (7b4fe514) on the base and head reco output, 16 jobs, all with exit code 0. trksegs gains 1362 CE and 3750 cosmic entries with sid 97, all in bounds. Every base trksegs entry other than the moved TSDA entries is still there, bit-identical and in the same order, except in the two turn-around tracks above. Of the 3.0 million other ntuple values I compared, only trk.avggap changes, plus tsdainter, nstup/nstdown and trkmcvd.iinter on those two tracks. Their iinter values still point at the same surfaces. Nothing in EventNtuple refers to ToTS5.
  • 🟢 Config contract. I ran fhicl-dump on 1133 files from Offline, Production, EventNtuple and mu2e-trig-config, including the generated trigger menus, at base and head. 969 dump in both and 164 fail in both. 102 differ, and only in SampleSurfaces. The changed modules are KKDe, KKDmu, KKUe, KKUmu, RegrowKKe, RegrowKKmu and RegrowLH. No Offline, digitize or trigger config changes.
  • 🟢 Leftovers. A GitHub code search of the Mu2e organization finds ToTS5 only in a prodtools wiki page, as part of the dataset names TS1ToTS5s100 and TS1ToTS5s30. TSdAMaker::make has one caller (GeometryService.cc:304), and the beamline is built before it (:222).
  • 🟢 Dave's two points are addressed. The net diff no longer touches KKExtrap. The surfaces come from GeomHandle<TSdA> in KinKalGeomMaker.cc. He approved at this head at 17:18 UTC.
  • FNALbuild at 6259129:
    • Build 3637 (16:43 UTC): every test passed except trigger, which failed with return code 2. apr_TC_calo passed 2078 events against a reference of 1947. Its TrigReport is identical to build 3635's, and builds 3634 and 3635 show the same counts, so the change comes from main. mu2e-trig-config#196 updated that reference at 16:56 UTC.
    • Build 3638 (17:36 UTC), with Production#606: every test passed, including trigger ("No problems detected"). Its TrigReport is identical to build 3637's.
    • clang-tidy reports 3 errors, all in the external cetlib/LibraryManager.h. The warnings on lines this PR touches are style only.
  • Cross-repo: Production#606 is needed for the reco RegrowLH to sample TS5_Face. That module is not on any path today, so the two PRs can merge in either order. Details are in my #606 review.

Residual risk

  • I did not run reco with the Run 1B geometry. There the TSDA plane moves 9 mm upstream and widens to r = 135-600 mm, so inBounds() will change for crossings at 135-235 mm and 525-600 mm.
  • Each sample is one input file, with no fit-quality selection.
  • I did not run KKTruthSeed, which the PR body says also gains ST_Front and ST_Back samples.
  • EventNtuple ran without the three MVA modules from ArtAnalysis, which the CI backing does not provide. So I did not check the MVA outputs. The intersection branches do not depend on them.

Author follow-ups

  1. Correct the statement that the extracted geometry keeps the old plane (finding 1).
  2. Optional: the cleanups in finding 2.

michaelmackenzie added a commit to michaelmackenzie/Production that referenced this pull request Nov 17, 2026
Per review: drop the override instead of editing it. The inherited KKDe list
is the same, so RegrowLH follows the Offline default (TS5_Face with
Mu2e/Offline#2152) and the merge order no longer matters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@michaelmackenzie

Copy link
Copy Markdown
Contributor Author

Thanks Yuri.

Finding 1 (extracted geometry): you're right, my comment above was wrong. geom_common_extracted includes TSdA_v02, so hasElement<TSdA>() is true there. Its TSDA plane moves from −5967.0 to −18730.4 mm and TS5_Face is at −18705.0 mm. Only geometries with no TSdA at all, such as geom_run1_b_v01, keep the old plane. I've corrected the PR body and noted that no Production job is affected today.

I also added your other results to the PR body's behaviour changes:

  • the 9 mm upstream move of the Run 1B plane (−5976.0 mm, with TS5_Face at −5967.25 mm);
  • the small avggap change;
  • the two turn-around fits;
  • the 1–5% CPU increase.

Production#606: done as you suggested. The override is removed and RegrowLH inherits the list, so merge order doesn't matter, and the PR body says so now.

I'm leaving the optional cleanups in finding 2 for a follow-up PR: the unused includes in constructTSdA, a single place for the version-1 TSdA z, and named fallback constants.

@FNALbuild

Copy link
Copy Markdown
Collaborator

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

oksuzian pushed a commit to Mu2e/Production that referenced this pull request Nov 17, 2026
RegrowLH overrides SampleSurfaces, so add TS5_Face to match the Offline
LHDriftFit default (Mu2e/Offline#2152). Requires that Offline PR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oksuzian
oksuzian merged commit 2c1f082 into Mu2e:main Nov 20, 2026
13 of 14 checks passed
@michaelmackenzie
michaelmackenzie deleted the kkextrap-ts5-face branch November 21, 2026 02:29
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