Implements run-level setup, data collection, and output handling for the PALLAS simulation.
More...
Implements run-level setup, data collection, and output handling for the PALLAS simulation.
- Author
- Arnaud HUBER huber.nosp@m.@lp2.nosp@m.ib.in.nosp@m.2p3..nosp@m.fr - Alexei SYTOV sytov.nosp@m.@inf.nosp@m.n.it
- Date
- 2025
- Copyright
- PALLAS Project - GEANT4 Collaboration
This file contains the method definitions for the PlasmaMLPALLASRunAction
class declared in PlasmaMLPALLASRunAction.hh
. It manages:
- Initialization of run-wide ROOT files and trees
- Thread-safe data collection in multi-threaded runs
- Branch creation for all recorded statistics
- Interaction with primary generator and geometry to populate run metadata
- Begin/end-of-run hooks to prepare and finalize data storage
The run action workflow:
- BeginOfRunAction:
- Locks file access (multi-thread safety)
- Builds the ROOT output file name based on threading context
- Creates TTree objects for each statistics category
- Defines ROOT branches for run-wide parameters and measurements
- Initializes the random seed
- During the run:
- Updates statistics via
UpdateStatistics()
and specialized variants
- EndOfRunAction:
- Finalizes statistics
- Writes all TTrees to the ROOT file
- Closes the file and releases resources
Thread safety is ensured via:
std::atomic<int> activeThreads
for counting active threads
G4Mutex fileMutex
for synchronized file access
- Note
- This class uses Geant4's ROOT integration to structure physics output in an analysis-friendly format.