Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4688dcc
added missing rng seed in fcl
YongyiBWu May 13, 2026
404a7b1
bug fixes
May 13, 2026
a7c6971
Merge branch 'main' of https://github.com/YongyiBWu/Mu2e_Production
May 13, 2026
e1bdc82
fixing issue with sample generating fcls
May 13, 2026
25692b0
Merge branch 'Mu2e:main' into main
YongyiBWu Jul 19, 2026
0135017
turn off log message limits
YongyiBWu Jul 31, 2026
881125b
Update VDResamplerConfigureTrainer.fcl
YongyiBWu Aug 6, 2026
98d0779
Update STM VD resampler trainer config
YongyiBWu Aug 18, 2026
1a6e372
Update STM VD resampler defaults
YongyiBWu Aug 22, 2026
9c1dd45
Share VDResamplerGenerator across STM configs
YongyiBWu Aug 24, 2026
7e3c6be
Update prolog.fcl
YongyiBWu Aug 26, 2026
f45094e
Fix STM pileup config comments
YongyiBWu Aug 28, 2026
acbae3f
Addition for peak label condition training
YongyiBWu Aug 28, 2026
a50ca30
Update STM generator file locations, fix crystal modules.
YongyiBWu Aug 31, 2026
988794a
Merge branch 'Mu2e:main' into main
YongyiBWu Aug 31, 2026
80deaec
Update prolog.fcl
YongyiBWu Aug 31, 2026
dc03f19
Update prolog.fcl
YongyiBWu Aug 31, 2026
f8053cc
Update VDResamplerToCrystals.fcl
YongyiBWu Aug 31, 2026
48fe445
Update VDResamplerToCrystals.fcl
YongyiBWu Aug 31, 2026
ac1ec2a
Revert "Update VDResamplerToCrystals.fcl"
YongyiBWu Aug 31, 2026
89ecb0e
Update VDResamplerToCrystals.fcl
YongyiBWu Aug 31, 2026
e2182f6
Update VDResamplerToCrystals.fcl
YongyiBWu Aug 31, 2026
5a7fdb7
Split STM VD sampler into GenParticles stage
YongyiBWu Aug 31, 2026
e0d13e1
Update VDResamplerGenerateMix.fcl
YongyiBWu Aug 31, 2026
d2f40f9
Update VDResamplerGenerateMix.fcl
YongyiBWu Aug 31, 2026
8c9d5d4
Update VDResamplerGenerateMix.fcl
YongyiBWu Aug 31, 2026
ff2bfc1
Separate STM stage-2 generation and propagation: propagation
YongyiBWu Aug 31, 2026
aa763ee
Use trainingPlanFile for VD resampler configs
YongyiBWu Sep 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions JobConfig/pileup/STM/VDResamplerConfigureTrainer.fcl
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
# Provides a pass of the data and set up fcl's to train the SBDM models that
# describe particle distributions at a selected VD.

# Update services.TFileService.fileName, dataSourceTag for different data sources
# Keep run number consistent with Offline/STMMC/fcl/VDResamplerTrainingPlan.fcl

#include "Offline/STMMC/fcl/prolog.fcl"
#include "Offline/fcl/standardServices.fcl"
#include "Production/JobConfig/pileup/STM/prolog.fcl"

process_name: VDResamplerConfigureTrainer

source : @local::STMPileup.VDResamplerSource

services : @local::Services.Sim
services : @local::STMPileup.VDResamplerServices

physics: {
analyzers : {
VDResamplerTrainingSetup : {
module_type : VDResamplerConfigure
StepPointMCsTag : "compressDetStepMCsSTM:"
SimParticlemvTag : "compressDetStepMCsSTM:"
VirtualDetectorID : 116
VDResamplerDir : "Offline/STMMC/VDResamplerFiles"
fclDir : "Production/JobConfig/pileup/STM"
dataSourceTag : MuBeam
StepPointMCsTag : "compressDetStepMCsSTM116:"
SimParticlemvTag : "compressDetStepMCsSTM116:"
# VDResamplerDir : "" # defaulted empty, i.e. placing in the current working directory
# fclDir : "" # defaulted empty
trainingPlanFile : "Offline/STMMC/fcl/VDResamplerTrainingPlan.fcl"
dataSourceTag : MuBeam # EleBeam, MuBeam, TargetStops1809, or Neutrals
trainingThreshold : 100
doROOTDump: true
}
Expand All @@ -29,4 +33,6 @@ physics: {
}

# if allows ROOTDump, specify output file name
services.TFileService.fileName : @nil
# for consistency, recommended name being "nts.mu2e.STMVDResamplerConfigure_VD<id>_hitDump.<ver>.<run6>_<src8>.root"
# src8 is the 8-digit encoding of the data source, e.g. 00000000 for EleBeam, 00000001 for MuBeam, 00000002 for TargetStops1809, and 00000003 for Neutrals
services.TFileService.fileName : @nil
52 changes: 38 additions & 14 deletions JobConfig/pileup/STM/VDResamplerGenerateFromModel.fcl
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,57 @@
# A demonstrator of module function and allows root sample dump for study.

#include "Offline/STMMC/fcl/prolog.fcl"
#include "Offline/fcl/standardServices.fcl"
#include "Production/JobConfig/pileup/STM/prolog.fcl"

process_name: VDResamplerGenerateFromModel

source : @local::STMPileup.VDResamplerSource
source : @local::STMPileup.VDResamplerGenSource

services : @local::Services.Sim
services : @local::STMPileup.VDResamplerGenServices

physics: {
physics : {
producers : {
# replace either a pair of stage 1 and stage 2 model files or an allAtOnceModelFile for the placeholder while running this module
VDResamplerGenerator : {
module_type : VDResamplerGenerateFromModel
useTwoStageModel: true
stage1ModelFile : @nil
stage2ModelFile : @nil
allAtOnceModelFile : @nil
useTwoStageModel : false
stage1ModelFile : ""
stage2ModelFile : ""
allAtOnceModelFile : ""
SBDMstage1Method : INVERSE_CDF # stage-1 pTotal source: DIFFUSION (require stage1ModelFile) / INVERSE_CDF / SPLINE_CDF / KDE (require resamplerSourceRootFile).
resamplerSourceRootFile : "" # required for SBDMstage1Method = INVERSE_CDF / SPLINE_CDF / KDE, same for the tree name below
resamplerSourceTreeName : "VDResamplerTrainingSetup/ttree"
useHeun : true
diffusionSteps : 200
# VDz0 : 37700.39 # z-coordinates of VD116. Only change when another VD is used
# VDr : 2000.0 # radius of VD116. Only change when another VD is used
doROOTDump: true
useSDE : true
sdeToOdeSigmaThreshold : 0.1
useEMANetworkIfAvailable : true
diffusionSteps : 500
# REQUIRED: supplies VirtualDetectorID, VDz0 and VDr from its common_training_config.
# Must be the same plan the model was trained with.
trainingPlanFile : "Offline/STMMC/fcl/VDResamplerTrainingPlan.fcl"
# SBDMpeakTagCenters : [1.809] # if trained model TargetStops1809 photon model using 2-stage with inverse CDF stage-1, and trained with peak tagging
# SBDMpeakTagHalfWidths : [0.001]
doROOTDump : true
doValidationPlots : true
}
genCounter : {
module_type : GenEventCounter
}
}
analyzers : {
genCountLogger : {
module_type : GenEventCountReader
}
}
o1: [VDResamplerGenerator]
end_paths: [o1]
genSample : [VDResamplerGenerator, genCounter]
ana : [genCountLogger]
trigger_paths : [genSample]
end_paths : [ana]
}

services.SeedService.baseSeed : 8

services.message.destinations.log.categories.default.limit : -1

# if allows ROOTDump, specify output file name
services.TFileService.fileName : @nil
85 changes: 63 additions & 22 deletions JobConfig/pileup/STM/VDResamplerGenerateMix.fcl
Original file line number Diff line number Diff line change
@@ -1,35 +1,76 @@
# Generate samples from multiple Score-Based Diffusion Models from a list of sources.
# The samples from each source are mixed according to their corresponding POTs.
# A demonstrator of module function and allows root sample dump for study.
# Generate samples from multiple Score-Based Diffusion Models from a list of sources.
# The samples from each source are mixed according to their corresponding POTs.
#
# Stage 1 of 2. This job only generates the GenParticles on the VD116 surface and writes them to
# an art file. VDResamplerToCrystals.fcl then reads that file and propagates them to the STM
# crystals, and the ROOT tree making is a separate step again (Offline/STMMC/fcl/MakeTree.fcl).
# Splitting it this way means the expensive diffusion sampling is done once and its output can be
# re-propagated as many times as needed.
#
# The generated sample dump and the validation plots are on by default so this stage also produces
# a ROOT file. To turn them off, toggle the lines near the end.

#include "Offline/STMMC/fcl/prolog.fcl"
#include "Offline/fcl/standardServices.fcl"
#include "Production/JobConfig/pileup/STM/prolog.fcl"

process_name: VDResamplerGenerateMix

source : @local::STMPileup.VDResamplerSource
source : @local::STMPileup.VDResamplerGenSource

services : @local::Services.Sim
services : @local::STMPileup.VDResamplerGenServices

physics: {
physics : {
producers : {
# Enter a list [aaa, bbb, ...] of hitSummaryFiles and a list of corresponding POTs at run
VDResamplerGenerator : {
module_type : VDResamplerGenerateMix
hitSummaryFiles : @nil
potsPerFile : @nil
ModelFileDir: "Offline/STMMC/VDResamplerFiles"
# VirtualDetectorID : 116 # default break-off point for STM downstream
useHeun : true
diffusionSteps : 200
# VDz0 : 37700.39 # z-coordinates of VD116. Only change when another VD is used
# VDr : 2000.0 # radius of VD116. Only change when another VD is used
doROOTDump: true
# To turn off sources (in the order of EleBeam, MuBeam, TargetStops1809, Neutrals), add the
# following line (or other boolean sequence) to the end of this file:
# physics.producers.VDResamplerGenerator.useSummaryFile : [false, true, true, true]
VDResamplerGenerator : @local::STMPileup.producers.VDResamplerGenerator
genCounter: {
module_type: GenEventCounter
}
}
o1: [VDResamplerGenerator]
end_paths: [o1]
analyzers : {
genCountLogger: {
module_type: GenEventCountReader
# GenEventCountReader defaults makeHistograms to true, which grabs TFileService in endJob.
# That service only exists here when the generator's doROOTDump is on, so leaving the
# default would make this job fail at endJob whenever the dump is off. The counts are still
# printed to the log either way - only the numEvents/numSubRuns histograms are dropped.
makeHistograms : false
}
}
genSample : [VDResamplerGenerator, genCounter]
ana : [genCountLogger, genOutput]
trigger_paths : [genSample]
end_paths: [ana]
}

# if allows ROOTDump, specify output file name
services.TFileService.fileName : @nil
outputs : {
genOutput : {
module_type : RootOutput
outputCommands : [
"drop *_*_*_*",
"keep art::EventIDs_*_*_*",
"keep mu2e::GenParticles_*_*_*",
"keep mu2e::GenEventCount_*_*_*"
]
SelectEvents : [genSample]
}
}

# This stage toggles the ROOT dump on/off that allows inspection of the quality of the outputs.
# The art file is written either way - only the diagnostic ROOT file is affected.
# Swap which pair is commented out to switch modes. The prolog defaults both to true, so turning
# the dump off needs the explicit falses, not just commenting the trues out. Drop the
# TFileService line along with the dump: the generator is the only module that creates that
# service, so naming a file for it when nothing instantiates it is misleading.
# physics.producers.VDResamplerGenerator.doROOTDump : false
# physics.producers.VDResamplerGenerator.doValidationPlots : false
physics.producers.VDResamplerGenerator.doROOTDump : true
physics.producers.VDResamplerGenerator.doValidationPlots : true
services.TFileService.fileName : "nts.owner.STMVDResamplerGenerateMix.version.sequencer.root"

outputs.genOutput.fileName : "dts.owner.STMVDResamplerGenerateMix.version.sequencer.art"

services.SeedService.baseSeed : 8
Loading