actions
Loading...
Searching...
No Matches
gPrimaryGeneratorAction.h
Go to the documentation of this file.
1#pragma once
2
3// gemc
4#include "goptions.h"
5#include "gbase.h"
6#include "gparticle_options.h"
7
8// geant4
9#include "G4VUserPrimaryGeneratorAction.hh"
10#include "G4ParticleGun.hh"
11
19constexpr const char* GPRIMARYGENERATORACTION_LOGGER = "generator";
20
26namespace gprimaryaction {
36} // namespace gprimaryaction
37
38
51class GPrimaryGeneratorAction : public GBase<GPrimaryGeneratorAction>, public G4VUserPrimaryGeneratorAction {
52public:
62 GPrimaryGeneratorAction(std::shared_ptr<GOptions> gopts);
63
67 ~GPrimaryGeneratorAction() override;
68
77 void GeneratePrimaries(G4Event* event) override;
78
79private:
85 G4ParticleGun* gparticleGun;
86
93 std::vector<GparticlePtr> gparticles;
94};
Generates primary vertices for each event.
void GeneratePrimaries(G4Event *event) override
Generates the primaries for the given event.
~GPrimaryGeneratorAction() override
Destructor. Releases the internally owned particle gun.
GPrimaryGeneratorAction(std::shared_ptr< GOptions > gopts)
Constructs the primary generator action.
constexpr const char * GPRIMARYGENERATORACTION_LOGGER
Namespace collecting helpers for the primary generator action.
GOptions defineOptions()
Returns the options associated with the primary generator action.