Running Mokka simulations locally
Extensive sets of simulations are already available and many types of physics can be studied using these sets. However, if a customised detector configuration is needed, it is important to be able to run our own simulations locally, using the PPE batch farm. This wiki explains how to do this, step by step.
Testing Mokka
This is described in the
ILCSoft wiki. One can try quickly:
. /afs/phas.gla.ac.uk/data/ilc/software/ilcsoft/v01-14/init_ilcsoft.sh
cd /afs/phas.gla.ac.uk/data/ilc/software/validation/StandardConfig/current
Mokka -M ILD_o1_v05 -e ./particle.tbl bbudsc_3evt.steer
Changing certain detector parameters
Detector parameters are taken from (a default) database. There are many versions of the ILC detectors. One can browse this database via the
Mokka Detector Model Database Browser
.
To change for example the number of layers in the
Hcal
, and the sensitive Si layer thickness in
Ecal
, one would add in the steering file
/Mokka/init/globalModelParameter Hcal_nlayers 36
/Mokka/init/globalModelParameter Ecal_Si_thickness 0.45
to the steering file and use the "-U" command line option to enable the change:
Mokka -M ILD_o1_v05 -U -e ./particle.tbl my_bbudsc_3evt.steer
Visualisation
To visualise the detector geometry set in the steering file for example:
/Mokka/init/BatchMode false
and then in Geant4 prompt type
/vis/open OGL
/vis/scene/create
/vis/drawVolume
/vis/viewer/set/viewpointThetaPhi 60 45
To draw trajectories:
/vis/scene/add/trajectories
/vis/scene/add/hits
/vis/viewer/flush
A good tutorial can be found
here
.
Running from your own work directory
To be able to customise your scripts and better keep track of the outputs, you should run
Mokka
from your own directory, e.g.
cd ~
mkdir ILC_Simulations
cd ILC_Simulations
cp /afs/phas.gla.ac.uk/data/ilc/software/validation/StandardConfig/current/bbudsc_3evt* .
Edit now these files, rename and customise them and run (after you've sourced the correct environment as before)
Mokka -M ILD_o1_v05 -U -e ./particle.tbl my_sim.steer
Running Mokka on the PPE batch farm
Here's a simple script (named
mokka_test.pbs
) that runs the Mokka example on the PPE batch farm:
#PBS -N Mokka_test_1
#PBS -m abe
#PBS -M gary.smythe@glasgow.ac.uk
#PBS -q long5
echo "Running Mokka test 1 ..."
. /afs/phas.gla.ac.uk/data/ilc/software/ilcsoft/v01-14/init_ilcsoft.sh
cd /afs/phas.gla.ac.uk/user/p/protopop/ILC_Simulations
Mokka -M ILD_o1_v05 -e ./particle.tbl my_sim.steer
echo "Mokka test 1 done!"
To submit the job from any PPE linux account, use the command
qsub mokka_test.pbs
To learn more about PBS commands type
man pbs
in your terminal.
Using a particle gun
The example above needs around 3 minutes per event. For certain purposes, it is enough to use a simple particle gun instead, and this will run much faster. To do this, replace in the example steering file
/Mokka/init/initialMacroFile bbudsc_3evt.g4macro
with
/Mokka/init/initialMacroFile e-gun.g4macro
where the file
e-gun.g4macro
contains the following instructions:
/generator/generator particleGun
/gun/particle e-
/gun/energy 100 GeV
/gun/momentumSmearing 5 GeV
/gun/position 0 0 0
/gun/direction 1 0 1
/run/beamOn 3000
exit
Random Direction:
Outlined in the Mokka
release_notes_mokka-01-02
. Note that this has been replaced in newer versions of Mokka such that the new commands are detailed below.
The new method (which works) is outlined in section 'VI. New Commands for the Particle Gun' in the Mokka
release_notes_mokka-05-02
. Relevant subsections of IV. are "/gun/thetaSmearing", "/gun/phiSmearing" and "/gun/directionSmearingMode".
Works if replace "/gun/direction 1 0 1" with "/gun/directionSmearingMode gaussian" in the e-gun.g4macro