Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4MTRunManager.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// G4MTRunManager implementation
27//
28// Original authors: X.Dong, A.Dotti - February 2013
29// --------------------------------------------------------------------
30
31#include "G4MTRunManager.hh"
32#include "G4AutoLock.hh"
35#include "G4Run.hh"
36#include "G4ScoringManager.hh"
37#include "G4StateManager.hh"
38#include "G4TiMemory.hh"
39#include "G4Timer.hh"
41#include "G4UImanager.hh"
42#include "G4UserRunAction.hh"
46#include "G4WorkerRunManager.hh"
47#include "G4WorkerThread.hh"
48
54G4ThreadId G4MTRunManager::masterThreadId = G4ThisThread::get_id();
55
56// --------------------------------------------------------------------
57namespace
58{
59 G4Mutex cmdHandlingMutex = G4MUTEX_INITIALIZER;
60 G4Mutex scorerMergerMutex = G4MUTEX_INITIALIZER;
61 G4Mutex runMergerMutex = G4MUTEX_INITIALIZER;
62 G4Mutex setUpEventMutex = G4MUTEX_INITIALIZER;
63} // namespace
64
65// --------------------------------------------------------------------
67{
68 return fMasterRM;
69}
70
71// --------------------------------------------------------------------
73{
74 return fMasterRM->kernel;
75}
76
77// --------------------------------------------------------------------
79{
80 return fMasterRM->MTkernel;
81}
82
83// --------------------------------------------------------------------
85{
86 return masterScM;
87}
88
89// --------------------------------------------------------------------
91{
92 return masterWorlds;
93}
94
95// --------------------------------------------------------------------
97{
98 masterWorlds.insert(std::make_pair(counter, w));
99}
100
101// --------------------------------------------------------------------
103{
104 return masterThreadId;
105}
106
107// --------------------------------------------------------------------
109{
111}
112
113// --------------------------------------------------------------------
115{
117}
118
119// --------------------------------------------------------------------
121 : G4RunManager(masterRM)
122{
123 if(fMasterRM)
124 {
125 G4Exception("G4MTRunManager::G4MTRunManager", "Run0110", FatalException,
126 "Another instance of a G4MTRunManager already exists.");
127 }
128 fMasterRM = this;
129 masterThreadId = G4ThisThread::get_id();
130 MTkernel = static_cast<G4MTRunManagerKernel*>(kernel);
131#ifndef G4MULTITHREADED
133 msg << "Geant4 code is compiled without multi-threading support"
134 << "(-DG4MULTITHREADED is set to off).\n";
135 msg << "G4MTRunManager can only be used in multi-threaded applications.";
136 G4Exception("G4MTRunManager::G4MTRunManager", "Run0111", FatalException, msg);
137#endif
138
139 G4int numberOfStaticAllocators = kernel->GetNumberOfStaticAllocators();
140 if(numberOfStaticAllocators > 0)
141 {
143 msg1
144 << "There are " << numberOfStaticAllocators
145 << " static G4Allocator objects detected.\n"
146 << "In multi-threaded mode, all G4Allocator objects must be dynamically "
147 "instantiated.";
148 G4Exception("G4MTRunManager::G4MTRunManager", "Run1035", FatalException,
149 msg1);
150 }
153
154 // Check if a default RandomNumberGenerator has been created by user,
155 // if not create default one
156 // Note this call forces creation of defaults if not already there
157 // G4Random::getTheEngine(); //User did not specify RNG, create defaults
158 // Now remember the master instance of the RNG Engine
159 masterRNGEngine = G4Random::getTheEngine();
160
162
163 char* env = std::getenv("G4FORCENUMBEROFTHREADS");
164 if(env)
165 {
166 G4String envS = env;
167 if(envS == "MAX" || envS == "max")
168 {
170 }
171 else
172 {
173 std::istringstream is(env);
174 G4int val = -1;
175 is >> val;
176 if(val > 0)
177 {
178 forcedNwokers = val;
179 }
180 else
181 {
183 msg2 << "Environment variable G4FORCENUMBEROFTHREADS has an invalid "
184 "value <"
185 << envS << ">. It has to be an integer or a word \"max\".\n"
186 << "G4FORCENUMBEROFTHREADS is ignored.";
187 G4Exception("G4MTRunManager::G4MTRunManager", "Run1039", JustWarning,
188 msg2);
189 }
190 }
191 if(forcedNwokers > 0)
192 {
194 if(verboseLevel > 0)
195 { G4cout << "### Number of threads is forced to " << forcedNwokers
196 << " by Environment variable G4FORCENUMBEROFTHREADS." << G4endl; }
197 }
198 }
199}
200
201// --------------------------------------------------------------------
203{
204 // TODO: Currently does not work due to concurrent deletion of something
205 // that is shared:
206 // G4ProcessTable::DeleteMessenger from ~G4RunManager
207 // G4cout<<"Destroy MTRunManager"<<G4endl;//ANDREA
209 delete[] randDbl;
210}
211
212// --------------------------------------------------------------------
214{
215 std::ostringstream os;
216 os << randomNumberStatusDir << "G4Master_" << fn << ".rndm";
217 G4Random::saveEngineStatus(os.str().c_str());
218}
219
220// --------------------------------------------------------------------
222{
223 G4int runNumber = 0;
224 if(currentRun != nullptr)
225 runNumber = currentRun->GetRunID();
227 {
228 G4cerr << "Warning from G4RunManager::rndmSaveThisRun():"
229 << " Random number status was not stored prior to this run."
230 << G4endl << "/random/setSavingFlag command must be issued. "
231 << "Command ignored." << G4endl;
232 return;
233 }
234
235 G4String fileIn = randomNumberStatusDir + "G4Worker_currentRun.rndm";
236
237 std::ostringstream os;
238 os << "run" << runNumber << ".rndm" << '\0';
239 G4String fileOut = randomNumberStatusDir + os.str();
240
241#ifdef WIN32
242 G4String copCmd = "/control/shell copy " + fileIn + " " + fileOut;
243#else
244 G4String copCmd = "/control/shell cp " + fileIn + " " + fileOut;
245#endif
247 if(verboseLevel > 0)
248 {
249 G4cout << fileIn << " is copied to " << fileOut << G4endl;
250 }
251}
252
253// --------------------------------------------------------------------
255{
256 G4Exception("G4MTRunManager::rndmSaveThisEvent", "RUN_RNDM001",
257 FatalException, "This method shall not be invoked !!");
258}
259
260// --------------------------------------------------------------------
262{
263 if(threads.size() != 0)
264 {
266 msg << "Number of threads cannot be changed at this moment \n"
267 << "(old threads are still alive). Method ignored.";
268 G4Exception("G4MTRunManager::SetNumberOfThreads(G4int)", "Run0112",
269 JustWarning, msg);
270 }
271 else if(forcedNwokers > 0)
272 {
274 msg << "Number of threads is forced to " << forcedNwokers
275 << " by G4FORCENUMBEROFTHREADS shell variable.\n"
276 << "Method ignored.";
277 G4Exception("G4MTRunManager::SetNumberOfThreads(G4int)", "Run0113",
278 JustWarning, msg);
279 }
280 else
281 {
282 nworkers = n;
283 }
284}
285
286// --------------------------------------------------------------------
288{
290
291 // make sure all worker threads are set up.
292 BeamOn(0);
294 /// G4UImanager::GetUIpointer()->SetIgnoreCmdNotFound(true);
295}
296
297// --------------------------------------------------------------------
299{
300 // Nothing to do
301}
302
303// --------------------------------------------------------------------
305{
306 // Nothing to do
307}
308
309// --------------------------------------------------------------------
311{
312 G4AutoLock l(&cmdHandlingMutex);
313 uiCmdsForWorkers.clear();
314 std::vector<G4String>* cmdCopy =
316 for(auto it = cmdCopy->cbegin(); it != cmdCopy->cend(); ++it)
317 uiCmdsForWorkers.push_back(*it);
318 cmdCopy->clear();
319 delete cmdCopy;
320}
321
322// --------------------------------------------------------------------
323std::vector<G4String> G4MTRunManager::GetCommandStack()
324{
325 G4AutoLock l(&cmdHandlingMutex);
326 return uiCmdsForWorkers;
327}
328
329// --------------------------------------------------------------------
331{
332 // Now loop on requested number of workers
333 // This will also start the workers
334 // Currently we do not allow to change the
335 // number of threads: threads area created once
336 if(threads.size() == 0)
337 {
338 if(verboseLevel > 0)
339 {
340 // for consistency with G4TaskRunManager
341 std::stringstream msg;
342 msg << "--> G4MTRunManager::CreateAndStartWorkers() --> "
343 << "Initializing workers...";
344
345 std::stringstream ss;
346 ss.fill('=');
347 ss << std::setw(G4int(msg.str().length())) << "";
348 G4cout << "\n"
349 << ss.str() << "\n"
350 << msg.str() << "\n"
351 << ss.str() << "\n"
352 << G4endl;
353 }
354
355 for(G4int nw = 0; nw < nworkers; ++nw)
356 {
357 // Create a new worker and remember it
358 G4WorkerThread* context = new G4WorkerThread;
359 context->SetNumberThreads(nworkers);
360 context->SetThreadId(nw);
361 G4Thread* thread =
363 threads.push_back(thread);
364 }
365 }
366 // Signal to threads they can start a new run
368}
369
370// --------------------------------------------------------------------
371void G4MTRunManager::InitializeEventLoop(G4int n_event, const char* macroFile,
372 G4int n_select)
373{
374 MTkernel->SetUpDecayChannels();
377
378 if(!fakeRun)
379 {
380 nSeedsUsed = 0;
381 nSeedsFilled = 0;
382
383 if(verboseLevel > 0)
384 {
385 timer->Start();
386 }
387
388 n_select_msg = n_select;
389 if(macroFile != 0)
390 {
391 if(n_select_msg < 0)
392 n_select_msg = n_event;
393 msgText = "/control/execute ";
394 msgText += macroFile;
395 selectMacro = macroFile;
396 }
397 else
398 {
399 n_select_msg = -1;
400 selectMacro = "";
401 }
402
403 // initialize seeds
404 // If user did not implement InitializeSeeds,
405 // use default: nSeedsPerEvent seeds per event
406 if(eventModuloDef > 0)
407 {
410 {
412 if(eventModulo < 1)
413 eventModulo = 1;
415 msgd << "Event modulo is reduced to " << eventModulo
416 << " to distribute events to all threads.";
417 G4Exception("G4MTRunManager::InitializeEventLoop()", "Run10035",
418 JustWarning, msgd);
419 }
420 }
421 else
422 {
425 if(eventModulo < 1)
426 eventModulo = 1;
427 }
428 if(InitializeSeeds(n_event) == false && n_event > 0)
429 {
432 {
433 case 0:
434 nSeedsFilled = n_event;
435 break;
436 case 1:
438 break;
439 case 2:
440 nSeedsFilled = n_event / eventModulo + 1;
441 break;
442 default:
444 msgd << "Parameter value <" << seedOncePerCommunication
445 << "> of seedOncePerCommunication is invalid. It is reset to 0.";
446 G4Exception("G4MTRunManager::InitializeEventLoop()", "Run10036",
447 JustWarning, msgd);
449 nSeedsFilled = n_event;
450 }
451
452 // Generates up to nSeedsMax seed pairs only.
455 masterRNGEngine->flatArray(nSeedsPerEvent * nSeedsFilled, randDbl);
456 helper->Fill(randDbl, nSeedsFilled, n_event, nSeedsPerEvent);
457 }
458 }
459
460 // Now initialize workers. Check if user defined a WorkerThreadInitialization
461 if(userWorkerThreadInitialization == nullptr)
462 {
464 }
465
466 // Prepare UI commands for threads
468
469 // Start worker threads
471
472 // We need a barrier here. Wait for workers to start event loop.
473 // This will return only when all workers have started processing events.
475}
476
477// --------------------------------------------------------------------
479{
481 G4int nFill = 0;
483 {
484 case 0:
486 break;
487 case 1:
488 nFill = nworkers - nSeedsFilled;
489 break;
490 case 2:
491 default:
493 / eventModulo + 1;
494 }
495 // Generates up to nSeedsMax seed pairs only.
496 if(nFill > nSeedsMax)
497 nFill = nSeedsMax;
498 masterRNGEngine->flatArray(nSeedsPerEvent * nFill, randDbl);
499 helper->Refill(randDbl, nFill);
500 nSeedsFilled += nFill;
501}
502
503// --------------------------------------------------------------------
505{
506 // Wait for all worker threads to have finished the run
507 // i.e. wait for them to return from RunTermination()
508 // This guarantee that userrunaction for workers has been called
509
510 // Wait now for all threads to finish event-loop
512 // Now call base-class methof
515}
516
517// --------------------------------------------------------------------
519{
521 // Call base class stuff...
523
524 masterWorlds.clear();
525 G4int nWorlds = (G4int)
527 auto itrW =
529 for(G4int iWorld = 0; iWorld < nWorlds; ++iWorld)
530 {
531 addWorld(iWorld, *itrW);
532 ++itrW;
533 }
534}
535
536// --------------------------------------------------------------------
538{
539 userWorkerInitialization = userInit;
540}
541
542// --------------------------------------------------------------------
545{
547}
548
549// --------------------------------------------------------------------
552{
553 userActionInitialization = userInit;
555}
556
557// --------------------------------------------------------------------
559{
561 // Needed for MT, to be moved in kernel
562}
563
564// --------------------------------------------------------------------
566{
568}
569
570// --------------------------------------------------------------------
572{
573 G4RunManager::SetUserAction(userAction);
574 if(userAction)
575 userAction->SetMaster();
576}
577
578// --------------------------------------------------------------------
580 G4VUserPrimaryGeneratorAction* /*userAction*/)
581{
583 "G4MTRunManager::SetUserAction()", "Run0123", FatalException,
584 "For multi-threaded version, define G4VUserPrimaryGeneratorAction in "
585 "G4VUserActionInitialization.");
586}
587
588// --------------------------------------------------------------------
590{
591 G4Exception("G4MTRunManager::SetUserAction()", "Run0124", FatalException,
592 "For multi-threaded version, define G4UserEventAction in "
593 "G4VUserActionInitialization.");
594}
595
596// --------------------------------------------------------------------
598{
599 G4Exception("G4MTRunManager::SetUserAction()", "Run0125", FatalException,
600 "For multi-threaded version, define G4UserStackingAction in "
601 "G4VUserActionInitialization.");
602}
603
604// --------------------------------------------------------------------
606{
607 G4Exception("G4MTRunManager::SetUserAction()", "Run0126", FatalException,
608 "For multi-threaded version, define G4UserTrackingAction in "
609 "G4VUserActionInitialization.");
610}
611
612// --------------------------------------------------------------------
614{
615 G4Exception("G4MTRunManager::SetUserAction()", "Run0127", FatalException,
616 "For multi-threaded version, define G4UserSteppingAction in "
617 "G4VUserActionInitialization.");
618}
619
620// --------------------------------------------------------------------
621void G4MTRunManager::MergeScores(const G4ScoringManager* localScoringManager)
622{
623 G4AutoLock l(&scorerMergerMutex);
624 if(masterScM != nullptr && localScoringManager != nullptr)
625 masterScM->Merge(localScoringManager);
626}
627
628// --------------------------------------------------------------------
629void G4MTRunManager::MergeRun(const G4Run* localRun)
630{
631 G4AutoLock l(&runMergerMutex);
632 if(currentRun != nullptr && localRun != nullptr)
633 currentRun->Merge(localRun);
634}
635
636// --------------------------------------------------------------------
637G4bool G4MTRunManager::SetUpAnEvent(G4Event* evt, long& s1, long& s2, long& s3,
638 G4bool reseedRequired)
639{
640 G4AutoLock l(&setUpEventMutex);
642 {
644 if(reseedRequired)
645 {
647 G4int idx_rndm = nSeedsPerEvent * nSeedsUsed;
648 s1 = helper->GetSeed(idx_rndm);
649 s2 = helper->GetSeed(idx_rndm + 1);
650 if(nSeedsPerEvent == 3)
651 s3 = helper->GetSeed(idx_rndm + 2);
652 ++nSeedsUsed;
654 RefillSeeds();
655 }
657 return true;
658 }
659 return false;
660}
661
662// --------------------------------------------------------------------
664 G4bool reseedRequired)
665{
666 G4AutoLock l(&setUpEventMutex);
668 {
669 G4int nev = eventModulo;
671 {
673 }
675 if(reseedRequired)
676 {
678 G4int nevRnd = nev;
680 nevRnd = 1;
681 for(G4int i = 0; i < nevRnd; ++i)
682 {
683 seedsQueue->push(helper->GetSeed(nSeedsPerEvent * nSeedsUsed));
684 seedsQueue->push(helper->GetSeed(nSeedsPerEvent * nSeedsUsed + 1));
685 if(nSeedsPerEvent == 3)
686 seedsQueue->push(helper->GetSeed(nSeedsPerEvent * nSeedsUsed + 2));
687 ++nSeedsUsed;
689 RefillSeeds();
690 }
691 }
693 return nev;
694 }
695 return 0;
696}
697
698// --------------------------------------------------------------------
700{
701 // Force workers to execute (if any) all UI commands left in the stack
703 // Ask workers to exit
705 // finalize profiler before shutting down the threads
707 // Now join threads.
708#ifdef G4MULTITHREADED // protect here to prevent warning in compilation
709 while(!threads.empty())
710 {
711 G4Thread* t = *(threads.begin());
712 threads.pop_front();
714 // G4THREADJOIN(*t);
715 delete t;
716 }
717#endif
718 threads.clear();
719}
720
721// --------------------------------------------------------------------
723{
724 // This method is valid only for GeomClosed or EventProc state
725 G4ApplicationState currentState =
727 if(currentState == G4State_GeomClosed || currentState == G4State_EventProc)
728 {
729 runAborted = true;
730 MTkernel->BroadcastAbortRun(softAbort);
731 }
732 else
733 {
734 G4cerr << "Run is not in progress. AbortRun() ignored." << G4endl;
735 }
736}
737
738// --------------------------------------------------------------------
740{
741 // nothing to do in the master thread
742}
743
744// --------------------------------------------------------------------
746{
750}
751
752// --------------------------------------------------------------------
754{
756}
757
758// --------------------------------------------------------------------
760{
764}
765
766// --------------------------------------------------------------------
768{
770}
771
772// --------------------------------------------------------------------
775{
777 // nextActionRequest is a shared resource, but there is no
778 // data-race thanks to the barrier: all threads are waiting
779 nextActionRequest = newRequest;
781}
782
783// --------------------------------------------------------------------
786{
788 return nextActionRequest;
789}
790
791// --------------------------------------------------------------------
793{
798}
799
800// --------------------------------------------------------------------
802{
804}
805
806// --------------------------------------------------------------------
808{
809 if(n == 0)
810 {
811 G4Exception("G4MTRunManager::SetPinAffinity", "Run0114", FatalException,
812 "Pin affinity must be >0 or <0.");
813 }
814 pinAffinity = n;
815 return;
816}
G4ApplicationState
@ G4State_EventProc
@ G4State_GeomClosed
@ JustWarning
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
std::queue< G4long > G4SeedsQueue
Definition: G4RNGHelper.hh:136
#define G4MUTEX_INITIALIZER
Definition: G4Threading.hh:85
G4Thread::id G4ThreadId
Definition: G4Threading.hh:286
std::mutex G4Mutex
Definition: G4Threading.hh:81
double G4double
Definition: G4Types.hh:83
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
virtual void flatArray(const int size, double *vect)=0
void SetEventID(G4int i)
Definition: G4Event.hh:80
void ThisWorkerReady()
Definition: G4MTBarrier.cc:40
void ResetCounter()
Definition: G4MTBarrier.cc:90
void Wait()
Definition: G4MTBarrier.cc:53
virtual void WaitForReadyWorkers()
Definition: G4MTBarrier.cc:81
void ReleaseBarrier()
Definition: G4MTBarrier.cc:72
void SetActiveThreads(unsigned int val)
Definition: G4MTBarrier.hh:140
void BroadcastAbortRun(G4bool softAbort)
static G4int SeedOncePerCommunication()
virtual void SetUserAction(G4UserRunAction *userAction)
virtual WorkerActionRequest ThisWorkerWaitForNextAction()
static void SetSeedOncePerCommunication(G4int val)
virtual void AbortEvent()
G4int numberOfEventToBeProcessed
virtual void ProcessOneEvent(G4int i_event)
virtual void TerminateOneEvent()
virtual void rndmSaveThisEvent()
virtual void SetUserInitialization(G4VUserPhysicsList *userPL)
virtual G4bool InitializeSeeds(G4int)
virtual void WaitForReadyWorkers()
G4MTBarrier beginOfEventLoopBarrier
virtual void CreateAndStartWorkers()
virtual void SetNumberOfThreads(G4int n)
virtual ~G4MTRunManager()
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)
static void addWorld(G4int counter, G4VPhysicalVolume *w)
virtual void InitializeEventLoop(G4int n_event, const char *macroFile=0, G4int n_select=-1)
virtual void PrepareCommandsStack()
static G4ScoringManager * GetMasterScoringManager()
static G4MTRUN_DLL G4ScoringManager * masterScM
virtual void Initialize()
static G4MTRUN_DLL G4MTRunManager * fMasterRM
virtual void ThisWorkerReady()
static G4MTRunManagerKernel * GetMTMasterRunManagerKernel()
G4double * randDbl
static G4int seedOncePerCommunication
virtual void RunTermination()
static G4MTRUN_DLL masterWorlds_t masterWorlds
virtual size_t GetNumberActiveThreads() const
virtual void ConstructScoringWorlds()
static G4MTRunManager * GetMasterRunManager()
virtual void StoreRNGStatus(const G4String &filenamePrefix)
virtual void WaitForEndEventLoopWorkers()
WorkerActionRequest nextActionRequest
std::map< G4int, G4VPhysicalVolume * > masterWorlds_t
virtual void AbortRun(G4bool softAbort=false)
virtual void RefillSeeds()
virtual void rndmSaveThisRun()
static G4ThreadId masterThreadId
G4MTBarrier processUIBarrier
static G4ThreadId GetMasterThreadId()
void MergeRun(const G4Run *localRun)
G4MTBarrier endOfEventLoopBarrier
G4MTBarrier nextActionRequestBarrier
virtual void TerminateWorkers()
static masterWorlds_t & GetMasterWorlds()
virtual void RequestWorkersProcessCommandsStack()
static G4RunManagerKernel * GetMasterRunManagerKernel()
void MergeScores(const G4ScoringManager *localScoringManager)
virtual void NewActionRequest(WorkerActionRequest newRequest)
void SetPinAffinity(G4int n=1)
std::vector< G4String > GetCommandStack()
virtual void ThisWorkerEndEventLoop()
static void Finalize()
Definition: G4Profiler.cc:331
G4int GetNumberOfStaticAllocators() const
G4UserWorkerInitialization * userWorkerInitialization
virtual void Initialize()
G4Timer * timer
void SetRunIDCounter(G4int i)
G4UserWorkerThreadInitialization * userWorkerThreadInitialization
G4int n_select_msg
G4int numberOfEventProcessed
G4RunManagerKernel * kernel
G4int verboseLevel
G4Run * currentRun
G4bool runAborted
G4String msgText
virtual void BeamOn(G4int n_event, const char *macroFile=nullptr, G4int n_select=-1)
G4String selectMacro
virtual void RunTermination()
G4VUserActionInitialization * userActionInitialization
G4String randomNumberStatusDir
virtual void TerminateEventLoop()
virtual void SetUserAction(G4UserRunAction *userAction)
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
G4bool storeRandomNumberStatus
virtual void ConstructScoringWorlds()
Definition: G4Run.hh:49
G4int GetRunID() const
Definition: G4Run.hh:78
virtual void Merge(const G4Run *)
Definition: G4Run.cc:67
void Merge(const G4ScoringManager *scMan)
static G4ScoringManager * GetScoringManagerIfExist()
const G4ApplicationState & GetCurrentState() const
static G4StateManager * GetStateManager()
static G4TemplateRNGHelper< T > * GetInstance()
Definition: G4RNGHelper.cc:42
virtual const T GetSeed(const G4int &sdId)
Definition: G4RNGHelper.hh:64
void Fill(G4double *dbl, G4int nev, G4int nev_tot, G4int nrpe)
Definition: G4RNGHelper.hh:83
void Refill(G4double *dbl, G4int nev)
Definition: G4RNGHelper.hh:96
void Start()
static G4TransportationManager * GetTransportationManager()
std::vector< G4VPhysicalVolume * >::iterator GetWorldsIterator()
std::size_t GetNoWorlds() const
std::vector< G4String > * GetCommandStack()
Definition: G4UImanager.cc:862
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:495
void SetMasterUIManager(G4bool val)
Definition: G4UImanager.hh:219
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77
virtual void SetMaster(G4bool val=true)
virtual G4Thread * CreateAndStartWorker(G4WorkerThread *workerThreadContext)
void SetNumberThreads(G4int numnberThreads)
void SetThreadId(G4int threadId)
G4int G4GetNumberOfCores()
Definition: G4Threading.cc:121