Simulating ePIC Events
Last updated on 2026-11-17 | Edit this page
Estimated time: 30 minutes
Overview
Questions
- How can we use the simulation of the ePIC detector?
- What geometries are available?
Objectives
- Process our event generator sample through the ePIC detector simulation
Introduction
The ePIC simulation is pre-installed within eic-shell.
The ePIC geometry is defined in the DD4HEP (Detector Description for
High Energy Physics) framework. More info can be found in the tutorials
on DD4HEP
to define ePIC detectors and Using
npsim and Geant4
Crucially, DD4HEP acts as a wrapper around the familiar Geant4 Monte-Carlo simulation toolkit.
Introduction - Setup
To run a simulation, we need to enter eic-shell if we’re
not already there:
Once inside, we need to load in a geometry. We can choose different
options of we want, but we will use epic-main:
Before we run anything, we’ll make a directory to run in to keep things neat:
Copy your generated event file from earlier into this directory too. We’re now ready to simulate!
Running Simulations
We will run our simulation using the npsim command.
npsim vs ddsim
In other tutorials, you may see reference to ddsim as
well as npsim? Is this the same thing?
Not quite. They are very similar, but
npsim effectively runs with a set of extra flags.
Crucially, these flags enable the simulation of optical
photons. As such, npsim should be used whenever
optical photons are important for your output - e.g. in calorimetry or
Cherenkov detectors. For rapid simulations of tracking,
ddsim may be appropriate. Generally for full detector event
simulations, use npsim.
We can check the available flags and options with
there’s lots of options! We’ll narrow down to a few:
-
--compactFile- Very important, this specifies which geometry definition we will simulate with
- Try
ls $DETECTOR_PATHto see the list of available.xmlconfigurations
-
--numberOfEvents- The number of events to process. We’ll keep this low to save time.
-
--inputFiles- The file path for the input
.hepmcfile (or files)
- The file path for the input
-
--outputFile- The file path to output to
-
vX- The verbosity level of the output to screen. X is a number between 1 and 7 corresponding to VERBOSE,DEBUG,INFO,WARNING,ERROR,FATAL,ALWAYS
- E.g.
-v5would selectERROR- We’ll print errors.
We will try running a short simulation on the events we generated earlier:
BASH
npsim --compactFile $DETECTOR_PATH/epic_craterlake_10x100.xml --numberOfEvents 10 --inputFiles Input.hepmc --outputFile Test_10_Events.edm4hep.root
This should start running, there’ll be a large info dump to screen with various configuration info loading in. It should not take too long to process.
Once it’s done, let’s have a quick look at the file.
Time Saving
For our next step, we’ll want a larger file, I suggest opening a new terminal tab/window and running this simulation in the background as we look at the output we have so far.
We can open it and have a look with ROOT. I recommend you **exit
eic-shell and look at the file in root externally if you
can. If you don’t have ROOT installed locally, you can use the webviewer, but be aware
that it is more limited.
Within the events tree, we can see a large range of
collections. These are primarily collections of hits or
contributions to various detector subsystems. For example,
the EcalBarrelSciFiHits collection. This collection
contains information on the energy and
position, as well as cellID of various hits
for this detector subsystem. There’s also
contributions_begin and contributions_end
items which can be used to trace back the individual contributions to a
given hit.
If you check other Hits type collections, you’ll see
very similar content. Some may have more or less info. Also of interest
is the MCParticles collection. This contains the original
MC information from our input file. This is retained so we can always
check the actual input for a given event.
For analysis purposes, we may want this information to study the response of a particular detector in a lot of detail, or perhaps to develop a new reconstruction algorithm. Generally though, this information isn’t particularly useful if we want to do a physics analysis. We need to reconstruct our events first. We’ll do this in the next part of our lesson.
The Afterburner
We processed our simulation output “as is”. In doing so, we’ve
ignored the impact of beam effects on our initial and final state
particles. We could add these effects in using the afterburner. This piece
of software adds in a large combination of effects to our MC file,
including the beam crossing angle, beam divergences and crab cavity
impacts. The overall effect is to slightly alter components of the beam
and final state particle momentum. For realistic physics simulations, we
should generally apply the afterburner. Doing so is simple, within
eic-shell we can simply run:
where <<preset>> is the beam configuration
preset to use and <<Output_File>> is the output
file to write to (do not include a file suffix). Other options and flags
are available, as usual, try abconv -h.
Note that the afterburner will try to automatically detect the beam
configuration if the -p option is not used. Available
presets can be seen from the output of abconv -h, but some
are not printed by default. See Lines
2110-2166 for the fill list of configurations available.
- Before running the simulations in
eic-shell, we need to load in a detector config -
npsimshould be used for simulations generally - Simulations can take some time to run
- The output is largely cell/element level hit distributions
- MC truth info is retained in the simulation output
- When simulating physics events, we should afterburn our input first