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)
 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
 
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="")
 
 GBase (const std::shared_ptr< GLogger > &logger)
 
 GBase (const GBase &)=default
 
 GBase (GBase &&) noexcept=default
 
virtual ~GBase ()
 
GBaseoperator= (const GBase &)=default
 
GBaseoperator= (GBase &&) noexcept=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 66 of file gRunAction.h.

Constructor & Destructor Documentation

◆ GRunAction() [1/3]

GRunAction::GRunAction ( std::shared_ptr< GOptions > gopts,
std::shared_ptr< gdynamicdigitization::dRoutinesMap > digi_map )
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.

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

◆ 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 131 of file gRunAction.h.

◆ get_digitization_routines_map()

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

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 95 of file gRunAction.h.

◆ get_streamer_threads_map()

auto GRunAction::get_streamer_threads_map ( ) const -> std::shared_ptr<const gstreamer::gstreamersMap>
inline

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 109 of file gRunAction.h.

◆ has_streamer_threads_map()

bool GRunAction::has_streamer_threads_map ( ) const
inline

Definition at line 117 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 149 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 170 of file gRunAction.h.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

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