The fastest way to get familiar with FairShip is to run the standard three-step chain: simulation withDocumentation 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.
run_simScript.py, reconstruction with ShipReco.py, and analysis with ShipAna.py. Each step reads the outputs of the previous one, and all three scripts live under $FAIRSHIP/macro/. The examples below use the --tag option to give output files a human-readable name instead of the default UUID identifier — ideal for interactive exploration.
Output File Naming Convention
Before running anything, it helps to understand how FairShip names its output files. The simulation step produces three ROOT files for each run:| File pattern | Contents |
|---|---|
sim_{identifier}.root | MCTrack tree (cbmsim) with simulated hits and MC truth |
geo_{identifier}.root | Full detector geometry exported from TGeoManager |
params_{identifier}.root | FairRoot runtime parameter database |
{identifier} is either a UUID generated automatically, or the value you pass with --tag. ShipReco.py reads the sim and geo files and writes a separate sim_{identifier}_rec.root containing only digitisation and reconstruction branches — the original simulation file is never modified. ShipAna.py then attaches the reconstruction file as a ROOT friend tree on the cbmsim tree, giving it simultaneous access to MC truth and reconstructed data.
The Standard Simulation → Reconstruction → Analysis Chain
Set up your environment
Choose the environment that matches your installation method:
- Pixi
- CVMFS / aliBuild
Inside the FairShip clone, prefix every command with The
pixi run, or start a shell once:activate.sh script automatically sets FAIRSHIP, GEOMPATH, PYTHONPATH, and LD_LIBRARY_PATH when the environment is activated.Run the simulation
The simulation macro runs Pythia-based event generation followed by full Geant4 transport through the SHiP detector geometry. The default configuration simulates HNL signal events.When the macro finishes you will see:Outputs:
- Pixi
- CVMFS / aliBuild
sim_my-simulation.root— MC truth and hit datageo_my-simulation.root— exported detector geometryparams_my-simulation.root— FairRoot parameter database
Run reconstruction
ShipReco.py performs hit digitisation, pattern recognition, and track fitting with GenFit. It reads the simulation and geometry files and writes a separate reconstruction file.- Pixi
- CVMFS / aliBuild
sim_my-simulation_rec.root— digitisation and reconstruction branches only; the originalsim_my-simulation.rootis untouched.
Run analysis
ShipAna.py opens the MC simulation file, attaches the reconstruction file as a friend tree (ship_reco_sim), and produces a set of diagnostic histograms and plots.- Pixi
- CVMFS / aliBuild
-i flag keeps Python interactive after the script finishes, letting you inspect histograms in the ROOT session. Successful completion prints:If you omit
-r, ShipAna.py automatically looks for a file named sim_my-simulation_rec.root in the current directory. If the input file already has the _rec suffix it is used directly and the script derives the MC file name by stripping _rec.Complete Command Reference
All steps together, for quick copying:EventCalc Signal Workflow
EventCalc is a dedicated tool for importing pre-generated signal event samples (for example, HNL decay kinematics computed externally) into the FairShip simulation chain. The workflow has two steps: first convert the input.dat file into a ROOT file, then run the standard simulation macro in EventCalc mode.
Convert the EventCalc input file
test_folder/test_input.root, a ROOT file containing the particle-level event records from the EventCalc generator.Event Display
The interactive event display visualises simulated hits, reconstructed tracks, and the detector geometry simultaneously. It is useful for sanity-checking individual events after the reco step.quit() or Ctrl-D.
Analysis Toolkit
For more structured pre-selection studies, FairShip includes an experimentalanalysis_toolkit module. An annotated example script is provided at $FAIRSHIP/examples/analysis_example.py and can be run after the reco step:
Next Steps
Simulation Overview
Configure the detector geometry, switch generator back-ends, and understand Geant4 transport options.
Reconstruction Overview
Learn about the digitisation pipeline, GenFit track fitting, and the experimental ACTS back-end.