Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
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 MergePartialResults();
75  //This method will merge (reduce) the results of this run into the
76  //global run
77 public:
80 private:
82  void SetupDefaultRNGEngine();
83 
84 public:
85  virtual void SetUserInitialization(G4VUserPhysicsList* userInit);
86  virtual void SetUserInitialization(G4VUserDetectorConstruction* userInit);
87  virtual void SetUserInitialization(G4VUserActionInitialization* userInit);
88  virtual void SetUserInitialization(G4UserWorkerInitialization* userInit);
90  virtual void SetUserAction(G4UserRunAction* userAction);
91  virtual void SetUserAction(G4VUserPrimaryGeneratorAction* userAction);
92  virtual void SetUserAction(G4UserEventAction* userAction);
93  virtual void SetUserAction(G4UserStackingAction* userAction);
94  virtual void SetUserAction(G4UserTrackingAction* userAction);
95  virtual void SetUserAction(G4UserSteppingAction* userAction);
96 
97 protected:
104 
105 public:
106  virtual void RestoreRndmEachEvent(G4bool flag) { readStatusFromFile = flag; }
107 #ifdef G4MULTITHREADED
108 private:
109  G4bool visIsSetUp;
110 #endif
111 };
112 
113 #endif //G4WorkerRunManager_h
virtual void RestoreRndmEachEvent(G4bool flag)
static G4WorkerRunManager * GetWorkerRunManager()
virtual void DoEventLoop(G4int n_event, const char *macroFile=0, G4int n_select=-1)
virtual void RunInitialization()
G4WorkerThread * workerContext
virtual void StoreRNGStatus(const G4String &filenamePrefix)
bool G4bool
Definition: G4Types.hh:79
virtual G4Event * GenerateEvent(G4int i_event)
virtual void TerminateEventLoop()
virtual void SetUserAction(G4UserRunAction *userAction)
void SetWorkerThread(G4WorkerThread *wc)
Sets the worker context.
virtual void ProcessOneEvent(G4int i_event)
virtual void ConstructScoringWorlds()
virtual void InitializeGeometry()
int G4int
Definition: G4Types.hh:78
virtual void SetUserInitialization(G4VUserPhysicsList *userInit)
std::queue< G4long > G4SeedsQueue
Definition: G4RNGHelper.hh:128
static G4WorkerRunManagerKernel * GetWorkerRunManagerKernel()
virtual void RunTermination()
virtual void MergePartialResults()