# ND Simulation How To ## TLDR; **prerequest** - `/sdf/group/neutrino/images/larcv2_ub20.04-cuda11.1-cudnn8-pytorch1.9.0-larndsim.sif` - login to a GPU node (only required for det-sim stage w/ `larnd-sim`) ``` source /sdf/group/neutrino/kvtsang/nd-sim/mc-prod/setup.sh gen-edepsim-g4mac mpvmpr_cfg.yaml g4.mac edepsim-nd g4.mac 10 edepsim-output detsim-nd -i edepsim-output.h5 ``` ## Generate GEANT4 macro ``` gen-edepsim-g4mac mpvmpr_cfg.yaml g4.mac ``` This script generates a macro file (reusable unless changes in the particle bomb config). ``` # ====== # g4.mac # ====== /edep/hitSagitta drift 1.0 mm /edep/hitLength drift 1.0 mm /edep/update /generator/kinematics/bomb/config /sdf/group/neutrino/kvtsang/nd-sim/mc-prod/etc/module0/mpvmpr_cfg.yaml /generator/kinematics/bomb/verbose 0 /generator/kinematics/set bomb /generator/count/fixed/number 1 /generator/count/set fixed /generator/add ``` It takes particle boob config file `mpvmpr_cfg.yaml` as input. You can provide your own config file. The script looks for file in your working directory first. If not found, it will search from the default directory. ``` # =============== # mpvmpr_cfg.yaml # =============== SEED: -1 GeneratorMPV: NumEvent: [1,2] NumParticle: [3,3] XRange: [-300,300] YRange: [-600,600] ZRange: [-300,300] TRange: [0,10] AddParent: True Particles: - PDG: [11,13] NumRange: [1,1] KERange: [0,1] UseMom: False Weight: 1 - PDG: [211,-211] NumRange: [0,2] KERange: [0,1] UseMom: False Weight: 1 - PDG: [22,111] NumRange: [0,2] KERange: [0,1] UseMom: False Weight: 1 - PDG: [2112] NumRange: [0,2] KERange: [0,1] UseMom: False Weight: 1 GeneratorMPR: NumEvent: [1,1] NumParticle: [1,5] XRange: [-300,300] YRange: [-600,600] ZRange: [-300,300] TRange: [0,10] Particles: - PDG: [13] NumRange: [0,5] KERange: [0,1] UseMom: False Weight: 8 - PDG: [11] NumRange: [0,5] KERange: [0,1] UseMom: False Weight: 1 - PDG: [2112] NumRange: [0,5] KERange: [0,1] UseMom: False Weight: 1 ``` ## GEANT4 Simulation aka `edep-sim` ``` edepsim-nd g4.mac 10 edepsim-output ``` The script is a shortcut for `edep-sim` command. It executes the GEANT4 edep-sim and output a root file (e.g. `edepsim-output.root`) If `edep-sim` exit cleanly, it also convert the root file to hdf (e.g. `edepsim-output.h5`) It is equivalent to `edep-sim -o output.root -g some_geo.gdml g4.mac`. ## Detector Simulation aka `larnd-sim` ``` detsim-nd -i edepsim-output.h5 ``` The script does larpix readout simulation using **GPU**. For more options, see `detsim-nd -h` ## Advanced Usage It's possible to use different geometry, pixel layout, ..... etc. To be documented. (Let me know if you want to try something different)