Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4WorkerRunManager.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// G4WorkerRunManager
27//
28// Class description:
29//
30// This is a class for run control in GEANT4 for multi-threading.
31// It extends G4RunManager re-implementing multi-threaded behavior in
32// key methods. See documentation for G4RunManager.
33// User should never initialize instances of this class, that are usually
34// handled by G4MTRunManager. There exists one instance of this class for
35// each worker in a MT application.
36
37// Original authors: X.Dong, A.Dotti - 2013
38// --------------------------------------------------------------------
39#ifndef G4WorkerRunManager_hh
40#define G4WorkerRunManager_hh 1
41
42#include "G4RNGHelper.hh"
43#include "G4RunManager.hh"
44
45class G4WorkerThread;
47
49{
50 public:
51
53
56
59
60 virtual void InitializeGeometry();
61 virtual void RunInitialization();
62 virtual void DoEventLoop(G4int n_event, const char* macroFile = 0,
63 G4int n_select = -1);
64 virtual void ProcessOneEvent(G4int i_event);
65 virtual G4Event* GenerateEvent(G4int i_event);
66
67 virtual void RunTermination();
68 virtual void TerminateEventLoop();
69
70 virtual void DoWork();
71 // This function is called by the thread function: it should
72 // loop until some work is requested.
73
74 inline void SetWorkerThread(G4WorkerThread* wc) { workerContext = wc; }
75 // Sets the worker context.
76
77 virtual void SetUserInitialization(G4VUserPhysicsList* userInit);
82 virtual void SetUserAction(G4UserRunAction* userAction);
83 virtual void SetUserAction(G4VUserPrimaryGeneratorAction* userAction);
84 virtual void SetUserAction(G4UserEventAction* userAction);
85 virtual void SetUserAction(G4UserStackingAction* userAction);
86 virtual void SetUserAction(G4UserTrackingAction* userAction);
87 virtual void SetUserAction(G4UserSteppingAction* userAction);
88
89 virtual void RestoreRndmEachEvent(G4bool flag) { readStatusFromFile=flag; }
90
91 protected:
92
93 virtual void ConstructScoringWorlds();
94 virtual void StoreRNGStatus(const G4String& filenamePrefix);
95 virtual void rndmSaveThisRun();
96 virtual void rndmSaveThisEvent();
97 virtual void MergePartialResults();
98 // This method will merge (reduce) the results
99 // of this run into the global run
100
101 private:
102
103 void SetupDefaultRNGEngine();
104
105 protected:
106
108 #ifdef G4MULTITHREADED
109 G4bool visIsSetUp = false;
110 #endif
111
119
120 private:
121
122 std::unique_ptr<ProfilerConfig> workerRunProfiler;
123};
124
125#endif // G4WorkerRunManager_hh
std::queue< G4long > G4SeedsQueue
Definition: G4RNGHelper.hh:136
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
virtual void ConstructScoringWorlds()
void SetWorkerThread(G4WorkerThread *wc)
static G4WorkerRunManagerKernel * GetWorkerRunManagerKernel()
virtual void RunTermination()
virtual void RestoreRndmEachEvent(G4bool flag)
virtual void rndmSaveThisEvent()
virtual void MergePartialResults()
G4WorkerThread * workerContext
virtual void SetUserAction(G4UserRunAction *userAction)
virtual void SetUserInitialization(G4VUserPhysicsList *userInit)
virtual void rndmSaveThisRun()
static G4WorkerRunManager * GetWorkerRunManager()
virtual void ProcessOneEvent(G4int i_event)
virtual void TerminateEventLoop()
virtual void RunInitialization()
virtual void DoEventLoop(G4int n_event, const char *macroFile=0, G4int n_select=-1)
virtual void InitializeGeometry()
virtual G4Event * GenerateEvent(G4int i_event)
virtual void StoreRNGStatus(const G4String &filenamePrefix)