remage
Simulation framework for HPGe-based experiments
 
Loading...
Searching...
No Matches
RMGVOutputScheme Class Reference

Virtual output scheme interface. More...

#include <RMGVOutputScheme.hh>

Inheritance diagram for RMGVOutputScheme:

Public Member Functions

virtual void AssignOutputNames (G4AnalysisManager *)
 Initialize ntuple column names for this output scheme.
 
virtual void ClearBeforeEvent ()
 Clear any event-specific data.
 
virtual bool ShouldDiscardEvent (const G4Event *)
 Decide whether to discard the current event.
 
virtual bool StoreAlways () const
 Indicates whether the output scheme always stores event data.
 
virtual void StoreEvent (const G4Event *)
 Store the event data.
 
virtual std::optional< G4ClassificationOfNewTrack > StackingActionClassify (const G4Track *, const int)
 Hook for classifying new tracks during the stacking phase.
 
virtual std::optional< bool > StackingActionNewStage (const int)
 Hook for transitioning to a new stacking stage.
 
virtual void TrackingActionPre (const G4Track *)
 Hook called before tracking a new particle.
 
virtual void TrackingActionPost (const G4Track *)
 Hook called after tracking a new particle.
 
virtual void SteppingAction (const G4Step *)
 Hook called after each step.
 
virtual void EndOfRunAction (const G4Run *)
 Perform final actions at the end of a run.
 
void SetNtuplePerDetector (bool ntuple_per_det)
 Specify whether to create separate ntuples for each detector.
 
void SetNtupleUseVolumeName (bool use_vol_name)
 Specify whether to use the physical volume name for naming ntuples.
 
void SetEventIDOffset (int offset)
 

Static Public Attributes

static std::string fUIDKeyFormatString = "det{:03}"
 

Protected Member Functions

virtual std::string GetNtupleName (RMGDetectorMetadata det) const
 
virtual std::string GetNtupleNameFlat () const
 
void CreateNtupleFOrDColumn (G4AnalysisManager *ana_man, int nt, std::string name, bool use_float)
 
void FillNtupleFOrDColumn (G4AnalysisManager *ana_man, int nt, int col, double val, bool use_float)
 
int GetEventIDForStorage (const G4Event *evt) const
 

Protected Attributes

bool fNtuplePerDetector = true
 
bool fNtupleUseVolumeName = false
 
int fEventIDOffset = 0
 

Detailed Description

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.).

Member Function Documentation

◆ AssignOutputNames()

virtual void RMGVOutputScheme::AssignOutputNames ( G4AnalysisManager * )
inlinevirtual

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.

Reimplemented in RMGGeomBenchOutputScheme, RMGGermaniumOutputScheme, RMGOpticalOutputScheme, RMGScintillatorOutputScheme, RMGTrackOutputScheme, and RMGVertexOutputScheme.

◆ ClearBeforeEvent()

virtual void RMGVOutputScheme::ClearBeforeEvent ( )
inlinevirtual

Clear any event-specific data.

Called before processing a new event, this function should clear any stored data from the previous event.

Reimplemented in RMGTrackOutputScheme.

◆ EndOfRunAction()

virtual void RMGVOutputScheme::EndOfRunAction ( const G4Run * )
inlinevirtual

Perform final actions at the end of a run.

This function can be used by derived output schemes to finalize or write remaining data.

Reimplemented in RMGGermaniumOutputScheme, and RMGTrackOutputScheme.

◆ SetNtuplePerDetector()

void RMGVOutputScheme::SetNtuplePerDetector ( bool ntuple_per_det)
inline

Specify whether to create separate ntuples for each detector.

Parameters
ntuple_per_detTrue to assign one ntuple per detector; false to use a single shared ntuple per output scheme type.

◆ SetNtupleUseVolumeName()

void RMGVOutputScheme::SetNtupleUseVolumeName ( bool use_vol_name)
inline

Specify whether to use the physical volume name for naming ntuples.

Parameters
use_vol_nameTrue to use the volume name; false to use the naming scheme based on the detector uid.

◆ ShouldDiscardEvent()

virtual bool RMGVOutputScheme::ShouldDiscardEvent ( const G4Event * )
inlinevirtual

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.

Reimplemented in RMGGermaniumOutputScheme, RMGIsotopeFilterScheme, and RMGScintillatorOutputScheme.

◆ StackingActionClassify()

virtual std::optional< G4ClassificationOfNewTrack > RMGVOutputScheme::StackingActionClassify ( const G4Track * ,
const int  )
inlinevirtual

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.

aTrack is the pointer to the G4Track being classified. stage is the current stage index in the stacking process.

Returns
An optional classification value; if empty, no classification is applied.

Reimplemented in RMGGermaniumOutputScheme, RMGIsotopeFilterScheme, RMGParticleFilterScheme, and RMGVolumeDistanceStacker.

◆ StackingActionNewStage()

virtual std::optional< bool > RMGVOutputScheme::StackingActionNewStage ( const int )
inlinevirtual

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.

stage is the new stacking stage index.

Returns
An optional boolean decision; if empty, no action is taken.

Reimplemented in RMGGermaniumOutputScheme, and RMGIsotopeFilterScheme.

◆ SteppingAction()

virtual void RMGVOutputScheme::SteppingAction ( const G4Step * )
inlinevirtual

Hook called after each step.

Output schemes may use this to record any step-specific information required for output.

Reimplemented in RMGGeometryCheckOutputScheme.

◆ StoreAlways()

virtual bool RMGVOutputScheme::StoreAlways ( ) const
inlinenodiscardvirtual

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.

Reimplemented in RMGGeomBenchOutputScheme, RMGTrackOutputScheme, and RMGVertexOutputScheme.

◆ StoreEvent()

virtual void RMGVOutputScheme::StoreEvent ( const G4Event * )
inlinevirtual

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.

Reimplemented in RMGGermaniumOutputScheme, RMGOpticalOutputScheme, RMGScintillatorOutputScheme, RMGTrackOutputScheme, and RMGVertexOutputScheme.

◆ TrackingActionPost()

virtual void RMGVOutputScheme::TrackingActionPost ( const G4Track * )
inlinevirtual

Hook called after tracking a new particle.

Output schemes may use this to record any track-specific information required for output.

Reimplemented in RMGGeometryCheckOutputScheme.

◆ TrackingActionPre()

virtual void RMGVOutputScheme::TrackingActionPre ( const G4Track * )
inlinevirtual

Hook called before tracking a new particle.

Output schemes may use this to record any track-specific information required for output.

Reimplemented in RMGGeometryCheckOutputScheme, RMGIsotopeFilterScheme, and RMGTrackOutputScheme.


The documentation for this class was generated from the following file: