Added IPAEndRingStops to track stopped muons in the MuBeamResampler.fcl - #562
Conversation
…muons at IPA EndRings
|
Hi @Etho-b02,
which require these tests: build. @Mu2e/write, @Mu2e/fnalbuild-users have access to CI actions on main. 📝 The author of this pull request is not a member of the Mu2e github organisation. |
AndrewEdmonds11
left a comment
There was a problem hiding this comment.
Looks good to me. I'll leave it up to the Production team to decide whether the extra IPAEndRingStops output wants to be on by default
| writeEventIDs : true | ||
| MaxEventsToSkip: @nil | ||
| //MaxEventsToSkip: @nil | ||
| MaxEventsToSkip: 0 |
There was a problem hiding this comment.
I would change this back to @nil since we just hard-coded it to 0 for our tests
oksuzian
left a comment
There was a problem hiding this comment.
PR Review Summary — #562 "Add IPAEndRingStops to track stopped muons in MuBeamResample.fcl"
Reviewed at head f57078ab
Decision
- 🔴 request changes
Scope understood
JobConfig/pileup/prolog.fcl: addsIPAEndRingMuonFinder(StoppedParticlesFinder,stoppingMaterial: "IPAPolystyrene"),IPAEndRingStopFilter(FilterG4Out) andcompressPVIPAEndRingStops, mirroring the existing IPA chain.JobConfig/pileup/MuBeamResampler.fcl: addsIPAEndRingStopPathtotrigger_paths,IPAEndRingStopOutput(a 6thRootOutput) tooutPath.- Also in
JobConfig/pileup/prolog.fcland not described by the PR title/body:beamResamplerandneutralsResamplerhaveMaxEventsToSkip: @nilreplaced byMaxEventsToSkip: 0, with the@nillines left commented out.
Carry-forward from the existing review
- @AndrewEdmonds11 (APPROVED, 2026-08-03) left an inline request on
JobConfig/pileup/prolog.fcl:262: "I would change this back to@nilsince we just hard-coded it to 0 for our tests." → UNADDRESSED atf57078ab(the PR still has a single commit, authored before the comment). Carried forward as finding 1, and it applies to both occurrences, not just line 262. - @AndrewEdmonds11's approval note — "I'll leave it up to the Production team to decide whether the extra IPAEndRingStops output wants to be on by default" — is still an open question. Carried forward as finding 3, with evidence on why the default matters.
Findings
-
🔴 [S0] Leftover test hack:
MaxEventsToSkip: @nil→0in the shared pileup prolog (carried over, unaddressed)- Evidence:
JobConfig/pileup/prolog.fcl:235-236(beamResampler) and:261-262(neutralsResampler) atf57078ab://MaxEventsToSkip: @nil MaxEventsToSkip: 0Pileup.filters.beamResampler/.neutralsResamplerare consumed byMuBeamResampler.fcl,EleBeamResampler.fcl,PiBeamResampler.fclandNeutralsResampler.fcl, so this is not scoped to the IPA end-ring work at all. - Impact:
@nilis the Mu2e "you must supply this" sentinel — notefileNames: @niltwo lines above is deliberately left as@nilin the same block.Offline/EventMixing/src/ResamplingMixer_module.ccdeclaresfhicl::Atom<unsigned> maxEventsToSkip{..., 0u}andeventsToSkip()drawsstd::uniform_int_distribution<size_t> uniform(0, maxEventsToSkip_)once, to pick the starting offset into the first secondary file. Replacing the sentinel with a legal value0converts a hard, loud failure ("you forgot the offset") into a silent one: every job that does not carry an explicit override starts at event 0 of its resampling file, i.e. all jobs resample the same events. No released dataset is affected today — the prodtools job-definition path appendsphysics.filters.<resampler>.mu2e.MaxEventsToSkip: <N>after the entry'sfcl_overrides, andValidation/nightly/pileup_09.fclsets it explicitly (8934) — which is precisely why the nightly would not catch a regression here either. The value of the@nilis the guard, and this removes it. - Suggested fix: restore
MaxEventsToSkip: @nilin both blocks and delete the commented-out lines rather than leaving them in (no commented-out code). If a hard-coded 0 is wanted for local testing, put it in the test's own top-level fcl (asScripts/ListPileupProducts.shandValidation/nightly/pileup_0*.fclalready do), not in the shared prolog.
- Evidence:
-
🟠 [S1]
stoppingMaterial: "IPAPolystyrene"matches nothing in any released geometry, and nothing in the geometries production pins — the new stream will select zero events- Evidence:
StoppedParticlesFinder::materialAccepted()(Offline/CommonMC/src/StoppedParticlesFinder_module.cc) is an exact string comparematerial == stoppingMaterial_; a non-matching name is silently zero-acceptance, no exception. Tracing the name:IPAPolystyreneis defined inOffline/Mu2eG4/src/ConstructMaterials.cc:1337and consumed by exactly one geometry file,Offline/Mu2eG4/geom/protonAbsorber_cylindrical_v05.txt(protonabsorber.ipa.endRingMaterial = "IPAPolystyrene"). Both are on Offline main only.protonAbsorber_cylindrical_v05.txtis included only bygeom_run1.txtandgeom_run1_a_stickman.txt(and thereforegeom_common.txt) — on main.- Every currently released SimJob backing release lacks it entirely:
protonAbsorber_cylindrical_v05.txtis absent from/cvmfs/mu2e.opensciencegrid.org/Musings/Offline/{v13_30_00,v13_31_00,v13_32_10,v13_33_00}(v13_33_00 backs the newest musing, SimJob/MDC2025au). In those releasesgeom_common.txt → geom_run1_a_stickman.txt → protonAbsorber_cylindrical_v04.txt, i.e.protonabsorber.ipa.endRingMaterial = "CorrugatedPolypropylene". - Even once main is released, the production
MuBeamResamplerentries overrideservices.GeometryService.inputFiletoOffline/Mu2eG4/geom/geom_run1_a.txt(MDC2025 / MDC2030 campaigns) orgeom_run1_b_v01.txt/geom_run1_b_v40.txt(Run1B), and all of those resolve toprotonAbsorber_cylindrical_v04.txtat line 66 —CorrugatedPolypropylene, notIPAPolystyrene.
- Impact:
IPAEndRingMuonFinderproduces an emptySimParticlePtrCollectionevery event,IPAEndRingStopFilterrejects,IPAEndRingStopPathnever passes, andIPAEndRingStopOutputwrites an events-freesim.*.IPAEndRingStops.*.artfor every job. The failure is completely silent — no exception, no non-zero exit — so it would only surface as an empty dataset after a full campaign. - Suggested fix: either (a) use the material actually configured for the end rings in the geometry this is meant to run against —
CorrugatedPolypropylenefor the_v04-basedgeom_run1_*family — or (b) state in the PR body which Offline version + geometry file this requires (protonAbsorber_cylindrical_v05.txt, i.e.geom_common.txt/geom_run1.txton main) and confirm the production entries will be repointed. Please also post theStoppedParticlesFinderend-of-job line (accepted = N) from a run against the intended geometry as validation evidence — a non-zeroacceptedis the one-line proof this finding is closed.
- Evidence:
-
🟡 [S2] The 6th output stream is unconditional in a shared production fcl (@AndrewEdmonds11's open question)
- Evidence:
MuBeamResampler.fcl:41-42putsIPAEndRingStopPathintrigger_pathsandIPAEndRingStopOutputinoutPathunconditionally;MuBeamResampler.fcl:74-81adds theRootOutput. This fcl is the production beam-flash workhorse (MDC2025, MDC2030, Run1B all drive it), and each job now writes one more art file. - Impact: every future
MuBeamFlashjob in every campaign gains a 6th output that the production tooling will register in SAM. With finding 2 unresolved, those are O(10^4) events-free files per campaign. There is also no downstream consumer yet — nothing cats or selectsIPAEndRingStopsthe wayIPAStopsCat/Scripts/ListPileupProducts.shhandleIPAStops— so the dataset is write-only until a follow-up lands. - Suggested fix: either confirm with the Production team that the stream should be on by default and add the matching downstream entry, or keep
IPAEndRingStopPath/IPAEndRingStopOutputout of the defaulttrigger_paths/outPathand let a campaign entry opt in viafcl_overrides.JobConfig/pileup/IPAStopSelector.fclis the precedent for a separately-driven IPA stream.
- Evidence:
-
⚪ [S3] Formatting of the new output block
- Evidence:
MuBeamResampler.fcl:74-81—module_type :/SelectEvents :/fileName :use a space before the colon and the last three lines are indented 5 spaces, where the four sibling output blocks in the same file usemodule_type:and consistent 4-space bodies. - Impact: none functionally; it just reads as a different hand in an otherwise uniform file.
- Suggested fix: match the surrounding
IPAStopOutputblock verbatim.
- Evidence:
Verified — no action needed
- 🟢 Producer/filter/compressor wiring is internally consistent and mirrors the IPA chain exactly:
IPAEndRingMuonFinder→IPAEndRingStopFilter.mainSPPtrInputs→compressPVIPAEndRingStops.particleInputs: ["IPAEndRingStopFilter"]→IPAEndRingStopOutput.SelectEvents: [IPAEndRingStopPath]. Every label referenced by the new path is defined in the new prolog blocks. - 🟢 No duplicated simulation cost from the new path:
IPAEndRingStopPathshares@sequence::Pileup.beamResamplerSequenceand@sequence::Common.g4Sequencewith the five existing paths, and art executes each module once per event regardless of how many paths name it. - 🟢
@sequence::Pileup.SimKeptProductsused by the new output exists (JobConfig/pileup/prolog.fcl:356) and is the same sequence the sibling stop outputs use. - 🟢 Build systems: checked both.
Mu2e/Productionhas noCMakeLists.txtanywhere in the tree and exactly oneSConscript(JobConfig/ensemble/SConscript, unrelated to fcl); pileup fcl is resolved at run time viaFHICL_FILE_PATH, so there is no build file to mirror for this change and noconfigure_file/install list to update. - 🟢 Whitespace-only deletions of the two blank lines at
prolog.fcl(beforecompressPVIPAStopsand beforeIPAStopFilter) are cosmetic and harmless.
Validation check
- Build/tests run: none by me; no validation evidence is given in the PR body either. FNALbuild lists
buildas the required test forJobConfigchanges. - Config contract check: partial. FHiCL structure and module/label wiring are coherent (finding "Verified" above); the
stoppingMaterialvalue does not resolve against any released geometry (finding 2);MaxEventsToSkipno longer enforces its supply contract (finding 1). - Cross-repo consistency: needs follow-up. The change depends on Offline
protonAbsorber_cylindrical_v05.txt/IPAPolystyrene, which exist on Offline main but in none of the SimJob backing releases up to v13_33_00, and which the production-pinnedgeom_run1_*geometries do not include.
Residual risk
- A silently-empty
IPAEndRingStopsdataset produced at campaign scale before anyone notices (finding 2 has no loud failure mode). - A future resampler entry that omits the
MaxEventsToSkipoverride silently resampling identical events across all its jobs (finding 1). - One extra art file per
MuBeamFlashjob across MDC2025 / MDC2030 / Run1B storage and SAM bookkeeping (finding 3).
Author follow-ups
- Revert
MaxEventsToSkipto@nilin bothbeamResamplerandneutralsResampler, and delete the commented-out//MaxEventsToSkip: @nillines (finding 1 — already requested inline by @AndrewEdmonds11 and still open). - Confirm the intended stopping material:
CorrugatedPolypropylene(whatprotonAbsorber_cylindrical_v04.txt, and hence every production geometry today, sets for the IPA end rings) vsIPAPolystyrene(only inprotonAbsorber_cylindrical_v05.txton Offline main). Fix the value or document the Offline/geometry requirement in the PR body (finding 2). - Post validation evidence: the
StoppedParticlesFinderend-of-job summary forIPAEndRingMuonFinder(accepted = ...) from a shortMuBeamResamplerrun against the geometry you intend, plus the resulting file's event count. - Decide with the Production team whether the 6th output should be on by default, and if so, say which downstream Cat/selector entry will consume
IPAEndRingStops(finding 3). - Best practice reminder: please add a meaningful PR description covering intent, scope, and validation evidence, and keep the PR to a single topic — the
MaxEventsToSkipedit is unrelated to the IPA end-ring stops. (Also, the title saysMuBeamResample.fcl; the file isMuBeamResampler.fcl.)
Adressed Andy's comment and changed MaxEventsToSkip: nil in pileup/prolog : -neutralsResampler -beamResampler Kept IPAEndRingsStopPath out of trigger and out path -Leaves the decision making open Geometry files in the latest Offline PR was updated to include the polystyrene material -Changes to this repo reuqire protonAbsorbed_cylindrical_v05.txt and latest changes to the geometry files
|
@FNALbuild run build test |
|
⌛ The following tests have been triggered for ab80665: build (Build queue - API unavailable) |
oksuzian
left a comment
There was a problem hiding this comment.
PR Review Summary — re-review of #562 "Add IPAEndRingStops to track stopped muons in MuBeamResample.fcl"
Reviewed at head ab80665d (2026-08-10). Second pass. Prior reviews: @AndrewEdmonds11 APPROVED at f57078ab with one inline request, and mine 🔴 at f57078ab (4887595941, 4 findings). The delta is one commit, ab80665d "Adressed PR comments:", touching both files. Every prior finding is verified in the code at this head, not read off the commit message.
Decision
- 🔴 Request changes — for one thing only, and it is narrow. Three of the four findings are properly addressed, and the design decision you made on the output stream is the right one. But the
MaxEventsToSkipfix landed on only one of the two resamplers, and the one still holding the hard-coded0isbeamResampler— the one this PR's ownMuBeamResampler.fclactually runs. One line, and I flip to approve.
Scope understood (unchanged, plus this pass's changes)
IPAEndRingMuonFinder/IPAEndRingStopFilter/compressPVIPAEndRingStopsare added to the shared pileup prolog, andIPAEndRingStopPath/IPAEndRingStopOutputtoMuBeamResampler.fcl.- New this pass: the path and output are deliberately kept out of
trigger_pathsandoutPath;neutralsResampler'sMaxEventsToSkipis restored to@nil; the commented-out//MaxEventsToSkip: @nillines are deleted from both blocks; the output block'skey :spacing is normalised.
Findings
-
🔴 [S0]
MaxEventsToSkip: 0is still inbeamResampler— the fix landed onneutralsResampleronly (carried over, PARTIAL).- Evidence:
JobConfig/pileup/prolog.fclatab80665d:228: beamResampler: { 235: MaxEventsToSkip: 0 <-- still hard-coded 253: neutralsResampler: { 260: MaxEventsToSkip: @nil <-- restoredmainhas@nilat both sites (:213,:238), so the0is introduced by this PR and survives atbeamResampler. The commit message states "changed MaxEventsToSkip: nil in pileup/prolog : -neutralsResampler -beamResampler" — the diff (f57078ab...ab80665d) showsbeamResampleronly lost its commented-out line; the value was not restored. - Impact: this is the more consequential of the two.
Pileup.beamResamplerSequence : [genCounter, protonTimeOffset, beamResampler](prolog.fcl:370) is whatMuBeamResampler.fclruns on every one of its paths, andEleBeamResampler.fcl/PiBeamResampler.fcluse it too. As in the first review:@nilis the "you must supply this" sentinel, and replacing it with the legal value0turns a loud startup failure into a silent one — any job without an explicit override starts at event 0 of its resampling file, so all such jobs resample the same events. Nothing breaks today (prodtools appends the override, andValidation/nightly/pileup_09.fclsets it explicitly), which is exactly why nothing would catch the regression either. - Suggested fix:
MaxEventsToSkip: @nilat:235, matching what you already did at:260. - Credit where due: @AndrewEdmonds11's inline request pointed at line 262, i.e. the
neutralsResampleroccurrence, and that one is fixed. My finding extended it to both blocks; this is the half that remains.
- Evidence:
-
🟡 [S2]
stoppingMaterial: "IPAPolystyrene"still will not match under any geometry production actually runs — now dormant rather than harmful (carried over, downgraded from 🟠 S1, PARTIAL).- What changed: with
IPAEndRingStopPathout oftrigger_paths,IPAEndRingMuonFinderis not scheduled, so the zero-acceptance behaviour cannot produce empty datasets today. The severity drop reflects that, not a change in the underlying facts. - What you answered: the commit message states this needs
protonAbsorber_cylindrical_v05.txtand the latest geometry files. That is correct and it is the option-(b) answer I asked for — but it is in the commit message, not the PR body, and one gap remains open underneath it. - Evidence, re-verified at Offline
maintoday:IPAPolystyreneend rings come only fromprotonAbsorber_cylindrical_v05.txt, included by exactly two files:geom_run1.txt:66andgeom_run1_a_stickman.txt(hencegeom_common.txt, the default).geom_run1_a.txt:66is stillprotonAbsorber_cylindrical_v04.txt—CorrugatedPolypropylene. Andgeom_run1_b_v01.txt:4simply#includesgeom_run1_a.txt, so Run1B inherits v04 too.- Every production entry that drives this fcl overrides the geometry to one of those:
services.GeometryService.inputFile : Offline/Mu2eG4/geom/geom_run1_a.txtfor MDC2025 and MDC2030MuBeamFlash, andgeom_run1_b_v01.txtfor Run1B. - No released Offline musing carries v05 at all: absent from
v13_30_00,v13_31_00,v13_32_10andv13_33_00(the newest), wheregeom_run1_a_stickman.txtstill includes v04.
- Impact: the dependency on unreleased Offline
mainis real but tracked. The part that is not addressed by "wait for the Offline release" is thatgeom_run1_a.txt— the file production actually pins — does not pick up v05 even onmain. Whoever enables this path later inherits a silently zero-acceptance stream, becauseStoppedParticlesFinder::materialAccepted()is an exact string compare with no diagnostic. - Suggested fix: say in the PR body which Offline version and geometry file this requires, and state explicitly whether
geom_run1_a.txtis expected to move to v05 or whether the production entries will be repointed atgeom_run1.txt. When you enable the path, post theStoppedParticlesFinderend-of-jobaccepted = NforIPAEndRingMuonFinder— a non-zero count is the one-line proof this is closed.
- What changed: with
-
⚪ [S3] Indentation of the new output block is still off by one (carried over, PARTIAL).
- Evidence:
MuBeamResampler.fcl:74-81— thekey :→key:spacing is fixed, but the closing]and theSelectEvents/fileNamelines are still indented 5 spaces whereIPAStopOutput(:65-72) and the other four blocks use 4.
- Evidence:
-
⚪ [S3] Nothing documents how to turn the stream on, and the PR body is still one line.
- Enabling it means overriding
physics.trigger_pathsandphysics.outPath, which are sequences — anfcl_overridesentry has to restate the whole list, not append to it. A one-line comment aboveIPAEndRingStopPathgiving the two override lines would save the next person the reverse-engineering. - The PR body still does not mention the Offline/geometry dependency, the validation status, or that the stream ships disabled. The title still says
MuBeamResample.fcl; the file isMuBeamResampler.fcl.
- Enabling it means overriding
Carry-forward accounting (vs review 4887595941 at f57078ab)
- 🔴 [was S0]
MaxEventsToSkip— PARTIAL, see finding 1.neutralsResamplerfixed and both commented-out lines removed;beamResamplervalue not restored. - 🟡 [was S1]
stoppingMaterial— PARTIAL, downgraded, see finding 2. Documented in the commit message and defused by disabling the path; thegeom_run1_a.txtgap is still open. - 🟢 [was S2] The 6th output stream is no longer on by default — FIXED in
ab80665d, verified, and this is the right call.trigger_pathsandoutPathat:41-42are back to the five original entries. This also resolves @AndrewEdmonds11's open question from his approval note ("I'll leave it up to the Production team to decide whether the extra IPAEndRingStops output wants to be on by default") in the conservative direction: the machinery is staged, the decision stays with the Production team, and no campaign gains a file it did not ask for. - 🟡 [was S3] Output-block formatting — PARTIAL, see finding 3.
Verified 🟢 — no action needed
- 🟢 Leaving
IPAEndRingStopPathandIPAEndRingStopOutputdefined but unscheduled is safe — art ignores both silently. Tested, not assumed. I ran a minimal job under Offlinev13_33_00(artv3_15_00) with a path defined inphysicsbut absent fromtrigger_paths, and aRootOutputdefined inoutputsbut absent fromoutPath, including aSelectEventspointing at the unscheduled path. Result:Art has completed and will exit with status 0, only the scheduled output's file was created, the unscheduled one was never opened, and no warning or error naming either was emitted. So the staged blocks are genuinely inert — they cost nothing until someone lists them.- Worth knowing for finding 4: because art never validates the unscheduled config, a typo in
IPAEndRingStopPathor inSelectEventswill not surface until the day the stream is enabled.
- Worth knowing for finding 4: because art never validates the unscheduled config, a typo in
- 🟢 The producer/filter/compressor wiring still mirrors the IPA chain exactly and every label the new path names is defined:
IPAEndRingMuonFinder→IPAEndRingStopFilter.mainSPPtrInputs→compressPVIPAEndRingStops.particleInputs: ["IPAEndRingStopFilter"]→IPAEndRingStopOutput.SelectEvents: [IPAEndRingStopPath]. - 🟢 The new prolog blocks land in
Pileup.producers/Pileup.filters, so they are now configured into every fcl includingJobConfig/pileup/prolog.fcl—EleBeamResampler,NeutralsResampler,PiBeamResampler,MuStopPileupand the selectors. Unscheduled everywhere, so harmless; called out because the blast radius of that prolog is wider than this PR's title suggests. - 🟢
@sequence::Pileup.SimKeptProductsused by the new output exists and is the same sequence the sibling stop outputs use. - 🟢 No build file to update:
Mu2e/Productionhas noCMakeLists.txtin the tree and one unrelatedSConscript; pileup fcl resolves at run time viaFHICL_FILE_PATH. - 🟢
neutralsResampler's restored@nilis spelled exactly asmainhas it, two-space form included.
Validation check
- Build/tests run:
mu2e/buildtesthad no result atab80665d("This test has not been triggered yet"), so I triggered one — this is the required test forJobConfigchanges, and FNALbuild notes the author is not a Mu2e org member, so it needs a member to start it. Result pending atab80665das of this review; please check it before merging. Separately, I ran the unscheduled-path/output test described above myself. - Config contract check: partial — FHiCL structure and label wiring are coherent and the disabled stream is verified inert;
MaxEventsToSkipstill does not enforce its supply contract atbeamResampler(finding 1). - Cross-repo consistency: needs follow-up — depends on Offline
main(protonAbsorber_cylindrical_v05.txt), which is in no released musing throughv13_33_00, andgeom_run1_a.txt— what production actually pins — does not include it even onmain(finding 2).
Residual risk
- A future resampler entry that omits the
MaxEventsToSkipoverride silently resampling identical events across all its jobs (finding 1). - The IPA end-ring stream is now staged but unvalidated and unvalidatable by art until it is switched on; the first person to enable it inherits both the material mismatch and any typo in the unscheduled config.
Author follow-ups
MaxEventsToSkip: @nilatprolog.fcl:235(beamResampler) — the one blocking item (finding 1).- Put the Offline/geometry dependency in the PR body, and say whether
geom_run1_a.txtmoves toprotonAbsorber_cylindrical_v05.txtor the production entries get repointed (finding 2). - Optional: 4-space indent on the new output block (finding 3), and a comment giving the two overrides needed to enable the stream (finding 4).
- Check the
mu2e/buildtestresult atab80665dbefore merging — I triggered it, but it had not reported when this review was written.
|
☀️ The build tests passed at ab80665.
N.B. These results were obtained from a build of this Pull Request at ab80665 after being merged into the base branch at 20c93ed. For more information, please check the job page here. |
fixed spacing issue in MuBeamResampler.fcl changed beamResampler back to nill, was left out by accident
|
@FNALbuild run build test |
|
⌛ The following tests have been triggered for ce9614f: build (Build queue - API unavailable) |
|
☀️ The build tests passed at ce9614f.
N.B. These results were obtained from a build of this Pull Request at ce9614f after being merged into the base branch at 0c81d36. For more information, please check the job page here. |
Uh oh!
There was an error while loading. Please reload this page.