# stezow/stogs architecture

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

- Interactive diagram: https://gitdiagram.com/stezow/stogs
- Repository: https://github.com/stezow/stogs

## Overview

SToGS is a GEANT4 simulation package for nuclear-structure and gamma-ray spectroscopy experiments. The principal workflow configures a run, constructs detector geometry and physics, generates primary particles, transports them through the simulation, and records event data. The graph preserves detector construction variants, physics-list choices, sensitive-detector hit handling, and ROOT-oriented event models. Source excerpts show only part of the dispatch and data flow; uncertain subsystem links are omitted or marked unverified.

Main entry points: [`csrc/SToGS_DetectorFactory.cc`](https://github.com/stezow/stogs/blob/master/csrc/SToGS_DetectorFactory.cc) (Detector factory), [`csrc/SToGS_UserActionManager.cc`](https://github.com/stezow/stogs/blob/master/csrc/SToGS_UserActionManager.cc) (Run configuration), [`SToGS_MY_Container/PARIS/ParisUserAction.cc`](https://github.com/stezow/stogs/blob/master/SToGS_MY_Container/PARIS/ParisUserAction.cc) (PARIS event actions), [`csrc/SToGS_MaterialConsultant.cc`](https://github.com/stezow/stogs/blob/master/csrc/SToGS_MaterialConsultant.cc) (Material consultant)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_run["Run control"]
  node_source["Simulation entry<br/>[SToGS_Source.cc]"]
  node_config["Run configuration"]
  node_detector_build["Detector builder"]
end

subgraph group_geometry["Detector geometry"]
  node_factory["Detector factory"]
  node_material["Material consultant"]
  node_generic_geometry["Generic geometry"]
  node_two_shells["Two-shell geometry"]
  node_germanium["Germanium detector"]
  node_scintillator["Scintillator detector"]
  node_paris_geometry["PARIS optical detector"]
end

subgraph group_transport["Generation and transport"]
  node_physics["Modular physics"]
  node_hadron["Hadron physics"]
  node_primary["Primary generation"]
  node_root_generator["ROOT event generator"]
  node_actions["Action initialization"]
end

subgraph group_events["Event data"]
  node_tracker_sd["Tracker sensitive detector"]
  node_cluster_sd["Cluster sensitive detector"]
  node_paris_actions["PARIS event actions<br/>[ParisUserAction.cc]"]
  node_base_events["ROOT event model"]
  node_paris_events["PARIS event model<br/>[ParisEvents.h]"]
  node_event_output["Event output handlers"]
end

node_user(("Experiment user"))

node_user -->|"starts run"| node_source
node_source -->|"reads settings"| node_config
node_source -.->|"launches builder"| node_detector_build
node_config -->|"selects physics"| node_physics
node_config -->|"selects actions"| node_event_output
node_config -.->|"selects setup"| node_factory
node_detector_build -->|"uses factory"| node_factory
node_factory -->|"builds materials"| node_material
node_generic_geometry -->|"loads geometry"| node_factory
node_generic_geometry -->|"references construction"| node_two_shells
node_germanium -->|"requests materials"| node_material
node_scintillator -->|"loads components"| node_factory
node_scintillator -->|"requests materials"| node_material
node_paris_geometry -->|"requests materials"| node_material
node_physics -->|"registers physics"| node_hadron
node_actions -->|"registers detector"| node_tracker_sd
node_actions -->|"registers detector"| node_cluster_sd
node_root_generator -->|"reads event model"| node_base_events
node_paris_actions -->|"reads hits"| node_tracker_sd
node_paris_actions -->|"reads hits"| node_cluster_sd
node_paris_actions -->|"fills events"| node_paris_events
node_event_output -.->|"dispatches actions"| node_paris_actions

click node_source "https://github.com/stezow/stogs/blob/master/SToGS_Source.cc"
click node_config "https://github.com/stezow/stogs/blob/master/csrc/SToGS_UserActionManager.cc"
click node_detector_build "https://github.com/stezow/stogs/blob/master/SToGS_DetectorBuilder.cc"
click node_factory "https://github.com/stezow/stogs/blob/master/csrc/SToGS_DetectorFactory.cc"
click node_material "https://github.com/stezow/stogs/blob/master/csrc/SToGS_MaterialConsultant.cc"
click node_generic_geometry "https://github.com/stezow/stogs/blob/master/csrc/SToGS_GenericsDF.cc"
click node_two_shells "https://github.com/stezow/stogs/blob/master/csrc/SToGS_TwoShellsDetectorConstruction.cc"
click node_germanium "https://github.com/stezow/stogs/blob/master/csrc/SToGS_SemiConductorGeDF.cc"
click node_scintillator "https://github.com/stezow/stogs/blob/master/csrc/SToGS_ScintillatorDF.cc"
click node_paris_geometry "https://github.com/stezow/stogs/blob/master/SToGS_MY_Container/PARIS/PW_OpticalDetectorConstruction.cc"
click node_physics "https://github.com/stezow/stogs/blob/master/csrc/SToGS_ModularPhysicsList.cc"
click node_hadron "https://github.com/stezow/stogs/blob/master/csrc/SToGS_HadronPhysicsList.cc"
click node_primary "https://github.com/stezow/stogs/blob/master/csrc/SToGS_BasicPrimaryGeneratorAction.cc"
click node_root_generator "https://github.com/stezow/stogs/blob/master/SToGS_MY_Container/toROOTGPS/toROOTGPSPrimaryGeneratorAction.cc"
click node_actions "https://github.com/stezow/stogs/blob/master/csrc/SToGS_UserActionInitialization.cc"
click node_tracker_sd "https://github.com/stezow/stogs/blob/master/csrc/SToGS_G4_TrackerSD.cc"
click node_cluster_sd "https://github.com/stezow/stogs/blob/master/csrc/SToGS_G4_CopClusterSD.cc"
click node_paris_actions "https://github.com/stezow/stogs/blob/master/SToGS_MY_Container/PARIS/ParisUserAction.cc"
click node_base_events "https://github.com/stezow/stogs/blob/master/analysis/SToGS/SToGS_BaseROOTEvents.h"
click node_paris_events "https://github.com/stezow/stogs/blob/master/analysis/ParisAnalysis/ParisEvents.h"
click node_event_output "https://github.com/stezow/stogs/blob/master/csrc/SToGS_UserActionManager.cc"

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_source,node_config,node_detector_build,node_user toneBlue
class node_factory,node_material,node_generic_geometry,node_two_shells,node_germanium,node_scintillator,node_paris_geometry toneAmber
class node_physics,node_hadron,node_primary,node_root_generator,node_actions toneMint
class node_tracker_sd,node_cluster_sd,node_paris_actions,node_base_events,node_paris_events,node_event_output toneRose
```

## Components

### Run control

- [Simulation entry](https://github.com/stezow/stogs/blob/master/SToGS_Source.cc): `SToGS_Source.cc`
- [Run configuration](https://github.com/stezow/stogs/blob/master/csrc/SToGS_UserActionManager.cc): `csrc/SToGS_UserActionManager.cc`
- [Detector builder](https://github.com/stezow/stogs/blob/master/SToGS_DetectorBuilder.cc): `SToGS_DetectorBuilder.cc`

### Detector geometry

- [Detector factory](https://github.com/stezow/stogs/blob/master/csrc/SToGS_DetectorFactory.cc): `csrc/SToGS_DetectorFactory.cc`
- [Material consultant](https://github.com/stezow/stogs/blob/master/csrc/SToGS_MaterialConsultant.cc): `csrc/SToGS_MaterialConsultant.cc`
- [Generic geometry](https://github.com/stezow/stogs/blob/master/csrc/SToGS_GenericsDF.cc): `csrc/SToGS_GenericsDF.cc`
- [Two-shell geometry](https://github.com/stezow/stogs/blob/master/csrc/SToGS_TwoShellsDetectorConstruction.cc): `csrc/SToGS_TwoShellsDetectorConstruction.cc`
- [Germanium detector](https://github.com/stezow/stogs/blob/master/csrc/SToGS_SemiConductorGeDF.cc): `csrc/SToGS_SemiConductorGeDF.cc`
- [Scintillator detector](https://github.com/stezow/stogs/blob/master/csrc/SToGS_ScintillatorDF.cc): `csrc/SToGS_ScintillatorDF.cc`
- [PARIS optical detector](https://github.com/stezow/stogs/blob/master/SToGS_MY_Container/PARIS/PW_OpticalDetectorConstruction.cc): `SToGS_MY_Container/PARIS/PW_OpticalDetectorConstruction.cc`

### Generation and transport

- [Modular physics](https://github.com/stezow/stogs/blob/master/csrc/SToGS_ModularPhysicsList.cc): `csrc/SToGS_ModularPhysicsList.cc`
- [Hadron physics](https://github.com/stezow/stogs/blob/master/csrc/SToGS_HadronPhysicsList.cc): `csrc/SToGS_HadronPhysicsList.cc`
- [Primary generation](https://github.com/stezow/stogs/blob/master/csrc/SToGS_BasicPrimaryGeneratorAction.cc): `csrc/SToGS_BasicPrimaryGeneratorAction.cc`
- [ROOT event generator](https://github.com/stezow/stogs/blob/master/SToGS_MY_Container/toROOTGPS/toROOTGPSPrimaryGeneratorAction.cc): `SToGS_MY_Container/toROOTGPS/toROOTGPSPrimaryGeneratorAction.cc`
- [Action initialization](https://github.com/stezow/stogs/blob/master/csrc/SToGS_UserActionInitialization.cc): `csrc/SToGS_UserActionInitialization.cc`

### Event data

- [Tracker sensitive detector](https://github.com/stezow/stogs/blob/master/csrc/SToGS_G4_TrackerSD.cc): `csrc/SToGS_G4_TrackerSD.cc`
- [Cluster sensitive detector](https://github.com/stezow/stogs/blob/master/csrc/SToGS_G4_CopClusterSD.cc): `csrc/SToGS_G4_CopClusterSD.cc`
- [PARIS event actions](https://github.com/stezow/stogs/blob/master/SToGS_MY_Container/PARIS/ParisUserAction.cc): `SToGS_MY_Container/PARIS/ParisUserAction.cc`
- [ROOT event model](https://github.com/stezow/stogs/blob/master/analysis/SToGS/SToGS_BaseROOTEvents.h): `analysis/SToGS/SToGS_BaseROOTEvents.h`
- [PARIS event model](https://github.com/stezow/stogs/blob/master/analysis/ParisAnalysis/ParisEvents.h): `analysis/ParisAnalysis/ParisEvents.h`
- [Event output handlers](https://github.com/stezow/stogs/blob/master/csrc/SToGS_UserActionManager.cc): `csrc/SToGS_UserActionManager.cc`

### Other components

- **Experiment user**

## Connections

- Experiment user → Simulation entry: starts run (evidence: `SToGS_Source.cc`)
- Simulation entry → Run configuration: reads settings (evidence: `SToGS_Source.cc`)
- Simulation entry → Detector builder: launches builder
- Run configuration → Modular physics: selects physics (evidence: `csrc/SToGS_UserActionManager.cc`)
- Run configuration → Event output handlers: selects actions (evidence: `csrc/SToGS_UserActionManager.cc`)
- Run configuration → Detector factory: selects setup
- Detector builder → Detector factory: uses factory (evidence: `SToGS_DetectorBuilder.cc`)
- Detector factory → Material consultant: builds materials (evidence: `csrc/SToGS_DetectorFactory.cc`)
- Generic geometry → Detector factory: loads geometry (evidence: `csrc/SToGS_GenericsDF.cc`)
- Generic geometry → Two-shell geometry: references construction (evidence: `csrc/SToGS_GenericsDF.cc`)
- Germanium detector → Material consultant: requests materials (evidence: `csrc/SToGS_SemiConductorGeDF.cc`)
- Scintillator detector → Detector factory: loads components (evidence: `csrc/SToGS_ScintillatorDF.cc`)
- Scintillator detector → Material consultant: requests materials (evidence: `csrc/SToGS_ScintillatorDF.cc`)
- PARIS optical detector → Material consultant: requests materials (evidence: `SToGS_MY_Container/PARIS/PW_OpticalDetectorConstruction.cc`)
- Modular physics → Hadron physics: registers physics (evidence: `csrc/SToGS_ModularPhysicsList.cc`)
- Action initialization → Tracker sensitive detector: registers detector (evidence: `csrc/SToGS_UserActionInitialization.cc`)
- Action initialization → Cluster sensitive detector: registers detector (evidence: `csrc/SToGS_UserActionInitialization.cc`)
- ROOT event generator → ROOT event model: reads event model (evidence: `SToGS_MY_Container/toROOTGPS/toROOTGPSPrimaryGeneratorAction.cc`)
- PARIS event actions → Tracker sensitive detector: reads hits (evidence: `SToGS_MY_Container/PARIS/ParisUserAction.cc`)
- PARIS event actions → Cluster sensitive detector: reads hits (evidence: `SToGS_MY_Container/PARIS/ParisUserAction.cc`)
- PARIS event actions → PARIS event model: fills events (evidence: `SToGS_MY_Container/PARIS/ParisUserAction.cc`)
- Event output handlers → PARIS event actions: dispatches actions
