TheDocumentation 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.
experimental.analysis_toolkit module provides two high-level classes for reconstructed-event analysis in SHiP. selection_check encapsulates the full standard pre-selection pipeline: it loads the detector geometry from a ROOT file, applies impact parameter, fiducial volume, track quality, and timing cuts on HNL decay candidates, and can render a colour-coded table of per-cut pass/fail results. event_inspector provides a complementary view at the Monte Carlo truth level, printing a formatted table of all MCTrack entries per event for rapid visual debugging.
selection_check
selection_check wraps all geometry-aware per-candidate calculations and pre-selection cuts. It must be initialised with a ROOT geometry file so it can set up the TGeoManager and read the ShipGeo configuration.
Constructor
An open
ROOT.TFile containing both the FAIRGeom geometry manager and the ShipGeo configuration object (in either JSON or pickle format). The geometry manager is retrieved via geo_file.Get("FAIRGeom") and the configuration via load_from_root_file.On construction the veto geometry YAML is also loaded from $FAIRSHIP/geometry/:veto_config_helium.yamlwhenship_geo.DecayVolumeMedium == "helium"veto_config_vacuums.yamlwhenship_geo.DecayVolumeMedium == "vacuums"
__init__:
| Attribute | Type | Description |
|---|---|---|
geometry_manager | TGeoManager | ROOT geometry manager loaded from the geo file |
ship_geo | Config | Full geometry configuration object |
veto_geo | AttrDict | Veto detector geometry parameters from YAML |
access_event
selection_check instance. This must be called once per event (or once per tree if iterating with for event in tree) before invoking any per-candidate method, since those methods read branches such as FitTracks, fitTrack2MC, and strawtubesPoint from self.tree.
The current event object obtained from iterating the
cbmsim tree (with the reconstruction friend attached).define_candidate_time
t0 from the ShipEventHeader is added.
The candidate decay vertex object. Must expose
GetVertex(), GetDaughter(i), and Momentum() methods, as provided by the SHiP reconstruction output.Estimated time at the decay vertex in nanoseconds (FairShip internal time units), averaged over all contributing straw hits from daughter tracks.
impact_parameter
(0, 0, ship_geo.target.z0) — the standard impact parameter used to reject combinatorial background.
The candidate object. Vertex and four-momentum are read via
GetVertex() and Momentum().Impact parameter in cm.
dist_to_innerwall
TGeoManager::FindNextBoundary. Returns 0 if the vertex is outside the decay volume or if the wall distance exceeds 100 m.
Candidate whose vertex is tested.
Minimum distance to the inner wall in cm, or
0 if outside the volume or wall distance exceeds 100 m.dist_to_vesselentrance
vertex.Z() - veto_geo.z0.
Candidate whose vertex z-coordinate is tested.
Distance in cm from the vessel entrance. Positive values are downstream of the entrance.
is_in_fiducial
- Downstream of the veto entrance (
vertex.Z() > veto_geo.z0) - Upstream of Track Station 1 (
vertex.Z() < ship_geo.TrackStation1.z) - Inside a volume whose ROOT geometry name starts with
"DecayVacuum_"
Candidate to test.
True if the decay vertex is within the defined fiducial volume.nDOF
Candidate providing daughter track indices via
GetDaughter(0) and GetDaughter(1).Array of shape
(2,) containing the rounded nDOF for the first and second daughter tracks, read from FitTracks[i].getFitStatus().getNdf().chi2nDOF
Candidate providing daughter track indices.
Array of shape
(2,) with chi2 / ndf for each daughter track.daughtermomentum
Candidate providing daughter track indices.
Array of shape
(2,) with momentum magnitude in GeV for each daughter, read from FitTracks[i].getFittedState().getMom().Mag().invariant_mass
Candidate exposing
GetMass().Invariant mass in GeV.
DOCA
Candidate exposing
GetDoca().DOCA in cm.
preselection_cut
True if all cuts pass. This is the umbrella method that calls all individual selection methods. The applied cuts are:
| Criterion | Cut |
|---|---|
| Number of candidates in event | == 1 |
| Fiducial volume | is_in_fiducial == True |
| Distance to inner wall | > 5 cm |
| Distance to vessel entrance | > 100 cm |
| Impact parameter | < IP_cut (in cm) |
| DOCA | < 1 cm |
| nDOF (both daughters) | > 25 |
| χ²/nDOF (both daughters) | < 5 |
| Daughter momentum (both) | > 1 GeV |
The candidate to evaluate.
Maximum allowed impact parameter in cm. Default is 250 cm.
When
True, prints a formatted tabulate grid table to stdout showing each criterion’s measured value, cut threshold, and pass/fail status (ANSI-coloured green/red).True if the candidate passes all pre-selection cuts, False otherwise.event_inspector
event_inspector provides a Monte Carlo truth viewer. It initialises the PDG database and registers the HNL particle type so that HNL tracks display with a meaningful name.
Constructor
ROOT.TDatabasePDG.Instance() and calls pythia8_conf.addHNLtoROOT() to register HNL PDG entries.
dump_event
MCTrack entries in the event using tabulate. Each row shows the track index, particle name (from PDG database, or "----" if unknown), PDG code, mother track ID, momentum components (Px, Py, Pz) in GeV/c, start vertex (x, y, z) in metres, Geant4 process name, and event weight.
The current event object, expected to contain a
MCTrack branch.Minimum momentum in GeV for a track to be included in the table. Tracks with
P < mom_threshold are skipped. Useful for suppressing low-momentum secondaries.Full example from examples/analysis_example.py
The following is the complete analysis workflow taken directly from examples/analysis_example.py: