Fcl tools to go with https://github.com/Mu2e/Offline/pull/1960 - #576
Fcl tools to go with https://github.com/Mu2e/Offline/pull/1960#576YongyiBWu wants to merge 27 commits into
Conversation
This change clarifies and standardizes the STM VD resampler training configuration. It documents the expected data source tags and TFileService output naming, keeps the run number aligned with Offline/STMMC/fcl/VDResamplerTrainingPlan.fcl, and leaves VDResamplerDir and fclDir unset so the defaults can resolve to the current working directory and config path.
Refresh the STM pileup resampler FCL defaults for both the model-based and mix generators. This adds SBDM stage-1 configuration, resampler source file/tree inputs, catalog-based model lists, and newer validation and diffusion settings. It also enables default validation plots and clarifies the expected model and source-file metadata used by the generators.
Centralize the VDResamplerGenerator configuration in JobConfig/pileup/STM/prolog.fcl and make VDResamplerGenerateMix.fcl reference it instead of defining its own block. Add a new VDResamplerToCrystals.fcl job that reuses the shared generator, runs G4 to propagate VD116 samples to the STM crystals, and produces separate paths/outputs for crystals and VD crossings (VD101, VD89, VD90). The prolog now supplies defaults (hitSummaryFiles, potsPerFile, ModelFileList, resamplerSourceRootFiles, and related flags), consolidating settings and enabling reuse between generation and propagation jobs.
Corrected the STM pileup POT comment labels and the neutrals dataset name in the STM prolog configuration. This keeps the metadata aligned with the actual MDC sample names and catalog entries used by the resampler, without changing the underlying pileup logic.
Adds the STM resampler training plan file to the pileup prolog and documents the optional peak-tag model parameters in the generate-from-model configuration. This makes the model-based virtual detector generation use the intended training plan and keeps the relevant SBDM settings visible for future runs.
Factor per-VD STM extraction/compression into templates in prolog.fcl and reuse them from VDResamplerToCrystals.fcl to remove duplicated producer blocks. Apply per-VD overrides (VirtualDetectorID, stepPointMCTags) at top-level as FHiCL requires. Replace root://fndcadoor... data/model paths with CVMFS paths, and re-enable the MT include. Add explanatory comments about the FHiCL limitation and template usage.
This reverts commit 48fe445.
This change clarifies the staged STM VD resampling flow: stage 1 now writes only the generated GenParticles to an art file, while ROOT dump and validation plots remain opt-in and are moved out of the production path. It also documents the source-selection flags and sets explicit output filenames and seed values for reproducible generation.
This change converts the STM VD-to-crystal tracking job to consume pre-generated GenParticles from the stage-1 art files instead of producing them locally. It removes the TFileService-based generator dump and tree creation, keeps only the compressed output products on each trigger path, and preserves the input GenParticles so downstream analyses can trace each event back to its source sample.
|
Hi @YongyiBWu,
which require these tests: build. @Mu2e/write, @Mu2e/fnalbuild-users have access to CI actions on main. ⌛ The following tests have been triggered for ff2bfc1: build (Build queue - API unavailable) |
|
☀️ The build tests passed at ff2bfc1.
N.B. These results were obtained from a build of this Pull Request at ff2bfc1 after being merged into the base branch at 817bff4. For more information, please check the job page here. |
|
📝 The HEAD of |
oksuzian
left a comment
There was a problem hiding this comment.
PR Review Summary — #576
Reviewed at head ff2bfc1. First pass; no prior reviews on the PR.
Decision
- 🟡 comment only
Scope understood
- The FHiCL half of the STM VD-resampler work in Mu2e/Offline#1960:
VDResamplerConfigureTrainer.fcl,VDResamplerGenerateFromModel.fclandVDResamplerGenerateMix.fclare rewired onto new module parameters, a two-stageVDResamplerToCrystals.fclis added, andJobConfig/pileup/STM/prolog.fclgains 102 lines of shared configuration. - The prolog is the part with reach beyond the new tool:
BeamToVD.fcl,BeamToVD1809.fclandSTMResampler.fclall include it today. - The physics of the diffusion model itself is Offline#1960's review, not this one. That PR is open and so far unreviewed, and this PR cannot run without it.
Findings
-
🟠 [S1] Nothing in CI parses any of these five files, and the changed prolog reaches three existing production configs
- Evidence: FNALbuild's table at
ff2bfc1listsbuild (prof),ceSimReco,g4test_03MT,transportOnly,POT,g4study,cosmicSimReco,cosmicOffSpill,ceSteps,ceDigi,muDauSteps,ceMix,rootOverlapsandg4surfaceCheck. None of them reads anything underJobConfig/pileup/STM/. FNALbuild has since posted thatmainmoved tofed9a04and the result is out of date, so even the build is now stale. - Impact: a composition error in the 102 new prolog lines would break
BeamToVD.fcl,BeamToVD1809.fclandSTMResampler.fcl, and no automated check anywhere would catch it. The green tick on this PR is not evidence about these files. - Suggested fix: paste the output of
fhicl-dump -a(or a one-eventmu2e -c) for the four job fcl and for the three existing STM configs that include the prolog. I traced the composition by hand and found nothing wrong — see the verified list below — but hand-tracing is not a parse, and this is the one thing only you can supply. - I have left this as a comment rather than a change request because I found no actual error, only the absence of evidence.
- Evidence: FNALbuild's table at
-
🟡 [S2] The
TargetStops1809entry inpotsPerFilecannot be checked against the recipe the block claims to follow- The header comment gives the formula as
<number of simulated events> / <number of output from last stage> * <POT of the last stage>, three terms. The other three entries follow it; the 1809 entry is4e9 / 1442670/1e3 * 4e9 / 213816 * 1e8, five terms, with an unexplained/1e3and the MuBeam denominator213816reappearing inside it. All four values reproduce their comments exactly, so the arithmetic is fine and this is purely a documentation gap — but these are the mixing weights, and a reader cannot presently confirm one of them.
- The header comment gives the formula as
-
⚪ [S3] Smaller things, collected
# ModelFileDir is now overridden by ModelFileListrecords an edit rather than describing the parameter; git already holds that. Saying whatModelFileListexpects would be more use to the next reader.services.SeedService.baseSeed : 8inVDResamplerToCrystals.fclrepeatsCommon.BaseSeed : 8, which that file already has in scope throughProduction/JobConfig/common/prolog.fcl. The production configs spell it@local::Common.BaseSeed(JobConfig/primary/epilog.fcl,JobConfig/digitize/epilog.fcl,JobConfig/cosmic/NoField.fcl).- All four data files sit under
.../STMVDResampler/MDC2025ai/but two are namedMDC2025auandMDC2025av, and the two sample dumps arents.yongyiwu.*where the summaries areetc.mu2e.*. Every path exists, so nothing is broken; the directory name just no longer says what is in it. JobConfig/pileup/STM/prolog.fclandVDResamplerToCrystals.fclboth end without a trailing newline.
Verified
- 🟢 All four
potsPerFilevalues reproduce their inline derivations to the last digit: 98360017778.32725, 467691847195.7197, 5186958594225.648 and 3743491962.61981. - 🟢 Every referenced data file exists on cvmfs — the four
hitSummaryFiles, theModelFileListcatalog and theresamplerSourceRootFilesdumps. - 🟢 The new
VDResamplerGeneratorproducer added toSTMPileup.producersdoes not leak into the three existing jobs.BeamToVD.fcl,BeamToVD1809.fclandSTMResampler.fclreference only@sequence::STMPileup.BeamToVDKeptProductsand@sequence::STMPileup.stmResamplerSequence; none of them takes@table::STMPileup.producers. - 🟢 The two new
#includes in the prolog do not introduce a new double-inclusion hazard.BeamToVD.fclalready includes bothProduction/JobConfig/pileup/prolog.fclandProduction/JobConfig/pileup/STM/prolog.fcl, and those two already shareOffline/TrackerMC/fcl/prolog.fclplus four siblings, so re-including a prolog is already exercised by these jobs in production. - 🟢 Every
@local::reference into Offline resolves to the value its comment claims, checked againstOffline/STMMC/fcl/prolog.fclonmain:ResamplingProducer.StepPointMCsTagis"g4run:virtualdetector"(:42),ResamplingProducer.VirtualDetectorIDis101(:43),ResamplingFilter.StepPointMCsTagis"compressDetStepMCsSTM"(:46) andVirtualDetectorCounter.StepPointMCsTagis"g4run:virtualdetector"(:49). - 🟢
physics.producers.g4run.Mu2eG4CommonCut : {}matches the filesVDResamplerToCrystals.fclsays it follows —BeamToVD.fcl:116andSTMResampler.fcl:132both clear it the same way. - 🟢 Replacing the old
@nilplaceholders with""does not turn a validation failure into a silent one. The module constructors throw acet::exceptionnaming the parameter for an emptystage2ModelFile, an emptyresamplerSourceRootFileunder a non-DIFFUSIONstage-1 method, an unopenableModelFileListor hit summary, and a non-positivepotsPerFile;hitSummaryFiles,potsPerFile,useSummaryFileandresamplerSourceRootFilesare all length-checked against each other.
Validation check
- Build/tests run: no. The build at
ff2bfc1was green but FNALbuild has marked it out of date, and it covers none of these files either way. I did not trigger a rerun, since a rerun would not test them. - Config contract check: partial. Every
@local::and@sequence::reference was resolved by hand against the Offline and Production prologs onmain, and every data-file path was checked to exist. Nofhicl-dumpwas produced. - Cross-repo consistency: needs follow-up on merge order.
trainingPlanFile : "Offline/STMMC/fcl/VDResamplerTrainingPlan.fcl"names a file Offline#1960 adds, and the new parameter names come from modules that PR rewrites, so #1960 has to merge first. That is ordering, not a blocker.
Not checked
- Nothing was run — no
fhicl-dump, no art job, no G4 stage. - The diffusion-model physics, the sampling method and the validation plots. Those belong to Offline#1960, which has no review yet.
- Whether the absolute
/cvmfs/...paths should stay absolute. They have to be as the code stands — the module reads them with a barestd::ifstream, so the search-path form used by, say,Offline/CaloMC/fcl/prolog.fcl("OfflineData/ConditionsService/...") would not resolve. Worth settling on #1960 whether these parameters ought to go through a lookup policy, since as written the job cannot run anywhere cvmfs is not mounted and the configuration is pinned to oneMDC2025aidirectory.
Author follow-ups
- Post
fhicl-dump -aoutput for the four job fcl and forBeamToVD.fcl,BeamToVD1809.fclandSTMResampler.fcl, since CI covers none of them. - Rewrite the
TargetStops1809derivation so it reads against the formula in the block header, or extend the header to cover the five-term case. - Say in the PR body that Offline#1960 must merge first.
|
To clarify [S2]: The TargetStops1809 entry in potsPerFile have additional factors, because the sample comes from TargetStops, which is a staged propagated from MuBeam. The extra factors count for efficiency of MuBeam->TargetStops. This stage also has a random selection filter to downsample by 1000x. For matching the POTs, this calls for the additional 1000x |
Fcl tools to go with Mu2e/Offline#1960. More details there.