Pawel plesniak/absorber shift - #552
Conversation
|
Hi @PawelPlesniak,
which require these tests: build. @Mu2e/fnalbuild-users, @Mu2e/write have access to CI actions on main. ⌛ The following tests have been triggered for a2e2f31: build (Build queue - API unavailable) |
|
|
I leave this for review by @YongyiBWu and @AndrewEdmonds11 |
|
Note - I will review any failures that the CI workflow raises |
|
@FNALbuild run build test |
|
⌛ The following tests have been triggered for 79419ad: build (Build queue - API unavailable) |
|
☀️ The build tests passed at 79419ad.
N.B. These results were obtained from a build of this Pull Request at 79419ad after being merged into the base branch at 173faea. For more information, please check the job page here. |
|
@YongyiBWu and @AndrewEdmonds11 The CI workflow issues have been addressed, this is now ready for review |
AndrewEdmonds11
left a comment
There was a problem hiding this comment.
These look good to me
oksuzian
left a comment
There was a problem hiding this comment.
PR Review Summary — #552 (STM simulation clean-up / standardized data-product naming)
Reviewed at head 79419ad3
Decision
- 🔴 request changes
Scope understood
- Restructures
JobConfig/pileup/STM/so that every module label, product instance and file name comes from two new prolog tables (STMSimDataProducts,STMPileup) instead of literals; re-homesResamplingProducer/ResamplingFilter/VirtualDetectorCounter/ShiftVD101StepsfromOffline/STMMC/fcl/prolog.fclinto Production; addsSTMResampler1809.fcl; reorders the stage-1 path so the VD filter runs before compression. - Reorganises
Scripts/STM/intoAnalysis/andG4/, addsgen_STMResampler.sh,gen_STMResampler1809.sh,gen_ROOTAnalysisDump.sh. - Paired with Offline#1875, which deletes the re-homed tables from
STMMC/fcl/prolog.fcl, adds#include "Production/JobConfig/pileup/STM/prolog.fcl"there, and changesSTMResamplingProducerto emit a named product instance.
Findings
-
🔴 [S0] Three of the four STM job configs do not parse at this head
- Evidence: with
Production@79419ad3+Offline@mainonFHICL_FILE_PATH,fhicl-dumpaborts on all three:BeamToVD.fcl:128andBeamToVD1809.fcl:144—@sequence::STMPileup.BeamToVDKeptProducts→Local lookup error / Can't find key: STMPileup.BeamToVDKeptProducts (at part "BeamToVDKeptProducts").prolog.fclmovedBeamToVDKeptProductsout ofSTMPileupand intoSTMSimDataProducts(prolog.fcl:160), but neither consumer was updated.STMResampler.fcl:112,113—@sequence::STMPileup.stmResamplerSequence→Can't find key: STMPileup.stmResamplerSequence. The sequence was renamed toSTMResamplerSequenceBeamCatDatasets(prolog.fcl:289);STMResampler1809.fclwas updated to the new name,STMResampler.fclwas not.
- Impact:
generate_fcl/mu2e -cfail immediately for all of BeamToVD, BeamToVD1809 and STMResampler. Every fcl in this directory exceptSTMResampler1809.fclis unusable as committed. - Suggested fix:
@sequence::STMSimDataProducts.BeamToVDKeptProductsin both BeamToVD files, and@sequence::STMPileup.STMResamplerSequenceBeamCatDatasetsinSTMResampler.fcl. (NoteBeamToVDKeptProductsnow begins with its own"drop *_*_*_*", so drop the duplicate literal"drop *_*_*_*"that precedes it in both output blocks.)
- Evidence: with
-
🔴 [S0]
STMResampler.fcl:134is not valid FHiCL syntax- Evidence:
primaryTag : @local::STMSimDataProducts.Stage2.InputTag.@nil # Populate me!. After locally patching finding 1,fhicl-dumpstill aborts:Parse error ... detected at or near line 152, character 59pointing at the@nilin the@local::path.@nilis a value, not a name component, so this cannot be left as a fill-in-the-blank marker. - Impact: the file cannot be parsed even by a user who follows the header instructions, because the breakage is syntactic, not semantic.
- Suggested fix: commit a working default (
@local::STMSimDataProducts.Stage2.InputTag.HPGe) with the alternative in a comment — exactly the patternSTMResampler1809.fcl:148already uses (... .HPGe # @nil # Populate me!), which parses cleanly. Same forSelectEvents : [ @nil ]atSTMResampler.fcl:123-125.
- Evidence:
-
🔴 [S0] Required cross-repo change (Offline#1875) is not declared and is mutually blocking
- Evidence:
prolog.fcl:68setsStage1.ExtractedStepPointMCs : "extractVirtualDetectorSteps:virtualdetector", consumed ascompressDetStepMCsSTM.stepPointMCTagsand asfilterVirtualDetectorSteps.StepPointMCsTag. OnOffline@main,STMMC/src/STMResamplingProducer_module.cc:47,66doesproduces<StepPointMCCollection>()/event.put(std::move(outputStepPointMCs))— unnamed instance. Offline#1875 (3cedaf72) is what changes those two lines to"virtualdetector". Conversely Offline#1875 adds#include "Production/JobConfig/pileup/STM/prolog.fcl"toSTMMC/fcl/prolog.fcland resolvesDataProducts.*from@local::STMSimDataProducts.*, so #1875 cannot merge before this PR either. - Impact: merging #552 alone leaves stage 1 asking art for a product that is never produced. The PR body does not mention #1875 at all, and neither PR links the other.
- Suggested fix: state the dependency in both PR bodies and have the two merged together (or gate #552 on #1875). Please also confirm with the software team that an
Offline/prolog including aProduction/prolog is an acceptable dependency direction — that is new.
- Evidence:
-
🔴 [S0]
STMResampler1809.fclpoints Mu2eG4 at a resampler that never runs in its paths- Evidence:
STMResampler1809.fcl:107,113run@sequence::STMPileup.STMResamplerSequenceTargetStopsCatDataset(i.e. thestmResamplerTargetStopsCatDatasetmodule). ButStage2.InputPhysVolumeMultiInfo(prolog.fcl:113) andStage2.UpdateEventLevelVolumeInfos.Input(prolog.fcl:117) are scalars hard-wired to"stmResamplerBeamCatDatasets"/"stmResamplerBeamCatDatasets:eventlevel", and lines 151/153 use them unchanged. Confirmed in the expanded config:fhicl-dump STMResampler1809.fclemitsinputPhysVolumeMultiInfo: "stmResamplerBeamCatDatasets". - Impact:
Mu2eG4::beginSubRun→writePhysicalVolumesdoesgetValidHandle<PhysicalVolumeInfoMultiCollection>on that tag; the module is configured (via@table::STMPileup.filters) but not scheduled, so the product does not exist and the job throws on the first subrun. - Suggested fix: split
Stage2.InputPhysVolumeMultiInfoandStage2.UpdateEventLevelVolumeInfos.Inputby dataset type the same wayStage1andStage2.PreSimulatedDataalready are, and reference theTargetStopsCatDatasetvariant here.
- Evidence:
-
🟠 [S1]
Stage2.CompressedOutputnames a module label that does not exist, and Offline#1875 consumes it- Evidence:
prolog.fcl:149-155definescompressDetStepMCs:virtualdetector/compressDetStepMCs:STMDet/compressDetStepMCs:. The stage-2 compressor is labelledcompressSTMDetinSTMResampler.fcl:71andSTMResampler1809.fcl:65, andSTMResamplerKeptProducts(prolog.fcl:178-179) correctly keeps*_compressSTMDet_*_*. In Offline#1875,STMMC/fcl/prolog.fclreplaces the previously-correct literals"compressSTMDet:STMDet"/"compressSTMDet:virtualdetector"/"compressSTMDet:"with@local::STMSimDataProducts.Stage2.CompressedOutput.*, which feedsROOTAnalysisDump.Stage2.*. - Impact: dead config in Production today, but a silent regression in the paired Offline PR — the stage-2 ROOT dump would request products that no module produces.
- Suggested fix:
compressDetStepMCs→compressSTMDetin all threeStage2.CompressedOutputentries.
- Evidence:
-
🟠 [S1]
gen_STMResampler1809.shembeds the wrong template fcl- Evidence:
Scripts/STM/G4/gen_STMResampler1809.shwrites#include "Production/JobConfig/pileup/STM/STMResampler.fcl"and then overridesphysics.filters.stmResamplerTargetStopsCatDataset.mu2e.MaxEventsToSkip.STMResampler.fclis the BeamCat template; its paths usestmResamplerBeamCatDatasets, so the override lands on a filter that is configured but never scheduled, and--auxinput=...stmResamplerTargetStopsCatDataset.fileNameslikewise. - Impact: even after findings 1-2 are fixed, the 1809 stage-2 generator produces jobs that resample the wrong stream with
fileNames: @nilleft unresolved. - Suggested fix: include
Production/JobConfig/pileup/STM/STMResampler1809.fcl.
- Evidence:
-
🟠 [S1]
gen_ROOTAnalysisDump.shincludes a file that does not exist in this repo- Evidence: the script writes
#include "Production/JobConfig/pileup/STM/SignalParticleTrace.fcl". A recursive tree listing ofProduction@79419ad3contains noSignalParticleTrace.fclanywhere. The script's own header says the driver "should be configured inOffline/STMMC/fcl/ROOTAnalysisDump.fcl", which is the file Offline#1875 adds. - Impact: every
generate_fclcall in the script fails. - Suggested fix: include
Offline/STMMC/fcl/ROOTAnalysisDump.fcl, matching the script's documentation.
- Evidence: the script writes
-
🟠 [S1]
simStageOverride : 2looks off by one inSTMResampler1809.fcl- Evidence:
Mu2eG4/src/writePhysicalVolumes.ccsetssimStage = mvi->size()(count of upstream stages) and appends exactly one entry per Mu2eG4 stage;Mu2eProductMixer::endSubRunre-emits the collection withsubrunVolumes_.size()preserved, so a resampler does not change the count;Mu2eG4::beginSubRun/endSubRunthrowcet::exception("BADINPUT") ... inconsistent simStagewhen the override disagrees. Assuming the unchangedBeamToVD1809.fcl:156value of2is correct, its output carries 3 entries, soSTMResampler1809.fcl:150should be3. The same arithmetic says the BeamCat chain's3 → 2change inSTMResampler.fcl:136is a genuine fix (BeamToVD writes 2), so I read this as the 1809 file inheriting the wrong constant. - Impact: the job burns full G4 CPU and then throws at end-of-subrun.
- Suggested fix: confirm against a real stage-1 1809 file and set the value accordingly; a per-chain
Stage2.SimStageOverride.{BeamCatDatasets,TargetStopsCatDataset}entry would keep this from drifting again.
- Evidence:
-
🟠 [S1] Multi-threading is silently switched on for both stage-2 configs
- Evidence:
STMResampler.fcl:162andSTMResampler1809.fcl:176are now an active#include "Production/JobConfig/common/MT.fcl"; the previousSTMResampler.fclline was# comment out of MT issue #include ..., andBeamToVD.fcl/BeamToVD1809.fclstill carry that comment.fhicl-dump STMResampler1809.fclconfirmsmodule_type: "Mu2eG4MT",num_schedules: 2,num_threads: 2. - Impact: an undiscussed switch to
Mu2eG4MTwith 2 schedules in jobs that also run an art mixing filter (ResamplingMixer), in files whose siblings explicitly keep MT off for a known issue. Memory footprint and reproducibility both change. - Suggested fix: either restore the comment, or state in the PR body that the MT issue is resolved for these jobs and give the validation run that shows it.
- Evidence:
-
🟡 [S2] All three generators now use
--run-number=1204- Evidence:
gen_BeamToVD.shmuons1205 → 1204;gen_BeamToVD1809.sh1206 → 1204; the newgen_STMResampler*.shalso use1204. Electrons were already1204. - Impact: the Ele, Mu and 1809 streams are generated with overlapping
art::EventIDs and are later mixed together (STMStepMixerEle/Mu/1809) withwriteEventIDs : true. Distinct run numbers were what kept those IDs disjoint. - Suggested fix: keep one run number per stream, or say in the PR body why collisions are harmless for the mixing/back-tracing chain.
- Evidence:
-
🟡 [S2] Known-broken compression shipped with a "debugging is left to the user" note
- Evidence:
STMResampler.fcl:11andSTMResampler1809.fcl:8: "When finalizing this script, there were some errors with the compression. I couldn't debug it and did not make time to run a separate simulation to propagate these changes." - Impact: a production config carrying a self-declared unresolved defect, with no issue to track it.
- Suggested fix: open a GitHub issue describing the compression errors and reference it from the comment, so this is tracked rather than buried in a header.
- Evidence:
-
🟡 [S2]
returnused for early exit in executable scripts- Evidence:
gen_STMResampler.sh:18/gen_STMResampler1809.sh:18(return -1) and the tworeturnstatements in theelsebranch; both files are mode100755with#!/usr/bin/bash.returnoutside a function in a non-sourced script is an error and execution continues. - Impact: the "Missing arguments!" and "No dataset list file" guards do not actually stop the script. The script this replaces used
exit 1in the equivalent place. - Suggested fix: use
exit 1.
- Evidence:
-
⚪ [S3] Dead and drifted config, and doc/path drift
STMPileup.ShiftVD101Steps.StepPointMCsTag(prolog.fcl:263) andSTMSimDataProducts.Stage2.ExtractedStepPointMCs(prolog.fcl:146) are never referenced — stage 2 has noextractVirtualDetectorStepsmodule.- Headers point at
Production/Scripts/STM/gen_*.sh, but the scripts moved toScripts/STM/G4/;STMResampler1809.fcl:6namesgen_STMResampler.shrather thangen_STMResampler1809.sh. gen_ROOTAnalysisDump.shis mode100644with no shebang, but its usage says./gen_ROOTAnalysisDump.sh.gen_STMResampler*.sh:nFiles=$(wc -c < ...)counts bytes, not files, and the zero-check only warns; the commented "for large simulation studies" block ingen_BeamToVD1809.shstill usesnEleEvts/nEleFilesvariable names.- Typos in new text:
virtualdetecctor(several),geomety,EleBemaCat,randonNoReplace;prolog.fclhas no trailing newline.
Verified, no action needed
- 🟢
Stage1.PreSimulatedData.TargetStopsCatDataset : ["TargetStopResampler:virtualdetector"]is correct:JobConfig/primary/prolog.fclgivesTargetStopResamplerastepPointMCMixerof[["TargetStopFilter:virtualdetector", ":"]], andMu2eProductMixer.cc:20resolves":"to the input instance name. - 🟢
Stage2.ResampledStepPointMCs.* = "stmResampler*:virtualdetector"is likewise correct for the new[["compressDetStepMCsSTM:virtualdetector", ":"]]mixing map. - 🟢
Stage1.CompressedOutput.StepPointMCs : "compressDetStepMCsSTM:virtualdetector"matchesCompressDetStepMCs_module.cc:247,328, which produces/puts underi_tag.instance(). - 🟢 Moving
filterVirtualDetectorStepsahead ofcompressDetStepMCsSTMin the stage-1 path and repointing it atextractVirtualDetectorSteps:virtualdetectoris internally consistent (given finding 3). - 🟢
protonTimeOffsetandgenCounter, used by the renamed resampler sequences, are supplied by@table::Pileup.producers(JobConfig/pileup/prolog.fcl:133) and@table::Common.producers(JobConfig/common/prolog.fcl:10); dropping theOffline/CommonMCandOffline/STMMCincludes fromBeamToVD.fcldoes not break anything it still references. - 🟢
STMResampler1809.fclparses cleanly (fhicl-dumpexit 0).
Validation check
- Build/tests run: FNALbuild reports green at
79419ad3, but none of its stages parse these files —ceSimReco,ceMix,g4test_03MTetc. touch no STM config, and Production ships no build file coveringJobConfig/pileup/STM/orScripts/STM/(JobConfig/ensemble/SConscriptis the repo's only SConscript, and there is no CMakeLists), so scons/CMake mirroring is not in scope here and the green check is not evidence for this PR. I ranfhicl-dumpon all four configs withProduction@79419ad3+Offline@main: 3 abort, 1 passes. - Config contract check: fail — findings 1, 2, 4, 5.
- Cross-repo consistency: needs follow-up — findings 3 and 5; Offline#1875 does register its two new modules in
STMMC/CMakeLists.txtandSTMMC/src/SConscriptglobs*_module.cc, so that PR's build side is mirrored.
Residual risk
- No end-to-end run of the new chain is reported in the PR; with the configs unparseable, none is possible at this head.
- Findings 4, 5 and 8 are runtime/downstream failures that a fix for findings 1-2 will not surface until someone submits real jobs.
- Finding 8 rests on the unchanged
BeamToVD1809.fclvalue ofsimStageOverride : 2being correct; please confirm against a real stage-1 1809 file.
Author follow-ups
- Fix the three parse errors (findings 1 and 2) and add
fhicl-dumpoutput for all four configs to the PR body as validation evidence. - Link Offline#1875 from this PR body (and vice versa), state that they must merge together, and confirm the new
Offline→Productionprolog include direction with the software team. - Fix
Stage2.CompressedOutput(compressDetStepMCs→compressSTMDet) before #1875 picks the value up. - Split
Stage2.InputPhysVolumeMultiInfo/UpdateEventLevelVolumeInfos.Inputper dataset type soSTMResampler1809.fclstops pointing atstmResamplerBeamCatDatasets. - Correct the two script includes (
gen_STMResampler1809.sh→STMResampler1809.fcl;gen_ROOTAnalysisDump.sh→Offline/STMMC/fcl/ROOTAnalysisDump.fcl) and changereturn→exit. - Confirm
simStageOverridefor the 1809 stage-2 job, justify the--run-numberconsolidation to 1204, and either justify or revert theMT.fclactivation. - Open a tracking issue for the compression errors called out in the
STMResampler*.fclheaders.
Note on prior review: the existing approval of this PR by @AndrewEdmonds11 at this same head ("These look good to me") carried no findings, so nothing is carried forward. The parse failures above are reproducible at 79419ad3, so they are not regressions introduced since that read.
Clean up of the STM simulation production code, including generation of data products with a standardized naming format