Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4WorkerRunManager.cc
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 #include "G4WorkerRunManager.hh"
30 #include "G4UImanager.hh"
32 #include "G4MTRunManager.hh"
33 #include "G4ScoringManager.hh"
36 #include "G4WorkerThread.hh"
37 #include "G4VUserPhysicsList.hh"
41 #include "G4UserRunAction.hh"
42 #include "G4RNGHelper.hh"
43 #include "G4Run.hh"
45 #include "G4VVisManager.hh"
46 #include "G4SDManager.hh"
47 #include "G4VScoringMesh.hh"
48 #include "G4Timer.hh"
49 #include <sstream>
50 #include <fstream>
51 
53 { return static_cast<G4WorkerRunManager*>(G4RunManager::GetRunManager()); }
54 
56 { return static_cast<G4WorkerRunManagerKernel*>(GetWorkerRunManager()->kernel); }
57 
59  //This constructor should never be called in non-multithreaded mode
60 #ifndef G4MULTITHREADED
62  msg<<"Geant4 code is compiled without multi-threading support (-DG4MULTITHREADED is set to off).";
63  msg<<" This type of RunManager can only be used in mult-threaded applications.";
64  G4Exception("G4WorkerRunManager::G4WorkerRunManager()","Run0103",FatalException,msg);
65 #endif
68  if(masterScM) G4ScoringManager::GetScoringManager(); //TLS instance for a worker
69 
70  eventLoopOnGoing = false;
71  runIsSeeded = false;
72  nevModulo = -1;
73  currEvID = -1;
74  workerContext = 0;
75  readStatusFromFile = false;
76 
78 
79 #ifdef G4MULTITHREADED
81  if(pVVis)
82  {
83  pVVis->SetUpForAThread();
84  visIsSetUp = true;
85  }
86  else
87  { visIsSetUp = false; }
88 #endif
89 }
90 
91 #include "G4MTRunManager.hh"
92 
94  // Delete thread-local process manager objects
96 
97  //Put these pointers to zero: owned by master thread
98  //If not to zero, the base class destructor will attempt to
99  //delete them
100  userDetector = 0;
104  physicsList = 0;
105  if(verboseLevel>0) G4cout<<"Destroying WorkerRunManager ("<<this<<")"<<G4endl;
106 }
107 
108 
110  if(!userDetector)
111  {
112  G4Exception("G4RunManager::InitializeGeometry", "Run0033",
113  FatalException, "G4VUserDetectorConstruction is not defined!");
114  return;
115  }
118 
119  //Step1: Get pointer to the physiWorld (note: needs to get the "super pointer, i.e. the one shared by all threads"
121  G4VPhysicalVolume* worldVol = masterKernel->GetCurrentWorld();
122  //Step2:, Call a new "WorkerDefineWorldVolume( pointer from 2-, false);
123  kernel->WorkerDefineWorldVolume(worldVol,false);
125  //Step3: Call user's ConstructSDandField()
128  geometryInitialized = true;
129 }
130 
132 
134 {
135 #ifdef G4MULTITHREADED
136  if(!visIsSetUp)
137  {
139  if(pVVis)
140  {
141  pVVis->SetUpForAThread();
142  visIsSetUp = true;
143  }
144  }
145 #endif
146 
147  if(!(kernel->RunInitialization(fakeRun))) return;
148 
149  //Signal this thread can start event loop.
150  //Note this will return only when all threads reach this point
152  if(fakeRun) return;
153 
154  const G4UserWorkerInitialization* uwi
157  if(currentRun) delete currentRun;
158  currentRun = 0;
159 
161  //Call a user hook: this is guaranteed all threads are "synchronized"
162  if(uwi) uwi->WorkerRunStart();
163 
165  if(!currentRun) currentRun = new G4Run();
166 
169 
172  if(fSDM)
173  { currentRun->SetHCtable(fSDM->GetHCtable()); }
174 
175  std::ostringstream oss;
176  G4Random::saveFullState(oss);
177  randomNumberStatusForThisRun = oss.str();
179 
180  for(G4int i_prev=0;i_prev<n_perviousEventsToBeStored;i_prev++)
181  { previousEvents->push_back((G4Event*)0); }
182 
183  if(printModulo>0 || verboseLevel>0)
184  {
185  G4cout << "### Run " << currentRun->GetRunID() << " starts on worker thread "
186  << G4Threading::G4GetThreadId() << "." << G4endl;
187  }
189 
191  G4String fileN = "currentRun";
192  if ( rngStatusEventsFlag ) {
193  std::ostringstream os;
194  os << "run" << currentRun->GetRunID();
195  fileN = os.str();
196  }
197  StoreRNGStatus(fileN);
198  }
199 
200  runAborted = false;
202 }
203 
204 void G4WorkerRunManager::DoEventLoop(G4int n_event, const char* macroFile , G4int n_select)
205 {
207  {
208  G4Exception("G4RunManager::GenerateEvent()", "Run0032", FatalException,
209  "G4VUserPrimaryGeneratorAction is not defined!");
210  }
211 
212  //This is the same as in the sequential case, just the for-loop indexes are
213  //different
214  InitializeEventLoop(n_event,macroFile,n_select);
215 
216  // Reset random number seeds queue
217  while(seedsQueue.size()>0)
218  { seedsQueue.pop(); }
219  // for each run, worker should receive at least one set of random number seeds.
220  runIsSeeded = false;
221 
222  // Event loop
223  eventLoopOnGoing = true;
225  G4int i_event = -1;
226  nevModulo = -1;
227  currEvID = -1;
228 
229  while(eventLoopOnGoing)
230  {
231  ProcessOneEvent(i_event);
232  if(eventLoopOnGoing)
233  {
235  if(runAborted)
236  { eventLoopOnGoing = false; }
242  }
243  }
244 
246 }
247 
249 {
250  currentEvent = GenerateEvent(i_event);
251  if(eventLoopOnGoing)
252  {
255  UpdateScoring();
257  }
258 }
259 
261 {
262  G4Event* anEvent = new G4Event(i_event);
263  long s1 = 0;
264  long s2 = 0;
265  long s3 = 0;
266  G4bool eventHasToBeSeeded = true;
268  { eventHasToBeSeeded = false; }
269 
270  if(i_event<0)
271  {
273  if(nevM==1)
274  {
276  ->SetUpAnEvent(anEvent,s1,s2,s3,eventHasToBeSeeded);
277  runIsSeeded = true;
278  }
279  else
280  {
281  if(nevModulo<=0)
282  {
284  ->SetUpNEvents(anEvent,&seedsQueue,eventHasToBeSeeded);
285  if(nevToDo==0)
286  { eventLoopOnGoing = false; }
287  else
288  {
289  currEvID = anEvent->GetEventID();
290  nevModulo = nevToDo - 1;
291  }
292  }
293  else
294  {
295  if(G4MTRunManager::SeedOncePerCommunication()>0) eventHasToBeSeeded = false;
296  anEvent->SetEventID(++currEvID);
297  nevModulo--;
298  }
299  if(eventLoopOnGoing && eventHasToBeSeeded)
300  {
301  s1 = seedsQueue.front(); seedsQueue.pop();
302  s2 = seedsQueue.front(); seedsQueue.pop();
303  }
304  }
305 
306  if(!eventLoopOnGoing)
307  {
308  delete anEvent;
309  return 0;
310  }
311  }
312  else if(eventHasToBeSeeded)
313  {
314  //Need to reseed random number generator
316  s1 = helper->GetSeed(i_event*2);
317  s2 = helper->GetSeed(i_event*2+1);
318  }
319 
320  if(eventHasToBeSeeded)
321  {
322  long seeds[3] = { s1, s2, 0 };
323  G4Random::setTheSeeds(seeds,-1);
324  runIsSeeded = true;
326  }
327 
328  //Read from file seed.
329  //Andrea Dotti 4 November 2015
330  //This is required for strong-reproducibility, in MT mode we have that each
331  //thread produces, for each event a status file, we want to do that.
332  //Search a random file with the format run{%d}evt{%d}.rndm
333 
334  //This is the filename base constructed from run and event
335  const auto filename = [&] {
336  std::ostringstream os;
337  os << "run"<<currentRun->GetRunID() << "evt" << anEvent->GetEventID();
338  return os.str();
339  };
340 
341  G4bool RNGstatusReadFromFile = false;
342  if ( readStatusFromFile ) {
343  //Build full path of RNG status file for this event
344  std::ostringstream os;
345  os << filename() << ".rndm";
346  const G4String& randomStatusFile = os.str();
347  std::ifstream ifile(randomStatusFile.c_str());
348  if ( ifile ) { //File valid and readable
349  RNGstatusReadFromFile = true;
350  G4Random::restoreEngineStatus(randomStatusFile.c_str());
351  }
352  }
353 
354 
356  {
357  std::ostringstream oss;
358  G4Random::saveFullState(oss);
359  randomNumberStatusForThisEvent = oss.str();
361  }
362 
363  if(storeRandomNumberStatus && ! RNGstatusReadFromFile ) { //If reading from file, avoid to rewrite the same
364  G4String fileN = "currentEvent";
365  if ( rngStatusEventsFlag ) {
366  fileN = filename();
367  }
368  StoreRNGStatus(fileN);
369  }
370 
371  if(printModulo > 0 && anEvent->GetEventID()%printModulo == 0 )
372  {
373  G4cout << "--> Event " << anEvent->GetEventID() << " starts";
374  if(eventHasToBeSeeded)
375  { G4cout << " with initial seeds (" << s1 << "," << s2 << ")"; }
376  G4cout << "." << G4endl;
377  }
379  return anEvent;
380 }
381 
383 {
384  //Merge partial results into global run
387  if(ScM) mtRM->MergeScores(ScM);
388  mtRM->MergeRun(currentRun);
389 }
390 
392 {
393  if(!fakeRun)
394  {
396 
397  //Call a user hook: note this is before the next barrier
398  //so threads execute this method asyncrhonouzly
399  //(TerminateRun allows for synch via G4RunAction::EndOfRun)
400  const G4UserWorkerInitialization* uwi
402  if(uwi) uwi->WorkerRunEnd();
403  }
404 
406  //Signal this thread has finished envent-loop.
407  //Note this will return only whan all threads reach this point
409 
410 }
411 
413 {
414  if(verboseLevel>0 && !fakeRun)
415  {
416  timer->Stop();
417  G4cout << "Thread-local run terminated." << G4endl;
418  G4cout << "Run Summary" << G4endl;
419  if(runAborted)
420  { G4cout << " Run Aborted after " << numberOfEventProcessed << " events processed." << G4endl; }
421  else
422  { G4cout << " Number of events processed : " << numberOfEventProcessed << G4endl; }
423  G4cout << " " << *timer << G4endl;
424  }
425 }
426 
427 /****************************
428 void G4WorkerRunManager::BeamOn(G4int n_event,const char* macroFile,G4int n_select)
429 {
430  if(n_event>0)
431  { G4RunManager::BeamOn(n_event,macroFile,n_select); }
432  else
433  {
434  // fake BeamOn.
435  G4MTRunManager::GetMasterRunManager()->ThisWorkerReady();
436  G4MTRunManager::GetMasterRunManager()->ThisWorkerEndEventLoop();
437  }
438 }
439 ******************************/
440 
441 #include "G4AutoLock.hh"
442 namespace { G4Mutex ConstructScoringWorldsMutex = G4MUTEX_INITIALIZER; }
444 {
445  // Return if unnecessary
447  if(!ScM) return;
448  G4int nPar = ScM->GetNumberOfMesh();
449  if(nPar<1) return;
450 
451  // Update thread-local G4TransportationManager of all the world volumes
453 
455  assert( masterScM != NULL );
456 
459 
460  for(G4int iw=0;iw<nPar;iw++)
461  {
462  G4VScoringMesh* mesh = ScM->GetMesh(iw);
464  G4VPhysicalVolume* pWorld
466  ->IsWorldExisting(ScM->GetWorldName(iw));
467  if(!pWorld)
468  {
470  ed<<"Mesh name <"<<ScM->GetWorldName(iw)<<"> is not found in the master thread.";
471  G4Exception("G4WorkerRunManager::ConstructScoringWorlds()","RUN79001",
472  FatalException,ed);
473  }
474  if(!(mesh->GetMeshElementLogical()))
475  {
476  G4AutoLock l(&ConstructScoringWorldsMutex);
477  G4VScoringMesh* masterMesh = masterScM->GetMesh(iw);
478  mesh->SetMeshElementLogical(masterMesh->GetMeshElementLogical());
479  l.unlock();
480 
481  G4ParallelWorldProcess* theParallelWorldProcess = mesh->GetParallelWorldProcess();
482  if(theParallelWorldProcess)
483  { theParallelWorldProcess->SetParallelWorld(ScM->GetWorldName(iw)); }
484  else
485  {
486  theParallelWorldProcess = new G4ParallelWorldProcess(ScM->GetWorldName(iw));
487  mesh->SetParallelWorldProcess(theParallelWorldProcess);
488  theParallelWorldProcess->SetParallelWorld(ScM->GetWorldName(iw));
489 
490  particleIterator->reset();
491  while( (*particleIterator)() ){
492  G4ParticleDefinition* particle = particleIterator->value();
493  G4ProcessManager* pmanager = particle->GetProcessManager();
494  if(pmanager)
495  {
496  pmanager->AddProcess(theParallelWorldProcess);
497  if(theParallelWorldProcess->IsAtRestRequired(particle))
498  { pmanager->SetProcessOrdering(theParallelWorldProcess, idxAtRest, 9900); }
499  pmanager->SetProcessOrderingToSecond(theParallelWorldProcess, idxAlongStep);
500  pmanager->SetProcessOrdering(theParallelWorldProcess, idxPostStep, 9900);
501  } //if(pmanager)
502  }//while
503  }
504  }
505  mesh->WorkerConstruct(pWorld);
506  }
507 }
508 
510 {
511  G4Exception("G4RunManager::SetUserInitialization(G4UserWorkerInitialization*)", "Run0118",
512  FatalException, "This method should be used only with an instance of G4MTRunManager");
513 }
514 
516 {
517  G4Exception("G4RunManager::SetUserInitialization(G4UserWorkerThreadInitialization*)", "Run0119",
518  FatalException, "This method should be used only with an instance of G4MTRunManager");
519 }
520 
522 {
523  G4Exception("G4RunManager::SetUserInitialization(G4VUserActionInitialization*)", "Run0120",
524  FatalException, "This method should be used only with an instance of G4MTRunManager");
525 }
526 
528 {
529  G4Exception("G4RunManager::SetUserInitialization(G4VUserDetectorConstruction*)", "Run0121",
530  FatalException, "This method should be used only with an instance of G4MTRunManager");
531 }
532 
534 {
535  pl->InitializeWorker();
537 }
538 
540 {
541  G4RunManager::SetUserAction(userAction);
542  userAction->SetMaster(false);
543 }
544 
545 void G4WorkerRunManager::SetupDefaultRNGEngine()
546 {
548  assert(mrnge);//Master has created RNG
551  uwti->SetupRNGEngine(mrnge);
552 }
553 
554 
555 //Forward calls (avoid GCC compilation warnings)
557 {
559 }
560 
562 {
564 }
565 
567 {
569 }
570 
572 {
574 }
575 
577 {
579 }
580 
582 {
583  std::ostringstream os;
584  os << randomNumberStatusDir << "G4Worker"<<workerContext->GetThreadId()<<"_"<<fn <<".rndm";
585  G4Random::saveEngineStatus(os.str().c_str());
586 }
587 
589 {
593  {
594  if( nextAction == G4MTRunManager::WorkerActionRequest::NEXTITERATION ) // start the next run
595  {
596  //The following code deals with changing materials between runs
597  static G4ThreadLocal G4bool skipInitialization = true;
598  if(skipInitialization)
599  {
600  // re-initialization is not necessary for the first run
601  skipInitialization = false;
602  }
603  else
604  {
605 // ReinitializeGeometry();
607  }
608 
609  // Execute UI commands stored in the master UI manager
610  std::vector<G4String> cmds = mrm->GetCommandStack();
611  G4UImanager* uimgr = G4UImanager::GetUIpointer(); //TLS instance
612  std::vector<G4String>::const_iterator it = cmds.begin();
613  for(;it!=cmds.end();it++)
614  { uimgr->ApplyCommand(*it); }
615  //Start this run
616  G4int numevents = mrm->GetNumberOfEventsToBeProcessed();
617  G4String macroFile = mrm->GetSelectMacro();
618  G4int numSelect = mrm->GetNumberOfSelectEvents();
619  if ( macroFile == "" || macroFile == " " )
620  {
621  this->BeamOn(numevents);
622  }
623  else
624  {
625  this->BeamOn(numevents,macroFile,numSelect);
626  }
627  }
628  else if (nextAction == G4MTRunManager::WorkerActionRequest::PROCESSUI ) {
629  std::vector<G4String> cmds = mrm->GetCommandStack();
630  G4UImanager* uimgr = G4UImanager::GetUIpointer(); //TLS instance
631  std::vector<G4String>::const_iterator it = cmds.begin();
632  for(;it!=cmds.end();it++)
633  { uimgr->ApplyCommand(*it); }
635  }
636  else
637  {
639  d<<"Cannot continue, this worker has been requested an unknwon action: "
640  <<static_cast<std::underlying_type<G4MTRunManager::WorkerActionRequest>::type>(nextAction);
641  G4Exception("G4WorkerRunManager::DoWork","Run0104",FatalException,d);
642  }
643 
644  //Now wait for master thread to signal new action to be performed
645  nextAction = mrm->ThisWorkerWaitForNextAction();
646  } //No more actions to perform
647 
648  return;
649 }
G4Timer * timer
void SetNumberOfEventToBeProcessed(G4int n_ev)
Definition: G4Run.hh:97
G4VPhysicalVolume * IsWorldExisting(const G4String &worldName)
void WorkerG4ParticleTable()
G4int numberOfEventToBeProcessed
void SetDCtable(G4DCtable *DCtbl)
Definition: G4Run.hh:101
virtual G4int SetUpNEvents(G4Event *, G4SeedsQueue *seedsQueue, G4bool reseedRequired=true)
std::vector< G4String > GetCommandStack()
G4int GetNumberOfParallelWorld() const
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
G4int n_select_msg
void SetParallelWorldProcess(G4ParallelWorldProcess *proc)
G4int numberOfEventProcessed
G4String GetWorldName(G4int i) const
G4String randomNumberStatusForThisRun
virtual void RunTermination()
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
virtual void ThisWorkerEndEventLoop()
virtual void SetupRNGEngine(const CLHEP::HepRandomEngine *aRNGEngine) const
G4VUserPhysicsList * physicsList
virtual void InitializeGeometry()
G4String randomNumberStatusForThisEvent
static G4bool fGeometryHasBeenDestroyed
void GeometryHasBeenDestroyed()
static void UpdateGeometryAndPhysicsVectorFromMaster()
static G4VVisManager * GetConcreteInstance()
void SetIgnoreCmdNotFound(G4bool val)
Definition: G4UImanager.hh:269
void SetNumberOfParallelWorld(G4int i)
void SetProcessOrderingToSecond(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt)
G4VUserActionInitialization * userActionInitialization
void SetMeshElementLogical(G4LogicalVolume *val)
virtual void ConstructScoringWorlds()
static G4WorkerRunManager * GetWorkerRunManager()
G4bool storeRandomNumberStatus
G4String GetSelectMacro() const
G4bool IsAtRestRequired(G4ParticleDefinition *)
G4UserWorkerThreadInitialization * userWorkerThreadInitialization
virtual void TerminateEventLoop()
virtual void DoEventLoop(G4int n_event, const char *macroFile=0, G4int n_select=-1)
virtual void RunInitialization()
virtual void BeamOn(G4int n_event, const char *macroFile=0, G4int n_select=-1)
virtual const T GetSeed(const G4int &sdId)
Definition: G4RNGHelper.hh:62
const G4UserWorkerInitialization * GetUserWorkerInitialization() const
void WorkerConstruct(G4VPhysicalVolume *fWorldPhys)
#define G4ThreadLocal
Definition: tls.hh:89
virtual void SetUserInitialization(G4VUserPhysicsList *userInit)
G4String msgText
int G4int
Definition: G4Types.hh:78
G4bool runAborted
#define G4MUTEX_INITIALIZER
Definition: G4Threading.hh:175
G4bool RunInitialization(G4bool fakeRun=false)
void WorkerDefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
G4Event * currentEvent
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
static G4ParallelWorldProcessStore * GetInstance()
G4int GetEventID() const
Definition: G4Event.hh:151
G4bool geometryInitialized
G4HCtable * GetHCtable() const
Definition: G4SDManager.hh:101
G4VUserPrimaryGeneratorAction * userPrimaryGeneratorAction
void SetParallelWorld(G4String parallelWorldName)
static G4RunManagerKernel * GetMasterRunManagerKernel()
G4GLOB_DLL std::ostream G4cout
void MergeRun(const G4Run *localRun)
void reset(G4bool ifSkipIon=true)
static G4ScoringManager * GetScoringManagerIfExist()
G4UserWorkerInitialization * userWorkerInitialization
G4String randomNumberStatusDir
bool G4bool
Definition: G4Types.hh:79
G4bool rngStatusEventsFlag
virtual void AnalyzeEvent(G4Event *anEvent)
static G4MTRunManager * GetMasterRunManager()
G4int AddProcess(G4VProcess *aProcess, G4int ordAtRestDoIt=ordInActive, G4int ordAlongSteptDoIt=ordInActive, G4int ordPostStepDoIt=ordInActive)
G4int storeRandomNumberStatusToG4Event
virtual WorkerActionRequest ThisWorkerWaitForNextAction()
virtual void ThisWorkerProcessCommandsStackDone()
G4int GetRunID() const
Definition: G4Run.hh:76
Definition: G4Run.hh:46
G4int GetThreadId() const
G4int GetNumberOfEventsToBeProcessed() const
void SetProcessOrdering(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt, G4int ordDoIt=ordDefault)
virtual void SetMaster(G4bool val=true)
std::list< G4Event * > * previousEvents
G4UserRunAction * userRunAction
virtual void RunTermination()
virtual void ProcessOneEvent(G4int i_event)
void SetHCtable(G4HCtable *HCtbl)
Definition: G4Run.hh:99
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
void SetRandomNumberStatus(G4String &st)
Definition: G4Event.hh:125
static G4TransportationManager * GetTransportationManager()
G4int GetNumberOfSelectEvents() const
const G4UserWorkerThreadInitialization * GetUserWorkerThreadInitialization() const
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:79
G4int runIDCounter
G4int G4Mutex
Definition: G4Threading.hh:173
static G4ScoringManager * GetMasterScoringManager()
virtual void GeneratePrimaries(G4Event *anEvent)=0
virtual void ThisWorkerReady()
static G4ParticleTable * GetParticleTable()
void CleanUpPreviousEvents()
virtual G4Event * GenerateEvent(G4int i_event)
G4ProcessManager * GetProcessManager() const
void Stop()
virtual G4bool SetUpAnEvent(G4Event *, long &s1, long &s2, long &s3, G4bool reseedRequired=true)
virtual void InitializeEventLoop(G4int n_event, const char *macroFile=0, G4int n_select=-1)
const CLHEP::HepRandomEngine * getMasterRandomEngine() const
G4int GetEventModulo() const
G4ParallelWorldProcess * GetParallelWorldProcess() const
virtual void BeginOfRunAction(const G4Run *aRun)
static G4int SeedOncePerCommunication()
static G4TemplateRNGHelper< T > * GetInstance()
Definition: G4RNGHelper.cc:37
G4LogicalVolume * GetMeshElementLogical() const
std::vector< G4InuclElementaryParticle >::iterator particleIterator
Definition: G4BigBanger.cc:65
G4Run * currentRun
#define G4endl
Definition: G4ios.hh:61
void ProcessOneEvent(G4Event *anEvent)
G4RunManagerKernel * kernel
static G4ScoringManager * GetScoringManager()
size_t GetNumberOfMesh() const
G4EventManager * eventManager
virtual void TerminateOneEvent()
void SetRunID(G4int id)
Definition: G4Run.hh:95
G4VUserDetectorConstruction * userDetector
G4VScoringMesh * GetMesh(G4int i) const
virtual void SetUserAction(G4UserRunAction *userAction)
void SetRandomNumberStatus(G4String &st)
Definition: G4Run.hh:103
virtual G4Run * GenerateRun()
void MergeScores(const G4ScoringManager *localScoringManager)
void SetEventID(G4int i)
Definition: G4Event.hh:115
G4PTblDicIterator * GetIterator() const
void UpdateScoring()
G4DCtable * DCtable
G4int n_perviousEventsToBeStored
G4VPhysicalVolume * GetCurrentWorld() const
G4int G4GetThreadId()
Definition: G4Threading.cc:144
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447
G4int verboseLevel
virtual void SetUserAction(G4UserRunAction *userAction)
static G4SDManager * GetSDMpointerIfExist()
Definition: G4SDManager.cc:49
static G4WorkerRunManagerKernel * GetWorkerRunManagerKernel()
virtual void MergePartialResults()
virtual void StoreRNGStatus(const G4String &filenamePrefix)