ATLAS Offline Software
Loading...
Searching...
No Matches
G4UA::SyncPrimaryGeneratorAction Class Reference

#include <SyncPrimaryGeneratorAction.h>

Inheritance diagram for G4UA::SyncPrimaryGeneratorAction:
Collaboration diagram for G4UA::SyncPrimaryGeneratorAction:

Public Member Functions

 SyncPrimaryGeneratorAction (IG4RunTool *)
virtual void GeneratePrimaries (G4Event *) override

Private Attributes

IG4RunToolm_g4RunTool {}

Detailed Description

Definition at line 18 of file SyncPrimaryGeneratorAction.h.

Constructor & Destructor Documentation

◆ SyncPrimaryGeneratorAction()

G4UA::SyncPrimaryGeneratorAction::SyncPrimaryGeneratorAction ( IG4RunTool * g4RunTool)

Definition at line 18 of file SyncPrimaryGeneratorAction.cxx.

19 : G4VUserPrimaryGeneratorAction(), m_g4RunTool(g4RunTool)
20{
21}

Member Function Documentation

◆ GeneratePrimaries()

void G4UA::SyncPrimaryGeneratorAction::GeneratePrimaries ( G4Event * anEvent)
overridevirtual

Definition at line 23 of file SyncPrimaryGeneratorAction.cxx.

24{
25 // get an event from the shared queue
26 if(auto inputEventInfo = m_g4RunTool->GetEvent()) {
27 // setup rng engine seeded by Athena
28 G4Random::setTheEngine(inputEventInfo->HepRandomEngine());
29 // convert Genevent to G4Event
30 if(inputEventInfo->EventFactory()(*anEvent, std::move(inputEventInfo)).isFailure()) {
31 G4cout << "Failed to prepare G4Event from Athena event" << G4endl;
32 }
33 }
34 // if get_Event returns nullptr, this means that no more events are available and the run should be aborted.
35 // Because Geant4 will still go through and finish the current event after calling AbortRun,
36 // and it reset the G4Event::Aborted flag after GeneratePrimaries, abortRun must be called in the BeginOfEventAction
37}

Member Data Documentation

◆ m_g4RunTool

IG4RunTool* G4UA::SyncPrimaryGeneratorAction::m_g4RunTool {}
private

Definition at line 26 of file SyncPrimaryGeneratorAction.h.

26{};

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