actions
Loading...
Searching...
No Matches
gaction.h
Go to the documentation of this file.
1#pragma once
2
3// geant4
4#include "G4VUserActionInitialization.hh"
5
6// gemc
7#include <gemc/gbase/gbase.h>
8#include <gemc/ganalysis/gAnalysisAccumulator.h>
9#include <gemc/gdynamicDigitization/gdynamicdigitization.h>
10#include <gemc/gstreamer/gstreamer.h>
11
12// the other actions, so we can define the options all at once
13#include "event/gEventAction.h"
14#include "run/gRunAction.h"
15#include "run/gRun.h"
17
29
30constexpr const char* GACTION_LOGGER = "gaction";
31
64
65
95class GAction : public GBase<GAction>, public G4VUserActionInitialization {
96public:
104 explicit GAction(std::shared_ptr<GOptions> gopts,
105 std::shared_ptr<gdynamicdigitization::dRoutinesMap> digi_map,
106 std::shared_ptr<GAnalysisAccumulator> analysis_accumulator = nullptr);
107
108 ~GAction() override = default;
109
110 GAction(const GAction&) = delete;
111 GAction& operator=(const GAction&) = delete;
112 GAction(GAction&&) = delete;
114
131 void Build() const override;
132
140 void BuildForMaster() const override;
141
142private:
150 std::shared_ptr<GOptions> goptions;
151
158 std::shared_ptr<gdynamicdigitization::dRoutinesMap> digitization_routines_map;
159
165 std::shared_ptr<GAnalysisAccumulator> analysis_accumulator;
166
174 std::shared_ptr<std::vector<GparticlePtr>> sharedParticles_;
175
176public:
178 std::shared_ptr<std::vector<GparticlePtr>> getSharedParticles() const { return sharedParticles_; }
179};
GAction(std::shared_ptr< GOptions > gopts, std::shared_ptr< gdynamicdigitization::dRoutinesMap > digi_map, std::shared_ptr< GAnalysisAccumulator > analysis_accumulator=nullptr)
Constructs the action initializer used by the Geant4 run manager.
Definition gaction.cc:13
GAction(const GAction &)=delete
std::shared_ptr< std::vector< GparticlePtr > > getSharedParticles() const
Returns the shared particle list so the pmaker GUI can wire its tabs to the same objects.
Definition gaction.h:178
~GAction() override=default
GAction(GAction &&)=delete
void Build() const override
Registers the user actions required by worker threads and sequential execution.
Definition gaction.cc:40
void BuildForMaster() const override
Registers the user actions required by the master thread.
Definition gaction.cc:31
GAction & operator=(const GAction &)=delete
GAction & operator=(GAction &&)=delete
GBase(const std::shared_ptr< GOptions > &gopt, std::string logger_name="")
Declares GEventAction, the per-event processing action for the GEMC actions module.
Declares GPrimaryGeneratorAction, the primary-particle generation action for the GEMC actions module.
Declares GRunAction, the run-lifecycle action for the GEMC actions module.
Declares GRun, the thread-local run container used by the GEMC actions module.
constexpr const char * GACTION_LOGGER
Definition gaction.h:30
Namespace containing helpers related to action-subsystem configuration.
Definition gaction.h:40
GOptions defineOptions()
Builds the aggregate option set required by the actions subsystem.
Definition gaction.h:54
GOptions defineOptions()
Returns the options associated with the event-action logger scope.
GOptions defineOptions()
Returns the options associated with the primary-generator action scope.
GOptions defineOptions()
Returns the options associated with the run-container logger scope.
Definition gRun.h:32
GOptions defineOptions()
Returns the options associated with the run-action logger scope.
Definition gRunAction.h:39