[Halld-klf-physics] [EXTERNAL] KLF MCWrapper

Stuart Fegan stuart.fegan at york.ac.uk
Fri Jan 23 11:17:57 EST 2026


Dear KLF,

I am finally ready to let you all have go with the KLF modified version 
of MCwrapper, the standard Hall D tool for automating MC generation at 
scale. I've prepared some documentation, located here 
https://urldefense.proofpoint.com/v2/url?u=https-3A__www.overleaf.com_read_swqdrntptpff-23317d1a&d=DwIDaQ&c=CJqEzB1piLOyyvZjb8YUQw&r=RlEsaFp8D0NPe1UW2n96woC0o_drOLa0fpikeV6J-ug&m=2pAdN22zZQGIX2vhkgkfvrLRTSOfrbctOJpqQoeq3-e0rxgsfHCiFczDq0NzqXLY&s=J9C5JuGEqH26msKWb2Sou-nIgmhrgI6llU0SesruHTs&e= , and I am in the 
process of adding a section to the KLF simulations wiki page.  However, 
to get you started, here are some basic instructions for running from a 
KLF environment on the ifarm;

1) (this is a temporary step until some minor updates are merged with 
the KLGenerator repository) Download and install my version of the 
generator, github.com/sfegan84/KLongboiGenerator. It's the exact same 
process as the regular generator, I just use a York in-joke name for my 
repository.

2) set an environment variable called KLGEN to the full path to where 
you have downloaded the generator source code. This will allow the 
generator to access beam profiles, cross sections, etc at runtime 
without having to be in the same folder as the source files.

3) Append python3 libraries from a standard Hall D software build to 
your environment. Hopefully this is also a temporary step, I just know 
MCWrapper seems to need these libraries and I don't currently see them 
in my KLF build. In csh; setenv PYTHONPATH 
"${PYTHONPATH}:/group/halld/Software/builds/Linux_Alma9-x86_64-gcc11.5.0/halld_recon/halld_recon-5.0.0/Linux_Alma9-x86_64-gcc11.5.0/python3"

4) Download the KLF branch of gluex_MCrapper. The git command for this 
is "git clone --single-branch --branch KLF 
https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_JeffersonLab_gluexMCwrapper.git&d=DwIDaQ&c=CJqEzB1piLOyyvZjb8YUQw&r=RlEsaFp8D0NPe1UW2n96woC0o_drOLa0fpikeV6J-ug&m=2pAdN22zZQGIX2vhkgkfvrLRTSOfrbctOJpqQoeq3-e0rxgsfHCiFczDq0NzqXLY&s=NOsyfSP5wssk10yWbmmWOtP4kcKpkUAYp7Urq4PxWdE&e= "

5) Set the environment variable MCWRAPPER_CENTRAL to the full path to 
wherever you cloned the branch of MCwrapper

6) Edit or make your own copy of the configuration file KLFMC.config. 
This tells MCWrapper what you're running and how. I refer you to the 
MCwrapper documentation and examples for how to adapt this to your 
channels. One tip; you will need a separate configuration file with the 
reaction channel flag for KLGenerator, and point the GENERATOR_CONFIG 
variable to it. It'll make sense as you look through the configuration.

7) Run MCwrapper using the command "$MCWRAPPER_CENTRAL/gluex_MC.py 
$MCWRAPPER_CENTRAL/examples/KLFMC.config <run number> <number of 
events>". I prefix the gluex_MC.py with the MCWRAPPER_CENTRAL variable 
to ensure it runs the KLF version, not the standard gluex one. A 
suitable run number for KLF is 72800 and depending where you are running 
from, you may want to be cautious with how many events you generate.

As I am only one person, and have developed this from the perspective of 
my simulation workflows, I will appreciate any feedback or bug reports 
for your use cases, and I will continue to update this as we expand our 
usage, including functionality for batch processing via slurm or swift.  
For this beta launch, I re-synced with the current state of MCwrapper 
and plumbing everything back in was the priority over further development.

I have no expectation for anyone to try this over the weekend, I'm also 
having issues with my KLF build since the maintenance day that mcsmear 
has stopped working, but I'll be happy to make a live demonstration in 
the next software meeting, as well as continue discussions about bugs 
and desired features before people get cracking with it. Ideally, we 
will one day fully integrate this with the GlueX "Submit MC" web page, 
as MCwrapper is the backend of that tool, but that's a story for another 
time.

Cheers,

Stuart



More information about the Halld-klf-physics mailing list