Skip to content

Event generation

It is useful for performance studies to generate events with single particles (muons, pions, electrons, etc) with specific parameters. This is colloquially called the particle gun. A dedicated Python script allows to generate an LCIO file with stable particles, represented by LCIO::MCParticle objects. For example, the following command will generate 10 events with 1 electron per event, where the electron has p = 100 GeV, polar angle randomly distributed in the range [10deg, 170deg], and azimuthal angle randomly distributed in the range [0, 2pi]:

# Runs in a few seconds
cd /scratch/$USER/tutorial2024
python mucoll-benchmarks/generation/pgun/pgun_lcio.py \
    -s 12345 \
    -e 10 \
    --pdg 11 \
    --p 100 \
    --theta 10 170 \
    -- output_gen.slcio
ls

The Monte Carlo particle numbering scheme is provided by the Particle Data Group (PDG).

The contents of the output file can be inspected with anajob:

lcio_event_counter output_gen.slcio
anajob output_gen.slcio

The contents can also be inspected with a python script using pyLCIO:

python MuC-Tutorial/dumpers/print_mc_particles.py -i output_gen.slcio

Note that the particle gun is unaware of the detector geometry. The particle gun simply creates events in LCIO format with specified truth (MC) particles.

This tutorial won't include instructions on how to generate physics processes like H -> bb. You can find this in tutorials from previous years.