Geant4  10.00.p01
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 handled
36 // by G4MTRunManager.
37 // There exists one instance of this class for each worker in a MT application.
38 
39 #ifndef G4WorkerRunManager_h
40 #define G4WorkerRunManager_h 1
41 #include "G4RNGHelper.hh"
42 #include "G4RunManager.hh"
43 
44 class G4WorkerThread;
46 
48 public:
53  //Modified for worker behavior
55  virtual void InitializeGeometry();
56  virtual void RunInitialization();
57  virtual void DoEventLoop(G4int n_event,const char* macroFile=0,G4int n_select=-1);
58  virtual void ProcessOneEvent(G4int i_event);
59  virtual G4Event* GenerateEvent(G4int i_event);
60  //G4int NewCommands( const std::vector<G4String>& newCmdsToExecute , G4String& currentCmd );
61  //Called by the MTRunManager when new UI commands are to be executed.
62  //It is not assumed method is not thread-safe: i.e. should be called sequentially
63  //Returns 0 if commands are executed corrected, otherwise returns error code (see G4UImanager::ApplyCommand)
64  //In case of error currentCmd is set to the command that gave the problem
65  virtual void RunTermination();
66 protected:
67  virtual void ConstructScoringWorlds();
68  virtual void StoreRNGStatus(const G4String& filenamePrefix );
69  virtual void MergePartialResults();
70  //This method will merge (reduce) the results of this run into the
71  //global run
72 public:
75 private:
77  void SetupDefaultRNGEngine();
78 
79 public:
80  virtual void SetUserInitialization(G4VUserPhysicsList* userInit);
81  virtual void SetUserInitialization(G4VUserDetectorConstruction* userInit);
82  virtual void SetUserInitialization(G4VUserActionInitialization* userInit);
83  virtual void SetUserInitialization(G4UserWorkerInitialization* userInit);
85  virtual void SetUserAction(G4UserRunAction* userAction);
86  virtual void SetUserAction(G4VUserPrimaryGeneratorAction* userAction);
87  virtual void SetUserAction(G4UserEventAction* userAction);
88  virtual void SetUserAction(G4UserStackingAction* userAction);
89  virtual void SetUserAction(G4UserTrackingAction* userAction);
90  virtual void SetUserAction(G4UserSteppingAction* userAction);
91 
92 protected:
97 
98 #ifdef G4MULTITHREADED
99 private:
100  G4bool visIsSetUp;
101 #endif
102 };
103 
104 #endif //G4WorkerRunManager_h
virtual void InitializeGeometry()
G4WorkerThread * workerContext
virtual void ConstructScoringWorlds()
static G4WorkerRunManager * GetWorkerRunManager()
virtual void DoEventLoop(G4int n_event, const char *macroFile=0, G4int n_select=-1)
virtual void RunInitialization()
virtual void SetUserInitialization(G4VUserPhysicsList *userInit)
int G4int
Definition: G4Types.hh:78
std::queue< long > G4SeedsQueue
Definition: G4RNGHelper.hh:133
bool G4bool
Definition: G4Types.hh:79
virtual void RunTermination()
virtual void ProcessOneEvent(G4int i_event)
void SetWorkerThread(G4WorkerThread *wc)
Sets the worker context.
virtual G4Event * GenerateEvent(G4int i_event)
virtual void SetUserAction(G4UserRunAction *userAction)
static G4WorkerRunManagerKernel * GetWorkerRunManagerKernel()
virtual void MergePartialResults()
virtual void StoreRNGStatus(const G4String &filenamePrefix)