FairShip’s physics configuration is spread across four layers: ROOT environment initialisation (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.
shipRoot_conf.py), Pythia8 generator configuration (pythia8_conf.py), Geant4 process and tracking cuts (gconfig/SetCuts.C), and external decay table selection (gconfig/DecayConfig*.C). Each layer must be set up in order — shipRoot_conf.configure() must be called before any FairShip ROOT class is instantiated, Pythia8 configuration follows, and the Geant4 cut and decay macros are loaded automatically by FairRoot at simulation start. This page documents every function, parameter, and configuration knob in each layer.
python/shipRoot_conf.py — ROOT and FairRoot Environment Setup
This module bootstraps the ROOT/FairRoot environment for FairShip. It is
loaded at import time and must be the first FairShip module imported in any
steering script. The module-level code immediately checks for
FAIRSHIP_ROOT; if the variable is absent the process prints a diagnostic
and calls quit().
Module-level initialisation (import time)
When the module is imported the following steps run unconditionally:ROOT.gSystem.Load("libEGPythia6")— loads the EG Pythia6 interfaceROOT.gSystem.Load("libPythia6")— loads the Pythia6 libraryROOT.gSystem.Load("libpythia8")— loads the Pythia8 library- If
GENFIT_ROOT(orGENFIT) is set:ROOT.gSystem.Load("libgenfit2")ROOT.gInterpreter.AddIncludePath(genfit_root + "/include")- Declares the following GenFit2 headers via
ROOT.gInterpreter.Declare:DAF.h,DetPlane.h,Exception.h,FieldManager.h,MaterialEffects.h,MeasuredStateOnPlane.h,RKTrackRep.h,SharedPlanePtr.h,StateOnPlane.h,TGeoMaterialInterface.h,Tools.h,Track.h,TrackPoint.h,WireMeasurement.h
GenFit 02-03-00 no longer ships
.rootmap or unified PCM files, so ROOT’s
autoloading cannot discover GenFit classes. The explicit
gInterpreter.Declare block is the required workaround; removing it breaks
track fitting at runtime.configure(darkphoton=None) -> None
Completes the PDG database and loads the SHiP globals header. Call this
once per process before constructing any FairShip detector or generator object.
Controls which beyond-Standard-Model particle is registered in the ROOT PDG
database:
| Value | Behaviour |
|---|---|
None (default) | Calls addHNLtoROOT() — registers the HNL as N2 (PDG 9900015) |
True | Calls addDPtoROOT() — registers the dark photon |
0 | Returns immediately; BSM particle registration is deferred to pythia8_conf |
Registered non-standard particles
The following particles are registered in every call toconfigure(),
regardless of the darkphoton flag:
Pythia8 internal / diffraction particles
Pythia8 internal / diffraction particles
| Name | PDG ID | Mass (GeV) | Notes |
|---|---|---|---|
system | 90 | 0.0 | Pythia8 internal system particle |
Pomeron | 990 | 0.0 | Pomeron for diffraction |
p_diffr+ | 9902210 | 0.0 | Diffractive proton |
n_diffr0 | 9902110 | 0.0 | Diffractive neutron |
Nuclear isotopes
Nuclear isotopes
| Name | PDG ID | Mass (GeV) | Charge |
|---|---|---|---|
C12 (Carbon-12) | 1000060120 | 12.0 | 6 |
C13 (Carbon-13) | 1000060130 | 13.003355 | 6 |
Charmonium / NRQCD colour-octet states
Charmonium / NRQCD colour-octet states
These are intermediate states in the NRQCD factorisation framework used by
Pythia8 for J/ψ and ψ(2S) production.
| Name | PDG ID | Mass (GeV) |
|---|---|---|
J/psi[3PJ(8)] | 9942003 | 3.29692 |
J/psi[1S0(8)] | 9941003 | 3.29692 |
J/psi[3S1(8)] | 9940003 | 3.29692 |
f0(980) | 9010221 | 1.0 |
psi(3770) | 30443 | 3.77315 |
psi(3770)[3PJ(8)] | 9942033 | 3.97315 |
chi_0c[3S1(8)] | 9940011 | 3.61475 |
psi(2S)[1S0(8)] | 9941103 | 3.88611 |
psi(2S)[3S1(8)] | 9940103 | 3.88611 |
psi(2S)[3PJ(8)] | 9942103 | 3.88611 |
chi_1c[3S1(8)] | 9940023 | 3.71066 |
chi_2c[3S1(8)] | 9940005 | 3.75620 |
Upsilon[3S1(8)] | 9950003 | 9.66030 |
forReadingOldFile() -> None
Injects a C++ typedef into Cling so that pre-2018 ROOT files containing
Double32_t branches can be read without type-resolution errors.
python/pythia8_conf.py — Pythia8 Generator Configuration
This module provides functions that configure a HNLPythia8Generator
(or compatible Pythia8 wrapper) for specific SHiP signal processes. All
functions accept the generator object as their first argument and call
P8gen.SetParameters(...) to set Pythia8 string parameters. When
debug=True (the default), all method calls on the generator are mirrored to
pythia8_conf.txt via MethodLogger.
configure() — HNL Generator
HNLPythia8Generator instance for Heavy Neutral Lepton (HNL)
production at SHiP. The HNL is assigned PDG ID 9900015 (N2). Its
lifetime is computed from the supplied couplings using the hnl module and
converted to a proper decay length for Pythia8.
The Pythia8 generator instance to configure. Must already be constructed
(but not yet initialised) before this function is called.
HNL mass in GeV.
List of three mixing matrix elements
[Ue2, Umu2, Utau2] used to compute
branching ratios for production processes (charm/beauty decays to HNL).List of three mixing matrix elements
[Ue2, Umu2, Utau2] used to compute
the HNL lifetime and decay channel branching ratios. May differ from
production couplings in phenomenological scans.Selects the hard process from which the HNL is produced.
| Value | Description |
|---|---|
"inclusive" (or True) | Full inelastic pp collision: SoftQCD:inelastic, PhotonCollision:gmgm2mumu, PromptPhoton:all, WeakBosonExchange:all |
"c" | Charm decays only (D+, D0, D_s+, Λ_c+) with secondary HNL production via D_s+ → τ+ → N |
"b" | Beauty decays only (B+, B0) |
"bc" | B_c meson decays |
When
True, calls P8gen.UseDeepCopy() so that each generated event is
deep-copied before storage. Required for some grid submission frameworks
that share the generator object across threads.When
True, wraps P8gen in a MethodLogger and writes all
SetParameters calls to pythia8_conf.txt in the working directory.
Set to False for batch production to avoid the extra I/O.Branching ratio scaling
For charm and beauty selections the function reads interpolated branching ratio tables from$FAIRSHIP/shipgen/branchingratios.dat and rescales all
decay channels by 1 / max_total_BR so that the most probable production
process has unit weight. The scale factor is printed to stdout via
print_scale_factor.
configurerpvsusy() — RPV SUSY Neutralino Generator
N2, PDG 9900015) production.
The neutralino lifetime is computed by the rpvsusy module. Branching ratio
tables are read from
$FAIRSHIP/shipgen/branchingratiosrpvsusybench{benchmark}.dat.
Neutralino mass in GeV.
RPV coupling vector. Index 1 (
couplings[1]) is the muon-sector coupling
used for charm and beauty BR calculations.Sfermion mass in GeV, passed to the
rpvsusy.RPVSUSY lifetime calculator.Benchmark scenario index. Selects the branching ratio data file via the
filename pattern
branchingratiosrpvsusybench{benchmark}.dat.Production channel:
"c" (charm), "b" (beauty), or "True" /
True for fully inclusive production via setup_pythia_inclusive.add_hnl() — HNL particle registration helper
$FAIRSHIP/python/DecaySelection.conf.
Calls P8gen.SetHNLId(9900015) to mark the signal particle.
setup_pythia_inclusive() — Inclusive production
python/pythia8_conf_utils.py — Generator Utility Functions
Helper functions used internally by pythia8_conf.py. Import directly for
low-level generator manipulation.
addHNLtoROOT(pid, m, g)
Registers a single particle entry in the ROOT PDG database.
PDG ID to register. Default is the SHiP HNL ID.
Particle mass in GeV.
Particle width in GeV (inverse lifetime × ℏ). Computed in
pythia8_conf.py as u.hbarc / ctau.make_particles_stable(P8gen, above_lifetime)
Iterates over all Pythia8 particle entries and sets mayDecay = false for
any particle with τ₀ > above_lifetime. This forces long-lived particles
(kaons, pions, hyperons) to be handed to Geant4 for decay rather than being
decayed inside the generator.
Lifetime threshold in Pythia8 natural units. Particles with
τ₀ above
this value are made stable in Pythia8.python/global_variables.py — Global State
This module provides a namespace for global state that must be visible
across multiple FairShip Python modules. It uses a __getattr__ stub so
that attribute access on the module never raises AttributeError — any
attribute that has not been set yet returns ... (Ellipsis) rather than
raising an exception. This pattern allows conditional imports and deferred
initialisation without guard logic scattered across steering scripts.
The
__getattr__ fallback returns the Python Ellipsis object (...),
not None. Code that tests global variables should check
var is not ... rather than var is not None.gconfig/SetCuts.C — Geant4 Process and Tracking Cuts
SetCuts.C is a ROOT macro loaded automatically by FairRoot at the start of
each Geant4 simulation job. It calls gMC->SetProcess and gMC->SetCut to
configure which electromagnetic and hadronic processes are active and what
energy thresholds govern secondary particle production and tracking.
Enabled processes
All standard processes are enabled. The table below lists everySetProcess call and its physics meaning:
| Process key | Description | Setting |
|---|---|---|
PAIR | Pair production (γ → e⁺e⁻) | 1 (on) |
COMP | Compton scattering | 1 (on) |
PHOT | Photoelectric effect | 1 (on) |
PFIS | Photofission | 0 (off) |
DRAY | Delta-ray (knock-on electron) production | 1 (on) |
ANNI | Positron annihilation | 1 (on) |
BREM | Bremsstrahlung | 1 (on) |
HADR | Hadronic interactions | 1 (on) |
MUNU | Muon nuclear interaction | 1 (on) |
DCAY | Particle decay | 1 (on) |
LOSS | Continuous energy loss | 1 (on) |
MULS | Multiple Coulomb scattering | 1 (on) |
For a GEANE comparison study or a simulation without secondary particle
generation, set
LOSS=2, DRAY=0, BREM=1 and raise the bremsstrahlung
and pair-production cuts (BCUTE, BCUTM, DCUTE, DCUTM, PPCUTM)
to 10 TeV while keeping CUTGAM–CUTMUO at 1 MeV or less.Energy thresholds
Two threshold constants are defined:| Cut key | Threshold | Applies to |
|---|---|---|
CUTGAM | 1 MeV | Photon tracking threshold |
CUTELE | 1 MeV | Electron/positron tracking threshold |
CUTNEU | 1 MeV | Neutral hadron tracking threshold |
CUTHAD | 1 MeV | Charged hadron tracking threshold |
CUTMUO | 1 MeV | Muon tracking threshold |
BCUTE | 1 MeV | Electron bremsstrahlung production threshold |
BCUTM | 1 MeV | Muon/hadron bremsstrahlung production threshold |
DCUTE | 1 MeV | Delta-ray production by electrons |
DCUTM | 1 MeV | Delta-ray production by muons |
PPCUTM | 1 MeV | Direct pair production by muons |
TOFMAX | 1 × 10¹⁰ s | Maximum particle time of flight |
gconfig/DecayConfig*.C — External Decay Table Configuration
FairRoot selects a DecayConfig.C variant at runtime based on which
generator backend is in use. Each variant installs an external decayer
that intercepts particle decays for specific PDG IDs and handles them
outside Geant4’s native decay mechanism.
Variant overview
- DecayConfig.C
- DecayConfigPy8.C
- DecayConfigNuAge.C
- DecayConfigPy6.C
- DecayConfigTEvtGen.C
The default no-op variant. Contains an empty
DecayConfig() function
body. Used when the simulation does not require any external decay
handling (e.g. muon-only background studies where charm decay kinematics
are irrelevant).gconfig/USERDECAY.DEC
An EvtGen user decay file present alongside the DecayConfig*.C macros.
It is read by DecayConfigTEvtGen.C (via the EVTGENDATA path) when
custom EvtGen decay tables are needed, for example to override J/ψ
polarisation or add rare charmonium decay modes not present in the default
DECAY.DEC.
Full Setup Sequence
Import shipRoot_conf (bootstraps ROOT)
libEGPythia6, libPythia6, libpythia8, and optionally
libgenfit2 at import time.