Generating HSN events in LArSoft (HsnGen)¶
Link to repository¶
Building HSN generator¶
Start by building uboonecode and larsim. At the moment, the suggested versions are:
--- uboonecode ---
Gen, G4, Detsim: uboonecode v06_26_01 -q e10:prof
Reco: uboonecode v06_26_01_10 -q e10:prof
--- larsim ---
Feature branch: larsim feature/sdporzio_hsngen_prodRelease_v06_26_01.
You can clone both as follows:
mrb g -t v06_26_01 uboonecode mrb g -b feature/sdporzio_hsngen_prodRelease_v06_26_01 larsim
After you have built both, you can test whether the generator works by running:
lar -c prodhsn.fcl
A good way of testing the generator is to run:
lar -c prodhsn.fcl -n 20000 -T testDistributions.root
(Don't worry, it'll take only a minute, the gen stage it's really really fast).
After that, just open the TFileService called
testDistributions.rootand open it with a TBrowser.
It should contain few test distributions for energy, momenta, timing and vertex position. Just make sure they look sensible.
You can copy a version of prodhsn.fcl and change parameters such as mass and decay channel.
The available parameters are as follows:
SterileMass: 0.300 DecayChannel: 2 FluxFile: "/pnfs/uboone/resilient/users/sporzio/HSN_FluxFiles/sterileFlux_m0.300.dat" Distance: 470. GlobalTimeOffset: 3125. BeamWindow: 1600. BoundariesX: [10,246.35] BoundariesY: [-105.53,107.47] BoundariesZ: [10.1,1026.8] GeneratedTimeWindow: [0,1e10]
The sterile mass is in GeV. The decay channel takes a code depending on the selected channels. Code are available here:
0: 3-body (nu e e) 1: Isotropic 2-body e pi 2: Isotropic 2-body mu pi 3: Isotropic 2-body nu Pi0 4: Isotropic 2-body nu gamma 5: 3-body (nu mu mu) 6: 3-body (nu mu e)
(mu pi and e pi channels available only, at this time).
Pre-generated flux files are available at this path:
There's 500 files, ranging HSN masses from 0 to 0.490 GeV in steps of 1 MeV.
It's extremely important that the SterileMass parameter matches the correct FluxFile.
E.g.: If you want to generate 420 MeV neutrinos, your parameters will have to be as follows:
... SterileMass: 0.420 FluxFile: "/pnfs/uboone/resilient/users/sporzio/HSN_FluxFiles/sterileFlux_m0.420.dat" ...
GeneratedTimeWindow allows you to generate the HSN in a specific time window. If not used you can use two arbitrarily large numbers (negative and positive respectively).
For generation on the grid, flux files must be handled differently. In that case, we'll have project.py copy the file directly from persistent and the .fcl file will just access it in the same directory on the grid.
E.g. if I want to generate 0.380 GeV HSN on the grid, I will set the
<jobsub>-f pathtofile</jobsub> flag (which will copy a file to the grid) on the xml file as follows:
<stage name="sim"> <fcl>pathToUploadDir/myProdhsn.fcl</fcl> <fcl>standard_g4_uboone.fcl</fcl> <fcl>standard_detsim_uboone.fcl</fcl> <numjobs>100</numjobs> <outdir>&data_dir;/sim</outdir> <workdir>&work_dir;/sim</workdir> <logdir>&log_dir;/sim</logdir> <jobsub>-f /pnfs/uboone/resilient/users/sporzio/HSN_FluxFiles/sterileFlux_m0.380.dat </jobsub> </stage>
Since the flux file is now directly copied on the same directory where myProdhsn.fcl is executed, the fcl will need to contain only the name of the file (with no path):