actions
Loading...
Searching...
No Matches
gaction.cc
Go to the documentation of this file.
1// gemc
2#include "gaction.h"
5#include "run/gRunAction.h"
6
7
8GAction::GAction(std::shared_ptr<GOptions> gopts, std::shared_ptr<gdynamicdigitization::dRoutinesMap> digi_map) :
9 GBase(gopts, GACTION_LOGGER),
10 goptions(gopts),
11 digitization_routines_map(digi_map) { }
12
13
15 // Master-thread registration: register the run action only.
17
18 SetUserAction(new GRunAction(goptions, digitization_routines_map));
19}
20
21
22void GAction::Build() const {
23 // Worker-thread registration: primary generator, run action, then event action.
24 auto thread_id = G4Threading::G4GetThreadId();
25
26 log->debug(NORMAL, FUNCTION_NAME, "thread id: " + std::to_string(thread_id));
27
28 SetUserAction(new GPrimaryGeneratorAction(goptions));
29
30 auto* run_action = new GRunAction(goptions, digitization_routines_map);
31 SetUserAction(run_action);
32
33 SetUserAction(new GEventAction(goptions, run_action));
34}
GAction(std::shared_ptr< GOptions > gopts, std::shared_ptr< gdynamicdigitization::dRoutinesMap > digi_map)
Constructs the action initializer.
Definition gaction.cc:8
void Build() const override
Registers user actions for worker threads (and sequential mode).
Definition gaction.cc:22
void BuildForMaster() const override
Registers user actions for the master thread.
Definition gaction.cc:14
std::shared_ptr< GLogger > log
Handles event begin/end callbacks and triggers digitization + streaming.
void debug(debug_type type, Args &&... args) const
Generates primary vertices for each event.
Handles run begin/end callbacks and creates the per-thread run object.
Definition gRunAction.h:54
Declares GEventAction, responsible for per-event lifecycle hooks and event publication.
Declares GPrimaryGeneratorAction, the primary particle generation action.
Declares GRunAction, responsible for run lifecycle hooks and run object creation.
Declares GAction, the Geant4 action-initialization entry point for GEMC.
constexpr const char * GACTION_LOGGER
Definition gaction.h:27
#define FUNCTION_NAME
NORMAL