Geant4 11.2.2
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// G4WorkerRunManager implementation
27//
28// Original authors: X.Dong, A.Dotti - 2013
29// --------------------------------------------------------------------
30
31#include "G4WorkerRunManager.hh"
32
33#include "G4AutoLock.hh"
34#include "G4CopyRandomState.hh"
35#include "G4MTRunManager.hh"
38#include "G4RNGHelper.hh"
39#include "G4Run.hh"
40#include "G4SDManager.hh"
41#include "G4ScoringManager.hh"
42#include "G4TiMemory.hh"
43#include "G4Timer.hh"
45#include "G4UImanager.hh"
46#include "G4UserRunAction.hh"
50#include "G4VScoringMesh.hh"
53#include "G4VUserPhysicsList.hh"
55#include "G4VVisManager.hh"
57#include "G4WorkerThread.hh"
58
59#include <fstream>
60#include <sstream>
61
62// --------------------------------------------------------------------
67
68// --------------------------------------------------------------------
73
74// --------------------------------------------------------------------
76{
77 // This constructor should never be called in non-multithreaded mode
78
79#ifndef G4MULTITHREADED
81 msg << "Geant4 code is compiled without multi-threading support "
82 "(-DG4MULTITHREADED "
83 "is set to off).";
84 msg << " This type of RunManager can only be used in mult-threaded "
85 "applications.";
86 G4Exception("G4WorkerRunManager::G4WorkerRunManager()", "Run0103", FatalException, msg);
87#endif
88 // G4ParticleTable::GetParticleTable()->WorkerG4ParticleTable();
89 // WorkerG4ParticleTable() would be performed twice,
90 // as it is called already from G4ParticleTable::GetParticleTable()
91 // which is called beforehand by other Geant4 classes
93 if (masterScM != nullptr) G4ScoringManager::GetScoringManager(); // TLS instance for a worker
94
95 // Properly initialise luxury level for Ranlux* engines...
96 //
97 if (dynamic_cast<const CLHEP::Ranlux64Engine*>(G4Random::getTheEngine()) != nullptr) {
98 const auto theEngine = dynamic_cast<const CLHEP::Ranlux64Engine*>(G4Random::getTheEngine());
100 }
101 else if (dynamic_cast<const CLHEP::RanluxEngine*>(G4Random::getTheEngine()) != nullptr) {
102 const auto theEngine = dynamic_cast<const CLHEP::RanluxEngine*>(G4Random::getTheEngine());
104 }
105
107
108#ifdef G4MULTITHREADED
110 if (pVVis != nullptr) {
111 pVVis->SetUpForAThread();
112 visIsSetUp = true;
113 }
114#endif
115}
116
117// --------------------------------------------------------------------
119{
121 // Put these pointers to zero: owned by master thread
122 // If not to zero, the base class destructor will attempt to
123 // delete them
124 userDetector = nullptr;
125 userWorkerInitialization = nullptr;
127 userActionInitialization = nullptr;
128 physicsList = nullptr;
129 if (verboseLevel > 1) G4cout << "Destroying WorkerRunManager (" << this << ")" << G4endl;
130}
131
132// --------------------------------------------------------------------
134{
135 if (userDetector == nullptr) {
136 G4Exception("G4RunManager::InitializeGeometry", "Run0033", FatalException,
137 "G4VUserDetectorConstruction is not defined!");
138 return;
139 }
142 }
143
144 // Step1: Get pointer to the physiWorld (note: needs to get the "super
145 // pointer, i.e. the one shared by all threads"
147 G4VPhysicalVolume* worldVol = masterKernel->GetCurrentWorld();
148 // Step2:, Call a new "WorkerDefineWorldVolume( pointer from 2-, false);
149 kernel->WorkerDefineWorldVolume(worldVol, false);
151 // Step3: Call user's ConstructSDandField()
154 geometryInitialized = true;
155}
156
157// --------------------------------------------------------------------
159{
160#ifdef G4MULTITHREADED
161 if (!visIsSetUp) {
163 if (pVVis != nullptr) {
164 pVVis->SetUpForAThread();
165 visIsSetUp = true;
166 }
167 }
168#endif
169
170 if (!(kernel->RunInitialization(fakeRun))) return;
171
172 // Signal this thread can start event loop.
173 // Note this will return only when all threads reach this point
175 if (fakeRun) return;
176
177 const G4UserWorkerInitialization* uwi =
180 delete currentRun;
181 currentRun = nullptr;
182
184 // Call a user hook: this is guaranteed all threads are "synchronized"
185 if (uwi != nullptr) uwi->WorkerRunStart();
186
188 if (currentRun == nullptr) currentRun = new G4Run();
189
192
195 if (fSDM != nullptr) {
197 }
198
199 if (G4VScoreNtupleWriter::Instance() != nullptr) {
200 auto hce = (fSDM != nullptr) ? fSDM->PrepareNewEvent() : nullptr;
202 delete hce;
203 }
204
205 std::ostringstream oss;
206 G4Random::saveFullState(oss);
209
210 for (G4int i_prev = 0; i_prev < n_perviousEventsToBeStored; ++i_prev) {
211 previousEvents->push_back(nullptr);
212 }
213
214 if (printModulo > 0 || verboseLevel > 0) {
215 G4cout << "### Run " << currentRun->GetRunID() << " starts on worker thread "
216 << G4Threading::G4GetThreadId() << "." << G4endl;
217 }
219
220#if defined(GEANT4_USE_TIMEMORY)
221 workerRunProfiler.reset(new ProfilerConfig(currentRun));
222#endif
223
226 }
227
229 G4String fileN = "currentRun";
231 std::ostringstream os;
232 os << "run" << currentRun->GetRunID();
233 fileN = os.str();
234 }
235 StoreRNGStatus(fileN);
236 }
237
238 runAborted = false;
240}
241
242// --------------------------------------------------------------------
243void G4WorkerRunManager::DoEventLoop(G4int n_event, const char* macroFile, G4int n_select)
244{
245 if (userPrimaryGeneratorAction == nullptr) {
246 G4Exception("G4RunManager::GenerateEvent()", "Run0032", FatalException,
247 "G4VUserPrimaryGeneratorAction is not defined!");
248 }
249
250 // This is the same as in the sequential case, just the for-loop indexes are
251 // different
252 InitializeEventLoop(n_event, macroFile, n_select);
253
254 // Reset random number seeds queue
255 while (!seedsQueue.empty()) {
256 seedsQueue.pop();
257 }
258 // for each run, worker should receive at least one set of random number
259 // seeds.
260 runIsSeeded = false;
261
262 // Event loop
263 eventLoopOnGoing = true;
264 /////// G4int i_event = workerContext->GetThreadId();
265 G4int i_event = -1;
266 nevModulo = -1;
267 currEvID = -1;
268
269 while (eventLoopOnGoing) {
270 ProcessOneEvent(i_event);
271 if (eventLoopOnGoing) {
273 if (runAborted) {
274 eventLoopOnGoing = false;
275 }
276 }
277 }
278
280}
281
282// --------------------------------------------------------------------
294
295// --------------------------------------------------------------------
297{
298 auto anEvent = new G4Event(i_event);
299 G4long s1 = 0;
300 G4long s2 = 0;
301 G4long s3 = 0;
302 G4bool eventHasToBeSeeded = true;
304 eventHasToBeSeeded = false;
305 }
306
307 if (i_event < 0) {
309 if (nevM == 1) {
311 eventHasToBeSeeded);
312 runIsSeeded = true;
313 }
314 else {
315 if (nevModulo <= 0) {
317 eventHasToBeSeeded);
318 if (nevToDo == 0) {
319 eventLoopOnGoing = false;
320 }
321 else {
322 currEvID = anEvent->GetEventID();
323 nevModulo = nevToDo - 1;
324 }
325 }
326 else {
327 if (G4MTRunManager::SeedOncePerCommunication() > 0) eventHasToBeSeeded = false;
328 anEvent->SetEventID(++currEvID);
329 --nevModulo;
330 }
331 if (eventLoopOnGoing && eventHasToBeSeeded) {
332 s1 = seedsQueue.front();
333 seedsQueue.pop();
334 s2 = seedsQueue.front();
335 seedsQueue.pop();
336 }
337 }
338
339 if (!eventLoopOnGoing) {
340 delete anEvent;
341 return nullptr;
342 }
343 }
344 else if (eventHasToBeSeeded) {
345 // Need to reseed random number generator
347 s1 = helper->GetSeed(i_event * 2);
348 s2 = helper->GetSeed(i_event * 2 + 1);
349 }
350
351 if (eventHasToBeSeeded) {
352 G4long seeds[3] = {s1, s2, 0};
353 G4Random::setTheSeeds(seeds, luxury);
354 runIsSeeded = true;
355 }
356
357 // Read from file seed.
358 // Andrea Dotti 4 November 2015
359 // This is required for strong-reproducibility, in MT mode we have that each
360 // thread produces, for each event a status file, we want to do that.
361 // Search a random file with the format run{%d}evt{%d}.rndm
362
363 // This is the filename base constructed from run and event
364 const auto filename = [&] {
365 std::ostringstream os;
366 os << "run" << currentRun->GetRunID() << "evt" << anEvent->GetEventID();
367 return os.str();
368 };
369
370 G4bool RNGstatusReadFromFile = false;
371 if (readStatusFromFile) {
372 // Build full path of RNG status file for this event
373 std::ostringstream os;
374 os << filename() << ".rndm";
375 const G4String& randomStatusFile = os.str();
376 std::ifstream ifile(randomStatusFile.c_str());
377 if (ifile) { // File valid and readable
378 RNGstatusReadFromFile = true;
379 G4Random::restoreEngineStatus(randomStatusFile.c_str());
380 }
381 }
382
384 std::ostringstream oss;
385 G4Random::saveFullState(oss);
387 anEvent->SetRandomNumberStatus(randomNumberStatusForThisEvent);
388 }
389
390 if (storeRandomNumberStatus && !RNGstatusReadFromFile)
391 { // If reading from file, avoid to rewrite the same
392 G4String fileN = "currentEvent";
394 fileN = filename();
395 }
396 StoreRNGStatus(fileN);
397 }
398
399 if (printModulo > 0 && anEvent->GetEventID() % printModulo == 0) {
400 G4cout << "--> Event " << anEvent->GetEventID() << " starts";
401 if (eventHasToBeSeeded) {
402 G4cout << " with initial seeds (" << s1 << "," << s2 << ")";
403 }
404 G4cout << "." << G4endl;
405 }
407 return anEvent;
408}
409
410// --------------------------------------------------------------------
412{
413 // Merge partial results into global run
416 if (ScM != nullptr) mtRM->MergeScores(ScM);
417 mtRM->MergeRun(currentRun);
418}
419
420// --------------------------------------------------------------------
422{
423 if (!fakeRun) {
424#if defined(GEANT4_USE_TIMEMORY)
425 workerRunProfiler.reset();
426#endif
428
429 // Call a user hook: note this is before the next barrier
430 // so threads execute this method asyncrhonouzly
431 //(TerminateRun allows for synch via G4RunAction::EndOfRun)
432 const G4UserWorkerInitialization* uwi =
434 if (uwi != nullptr) uwi->WorkerRunEnd();
435 }
436
438 // Signal this thread has finished envent-loop.
439 // Note this will return only whan all threads reach this point
441}
442
443// --------------------------------------------------------------------
445{
446 if (verboseLevel > 0 && !fakeRun) {
447 timer->Stop();
448 G4cout << "Thread-local run terminated." << G4endl;
449 G4cout << "Run Summary" << G4endl;
450 if (runAborted) {
451 G4cout << " Run Aborted after " << numberOfEventProcessed << " events processed." << G4endl;
452 }
453 else {
454 G4cout << " Number of events processed : " << numberOfEventProcessed << G4endl;
455 }
456 G4cout << " " << *timer << G4endl;
457 }
458}
459
460// --------------------------------------------------------------------
461namespace
462{
463G4Mutex ConstructScoringWorldsMutex = G4MUTEX_INITIALIZER;
464}
465
466// --------------------------------------------------------------------
468{
469 using MeshShape = G4VScoringMesh::MeshShape;
470
471 // Return if unnecessary
473 if (ScM == nullptr) return;
474 auto nPar = (G4int)ScM->GetNumberOfMesh();
475 if (nPar < 1) return;
476
477 // Update thread-local G4TransportationManager of all the world volumes
479
481
483
484 for (G4int iw = 0; iw < nPar; ++iw) {
485 G4VScoringMesh* mesh = ScM->GetMesh(iw);
487 G4VPhysicalVolume* pWorld = nullptr;
488 if (mesh->GetShape() != MeshShape::realWorldLogVol) {
489 pWorld =
491 if (pWorld == nullptr) {
493 ed << "Mesh name <" << ScM->GetWorldName(iw) << "> is not found in the master thread.";
494 G4Exception("G4WorkerRunManager::ConstructScoringWorlds()", "RUN79001", FatalException, ed);
495 }
496 }
497 if ((mesh->GetMeshElementLogical()) == nullptr) {
498 G4AutoLock l(&ConstructScoringWorldsMutex);
499 G4VScoringMesh* masterMesh = masterScM->GetMesh(iw);
500 mesh->SetMeshElementLogical(masterMesh->GetMeshElementLogical());
501 l.unlock();
502
503 if (mesh->GetShape() != MeshShape::realWorldLogVol) {
504 G4ParallelWorldProcess* theParallelWorldProcess = mesh->GetParallelWorldProcess();
505 if (theParallelWorldProcess != nullptr) {
506 theParallelWorldProcess->SetParallelWorld(ScM->GetWorldName(iw));
507 }
508 else {
509 theParallelWorldProcess = new G4ParallelWorldProcess(ScM->GetWorldName(iw));
510 mesh->SetParallelWorldProcess(theParallelWorldProcess);
511 theParallelWorldProcess->SetParallelWorld(ScM->GetWorldName(iw));
512
513 particleIterator->reset();
514 while ((*particleIterator)()) {
515 G4ParticleDefinition* particle = particleIterator->value();
516 G4ProcessManager* pmanager = particle->GetProcessManager();
517 if (pmanager != nullptr) {
518 pmanager->AddProcess(theParallelWorldProcess);
519 if (theParallelWorldProcess->IsAtRestRequired(particle)) {
520 pmanager->SetProcessOrdering(theParallelWorldProcess, idxAtRest, 9900);
521 }
522 pmanager->SetProcessOrderingToSecond(theParallelWorldProcess, idxAlongStep);
523 pmanager->SetProcessOrdering(theParallelWorldProcess, idxPostStep, 9900);
524 } // if(pmanager)
525 } // while
526 }
527 theParallelWorldProcess->SetLayeredMaterialFlag(mesh->LayeredMassFlg());
528 }
529 }
530 mesh->WorkerConstruct(pWorld);
531 }
532}
533
534// --------------------------------------------------------------------
536{
537 G4Exception("G4RunManager::SetUserInitialization(G4UserWorkerInitialization*)", "Run0118",
538 FatalException, "This method should be used only with an instance of G4MTRunManager");
539}
540
541// --------------------------------------------------------------------
543{
544 G4Exception("G4RunManager::SetUserInitialization(G4UserWorkerThreadInitialization*)", "Run0119",
545 FatalException, "This method should be used only with an instance of G4MTRunManager");
546}
547
548// --------------------------------------------------------------------
550{
551 G4Exception("G4RunManager::SetUserInitialization(G4VUserActionInitialization*)", "Run0120",
552 FatalException, "This method should be used only with an instance of G4MTRunManager");
553}
554
555// --------------------------------------------------------------------
557{
558 G4Exception("G4RunManager::SetUserInitialization(G4VUserDetectorConstruction*)", "Run0121",
559 FatalException, "This method should be used only with an instance of G4MTRunManager");
560}
561
562// --------------------------------------------------------------------
568
569// --------------------------------------------------------------------
571{
572 G4RunManager::SetUserAction(userAction);
573 if (userAction != nullptr) userAction->SetMaster(false);
574}
575
576// --------------------------------------------------------------------
577void G4WorkerRunManager::SetupDefaultRNGEngine()
578{
579 const CLHEP::HepRandomEngine* mrnge =
583 uwti->SetupRNGEngine(mrnge);
584}
585
586// Forward calls (avoid GCC compilation warnings)
587
588// --------------------------------------------------------------------
593
594// --------------------------------------------------------------------
599
600// --------------------------------------------------------------------
605
606// --------------------------------------------------------------------
611
612// --------------------------------------------------------------------
617
618// --------------------------------------------------------------------
620{
621 std::ostringstream os;
622 os << randomNumberStatusDir << "G4Worker" << workerContext->GetThreadId() << "_" << fn << ".rndm";
623 G4Random::saveEngineStatus(os.str().c_str());
624}
625
626// --------------------------------------------------------------------
628{
629 G4int runNumber = 0;
630 if (currentRun != nullptr) runNumber = currentRun->GetRunID();
632 G4cerr << "Warning from G4RunManager::rndmSaveThisRun():"
633 << " Random number status was not stored prior to this run." << G4endl
634 << "/random/setSavingFlag command must be issued. "
635 << "Command ignored." << G4endl;
636 return;
637 }
638
639 std::ostringstream oos;
640 oos << "G4Worker" << workerContext->GetThreadId() << "_"
641 << "currentRun.rndm"
642 << "\0";
643 G4fs::path fileIn = randomNumberStatusDir + oos.str();
644
645 std::ostringstream os;
646 os << "run" << runNumber << ".rndm" << '\0';
647 G4fs::path fileOut = randomNumberStatusDir + os.str();
648
649 if (G4CopyRandomState(fileIn, fileOut, "G4WorkerRunManager::rndmSaveThisRun()")
650 && verboseLevel > 0)
651 {
652 G4cout << fileIn << " is copied to " << fileOut << G4endl;
653 }
654}
655
656// --------------------------------------------------------------------
658{
659 if (currentEvent == nullptr) {
660 G4cerr << "Warning from G4RunManager::rndmSaveThisEvent():"
661 << " there is no currentEvent available." << G4endl << "Command ignored." << G4endl;
662 return;
663 }
664
666 G4cerr << "Warning from G4RunManager::rndmSaveThisEvent():"
667 << " Random number engine status is not available." << G4endl
668 << "/random/setSavingFlag command must be issued "
669 << "prior to the start of the run. Command ignored." << G4endl;
670 return;
671 }
672
673 std::ostringstream oos;
674 oos << "G4Worker" << workerContext->GetThreadId() << "_"
675 << "currentEvent.rndm"
676 << "\0";
677 G4fs::path fileIn = randomNumberStatusDir + oos.str();
678
679 std::ostringstream os;
680 os << "run" << currentRun->GetRunID() << "evt" << currentEvent->GetEventID() << ".rndm" << '\0';
681 G4fs::path fileOut = randomNumberStatusDir + os.str();
682
683 if (G4CopyRandomState(fileIn, fileOut, "G4WorkerRunManager::rndmSaveThisEvent()")
684 && verboseLevel > 0)
685 {
686 G4cout << fileIn << " is copied to " << fileOut << G4endl;
687 }
688}
689
690// --------------------------------------------------------------------
692{
696 if (nextAction == G4MTRunManager::WorkerActionRequest::NEXTITERATION) // start the next
697 // run
698 {
699 // The following code deals with changing materials between runs
700 static G4ThreadLocal G4bool skipInitialization = true;
701 if (skipInitialization) {
702 // re-initialization is not necessary for the first run
703 skipInitialization = false;
704 }
705 else {
706 // ReinitializeGeometry();
708 }
709
710 // Execute UI commands stored in the master UI manager
711 std::vector<G4String> cmds = mrm->GetCommandStack();
712 G4UImanager* uimgr = G4UImanager::GetUIpointer(); // TLS instance
713 for (const auto& cmd : cmds) {
714 uimgr->ApplyCommand(cmd);
715 }
716 // Start this run
717 G4int numevents = mrm->GetNumberOfEventsToBeProcessed();
718 G4String macroFile = mrm->GetSelectMacro();
719 G4int numSelect = mrm->GetNumberOfSelectEvents();
720 if (macroFile.empty() || macroFile == " ") {
721 this->BeamOn(numevents);
722 }
723 else {
724 this->BeamOn(numevents, macroFile, numSelect);
725 }
726 }
727 else if (nextAction == G4MTRunManager::WorkerActionRequest::PROCESSUI) {
728 std::vector<G4String> cmds = mrm->GetCommandStack();
729 G4UImanager* uimgr = G4UImanager::GetUIpointer(); // TLS instance
730 for (const auto& cmd : cmds) {
731 uimgr->ApplyCommand(cmd);
732 }
734 }
735 else {
737 d << "Cannot continue, this worker has been requested an unknown action: "
738 << static_cast<std::underlying_type<G4MTRunManager::WorkerActionRequest>::type>(nextAction);
739 G4Exception("G4WorkerRunManager::DoWork", "Run0104", FatalException, d);
740 }
741
742 // Now wait for master thread to signal new action to be performed
743 nextAction = mrm->ThisWorkerWaitForNextAction();
744 } // No more actions to perform
745
746 return;
747}
std::vector< G4InuclElementaryParticle >::iterator particleIterator
Helper function for copying random state files in G4run.
G4bool G4CopyRandomState(const G4fs::path &source, const G4fs::path &dest, const G4String &callsite)
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
@ idxPostStep
@ idxAtRest
@ idxAlongStep
#define G4MUTEX_INITIALIZER
std::mutex G4Mutex
long G4long
Definition G4Types.hh:87
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
std::shared_ptr< HepRandomEngine > theEngine
Definition Random.cc:76
int getLuxury() const
void ProcessOneEvent(G4Event *anEvent)
G4int GetEventID() const
Definition G4Event.hh:123
static G4int SeedOncePerCommunication()
virtual WorkerActionRequest ThisWorkerWaitForNextAction()
virtual void ThisWorkerProcessCommandsStackDone()
virtual G4int SetUpNEvents(G4Event *, G4SeedsQueue *seedsQueue, 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 G4bool SetUpAnEvent(G4Event *, G4long &s1, G4long &s2, G4long &s3, G4bool reseedRequired=true)
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 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 numberOfEventProcessed
G4int GetNumberOfEventsToBeProcessed() const
virtual void InitializeEventLoop(G4int n_event, const char *macroFile=nullptr, G4int n_select=-1)
G4RunManagerKernel * kernel
G4Run * currentRun
static G4RunManager * GetRunManager()
G4DCtable * DCtable
G4String randomNumberStatusForThisRun
G4String msgText
virtual void BeamOn(G4int n_event, const char *macroFile=nullptr, G4int n_select=-1)
G4UserRunAction * userRunAction
G4bool rngStatusEventsFlag
virtual void RunTermination()
const G4String & GetSelectMacro() const
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)
G4bool storeRandomNumberStatus
G4EventManager * eventManager
virtual void TerminateOneEvent()
G4int GetNumberOfSelectEvents() const
G4VUserPhysicsList * physicsList
virtual void AnalyzeEvent(G4Event *anEvent)
void UpdateScoring()
G4Event * currentEvent
Definition G4Run.hh:49
void SetHCtable(G4HCtable *HCtbl)
Definition G4Run.hh:108
G4int GetRunID() const
Definition G4Run.hh:86
void SetNumberOfEventToBeProcessed(G4int n_ev)
Definition G4Run.hh:107
void SetRunID(G4int id)
Definition G4Run.hh:106
void SetDCtable(G4DCtable *DCtbl)
Definition G4Run.hh:109
void SetRandomNumberStatus(G4String &st)
Definition G4Run.hh:110
G4HCofThisEvent * PrepareNewEvent()
static G4SDManager * GetSDMpointerIfExist()
G4HCtable * GetHCtable() const
G4VScoringMesh * GetMesh(G4int i) const
size_t GetNumberOfMesh() const
static G4ScoringManager * GetScoringManager()
G4String GetWorldName(G4int i) const
static G4ScoringManager * GetScoringManagerIfExist()
static G4TemplateRNGHelper< T > * GetInstance()
virtual const T GetSeed(const G4int &sdId)
void Stop()
static G4TransportationManager * GetTransportationManager()
G4VPhysicalVolume * IsWorldExisting(const G4String &worldName)
void SetIgnoreCmdNotFound(G4bool val)
G4int ApplyCommand(const char *aCommand)
static G4UImanager * GetUIpointer()
virtual void SetMaster(G4bool val=true)
virtual G4Run * GenerateRun()
virtual void BeginOfRunAction(const G4Run *)
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
virtual void WorkerConstruct(G4VPhysicalVolume *fWorldPhys)
void GeometryHasBeenDestroyed()
G4ParallelWorldProcess * GetParallelWorldProcess() const
void SetParallelWorldProcess(G4ParallelWorldProcess *proc)
void SetMeshElementLogical(G4LogicalVolume *val)
G4bool LayeredMassFlg()
virtual void InitializeWorker()
virtual void GeneratePrimaries(G4Event *anEvent)=0
static G4VVisManager * GetConcreteInstance()
static G4WorkerRunManagerKernel * GetWorkerRunManagerKernel()
void InitializeGeometry() override
void rndmSaveThisRun() override
void RunTermination() override
void SetUserAction(G4UserRunAction *userAction) override
G4Event * GenerateEvent(G4int i_event) override
virtual void MergePartialResults()
G4WorkerThread * workerContext
void rndmSaveThisEvent() override
void TerminateEventLoop() override
void RunInitialization() override
void SetUserInitialization(G4VUserPhysicsList *userInit) override
void ProcessOneEvent(G4int i_event) override
static G4WorkerRunManager * GetWorkerRunManager()
void ConstructScoringWorlds() override
G4ProfilerConfig< G4ProfileType::Run > ProfilerConfig
void DoEventLoop(G4int n_event, const char *macroFile=nullptr, G4int n_select=-1) override
void StoreRNGStatus(const G4String &filenamePrefix) override
G4int GetThreadId() const
static void UpdateGeometryAndPhysicsVectorFromMaster()
G4int G4GetThreadId()
#define G4ThreadLocal
Definition tls.hh:77