95 pVVis->SetUpForAThread();
151 std::ostringstream oss;
152 G4Random::saveFullState(oss);
169#if defined(GEANT4_USE_TIMEMORY)
183 std::ostringstream os;
202 "G4VUserPrimaryGeneratorAction is not defined!");
222 for(
G4int evt = 0; evt < n_event; ++evt)
250 G4cout <<
"Applying command \"" <<
msgText <<
"\" @ " << __FUNCTION__
251 <<
":" << __LINE__ <<
G4endl;
265 G4bool eventHasToBeSeeded =
true;
267 eventHasToBeSeeded =
false;
275 anEvent, s1, s2, s3, eventHasToBeSeeded);
295 eventHasToBeSeeded =
false;
314 else if(eventHasToBeSeeded)
318 s1 = helper->
GetSeed(i_event * 2);
319 s2 = helper->
GetSeed(i_event * 2 + 1);
322 if(eventHasToBeSeeded)
324 long seeds[3] = { s1, s2, 0 };
325 G4Random::setTheSeeds(seeds, -1);
338 const auto filename = [&] {
339 std::ostringstream os;
344 G4bool RNGstatusReadFromFile =
false;
348 std::ostringstream os;
349 os << filename() <<
".rndm";
350 const G4String& randomStatusFile = os.str();
351 std::ifstream ifile(randomStatusFile.c_str());
355 RNGstatusReadFromFile =
true;
356 G4Random::restoreEngineStatus(randomStatusFile.c_str());
363 std::ostringstream oss;
364 G4Random::saveFullState(oss);
381 if(eventHasToBeSeeded)
382 G4cout <<
" with initial seeds (" << s1 <<
"," << s2 <<
")";
395#if defined(GEANT4_USE_TIMEMORY)
396 workerRunProfiler.reset();
432 <<
" events processed." <<
G4endl;
443void G4WorkerTaskRunManager::SetupDefaultRNGEngine()
457 std::ostringstream os;
459 <<
"_" << fn <<
".rndm";
460 G4Random::saveEngineStatus(os.str().c_str());
474 bool matching = (command_stack.size() == processedCommandStack.size());
477 for(uintmax_t i = 0; i < command_stack.size(); ++i)
478 if(processedCommandStack.at(i) != command_stack.at(i))
489 for(
const auto& itr : command_stack)
491 processedCommandStack = command_stack;
529 bool empty_macro = (macroFile ==
"" || macroFile ==
" ");
531 const char* macro = (empty_macro) ?
nullptr : macroFile.c_str();
532 numSelect = (empty_macro) ? -1 : numSelect;
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4GLOB_DLL std::ostream G4cout
void ProcessOneEvent(G4Event *anEvent)
void SetRandomNumberStatus(G4String &st)
static G4int SeedOncePerCommunication()
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
virtual void ThisWorkerReady()
G4int GetEventModulo() const
static G4MTRunManager * GetMasterRunManager()
std::vector< G4String > GetCommandStack()
virtual void ThisWorkerEndEventLoop()
static G4ParallelWorldProcessStore * GetInstance()
G4bool RunInitialization(G4bool fakeRun=false)
G4bool isScoreNtupleWriter
void CleanUpPreviousEvents()
G4int storeRandomNumberStatusToG4Event
const G4UserWorkerInitialization * GetUserWorkerInitialization() const
std::list< G4Event * > * previousEvents
G4int numberOfEventProcessed
G4int GetNumberOfEventsToBeProcessed() const
virtual void InitializeEventLoop(G4int n_event, const char *macroFile=nullptr, G4int n_select=-1)
G4RunManagerKernel * kernel
virtual G4bool ConfirmBeamOnCondition()
static G4RunManager * GetRunManager()
G4String randomNumberStatusForThisRun
static G4bool IfGeometryHasBeenDestroyed()
G4UserRunAction * userRunAction
G4bool rngStatusEventsFlag
virtual void RunTermination()
const G4String & GetSelectMacro() const
G4VUserPrimaryGeneratorAction * userPrimaryGeneratorAction
const G4Run * GetCurrentRun() const
G4int numberOfEventToBeProcessed
G4String randomNumberStatusDir
G4String randomNumberStatusForThisEvent
const G4UserWorkerThreadInitialization * GetUserWorkerThreadInitialization() const
G4int n_perviousEventsToBeStored
G4bool storeRandomNumberStatus
G4EventManager * eventManager
virtual void TerminateOneEvent()
G4int GetNumberOfSelectEvents() const
virtual void AnalyzeEvent(G4Event *anEvent)
void SetHCtable(G4HCtable *HCtbl)
void SetNumberOfEventToBeProcessed(G4int n_ev)
void SetDCtable(G4DCtable *DCtbl)
void SetRandomNumberStatus(G4String &st)
G4HCofThisEvent * PrepareNewEvent()
static G4SDManager * GetSDMpointerIfExist()
G4HCtable * GetHCtable() const
static G4TaskRunManager * GetMasterRunManager()
static G4TemplateRNGHelper< T > * GetInstance()
virtual const T GetSeed(const G4int &sdId)
G4int ApplyCommand(const char *aCommand)
static G4UImanager * GetUIpointer()
virtual void BeginOfRunAction(const G4Run *aRun)
virtual G4Run * GenerateRun()
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 GeneratePrimaries(G4Event *anEvent)=0
static G4VVisManager * GetConcreteInstance()
virtual void ConstructScoringWorlds()
G4bool readStatusFromFile
virtual void MergePartialResults()
G4WorkerThread * workerContext
virtual void DoEventLoop(G4int n_event, const char *macroFile=nullptr, G4int n_select=-1) override
virtual G4Event * GenerateEvent(G4int i_event) override
virtual void StoreRNGStatus(const G4String &filenamePrefix) override
virtual void RunTermination() override
virtual void TerminateEventLoop() override
virtual void DoWork() override
G4ProfilerConfig< G4ProfileType::Run > ProfilerConfig
virtual void ProcessOneEvent(G4int i_event) override
static G4WorkerTaskRunManagerKernel * GetWorkerRunManagerKernel()
virtual void RunInitialization() override
static G4WorkerTaskRunManager * GetWorkerRunManager()
G4int GetThreadId() const
static void UpdateGeometryAndPhysicsVectorFromMaster()
#define G4ThreadLocalStatic