# snd-lhc/sndsw architecture

> Architecture diagram of the GitHub repository snd-lhc/sndsw, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/snd-lhc/sndsw
- Repository: https://github.com/snd-lhc/sndsw

## Overview

sndsw is the SND@LHC detector software framework, built on FairShip/FairRoot and exposed through C++ detector modules and Python/PyROOT workflows. Its documented path includes configuring geometry and running simulation, digitizing simulated detector points into hits and clusters, converting raw data, and inspecting or analyzing event data. GENFIT supplies reusable measurement, field, track-representation, and fitting machinery; SND-specific detector and reconstruction components sit alongside it. The README establishes the main workflow links; source excerpts and the index support selected internal links, while unsampled integration details are omitted.

Main entry points: [`shipLHC/run_simSND.py`](https://github.com/snd-lhc/sndsw/blob/master/shipLHC/run_simSND.py) (SND simulation), [`genfit/core`](https://github.com/snd-lhc/sndsw/tree/master/genfit/core) (Track framework), [`macro/eventDisplay.py`](https://github.com/snd-lhc/sndsw/blob/master/macro/eventDisplay.py) (Event display), [`python/MufluxDigiReco.py`](https://github.com/snd-lhc/sndsw/blob/master/python/MufluxDigiReco.py) (Muon reconstruction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_simulation["Simulation and geometry"]
  node_geometry["Geometry configuration"]
  node_generators["Event generators"]
  node_simrun["SND simulation<br/>[run_simSND.py]"]
end

subgraph group_detector["Detector and data"]
  node_detectors["Detector models"]
  node_digitization["MC digitization<br/>[DigiTaskSND.h]"]
  node_rawconversion["Raw conversion<br/>[convertRawData.py]"]
  node_eventbuilder["MC event building<br/>[MCEventBuilder.h]"]
end

subgraph group_tracking["Tracking and fields"]
  node_genfitcore["Track framework"]
  node_measurements["Track measurements"]
  node_trackrep["Runge-Kutta tracks<br/>[RKTrackRep.h]"]
  node_fitters["Track fitters"]
  node_fieldmanager["Magnetic field access<br/>[FieldManager.h]"]
  node_mufluxreco["Muon reconstruction<br/>[MufluxDigiReco.py]"]
end

subgraph group_analysis["Analysis and display"]
  node_analysiscuts["Analysis selection"]
  node_goldenneutrino["Neutrino filtering"]
  node_eventdisplay["Event display<br/>[eventDisplay.py]"]
  node_charmmonitor["Drift-tube monitoring"]
end

subgraph group_shared["Shared runtime"]
  node_geoconfig["Geometry registry<br/>[ShipGeoConfig.py]"]
  node_units["Physical units<br/>[shipunit.py]"]
  node_rootutils["ROOT utilities<br/>[rootUtils.py]"]
end

node_user(("Researcher"))
node_rootdata[("ROOT event data")]
node_rawsource[("Detector raw data")]

node_user -->|"runs simulation"| node_simrun
node_geometry -.->|"configures geometry"| node_simrun
node_generators -->|"supplies events"| node_simrun
node_simrun -.->|"transports particles"| node_detectors
node_simrun -->|"writes events"| node_rootdata
node_rootdata -->|"provides MC points"| node_digitization
node_digitization -->|"writes hits"| node_rootdata
node_rawsource -->|"provides raw data"| node_rawconversion
node_rawconversion -->|"writes converted data"| node_rootdata
node_eventbuilder -.->|"builds event data"| node_rootdata
node_mufluxreco -.->|"uses track framework"| node_genfitcore
node_genfitcore -.->|"uses measurements"| node_measurements
node_trackrep -->|"extends track representation"| node_genfitcore
node_genfitcore -->|"provides field access"| node_fieldmanager
node_mufluxreco -.->|"reconstructs tracks"| node_rootdata
node_user -.->|"selects events"| node_analysiscuts
node_user -.->|"filters neutrinos"| node_goldenneutrino
node_user -->|"views events"| node_eventdisplay
node_rootdata -->|"loads event data"| node_eventdisplay
node_rootdata -.->|"supplies monitoring data"| node_charmmonitor
node_eventdisplay -->|"loads configuration"| node_geoconfig
node_eventdisplay -.->|"uses ROOT helpers"| node_rootutils
node_geoconfig -->|"uses units"| node_units

click node_geometry "https://github.com/snd-lhc/sndsw/tree/master/geometry"
click node_generators "https://github.com/snd-lhc/sndsw/tree/master/shipgen"
click node_simrun "https://github.com/snd-lhc/sndsw/blob/master/shipLHC/run_simSND.py"
click node_detectors "https://github.com/snd-lhc/sndsw/tree/master/shipLHC"
click node_digitization "https://github.com/snd-lhc/sndsw/blob/master/sndFairTasks/DigiTaskSND.h"
click node_rawconversion "https://github.com/snd-lhc/sndsw/blob/master/shipLHC/rawData/convertRawData.py"
click node_eventbuilder "https://github.com/snd-lhc/sndsw/blob/master/sndFairTasks/MCEventBuilder.h"
click node_genfitcore "https://github.com/snd-lhc/sndsw/tree/master/genfit/core"
click node_measurements "https://github.com/snd-lhc/sndsw/tree/master/genfit/measurements"
click node_trackrep "https://github.com/snd-lhc/sndsw/blob/master/genfit/include/genfit/RKTrackRep.h"
click node_fitters "https://github.com/snd-lhc/sndsw/tree/master/genfit/fitters"
click node_fieldmanager "https://github.com/snd-lhc/sndsw/blob/master/genfit/core/include/FieldManager.h"
click node_mufluxreco "https://github.com/snd-lhc/sndsw/blob/master/python/MufluxDigiReco.py"
click node_analysiscuts "https://github.com/snd-lhc/sndsw/tree/master/analysis/cuts"
click node_goldenneutrino "https://github.com/snd-lhc/sndsw/blob/master/analysis/neutrinoFilterGoldenSample_stage2.py"
click node_eventdisplay "https://github.com/snd-lhc/sndsw/blob/master/macro/eventDisplay.py"
click node_charmmonitor "https://github.com/snd-lhc/sndsw/blob/master/charmdet/drifttubeMonitoring.py"
click node_geoconfig "https://github.com/snd-lhc/sndsw/blob/master/python/ShipGeoConfig.py"
click node_units "https://github.com/snd-lhc/sndsw/blob/master/python/shipunit.py"
click node_rootutils "https://github.com/snd-lhc/sndsw/blob/master/python/rootUtils.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_geometry,node_generators,node_simrun toneBlue
class node_detectors,node_digitization,node_rawconversion,node_eventbuilder,node_rootdata,node_rawsource toneAmber
class node_genfitcore,node_measurements,node_trackrep,node_fitters,node_fieldmanager,node_mufluxreco toneMint
class node_analysiscuts,node_goldenneutrino,node_eventdisplay,node_charmmonitor toneRose
class node_geoconfig,node_units,node_rootutils,node_user toneIndigo
```

## Components

### Simulation and geometry

- [Geometry configuration](https://github.com/snd-lhc/sndsw/tree/master/geometry): `geometry`
- [Event generators](https://github.com/snd-lhc/sndsw/tree/master/shipgen): `shipgen`
- [SND simulation](https://github.com/snd-lhc/sndsw/blob/master/shipLHC/run_simSND.py): `shipLHC/run_simSND.py`

### Detector and data

- [Detector models](https://github.com/snd-lhc/sndsw/tree/master/shipLHC): `shipLHC`
- [MC digitization](https://github.com/snd-lhc/sndsw/blob/master/sndFairTasks/DigiTaskSND.h): `sndFairTasks/DigiTaskSND.h`
- [Raw conversion](https://github.com/snd-lhc/sndsw/blob/master/shipLHC/rawData/convertRawData.py): `shipLHC/rawData/convertRawData.py`
- [MC event building](https://github.com/snd-lhc/sndsw/blob/master/sndFairTasks/MCEventBuilder.h): `sndFairTasks/MCEventBuilder.h`

### Tracking and fields

- [Track framework](https://github.com/snd-lhc/sndsw/tree/master/genfit/core): `genfit/core`
- [Track measurements](https://github.com/snd-lhc/sndsw/tree/master/genfit/measurements): `genfit/measurements`
- [Runge-Kutta tracks](https://github.com/snd-lhc/sndsw/blob/master/genfit/include/genfit/RKTrackRep.h): `genfit/include/genfit/RKTrackRep.h`
- [Track fitters](https://github.com/snd-lhc/sndsw/tree/master/genfit/fitters): `genfit/fitters`
- [Magnetic field access](https://github.com/snd-lhc/sndsw/blob/master/genfit/core/include/FieldManager.h): `genfit/core/include/FieldManager.h`
- [Muon reconstruction](https://github.com/snd-lhc/sndsw/blob/master/python/MufluxDigiReco.py): `python/MufluxDigiReco.py`

### Analysis and display

- [Analysis selection](https://github.com/snd-lhc/sndsw/tree/master/analysis/cuts): `analysis/cuts`
- [Neutrino filtering](https://github.com/snd-lhc/sndsw/blob/master/analysis/neutrinoFilterGoldenSample_stage2.py): `analysis/neutrinoFilterGoldenSample_stage2.py`
- [Event display](https://github.com/snd-lhc/sndsw/blob/master/macro/eventDisplay.py): `macro/eventDisplay.py`
- [Drift-tube monitoring](https://github.com/snd-lhc/sndsw/blob/master/charmdet/drifttubeMonitoring.py): `charmdet/drifttubeMonitoring.py`

### Shared runtime

- [Geometry registry](https://github.com/snd-lhc/sndsw/blob/master/python/ShipGeoConfig.py): `python/ShipGeoConfig.py`
- [Physical units](https://github.com/snd-lhc/sndsw/blob/master/python/shipunit.py): `python/shipunit.py`
- [ROOT utilities](https://github.com/snd-lhc/sndsw/blob/master/python/rootUtils.py): `python/rootUtils.py`

### Other components

- **Researcher**
- **ROOT event data**
- **Detector raw data**

## Connections

- Researcher → SND simulation: runs simulation (evidence: `README.md`)
- Geometry configuration → SND simulation: configures geometry
- Event generators → SND simulation: supplies events (evidence: `README.md`)
- SND simulation → Detector models: transports particles
- SND simulation → ROOT event data: writes events (evidence: `README.md`)
- ROOT event data → MC digitization: provides MC points (evidence: `README.md`)
- MC digitization → ROOT event data: writes hits (evidence: `README.md`)
- Detector raw data → Raw conversion: provides raw data (evidence: `README.md`)
- Raw conversion → ROOT event data: writes converted data (evidence: `README.md`)
- MC event building → ROOT event data: builds event data
- Muon reconstruction → Track framework: uses track framework
- Track framework → Track measurements: uses measurements (evidence: `genfit/measurements/include/FullMeasurement.h`)
- Runge-Kutta tracks → Track framework: extends track representation (evidence: `genfit/include/genfit/RKTrackRep.h`)
- Track framework → Magnetic field access: provides field access (evidence: `genfit/core/include/FieldManager.h`)
- Muon reconstruction → ROOT event data: reconstructs tracks
- Researcher → Analysis selection: selects events
- Researcher → Neutrino filtering: filters neutrinos
- Researcher → Event display: views events (evidence: `README.md`)
- ROOT event data → Event display: loads event data (evidence: `README.md`)
- ROOT event data → Drift-tube monitoring: supplies monitoring data
- Event display → Geometry registry: loads configuration (evidence: `macro/eventDisplay.py`)
- Event display → ROOT utilities: uses ROOT helpers
- Geometry registry → Physical units: uses units (evidence: `python/ShipGeoConfig.py`)
