ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4WorkerRunManager.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4WorkerRunManager.hh
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  virtual void TerminateEventLoop();
67 
68  //This function is called by the thread function: it should loop until some
69  //work is requested
70  virtual void DoWork();
71 protected:
72  virtual void ConstructScoringWorlds();
73  virtual void StoreRNGStatus(const G4String& filenamePrefix );
74  virtual void rndmSaveThisRun();
75  virtual void rndmSaveThisEvent();
76  virtual void MergePartialResults();
77  //This method will merge (reduce) the results of this run into the
78  //global run
79 public:
82 private:
84  void SetupDefaultRNGEngine();
85 
86 public:
87  virtual void SetUserInitialization(G4VUserPhysicsList* userInit);
88  virtual void SetUserInitialization(G4VUserDetectorConstruction* userInit);
89  virtual void SetUserInitialization(G4VUserActionInitialization* userInit);
90  virtual void SetUserInitialization(G4UserWorkerInitialization* userInit);
92  virtual void SetUserAction(G4UserRunAction* userAction);
93  virtual void SetUserAction(G4VUserPrimaryGeneratorAction* userAction);
94  virtual void SetUserAction(G4UserEventAction* userAction);
95  virtual void SetUserAction(G4UserStackingAction* userAction);
96  virtual void SetUserAction(G4UserTrackingAction* userAction);
97  virtual void SetUserAction(G4UserSteppingAction* userAction);
98 
99 protected:
107 
108 public:
109  virtual void RestoreRndmEachEvent(G4bool flag) { readStatusFromFile = flag; }
110 #ifdef G4MULTITHREADED
111 private:
112  G4bool visIsSetUp;
113 #endif
114 };
115 
116 #endif //G4WorkerRunManager_h