allpix::WorkerRunManager

Run manager for Geant4 that can be used by multiple threads where each thread will have its own instance. More…

#include <WorkerRunManager.hpp>

Inherits from G4WorkerRunManager

Public Functions

Name
~WorkerRunManager() override
void BeamOn(G4int n_event, const char * macroFile =nullptr, G4int n_select =-1) override
Executes specified number of events.
void InitializeGeometry() override
void AbortRun(G4bool softAbort) override
Overriding G4RunManager::AbortRun so as to reset the state to G4State_Idle in order to allow the next event to run BeamOn.
WorkerRunManager * GetNewInstanceForThread()
Factory method to create new worker for calling thread.

Protected Functions

Name
WorkerRunManager()
void DoEventLoop(G4int n_event, const char * macroFile =nullptr, G4int n_select =-1) override
Run the event loop for specified number of events.
void DoWork() override
Previously used to communicate work with master manager.
G4Event * GenerateEvent(G4int i_event) override
Constructs an event object and set the seeds for RNG.
void MergePartialResults() override
Previously used to merge the partial results obtained by this manager and the master.

Friends

Name
class MTRunManager

Detailed Description

class allpix::WorkerRunManager;

Run manager for Geant4 that can be used by multiple threads where each thread will have its own instance.

This manager overrides G4WorkerRunManager behaviour so it can be used on user defined threads. Therefore, there is no dependency on the master run manager except only in initialization. APIs inherited from G4WorkerRunManager which communicate with master run manager are suppressed because they are not needed anymore. This manager assumes that the client is only interested in its own results and it is independent from other instances running on different threads.

Public Functions Documentation

function ~WorkerRunManager

~WorkerRunManager() override

function BeamOn

void BeamOn(
    G4int n_event,
    const char * macroFile =nullptr,
    G4int n_select =-1
) override

Executes specified number of events.

Executes the specified number of events. Reimplemented to execute UI commands and maybe reinitialize workspace if there are changes between multiple calls.

function InitializeGeometry

void InitializeGeometry() override

function AbortRun

void AbortRun(
    G4bool softAbort
) override

Overriding G4RunManager::AbortRun so as to reset the state to G4State_Idle in order to allow the next event to run BeamOn.

function GetNewInstanceForThread

static WorkerRunManager * GetNewInstanceForThread()

Factory method to create new worker for calling thread.

Creates a new worker and initialize it to be used by the calling thread.

Protected Functions Documentation

function WorkerRunManager

WorkerRunManager()

function DoEventLoop

void DoEventLoop(
    G4int n_event,
    const char * macroFile =nullptr,
    G4int n_select =-1
) override

Run the event loop for specified number of events.

Parameters:

  • n_event number of events
  • macroFile Possible pointer to a macro file, passed on to Geant4
  • n_select Optional n_select parameter passed on to Geant4

Run the event loop. Everything is the same as base implementation except that we keep the seedsQueue since the master manager has already pushed the seeds in it.

function DoWork

inline void DoWork() override

Previously used to communicate work with master manager.

Thread loop for receiving work from master run manager. It will now do nothing.

function GenerateEvent

G4Event * GenerateEvent(
    G4int i_event
) override

Constructs an event object and set the seeds for RNG.

Parameters:

  • i_event the event number.

Creates a new G4Event object and set its event number, seeds for the thread RNG.

function MergePartialResults

inline void MergePartialResults() override

Previously used to merge the partial results obtained by this manager and the master.

Merge the run results with the master results. It will now do nothing.

Friends

friend MTRunManager

friend class MTRunManager(
    MTRunManager 
);

Updated on 2025-02-27 at 14:14:46 +0000