Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ShipSoft/FairShip/llms.txt
Use this file to discover all available pages before exploring further.
macro/run_simScript.py is the single entry point for all FairShip Monte Carlo simulations. It wires together the geometry configuration, event generator, FairRoot simulation run, and Geant4 transport, then writes the three output ROOT files. Understanding its arguments lets you configure any physics scenario supported by FairShip without touching the source code.
Quick-start examples
Output file naming
The three output files share a common{tag} identifier:
--tag is not provided, a random UUID v4 is generated at startup and used for all three files.
Generator selection flags
Exactly one primary generator must be active. If no generator flag is given on the command line, Pythia8 is enabled by default.Use Pythia8 as the primary generator (default when no other generator flag is set). Handles HNL signal, dark photon, RPV-SUSY, and charm-only modes. Sets 400 GeV proton beam momentum.
Use the legacy Pythia6 generator (
tPythia6Generator). Simulates 50 GeV gamma/mu interactions on a neutron target. Provided for backward compatibility.Read pre-generated events from an EventCalc
.root file (converted from .dat via macro/convertEvtCalc.py). Requires -f to specify the input file. The number of events is capped at the file content unless overridden with -n.Generate events from a muon background file produced by a previous Pythia8+Geant4 run. Requires
-f. Forces MCTracksWithHitsOnly to control output size. Empty events (no hits) are stripped after the run.Use
FixedTargetGenerator for minimum-bias proton–proton interactions at the SHiP fixed target. See also the dedicated macro/run_fixedTarget.py.Activate the particle gun. Must be passed as a positional subcommand, e.g.
python macro/run_simScript.py PG --pID 13. See the Particle gun parameters section below.Read neutrino interactions from a GENIE output file. Must be passed as a positional subcommand. Requires
-f for the input file path. The gst TTree is copied to the simulation output.Load
TEvtGenDecayer to handle J/ψ and other quarkonium decays via EvtGen. Activates DecayConfigTEvtGen.C as the Pythia decayer configuration. Can be combined with any primary generator.Physics scenario flags
HNL simulation is the default mode. If neither
--DarkPhoton nor --RpvSusy is given, the script runs in HNL mode automatically — there is no --HNL flag to pass.Simulate dark photon signal using
DPPythia8Generator. Default mass 0.2 GeV, default ε = 8×10⁻⁸. Production mode is set via -A.Controls which production process is active. For HNL:
c = ccbar→HNL (default), b = bbbar→HNL, bc = Bc⁺/Bc⁻ → HNL, inclusive = all. For dark photons: meson = meson decays, pbrem = proton bremsstrahlung, qcd = ff̄ → DP.Mass of the hidden particle in GeV. Defaults to 1.0 GeV for HNL and 0.2 GeV for dark photon if not specified.
HNL mixing angles as a comma-separated string
U2e,U2mu,U2tau. Sets both production and decay couplings simultaneously. Use -cp and -cd to set them independently.HNL production-only couplings
U2e,U2mu,U2tau. Must be combined with -cd; cannot be used alone.HNL decay-only couplings
U2e,U2mu,U2tau. Must be combined with -cp.Dark photon kinetic mixing parameter ε.
Dark photon production meson source. Options:
pi0, eta, omega, eta1, eta11.Run control
Number of events to generate. For file-backed generators (EventCalc, MuonBack, GENIE), the actual count is
min(n, file_entries).First event index within the input file. Useful for splitting large files across jobs.
Output directory for all three ROOT files. Created automatically if it does not exist.
Custom string tag for output file names (
sim_{TAG}.root, etc.). If omitted, a UUID v4 is generated.Input file path. Repeat
-f for multiple files. Accepts glob patterns. Required for --evtcalc, --MuonBack, --Ntuple, and Genie modes.Random seed. A value of 0 triggers a time-based seed, automatically clamped to Pythia8’s allowed range (≤ 900 000 000).
FairLogger console verbosity.
0 = INFO, 1 = DEBUG, 2 = DEBUG1, 3 = DEBUG2.Quick-test mode. Overrides the input file with a small bundled file (
$FAIRSHIP/files/Cascade-parp16-MSTP82-1-MSEL4-76Mpot_1_5000.root).Initialise the run and then exit immediately. Useful for checking that geometry and generator configuration succeed without running any events.
After the run, invoke TGeo overlap checking at 0.1 mm tolerance and print any overlaps found. A finer per-subsystem check (0.1 μm) is run on each top-level node.
Detector and geometry flags
Muon shield geometry to use, looked up from the
shield_db dictionary in python/geometry_config.py. Currently TRY_2025 is the only supported value.Maximum height of the decay vacuum tank in metres.
Straw tube tracker frame material.
4 = aluminium frame, 10 = steel frame.Set the decay volume medium to vacuum (changes vessel structural parameters). Mutually exclusive with
--helium.Set the decay volume medium to helium (default). This is a no-op unless you explicitly need to override a previous
--vacuums on the same command line.Activate the SND (Scattering and Neutrino Detector) subsystem.
SND design variant(s).
1 = EmulsionTarget, 2 = MTC + SiliconTarget. Pass all to enable every available design. Multiple values are space-separated.Path to the YAML file defining the target geometry. Defaults to
$FAIRSHIP/geometry/target_config.yaml.Path to the spectrometer magnetic field map ROOT file, relative to
files/. Overrides the default set in geometry_config.py.Beam smearing flags
Standard deviation of Gaussian beam smearing at the target, in cm.
Radius for beam painting (uniform circular smearing), in cm.
Randomise the azimuthal angle φ for the muon background generator.
Particle gun parameters
ThePG subcommand exposes a dedicated set of arguments. All position and size quantities are in centimetres.
PDG particle ID for the gun (e.g.
13 = μ⁻, -13 = μ⁺, 22 = photon, 11 = e⁻).Start of the kinetic energy (or momentum) range in GeV.
End of the kinetic energy range in GeV. Set equal to
--Estart for a mono-energetic gun.Enable multiple particle gun sources spread across an x–y plane at a fixed z, or in a 3D volume (controlled by
--smearMode).Number of particles to generate per event.
Vertex position of the particle gun in cm.
Full spread of the gun vertex in x and y: position is drawn uniformly from
(V − D/2, V + D/2). Only used with --multiplePG.Vertex smearing model name. Passed to
ParticleGunGenerator::SetVertexModel().Generate both charge signs of the given particle ID within a single run.
Fraction of events to generate with the positive sign when
--bothCharges is active. Must be in [0, 1].Index of the momentum model to use. Model
0 is flat between --Estart and --Eend. Use --showPGModels to print all available models.ROOT file containing a histogram to sample the gun kinematics from. Repeat for multiple histograms. Must be paired with
--histoName and --histoX.Muon background options
Make the muon shield active so that muon trajectories are followed through the iron. Implies
--FastMuon.Transport only muons, skipping other secondaries, for a fast muon-only background estimate.