85 if (pVVis !=
nullptr) {
124 if (fSDM !=
nullptr) {
134 std::ostringstream oss;
135 G4Random::saveFullState(oss);
143 G4cout <<
"### Run " <<
currentRun->GetRunID() <<
" starts on worker thread "
156 std::ostringstream os;
175 "This method is not used in the worker thread of sub-event parallel mode");
184 "This method is not used in the worker thread of sub-event parallel mode");
193 "This method is not used in the worker thread of sub-event parallel mode");
255 std::ostringstream os;
257 G4Random::saveEngineStatus(os.str().c_str());
265 if (mrm ==
nullptr)
return;
272 for (uintmax_t i = 0; i < command_stack.size(); ++i)
282 for (
const auto& itr : command_stack)
305 G4cout <<
"G4WorkerSubEvtRunManager::DoWork() starts.........." <<
G4endl;
312 if ((run !=
nullptr) && run->
GetRunID() != runId) {
318 G4bool reseedRequired =
false;
325 reseedRequired =
true;
333 G4bool needMoreWork =
true;
338 auto subEv = mrm->
GetSubEvent(fSubEventType, notReady, s1, s2, s3, reseedRequired);
339 if(subEv==
nullptr && notReady)
345 else if(subEv==
nullptr)
363 { needMoreWork =
false; }
368 G4cout <<
"G4WorkerSubEvtRunManager::DoWork() - "
370 <<
" sub-events are still incomplete in the event manager."<<
G4endl;
379 G4long seeds[3] = {s1, s2, s3};
380 G4Random::setTheSeeds(seeds, -1);
381 reseedRequired =
false;
386 auto masterEvent = subEv->GetEvent();
393 for(
auto& stackedTrack : *subEv)
411 if(subEv->IsCompleted())
432 G4cout <<
"G4WorkerSubEvtRunManager::DoWork() - "
434 <<
" sub-events are still incomplete in the event manager."<<
G4endl;
443 G4cout <<
"G4WorkerSubEvtRunManager::DoWork() completed.........." <<
G4endl;
451 mrm->RegisterSubEvtWorker(
this,ty);
459 G4Exception(
"G4WorkerSubEvtRunManager::SetUserInitialization(G4UserWorkerInitialization*)",
"RunSE0118",
460 FatalException,
"This method should be used only with an instance of the master thread");
466 G4Exception(
"G4WorkerSubEvtRunManager::SetUserInitialization(G4UserWorkerThreadInitialization*)",
"RunSE0119",
467 FatalException,
"This method should be used only with an instance of the master thread");
473 G4Exception(
"G4WorkerSubEvtRunManager::SetUserInitialization(G4VUserActionInitialization*)",
"RunSE0120",
474 FatalException,
"This method should be used only with an instance of the master thread");
480 G4Exception(
"G4WorkerSubEvtRunManager::SetUserInitialization(G4VUserDetectorConstruction*)",
"RunSE0121",
481 FatalException,
"This method should be used only with an instance of the master thread");
494 G4Exception(
"G4WorkerSubEvtRunManager::SetUserAction(G4UserRunAction*)",
"RunSE0221",
495 FatalException,
"This method should be used only with an instance of the master thread");
509 G4Exception(
"G4WorkerSubEvtRunManager::SetUserAction(G4VUserPrimaryGeneratorAction*)",
"RunSE0223",
510 FatalException,
"This method should be used only with an instance of the master thread");
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
#define G4THREADSLEEP(tick)
std::vector< G4Track * > G4TrackVector
G4WorkerTaskRunManagerKernel G4WorkerSubEvtRunManagerKernel
G4GLOB_DLL std::ostream G4cout
const G4SubEvent * GetSubEvent() const
void FlagAsSubEvent(G4Event *me, G4int ty, const G4SubEvent *se)
const CLHEP::HepRandomEngine * getMasterRandomEngine() const
virtual void ThisWorkerReady()
static G4MTRunManager * GetMasterRunManager()
std::vector< G4String > GetCommandStack()
virtual void ThisWorkerEndEventLoop()
static G4ParallelWorldProcessStore * GetInstance()
G4bool isScoreNtupleWriter
virtual void CleanUpPreviousEvents()
const G4UserWorkerInitialization * GetUserWorkerInitialization() const
std::list< G4Event * > * previousEvents
G4int numberOfEventProcessed
G4int GetNumberOfEventsToBeProcessed() const
G4RunManagerKernel * kernel
virtual G4bool ConfirmBeamOnCondition()
static G4RunManager * GetRunManager()
G4String randomNumberStatusForThisRun
static G4bool IfGeometryHasBeenDestroyed()
G4UserRunAction * userRunAction
G4bool rngStatusEventsFlag
virtual void RunTermination()
const G4Run * GetCurrentRun() const
G4int numberOfEventToBeProcessed
G4String randomNumberStatusDir
virtual void SetUserAction(G4UserRunAction *userAction)
const G4UserWorkerThreadInitialization * GetUserWorkerThreadInitialization() const
G4int n_perviousEventsToBeStored
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
G4bool storeRandomNumberStatus
G4EventManager * eventManager
G4HCofThisEvent * PrepareNewEvent()
static G4SDManager * GetSDMpointerIfExist()
G4HCtable * GetHCtable() const
void SubEventFinished(const G4SubEvent *se, const G4Event *evt) override
static G4SubEvtRunManager * GetMasterRunManager()
const G4SubEvent * GetSubEvent(G4int ty, G4bool ¬Ready, G4long &s1, G4long &s2, G4long &s3, G4bool reseedRequired=true) override
static G4TaskRunManager * GetMasterRunManager()
void CopyTrackInfo(const G4Track &, G4bool copyTouchables=true)
G4int ApplyCommand(const char *aCommand)
static G4UImanager * GetUIpointer()
virtual void WorkerRunEnd() const
virtual void WorkerRunStart() const
virtual void SetupRNGEngine(const CLHEP::HepRandomEngine *aRNGEngine) const
virtual G4bool Book(G4HCofThisEvent *hce)=0
static G4VScoreNtupleWriter * Instance()
virtual void OpenFile()=0
virtual void InitializeWorker()
static G4VVisManager * GetConcreteInstance()
virtual void SetUpForAThread()
virtual void MergePartialResults(G4bool mergeEvents=true)
G4WorkerThread * workerContext
void ConstructScoringWorlds() override
void TerminateEventLoop() override
void DoCleanup() override
void RunInitialization() override
void DoEventLoop(G4int n_event, const char *macroFile=nullptr, G4int n_select=-1) override
void RunTermination() override
void SetupDefaultRNGEngine() override
static G4WorkerSubEvtRunManagerKernel * GetWorkerRunManagerKernel()
G4WorkerSubEvtRunManager(G4int subEventType=0)
static G4WorkerSubEvtRunManager * GetWorkerRunManager()
G4Event * GenerateEvent(G4int i_event) override
void StoreRNGStatus(const G4String &filenamePrefix) override
void SetUserAction(G4UserRunAction *userAction) override
void SetUserInitialization(G4VUserPhysicsList *userPL) override
void ProcessUI() override
void SetSubEventType(G4int) override
void ProcessOneEvent(G4int i_event) override
G4StrVector processedCommandStack
std::string to_string(G4FermiAtomicMass mass)
#define G4ThreadLocalStatic