Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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"
29#include "G4MTRunManager.hh"
31#include "G4RNGHelper.hh"
32#include "G4Run.hh"
33#include "G4SDManager.hh"
34#include "G4ScoringManager.hh"
35#include "G4TiMemory.hh"
36#include "G4Timer.hh"
38#include "G4UImanager.hh"
39#include "G4UserRunAction.hh"
43#include "G4VScoringMesh.hh"
46#include "G4VUserPhysicsList.hh"
48#include "G4VVisManager.hh"
50#include "G4WorkerThread.hh"
51#include <fstream>
52#include <sstream>
53
55{
56 return static_cast<G4WorkerRunManager*>(G4RunManager::GetRunManager());
57}
58
60{
62}
63
65 : G4RunManager(workerRM)
66{
67 // This constructor should never be called in non-multithreaded mode
68
69#ifndef G4MULTITHREADED
71 msg << "Geant4 code is compiled without multi-threading support "
72 "(-DG4MULTITHREADED "
73 "is set to off).";
74 msg << " This type of RunManager can only be used in mult-threaded "
75 "applications.";
76 G4Exception("G4WorkerRunManager::G4WorkerRunManager()", "Run0103",
77 FatalException, msg);
78#endif
81 if(masterScM)
82 G4ScoringManager::GetScoringManager(); // TLS instance for a worker
83
84 eventLoopOnGoing = false;
85 runIsSeeded = false;
86 nevModulo = -1;
87 currEvID = -1;
88 workerContext = 0;
89 readStatusFromFile = false;
90
91 // Properly initialise luxury level for Ranlux* engines...
92 //
93 if(dynamic_cast<const CLHEP::Ranlux64Engine*>(G4Random::getTheEngine()))
94 {
96 dynamic_cast<const CLHEP::Ranlux64Engine*>(G4Random::getTheEngine());
97 luxury = theEngine->getLuxury();
98 }
99 else if(dynamic_cast<const CLHEP::RanluxEngine*>(G4Random::getTheEngine()))
100 {
102 dynamic_cast<const CLHEP::RanluxEngine*>(G4Random::getTheEngine());
103 luxury = theEngine->getLuxury();
104 }
105 else
106 {
107 luxury = -1;
108 }
109
111
112#ifdef G4MULTITHREADED
114 if(pVVis)
115 {
116 pVVis->SetUpForAThread();
117 visIsSetUp = true;
118 }
119 else
120 {
121 visIsSetUp = false;
122 }
123#endif
124}
125
126#include "G4MTRunManager.hh"
127
129{
130 // Delete thread-local data process manager objects
132 // physicsList->RemoveProcessManager();
133
134 // Put these pointers to zero: owned by master thread
135 // If not to zero, the base class destructor will attempt to
136 // delete them
137 userDetector = 0;
141 physicsList = 0;
142 if(verboseLevel > 0)
143 G4cout << "Destroying WorkerRunManager (" << this << ")" << G4endl;
144}
145
147{
148 if(!userDetector)
149 {
150 G4Exception("G4RunManager::InitializeGeometry", "Run0033", FatalException,
151 "G4VUserDetectorConstruction is not defined!");
152 return;
153 }
155 {
157 }
158
159 // Step1: Get pointer to the physiWorld (note: needs to get the "super
160 // pointer, i.e. the one shared by all threads"
161 G4RunManagerKernel* masterKernel =
163 G4VPhysicalVolume* worldVol = masterKernel->GetCurrentWorld();
164 // Step2:, Call a new "WorkerDefineWorldVolume( pointer from 2-, false);
165 kernel->WorkerDefineWorldVolume(worldVol, false);
167 // Step3: Call user's ConstructSDandField()
170 geometryInitialized = true;
171}
172
174
176{
177#ifdef G4MULTITHREADED
178 if(!visIsSetUp)
179 {
181 if(pVVis)
182 {
183 pVVis->SetUpForAThread();
184 visIsSetUp = true;
185 }
186 }
187#endif
188
190 return;
191
192 // Signal this thread can start event loop.
193 // Note this will return only when all threads reach this point
195 if(fakeRun)
196 return;
197
198 const G4UserWorkerInitialization* uwi =
201 if(currentRun)
202 delete currentRun;
203 currentRun = 0;
204
207 // Call a user hook: this is guaranteed all threads are "synchronized"
208 if(uwi)
209 uwi->WorkerRunStart();
210
211 if(userRunAction)
213 if(!currentRun)
214 currentRun = new G4Run();
215
218
221 if(fSDM)
222 {
224 }
225
227 {
228 auto hce = fSDM->PrepareNewEvent();
230 delete hce;
231 }
232
233 std::ostringstream oss;
234 G4Random::saveFullState(oss);
237
238 for(G4int i_prev = 0; i_prev < n_perviousEventsToBeStored; i_prev++)
239 {
240 previousEvents->push_back((G4Event*) 0);
241 }
242
243 if(printModulo > 0 || verboseLevel > 0)
244 {
245 G4cout << "### Run " << currentRun->GetRunID()
246 << " starts on worker thread " << G4Threading::G4GetThreadId() << "."
247 << G4endl;
248 }
249 if(userRunAction)
251
252#if defined(GEANT4_USE_TIMEMORY)
253 workerRunProfiler.reset(new ProfilerConfig(currentRun));
254#endif
255
257 {
259 }
260
262 {
263 G4String fileN = "currentRun";
265 {
266 std::ostringstream os;
267 os << "run" << currentRun->GetRunID();
268 fileN = os.str();
269 }
270 StoreRNGStatus(fileN);
271 }
272
273 runAborted = false;
275}
276
277void G4WorkerRunManager::DoEventLoop(G4int n_event, const char* macroFile,
278 G4int n_select)
279{
281 {
282 G4Exception("G4RunManager::GenerateEvent()", "Run0032", FatalException,
283 "G4VUserPrimaryGeneratorAction is not defined!");
284 }
285
286 // This is the same as in the sequential case, just the for-loop indexes are
287 // different
288 InitializeEventLoop(n_event, macroFile, n_select);
289
290 // Reset random number seeds queue
291 while(seedsQueue.size() > 0)
292 {
293 seedsQueue.pop();
294 }
295 // for each run, worker should receive at least one set of random number
296 // seeds.
297 runIsSeeded = false;
298
299 // Event loop
300 eventLoopOnGoing = true;
301 /////// G4int i_event = workerContext->GetThreadId();
302 G4int i_event = -1;
303 nevModulo = -1;
304 currEvID = -1;
305
306 while(eventLoopOnGoing)
307 {
308 ProcessOneEvent(i_event);
310 {
312 if(runAborted)
313 {
314 eventLoopOnGoing = false;
315 }
316 ////// else
317 ////// {
318 ////// i_event += workerContext->GetNumberThreads();
319 ////// eventLoopOnGoing = i_event<n_event;
320 ////// }
321 }
322 }
323
325}
326
328{
329 currentEvent = GenerateEvent(i_event);
331 {
337 }
338}
339
341{
342 G4Event* anEvent = new G4Event(i_event);
343 long s1 = 0;
344 long s2 = 0;
345 long s3 = 0;
346 G4bool eventHasToBeSeeded = true;
348 {
349 eventHasToBeSeeded = false;
350 }
351
352 if(i_event < 0)
353 {
355 if(nevM == 1)
356 {
358 anEvent, s1, s2, s3, eventHasToBeSeeded);
359 runIsSeeded = true;
360 }
361 else
362 {
363 if(nevModulo <= 0)
364 {
366 anEvent, &seedsQueue, eventHasToBeSeeded);
367 if(nevToDo == 0)
368 {
369 eventLoopOnGoing = false;
370 }
371 else
372 {
373 currEvID = anEvent->GetEventID();
374 nevModulo = nevToDo - 1;
375 }
376 }
377 else
378 {
380 eventHasToBeSeeded = false;
381 anEvent->SetEventID(++currEvID);
382 nevModulo--;
383 }
384 if(eventLoopOnGoing && eventHasToBeSeeded)
385 {
386 s1 = seedsQueue.front();
387 seedsQueue.pop();
388 s2 = seedsQueue.front();
389 seedsQueue.pop();
390 }
391 }
392
394 {
395 delete anEvent;
396 return 0;
397 }
398 }
399 else if(eventHasToBeSeeded)
400 {
401 // Need to reseed random number generator
403 s1 = helper->GetSeed(i_event * 2);
404 s2 = helper->GetSeed(i_event * 2 + 1);
405 }
406
407 if(eventHasToBeSeeded)
408 {
409 long seeds[3] = { s1, s2, 0 };
410 G4Random::setTheSeeds(seeds, luxury);
411 runIsSeeded = true;
412 ////G4cout<<"Event "<<currEvID<<" is seeded with { "<<s1<<", "<<s2<<"
413 ///}"<<G4endl;
414 }
415
416 // Read from file seed.
417 // Andrea Dotti 4 November 2015
418 // This is required for strong-reproducibility, in MT mode we have that each
419 // thread produces, for each event a status file, we want to do that.
420 // Search a random file with the format run{%d}evt{%d}.rndm
421
422 // This is the filename base constructed from run and event
423 const auto filename = [&] {
424 std::ostringstream os;
425 os << "run" << currentRun->GetRunID() << "evt" << anEvent->GetEventID();
426 return os.str();
427 };
428
429 G4bool RNGstatusReadFromFile = false;
431 {
432 // Build full path of RNG status file for this event
433 std::ostringstream os;
434 os << filename() << ".rndm";
435 const G4String& randomStatusFile = os.str();
436 std::ifstream ifile(randomStatusFile.c_str());
437 if(ifile)
438 { // File valid and readable
439 RNGstatusReadFromFile = true;
440 G4Random::restoreEngineStatus(randomStatusFile.c_str());
441 }
442 }
443
446 {
447 std::ostringstream oss;
448 G4Random::saveFullState(oss);
451 }
452
453 if(storeRandomNumberStatus && !RNGstatusReadFromFile)
454 { // If reading from file, avoid to rewrite the same
455 G4String fileN = "currentEvent";
457 {
458 fileN = filename();
459 }
460 StoreRNGStatus(fileN);
461 }
462
463 if(printModulo > 0 && anEvent->GetEventID() % printModulo == 0)
464 {
465 G4cout << "--> Event " << anEvent->GetEventID() << " starts";
466 if(eventHasToBeSeeded)
467 {
468 G4cout << " with initial seeds (" << s1 << "," << s2 << ")";
469 }
470 G4cout << "." << G4endl;
471 }
473 return anEvent;
474}
475
477{
478 // Merge partial results into global run
481 if(ScM)
482 mtRM->MergeScores(ScM);
483 mtRM->MergeRun(currentRun);
484}
485
487{
488 if(!fakeRun)
489 {
490#if defined(GEANT4_USE_TIMEMORY)
491 workerRunProfiler.reset();
492#endif
494
495 // Call a user hook: note this is before the next barrier
496 // so threads execute this method asyncrhonouzly
497 //(TerminateRun allows for synch via G4RunAction::EndOfRun)
498 const G4UserWorkerInitialization* uwi =
500 if(uwi)
501 uwi->WorkerRunEnd();
502 }
503
505 // Signal this thread has finished envent-loop.
506 // Note this will return only whan all threads reach this point
508}
509
511{
512 if(verboseLevel > 0 && !fakeRun)
513 {
514 timer->Stop();
515 G4cout << "Thread-local run terminated." << G4endl;
516 G4cout << "Run Summary" << G4endl;
517 if(runAborted)
518 {
519 G4cout << " Run Aborted after " << numberOfEventProcessed
520 << " events processed." << G4endl;
521 }
522 else
523 {
524 G4cout << " Number of events processed : " << numberOfEventProcessed
525 << G4endl;
526 }
527 G4cout << " " << *timer << G4endl;
528 }
529}
530
531/****************************
532void G4WorkerRunManager::BeamOn(G4int n_event,const char* macroFile,G4int
533n_select)
534{
535 if(n_event>0)
536 { G4RunManager::BeamOn(n_event,macroFile,n_select); }
537 else
538 {
539 // fake BeamOn.
540 G4MTRunManager::GetMasterRunManager()->ThisWorkerReady();
541 G4MTRunManager::GetMasterRunManager()->ThisWorkerEndEventLoop();
542 }
543}
544******************************/
545
546#include "G4AutoLock.hh"
547namespace
548{
549 G4Mutex ConstructScoringWorldsMutex = G4MUTEX_INITIALIZER;
550}
552{
553 using MeshShape = G4VScoringMesh::MeshShape;
554
555 // Return if unnecessary
557 if(!ScM)
558 return;
559 G4int nPar = ScM->GetNumberOfMesh();
560 if(nPar < 1)
561 return;
562
563 // Update thread-local G4TransportationManager of all the world volumes
565
567 assert(masterScM != NULL);
568
571
572 for(G4int iw = 0; iw < nPar; iw++)
573 {
574 G4VScoringMesh* mesh = ScM->GetMesh(iw);
577 G4VPhysicalVolume* pWorld = nullptr;
578 if(mesh->GetShape() != MeshShape::realWorldLogVol)
579 {
580 pWorld =
582 ScM->GetWorldName(iw));
583 if(!pWorld)
584 {
586 ed << "Mesh name <" << ScM->GetWorldName(iw)
587 << "> is not found in the master thread.";
588 G4Exception("G4WorkerRunManager::ConstructScoringWorlds()", "RUN79001",
589 FatalException, ed);
590 }
591 }
592 if(!(mesh->GetMeshElementLogical()))
593 {
594 G4AutoLock l(&ConstructScoringWorldsMutex);
595 G4VScoringMesh* masterMesh = masterScM->GetMesh(iw);
596 mesh->SetMeshElementLogical(masterMesh->GetMeshElementLogical());
597 l.unlock();
598
599 if(mesh->GetShape() != MeshShape::realWorldLogVol)
600 {
601 G4ParallelWorldProcess* theParallelWorldProcess =
603 if(theParallelWorldProcess)
604 {
605 theParallelWorldProcess->SetParallelWorld(ScM->GetWorldName(iw));
606 }
607 else
608 {
609 theParallelWorldProcess =
611 mesh->SetParallelWorldProcess(theParallelWorldProcess);
612 theParallelWorldProcess->SetParallelWorld(ScM->GetWorldName(iw));
613
614 particleIterator->reset();
615 while((*particleIterator)())
616 {
617 G4ParticleDefinition* particle = particleIterator->value();
618 G4ProcessManager* pmanager = particle->GetProcessManager();
619 if(pmanager)
620 {
621 pmanager->AddProcess(theParallelWorldProcess);
622 if(theParallelWorldProcess->IsAtRestRequired(particle))
623 {
624 pmanager->SetProcessOrdering(theParallelWorldProcess, idxAtRest,
625 9900);
626 }
627 pmanager->SetProcessOrderingToSecond(theParallelWorldProcess,
629 pmanager->SetProcessOrdering(theParallelWorldProcess, idxPostStep,
630 9900);
631 } // if(pmanager)
632 } // while
633 }
634 theParallelWorldProcess->SetLayeredMaterialFlag(mesh->LayeredMassFlg());
635 }
636 }
637 mesh->WorkerConstruct(pWorld);
638 }
639}
640
642{
644 "G4RunManager::SetUserInitialization(G4UserWorkerInitialization*)",
645 "Run0118", FatalException,
646 "This method should be used only with an instance of G4MTRunManager");
647}
648
651{
653 "G4RunManager::SetUserInitialization(G4UserWorkerThreadInitialization*)",
654 "Run0119", FatalException,
655 "This method should be used only with an instance of G4MTRunManager");
656}
657
659{
661 "G4RunManager::SetUserInitialization(G4VUserActionInitialization*)",
662 "Run0120", FatalException,
663 "This method should be used only with an instance of G4MTRunManager");
664}
665
667{
669 "G4RunManager::SetUserInitialization(G4VUserDetectorConstruction*)",
670 "Run0121", FatalException,
671 "This method should be used only with an instance of G4MTRunManager");
672}
673
675{
676 pl->InitializeWorker();
678}
679
681{
682 G4RunManager::SetUserAction(userAction);
683 if(userAction)
684 userAction->SetMaster(false);
685}
686
687void G4WorkerRunManager::SetupDefaultRNGEngine()
688{
689 const CLHEP::HepRandomEngine* mrnge =
691 assert(mrnge); // Master has created RNG
694 uwti->SetupRNGEngine(mrnge);
695}
696
697// Forward calls (avoid GCC compilation warnings)
699{
701}
702
704{
706}
707
709{
711}
712
714{
716}
717
719{
721}
722
724{
725 std::ostringstream os;
726 os << randomNumberStatusDir << "G4Worker" << workerContext->GetThreadId()
727 << "_" << fn << ".rndm";
728 G4Random::saveEngineStatus(os.str().c_str());
729}
730
732{
733 G4int runNumber = 0;
734 if(currentRun) runNumber = currentRun->GetRunID();
736 {
737 G4cerr << "Warning from G4RunManager::rndmSaveThisRun():"
738 << " Random number status was not stored prior to this run."
739 << G4endl << "/random/setSavingFlag command must be issued. "
740 << "Command ignored." << G4endl;
741 return;
742 }
743
744 std::ostringstream oos;
745 oos << "G4Worker" << workerContext->GetThreadId()
746 << "_" << "currentRun.rndm" << "\0";
747 G4String fileIn = randomNumberStatusDir + oos.str();
748
749 std::ostringstream os;
750 os << "run" << runNumber << ".rndm" << '\0';
751 G4String fileOut = randomNumberStatusDir + os.str();
752
753#ifdef WIN32
754 G4String copCmd = "/control/shell copy " + fileIn + " " + fileOut;
755#else
756 G4String copCmd = "/control/shell cp " + fileIn + " " + fileOut;
757#endif
759 if(verboseLevel > 0)
760 { G4cout << fileIn << " is copied to " << fileOut << G4endl; }
761}
762
764{
765 if(currentEvent == 0)
766 {
767 G4cerr
768 << "Warning from G4RunManager::rndmSaveThisEvent():"
769 << " there is no currentEvent available."
770 << G4endl << "Command ignored." << G4endl;
771 return;
772 }
773
775 {
776 G4cerr
777 << "Warning from G4RunManager::rndmSaveThisEvent():"
778 << " Random number engine status is not available."
779 << G4endl << "/random/setSavingFlag command must be issued "
780 << "prior to the start of the run. Command ignored." << G4endl;
781 return;
782 }
783
784 std::ostringstream oos;
785 oos << "G4Worker" << workerContext->GetThreadId()
786 << "_" << "currentEvent.rndm" << "\0";
787 G4String fileIn = randomNumberStatusDir + oos.str();
788
789 std::ostringstream os;
790 os << "run" << currentRun->GetRunID() << "evt" << currentEvent->GetEventID()
791 << ".rndm" << '\0';
792 G4String fileOut = randomNumberStatusDir + os.str();
793
794#ifdef WIN32
795 G4String copCmd = "/control/shell copy " + fileIn + " " + fileOut;
796#else
797 G4String copCmd = "/control/shell cp " + fileIn + " " + fileOut;
798#endif
800 if(verboseLevel > 0)
801 { G4cout << fileIn << " is copied to " << fileOut << G4endl; }
802}
803
805{
810 {
811 if(nextAction ==
813 // run
814 {
815 // The following code deals with changing materials between runs
816 static G4ThreadLocal G4bool skipInitialization = true;
817 if(skipInitialization)
818 {
819 // re-initialization is not necessary for the first run
820 skipInitialization = false;
821 }
822 else
823 {
824 // ReinitializeGeometry();
826 }
827
828 // Execute UI commands stored in the master UI manager
829 std::vector<G4String> cmds = mrm->GetCommandStack();
830 G4UImanager* uimgr = G4UImanager::GetUIpointer(); // TLS instance
831 std::vector<G4String>::const_iterator it = cmds.begin();
832 for(; it != cmds.end(); it++)
833 {
834 uimgr->ApplyCommand(*it);
835 }
836 // Start this run
837 G4int numevents = mrm->GetNumberOfEventsToBeProcessed();
838 G4String macroFile = mrm->GetSelectMacro();
839 G4int numSelect = mrm->GetNumberOfSelectEvents();
840 if(macroFile == "" || macroFile == " ")
841 {
842 this->BeamOn(numevents);
843 }
844 else
845 {
846 this->BeamOn(numevents, macroFile, numSelect);
847 }
848 }
850 {
851 std::vector<G4String> cmds = mrm->GetCommandStack();
852 G4UImanager* uimgr = G4UImanager::GetUIpointer(); // TLS instance
853 std::vector<G4String>::const_iterator it = cmds.begin();
854 for(; it != cmds.end(); it++)
855 {
856 uimgr->ApplyCommand(*it);
857 }
859 }
860 else
861 {
863 d << "Cannot continue, this worker has been requested an unknown action: "
864 << static_cast<
865 std::underlying_type<G4MTRunManager::WorkerActionRequest>::type>(
866 nextAction);
867 G4Exception("G4WorkerRunManager::DoWork", "Run0104", FatalException, d);
868 }
869
870 // Now wait for master thread to signal new action to be performed
871 nextAction = mrm->ThisWorkerWaitForNextAction();
872 } // No more actions to perform
873
874 return;
875}
std::vector< G4InuclElementaryParticle >::iterator particleIterator
Definition: G4BigBanger.cc:64
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
@ idxPostStep
@ idxAtRest
@ idxAlongStep
#define G4MUTEX_INITIALIZER
Definition: G4Threading.hh:85
std::mutex G4Mutex
Definition: G4Threading.hh:81
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
std::shared_ptr< HepRandomEngine > theEngine
Definition: Random.cc:76
void ProcessOneEvent(G4Event *anEvent)
void SetRandomNumberStatus(G4String &st)
Definition: G4Event.hh:90
G4int GetEventID() const
Definition: G4Event.hh:118
void SetEventID(G4int i)
Definition: G4Event.hh:80
static G4int SeedOncePerCommunication()
virtual WorkerActionRequest ThisWorkerWaitForNextAction()
virtual void ThisWorkerProcessCommandsStackDone()
virtual G4int SetUpNEvents(G4Event *, G4SeedsQueue *seedsQueue, G4bool reseedRequired=true)
virtual G4bool SetUpAnEvent(G4Event *, long &s1, long &s2, long &s3, G4bool reseedRequired=true)
const CLHEP::HepRandomEngine * getMasterRandomEngine() const
static G4ScoringManager * GetMasterScoringManager()
virtual void ThisWorkerReady()
G4int GetEventModulo() const
static G4MTRunManager * GetMasterRunManager()
void MergeRun(const G4Run *localRun)
static G4RunManagerKernel * GetMasterRunManagerKernel()
void MergeScores(const G4ScoringManager *localScoringManager)
std::vector< G4String > GetCommandStack()
virtual void ThisWorkerEndEventLoop()
static G4ParallelWorldProcessStore * GetInstance()
void SetLayeredMaterialFlag(G4bool flg=true)
void SetParallelWorld(G4String parallelWorldName)
G4bool IsAtRestRequired(G4ParticleDefinition *)
G4ProcessManager * GetProcessManager() const
G4PTblDicIterator * GetIterator() const
static G4ParticleTable * GetParticleTable()
void WorkerG4ParticleTable()
void SetProcessOrdering(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt, G4int ordDoIt=ordDefault)
void SetProcessOrderingToSecond(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt)
G4int AddProcess(G4VProcess *aProcess, G4int ordAtRestDoIt=ordInActive, G4int ordAlongSteptDoIt=ordInActive, G4int ordPostStepDoIt=ordInActive)
G4VPhysicalVolume * GetCurrentWorld() const
void SetNumberOfParallelWorld(G4int i)
G4bool RunInitialization(G4bool fakeRun=false)
void WorkerDefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
G4int GetNumberOfParallelWorld() const
G4bool isScoreNtupleWriter
G4bool geometryInitialized
void CleanUpPreviousEvents()
G4int storeRandomNumberStatusToG4Event
G4UserWorkerInitialization * userWorkerInitialization
const G4UserWorkerInitialization * GetUserWorkerInitialization() const
std::list< G4Event * > * previousEvents
G4Timer * timer
G4UserWorkerThreadInitialization * userWorkerThreadInitialization
G4int n_select_msg
G4int numberOfEventProcessed
G4int GetNumberOfEventsToBeProcessed() const
virtual void BeamOn(G4int n_event, const char *macroFile=0, G4int n_select=-1)
G4int runIDCounter
G4RunManagerKernel * kernel
G4int verboseLevel
G4Run * currentRun
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:84
G4DCtable * DCtable
G4String randomNumberStatusForThisRun
G4bool runAborted
G4String msgText
G4UserRunAction * userRunAction
G4bool rngStatusEventsFlag
virtual void RunTermination()
G4VUserActionInitialization * userActionInitialization
static G4RUN_DLL G4bool fGeometryHasBeenDestroyed
G4VUserDetectorConstruction * userDetector
G4VUserPrimaryGeneratorAction * userPrimaryGeneratorAction
G4int numberOfEventToBeProcessed
G4String randomNumberStatusDir
virtual void SetUserAction(G4UserRunAction *userAction)
G4String randomNumberStatusForThisEvent
const G4UserWorkerThreadInitialization * GetUserWorkerThreadInitialization() const
G4int n_perviousEventsToBeStored
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
G4String GetSelectMacro() const
G4bool storeRandomNumberStatus
G4EventManager * eventManager
virtual void TerminateOneEvent()
G4int GetNumberOfSelectEvents() const
G4VUserPhysicsList * physicsList
virtual void AnalyzeEvent(G4Event *anEvent)
void UpdateScoring()
G4Event * currentEvent
virtual void InitializeEventLoop(G4int n_event, const char *macroFile=0, G4int n_select=-1)
Definition: G4Run.hh:49
void SetHCtable(G4HCtable *HCtbl)
Definition: G4Run.hh:106
G4int GetRunID() const
Definition: G4Run.hh:82
void SetNumberOfEventToBeProcessed(G4int n_ev)
Definition: G4Run.hh:102
void SetRunID(G4int id)
Definition: G4Run.hh:101
void SetDCtable(G4DCtable *DCtbl)
Definition: G4Run.hh:107
void SetRandomNumberStatus(G4String &st)
Definition: G4Run.hh:108
G4HCofThisEvent * PrepareNewEvent()
Definition: G4SDManager.cc:109
static G4SDManager * GetSDMpointerIfExist()
Definition: G4SDManager.cc:48
G4HCtable * GetHCtable() const
Definition: G4SDManager.hh:103
G4VScoringMesh * GetMesh(G4int i) const
size_t GetNumberOfMesh() const
static G4ScoringManager * GetScoringManager()
G4String GetWorldName(G4int i) const
static G4ScoringManager * GetScoringManagerIfExist()
static G4TemplateRNGHelper< T > * GetInstance()
Definition: G4RNGHelper.cc:37
virtual const T GetSeed(const G4int &sdId)
Definition: G4RNGHelper.hh:58
void Stop()
static G4TransportationManager * GetTransportationManager()
G4VPhysicalVolume * IsWorldExisting(const G4String &worldName)
void SetIgnoreCmdNotFound(G4bool val)
Definition: G4UImanager.hh:222
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:485
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77
virtual void BeginOfRunAction(const G4Run *aRun)
virtual G4Run * GenerateRun()
virtual void SetMaster(G4bool val=true)
virtual void SetupRNGEngine(const CLHEP::HepRandomEngine *aRNGEngine) const
virtual G4bool Book(G4HCofThisEvent *hce)=0
static G4VScoreNtupleWriter * Instance()
virtual void OpenFile()=0
MeshShape GetShape() const
G4LogicalVolume * GetMeshElementLogical() const
void WorkerConstruct(G4VPhysicalVolume *fWorldPhys)
void GeometryHasBeenDestroyed()
G4ParallelWorldProcess * GetParallelWorldProcess() const
void SetParallelWorldProcess(G4ParallelWorldProcess *proc)
void SetMeshElementLogical(G4LogicalVolume *val)
G4bool LayeredMassFlg()
virtual void TerminateWorker()
virtual void InitializeWorker()
virtual void GeneratePrimaries(G4Event *anEvent)=0
static G4VVisManager * GetConcreteInstance()
virtual void ConstructScoringWorlds()
static G4WorkerRunManagerKernel * GetWorkerRunManagerKernel()
virtual void RunTermination()
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)
G4ProfilerConfig< G4ProfileType::Run > ProfilerConfig
virtual void InitializeGeometry()
virtual G4Event * GenerateEvent(G4int i_event)
virtual void StoreRNGStatus(const G4String &filenamePrefix)
G4int GetThreadId() const
static void UpdateGeometryAndPhysicsVectorFromMaster()
G4int G4GetThreadId()
Definition: G4Threading.cc:122
#define G4ThreadLocal
Definition: tls.hh:77