Class RMGVOutputScheme¶
Defined in File RMGVOutputScheme.hh
Inheritance Relationships¶
Derived Types¶
public RMGGeomBenchOutputScheme(Class RMGGeomBenchOutputScheme)public RMGGeometryCheckOutputScheme(Class RMGGeometryCheckOutputScheme)public RMGGermaniumOutputScheme(Class RMGGermaniumOutputScheme)public RMGIsotopeFilterScheme(Class RMGIsotopeFilterScheme)public RMGOpticalOutputScheme(Class RMGOpticalOutputScheme)public RMGParticleFilterScheme(Class RMGParticleFilterScheme)public RMGScintillatorOutputScheme(Class RMGScintillatorOutputScheme)public RMGTrackOutputScheme(Class RMGTrackOutputScheme)public RMGVertexOutputScheme(Class RMGVertexOutputScheme)
Class Documentation¶
-
class RMGVOutputScheme¶
Virtual output scheme interface.
This abstract class defines the interface for output schemes that transform and store hit-level simulation data into persistent storage (e.g. ntuples). It provides virtual methods for setting output names, clearing event data, storing event information, and for hooking into various Geant4 user actions (e.g. stacking, tracking, etc.).
Subclassed by RMGGeomBenchOutputScheme, RMGGeometryCheckOutputScheme, RMGGermaniumOutputScheme, RMGIsotopeFilterScheme, RMGOpticalOutputScheme, RMGParticleFilterScheme, RMGScintillatorOutputScheme, RMGTrackOutputScheme, RMGVertexOutputScheme
Public Functions
-
RMGVOutputScheme() = default¶
-
virtual ~RMGVOutputScheme() = default¶
-
inline virtual void AssignOutputNames(G4AnalysisManager*)¶
Initialize ntuple column names for this output scheme.
This function is called during run initialization to create and assign output column names for the analysis manager.
-
inline virtual void ClearBeforeEvent()¶
Clear any event-specific data.
Called before processing a new event, this function should clear any stored data from the previous event.
-
inline virtual bool ShouldDiscardEvent(const G4Event*)¶
Decide whether to discard the current event.
This function is called at the end of each event. It can be used to filter out events that do not meet specified criteria.
- Returns:
True if the event should be discarded, false otherwise.
-
inline virtual bool StoreAlways() const¶
Indicates whether the output scheme always stores event data.
Useful for output schemes that should always write out information regardless of filtering criteria defined by any output scheme in RMGVOutputScheme::ShouldDiscardEvent.
- Returns:
True if the scheme always stores event data, false otherwise.
-
inline virtual void StoreEvent(const G4Event*)¶
Store the event data.
This function is invoked at the end of an event to store the output data in the persistent file. Derived classes should implement how event data is recorded.
-
inline virtual std::optional<G4ClassificationOfNewTrack> StackingActionClassify(const G4Track*, const int)¶
Hook for classifying new tracks during the stacking phase.
This method allows the output scheme to classify tracks in the stacking action, e.g. to discard or temporarily hold them.
aTrackis the pointer to theG4Trackbeing classified.stageis the current stage index in the stacking process.- Returns:
An optional classification value; if empty, no classification is applied.
-
inline virtual std::optional<bool> StackingActionNewStage(const int)¶
Hook for transitioning to a new stacking stage.
Output schemes can use this method to determine whether waiting tracks should be cleared as the stacking process advances to a new stage.
stageis the new stacking stage index.- Returns:
An optional boolean decision; if empty, no action is taken.
-
inline virtual void TrackingActionPre(const G4Track*)¶
Hook called before tracking a new particle.
Output schemes may use this to record any track-specific information required for output.
-
inline virtual void TrackingActionPost(const G4Track*)¶
Hook called after tracking a new particle.
Output schemes may use this to record any track-specific information required for output.
-
inline virtual void SteppingAction(const G4Step*)¶
Hook called after each step.
Output schemes may use this to record any step-specific information required for output.
-
inline virtual void EndOfRunAction(const G4Run*)¶
Perform final actions at the end of a run.
This function can be used by derived output schemes to finalize or write remaining data.
-
inline void SetNtuplePerDetector(bool ntuple_per_det)¶
Specify whether to create separate ntuples for each detector.
- Parameters:
ntuple_per_det – True to assign one ntuple per detector; false to use a single shared ntuple per output scheme type.
-
inline void SetNtupleUseVolumeName(bool use_vol_name)¶
Specify whether to use the physical volume name for naming ntuples.
- Parameters:
use_vol_name – True to use the volume name; false to use the naming scheme based on the detector uid.
-
inline void SetEventIDOffset(int offset)¶
Public Static Attributes
-
static std::string fUIDKeyFormatString = "det{:03}"¶
Protected Functions
-
inline virtual std::string GetNtupleName(RMGDetectorMetadata det) const¶
-
inline virtual std::string GetNtupleNameFlat() const¶
-
inline void CreateNtupleFOrDColumn(G4AnalysisManager *ana_man, int nt, std::string name, bool use_float)¶
-
inline void FillNtupleFOrDColumn(G4AnalysisManager *ana_man, int nt, int col, double val, bool use_float)¶
-
inline int GetEventIDForStorage(const G4Event *evt) const¶
-
RMGVOutputScheme() = default¶