Warning, /EICrecon/docs/howto/run_dd4hep_simulation.md is written in an unsupported language. File is not indexed.
0001 # DD4HEP Simulation
0002
0003 ## Pythia and other EG
0004
0005 ```bash
0006 # Detectors live in /opt/detector
0007 # One can select particular configuration as
0008 # source /opt/detector/epic-main/bin/thisepic.sh
0009 #
0010 source /opt/detector/epic-main/bin/thisepic.sh
0011
0012 # Run simulation for 1000 events
0013 ddsim --compactFile=$DETECTOR_PATH/epic.xml -N=1000 --outputFile=sim_output.edm4hep.root --inputFiles mceg.hepmc
0014 ```
0015
0016 ## Particle gun
0017
0018 There are at least 2 ways of how to run a particle gun:
0019
0020 - using ddsim command line
0021 - using geant macro file and invoke GPS
0022
0023
0024 ### Using ddsim
0025
0026 Using ddsim (wrapper around ddsim) command line:
0027
0028 ```bash
0029 # set the detector
0030 source /opt/detector/epic-main/bin/thisepic.sh
0031
0032 # Electrons with 1MeV - 30GeV fired in all directions, 1000 events
0033 ddsim --compactFile=$DETECTOR_PATH/epic.xml -N=1000 --random.seed 1 --enableGun --gun.particle="e-" --gun.momentumMin 1*MeV --gun.momentumMax 30*GeV --gun.distribution uniform --outputFile gun_sim.edm4hep.root
0034
0035 # Pions from defined position and direction
0036 ddsim --compactFile=$DETECTOR_PATH/epic.xml -N=1000 --enableGun --gun.particle="pi-" --gun.position "0.0 0.0 1.0*cm" --gun.direction "1.0 0.0 1.0" --gun.energy 100*GeV --outputFile=test_gun.root
0037
0038 # uniform spread inside an angle:
0039 ddsim --compactFile=$DETECTOR_PATH/epic.xml -N=2 --random.seed 1 --enableGun --gun.energy 2*GeV --gun.thetaMin 0*deg --gun.thetaMax 90*deg --gun.distribution uniform --outputFile test.root
0040
0041 # run to see all particle gun options
0042 ddsim --help
0043 ```
0044
0045 ### Using Geant4 macros GPS
0046
0047 [GPS stands for General Particle Source (tutorial)](https://geant4-userdoc.web.cern.ch/UsersGuides/ForApplicationDeveloper/html/GettingStarted/generalParticleSource.html)
0048
0049 GPS is configured in Geant4 macro files. An example of such file
0050 [may be found here](https://eicweb.phy.anl.gov/EIC/detectors/athena/-/blob/master/macro/gps.mac)
0051
0052 To run ddsim with GPS you have to add [\--enableG4GPS]{.title-ref} flag
0053 and specify Geant4 macro file:
0054
0055 ```bash
0056 ddsim --runType run --compactFile=$DETECTOR_PATH/epic.xml --enableG4GPS --macro $DETECTOR_PATH/macro/gps.mac --outputFile gps_example.root
0057 ```