actions
Loading...
Searching...
No Matches
GRunAction Class Reference

Handles run begin/end callbacks and creates the thread-local GRun object. More...

#include <gRunAction.h>

Public Member Functions

 GRunAction (std::shared_ptr< GOptions > gopts, std::shared_ptr< gdynamicdigitization::dRoutinesMap > digi_map, std::shared_ptr< GAnalysisAccumulator > analysis_accumulator=nullptr)
 Constructs the run action.
 ~GRunAction () override=default
 GRunAction (const GRunAction &)=delete
GRunActionoperator= (const GRunAction &)=delete
 GRunAction (GRunAction &&)=delete
GRunActionoperator= (GRunAction &&)=delete
auto get_digitization_routines_map () const -> std::shared_ptr< gdynamicdigitization::dRoutinesMap >
 Returns the shared digitization-routine map used by this run action.
auto get_streamer_threads_map () const -> std::shared_ptr< const gstreamer::gstreamersMap >
 Returns the worker-thread streamer map, if it has been instantiated.
bool has_streamer_threads_map () const
bool analysis_enabled () const
 Return whether this run action has a GUI Analyzer shard.
void record_analysis_digitized (const std::string &detector, const GDigitizedData &data)
 Discover digitized variables in one accepted record and add them to this thread's shard.
void record_analysis_true (const std::string &detector, const GTrueInfoData &data)
 Discover true-information variables in one record and add them to this thread's shard.
void collect_event_data_collections (const std::string &hcSDName, std::unique_ptr< GDigitizedData > digi_data)
 Adds one run-mode digitized payload to the current thread run-data collection.
void increment_run_events_processed ()
 Increments the number of events processed by the current thread for this run.
void increment_run_events_with_payload ()
 Increments the number of events that produced run-mode payload.
Public Member Functions inherited from GBase< GRunAction >
 GBase (const std::shared_ptr< GOptions > &gopt, std::string logger_name="")
virtual ~GBase ()
GBaseoperator= (const GBase &)=default

Additional Inherited Members

Protected Attributes inherited from GBase< GRunAction >
std::shared_ptr< GLoggerlog

Detailed Description

This class is the GEMC implementation of the Geant4 run action. It participates in both worker-thread and master-thread execution.

Its main responsibilities are:

  • create the per-thread GRun instance through the private method GenerateRun();
  • initialize run-scoped bookkeeping at the start of a run;
  • determine whether event-mode and/or run-mode streamers are needed;
  • open and close the appropriate streamer connections;
  • accumulate run-mode data on worker threads;
  • gather and publish merged run-mode data on the master thread.

Threading model:

  • Worker threads can own thread streamer maps used for event publication.
  • The master thread can own a run streamer map used for merged run publication.
  • Worker-produced run data are moved into a protected static pool and consumed later by the master thread at run end.

Definition at line 67 of file gRunAction.h.

Constructor & Destructor Documentation

◆ GRunAction() [1/3]

GRunAction::GRunAction ( std::shared_ptr< GOptions > gopts,
std::shared_ptr< gdynamicdigitization::dRoutinesMap > digi_map,
std::shared_ptr< GAnalysisAccumulator > analysis_accumulator = nullptr )
explicit
Parameters
goptsShared configuration object used by the run action and the GRun object it creates.
digi_mapShared map associating collection names with digitization routines.
analysis_accumulatorGUI-only Analyzer service; null in batch mode.

Definition at line 16 of file gRunAction.cc.

◆ ~GRunAction()

GRunAction::~GRunAction ( )
overridedefault

◆ GRunAction() [2/3]

GRunAction::GRunAction ( const GRunAction & )
delete

◆ GRunAction() [3/3]

GRunAction::GRunAction ( GRunAction && )
delete

Member Function Documentation

◆ analysis_enabled()

bool GRunAction::analysis_enabled ( ) const
inlinenodiscard

Definition at line 125 of file gRunAction.h.

◆ collect_event_data_collections()

void GRunAction::collect_event_data_collections ( const std::string & hcSDName,
std::unique_ptr< GDigitizedData > digi_data )
inline

This method is used by event processing when a digitization routine reports that its output should be accumulated at run scope rather than published immediately at event scope.

Parameters
hcSDNameName of the hit collection or sensitive detector associated with the payload.
digi_dataDigitized payload to transfer into the run-level data collection.

Definition at line 151 of file gRunAction.h.

◆ get_digitization_routines_map()

auto GRunAction::get_digitization_routines_map ( ) const->std::shared_ptr< gdynamicdigitization::dRoutinesMap >
inlinenodiscard

Event processing uses this map to resolve the digitization routine associated with each hit collection name.

Returns
Shared pointer to the digitization-routine map.

Definition at line 98 of file gRunAction.h.

◆ get_streamer_threads_map()

auto GRunAction::get_streamer_threads_map ( ) const->std::shared_ptr< constgstreamer::gstreamersMap >
inlinenodiscard

The map is created lazily on worker threads during the private method BeginOfRunAction() when event-mode publication is required.

Returns
Shared pointer to the worker-thread streamer map, or nullptr when unavailable.

Definition at line 112 of file gRunAction.h.

◆ has_streamer_threads_map()

bool GRunAction::has_streamer_threads_map ( ) const
inlinenodiscard

Definition at line 120 of file gRunAction.h.

◆ increment_run_events_processed()

void GRunAction::increment_run_events_processed ( )
inline

The counter is stored in the run-data header and is updated once per processed event, independently of whether that event produces any payload.

Definition at line 169 of file gRunAction.h.

◆ increment_run_events_with_payload()

void GRunAction::increment_run_events_with_payload ( )
inline

This counter is updated only for events that contributed at least one payload entry to the run-level accumulation path.

Definition at line 190 of file gRunAction.h.

◆ operator=() [1/2]

GRunAction & GRunAction::operator= ( const GRunAction & )
delete

◆ operator=() [2/2]

GRunAction & GRunAction::operator= ( GRunAction && )
delete

◆ record_analysis_digitized()

void GRunAction::record_analysis_digitized ( const std::string & detector,
const GDigitizedData & data )
inline

Definition at line 128 of file gRunAction.h.

◆ record_analysis_true()

void GRunAction::record_analysis_true ( const std::string & detector,
const GTrueInfoData & data )
inline

Definition at line 135 of file gRunAction.h.


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