|
actions
|
Generates the primary vertices for each Geant4 event. More...
#include <gPrimaryGeneratorAction.h>
Public Member Functions | |
| GPrimaryGeneratorAction (std::shared_ptr< GOptions > gopts) | |
| Constructs the primary-generator action. | |
| GPrimaryGeneratorAction (std::shared_ptr< GOptions > gopts, std::shared_ptr< std::vector< GparticlePtr > > particles) | |
| Construct with a pre-populated shared particle list (used by GAction so all worker-thread instances share the same GparticlePtr objects as the GUI). | |
| ~GPrimaryGeneratorAction () override=default | |
| GPrimaryGeneratorAction (const GPrimaryGeneratorAction &)=delete | |
| GPrimaryGeneratorAction & | operator= (const GPrimaryGeneratorAction &)=delete |
| GPrimaryGeneratorAction (GPrimaryGeneratorAction &&)=delete | |
| GPrimaryGeneratorAction & | operator= (GPrimaryGeneratorAction &&)=delete |
| void | GeneratePrimaries (G4Event *event) override |
| Generates the primary content for one event. | |
Public Member Functions inherited from GBase< GPrimaryGeneratorAction > | |
| 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 () |
| GBase & | operator= (const GBase &)=default |
| GBase & | operator= (GBase &&) noexcept=default |
Static Public Member Functions | |
| static const GParticleEvent & | currentGeneratedParticles () |
| Returns the current event's Geant4-propagated generated particles. | |
| static const GParticleEvent & | currentGeneratedTrackedParticles () |
| Returns the current event's Geant4-tracked generated particles. | |
| static const GParticleRecordEvent & | currentGeneratedParticleRecords () |
| Returns the current event's full generated-particle records. | |
| static const GParticleRecordEvent & | currentGeneratedTrackedParticleRecords () |
| Returns the current event's Geant4-tracked generated-particle records. | |
Additional Inherited Members | |
Protected Attributes inherited from GBase< GPrimaryGeneratorAction > | |
| std::shared_ptr< GLogger > | log |
This class is the GEMC implementation of the Geant4 primary-generator action. It owns a G4ParticleGun and a list of configured Gparticle objects. Inline particles from -gparticle are generated for every event, while -gparticlefile sources are indexed by Geant4 event id.
For every event, GeneratePrimaries() iterates over the configured particle definitions and delegates the actual shooting operation to each Gparticle instance. This allows the generator configuration to be data-driven while still using the Geant4 particle-gun mechanism underneath.
If no particle definitions are found in the configuration, the constructor creates a default particle so the simulation still has a valid primary source.
The class also exposes thread-local generated-particle snapshots for event output. The generated snapshot contains runtime records for particles propagated in Geant4 plus source-only file rows that are not propagated. The generated_tracked snapshot contains only the runtime records propagated in Geant4.
Definition at line 74 of file gPrimaryGeneratorAction.h.
|
explicit |
Construction performs the following steps:
G4ParticleGun instance used for emission;| gopts | Shared configuration object used to retrieve generator settings and logging controls. |
Definition at line 48 of file gPrimaryGeneratorAction.cc.
| GPrimaryGeneratorAction::GPrimaryGeneratorAction | ( | std::shared_ptr< GOptions > | gopts, |
| std::shared_ptr< std::vector< GparticlePtr > > | particles ) |
Definition at line 63 of file gPrimaryGeneratorAction.cc.
|
overridedefault |
|
delete |
|
delete |
|
static |
This is the source for the generated output bank. It includes runtime records for propagated particles and source-only records for file-backed rows not propagated in Geant4.
Definition at line 135 of file gPrimaryGeneratorAction.cc.
|
static |
Definition at line 127 of file gPrimaryGeneratorAction.cc.
|
static |
This is the source for the generated_tracked output bank. It includes only runtime records for particles propagated in Geant4.
Definition at line 139 of file gPrimaryGeneratorAction.cc.
|
static |
This view contains inline particles and file-backed particles propagated in Geant4.
Definition at line 131 of file gPrimaryGeneratorAction.cc.
|
override |
The method loops over all configured Gparticle objects. For each non-null entry, it asks the particle object to configure the internal G4ParticleGun and to inject the resulting primary information into the supplied event.
This design allows multiple configured particle definitions to contribute to a single Geant4 event.
| event | The event that will receive the generated primary vertices and particles. |
Definition at line 81 of file gPrimaryGeneratorAction.cc.
|
delete |
|
delete |