actions
Loading...
Searching...
No Matches
GPrimaryGeneratorAction Class Reference

Generates primary vertices for each event. More...

#include <gPrimaryGeneratorAction.h>

Public Member Functions

 GPrimaryGeneratorAction (std::shared_ptr< GOptions > gopts)
 Constructs the primary generator action.
 
 ~GPrimaryGeneratorAction () override
 Destructor. Releases the internally owned particle gun.
 
void GeneratePrimaries (G4Event *event) override
 Generates the primaries for the given 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 ()
 
GBaseoperator= (const GBase &)=default
 
GBaseoperator= (GBase &&) noexcept=default
 

Additional Inherited Members

- Protected Attributes inherited from GBase< GPrimaryGeneratorAction >
std::shared_ptr< GLoggerlog
 

Detailed Description

This action constructs a Geant4 particle gun (G4ParticleGun) and a list of configured Gparticle objects. For each event, it iterates over the list and delegates to each Gparticle instance to configure the gun and shoot into the event.

If no particles are configured, a default particle is created and used.

Definition at line 51 of file gPrimaryGeneratorAction.h.

Constructor & Destructor Documentation

◆ GPrimaryGeneratorAction()

GPrimaryGeneratorAction::GPrimaryGeneratorAction ( std::shared_ptr< GOptions > gopts)
  • Allocates the G4ParticleGun instance.
  • Loads configured particles using gparticle::getGParticles().
  • If none are defined, creates a default particle.
Parameters
goptsShared configuration object used to retrieve particle definitions and logging settings.

Definition at line 6 of file gPrimaryGeneratorAction.cc.

◆ ~GPrimaryGeneratorAction()

GPrimaryGeneratorAction::~GPrimaryGeneratorAction ( )
override

Definition at line 21 of file gPrimaryGeneratorAction.cc.

Member Function Documentation

◆ GeneratePrimaries()

void GPrimaryGeneratorAction::GeneratePrimaries ( G4Event * event)
override

The method loops over the configured Gparticle list, logs particle details at higher verbosity, and invokes the per-particle shooting routine.

Parameters
eventThe Geant4 event that will receive the generated primaries.

Definition at line 27 of file gPrimaryGeneratorAction.cc.


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