Geant4 10.7.0
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//
27//
28//
29
30// class description:
31//
32// This is a class for run control in GEANT4 for multi-threaded runs
33// It extends G4RunManager re-implementing multi-threaded behavior in
34// key methods. See documentation for G4RunManager
35// User should never initialize instances of this class, that are usually
36// handled by G4MTRunManager. There exists one instance of this class for each
37// worker in a MT application.
38
39#ifndef G4WorkerRunManager_h
40#define G4WorkerRunManager_h 1
41#include "G4RNGHelper.hh"
42#include "G4RunManager.hh"
43
44class G4WorkerThread;
46
48{
49 public:
51
52 public:
57 // Modified for worker behavior
58 ////////virtual void BeamOn(G4int n_event,const char* macroFile=0,G4int
59 ///n_select=-1);
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 // G4int NewCommands( const std::vector<G4String>& newCmdsToExecute ,
67 // G4String& currentCmd ); Called by the MTRunManager when new UI commands are
68 // to be executed. It is not assumed method is not thread-safe: i.e. should be
69 // called sequentially Returns 0 if commands are executed corrected, otherwise
70 // returns error code (see G4UImanager::ApplyCommand) In case of error
71 // currentCmd is set to the command that gave the problem
72 virtual void RunTermination();
73 virtual void TerminateEventLoop();
74
75 // This function is called by the thread function: it should loop until some
76 // work is requested
77 virtual void DoWork();
78
79 protected:
80 virtual void ConstructScoringWorlds();
81 virtual void StoreRNGStatus(const G4String& filenamePrefix);
82 virtual void rndmSaveThisRun();
83 virtual void rndmSaveThisEvent();
84 virtual void MergePartialResults();
85 // This method will merge (reduce) the results of this run into the
86 // global run
87 public:
88 //! Sets the worker context
90
91 protected:
93#ifdef G4MULTITHREADED
94 G4bool visIsSetUp;
95#endif
96
97 private:
98 void SetupDefaultRNGEngine();
99
100 public:
101 virtual void SetUserInitialization(G4VUserPhysicsList* userInit);
105 virtual void SetUserInitialization(
107 virtual void SetUserAction(G4UserRunAction* userAction);
108 virtual void SetUserAction(G4VUserPrimaryGeneratorAction* userAction);
109 virtual void SetUserAction(G4UserEventAction* userAction);
110 virtual void SetUserAction(G4UserStackingAction* userAction);
111 virtual void SetUserAction(G4UserTrackingAction* userAction);
112 virtual void SetUserAction(G4UserSteppingAction* userAction);
113
114 protected:
122
123 private:
124 std::unique_ptr<ProfilerConfig> workerRunProfiler;
125
126 public:
127 virtual void RestoreRndmEachEvent(G4bool flag) { readStatusFromFile = flag; }
128};
129
130#endif // G4WorkerRunManager_h
std::queue< G4long > G4SeedsQueue
Definition: G4RNGHelper.hh:133
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
virtual void ConstructScoringWorlds()
void SetWorkerThread(G4WorkerThread *wc)
Sets the worker context.
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)