59 #ifndef G4MULTITHREADED
61 msg<<
"Geant4 code is compiled without multi-threading support (-DG4MULTITHREADED is set to off).";
62 msg<<
" This type of RunManager can only be used in mult-threaded applications.";
77 #ifdef G4MULTITHREADED
81 pVVis->SetUpForAThread();
85 { visIsSetUp =
false; }
110 G4Exception(
"G4RunManager::InitializeGeometry",
"Run0033",
133 #ifdef G4MULTITHREADED
139 pVVis->SetUpForAThread();
173 std::ostringstream oss;
174 G4Random::saveFullState(oss);
191 std::ostringstream os;
207 "G4VUserPrimaryGeneratorAction is not defined!");
264 G4bool eventHasToBeSeeded =
true;
266 { eventHasToBeSeeded =
false; }
310 else if(eventHasToBeSeeded)
314 s1 = helper->
GetSeed(i_event*2);
315 s2 = helper->
GetSeed(i_event*2+1);
318 if(eventHasToBeSeeded)
320 long seeds[3] = { s1, s2, 0 };
321 G4Random::setTheSeeds(seeds,-1);
328 std::ostringstream oss;
329 G4Random::saveFullState(oss);
337 std::ostringstream os;
346 G4cout <<
"--> Event " << anEvent->
GetEventID() <<
" starts with initial seeds ("
347 << s1 <<
"," << s2 <<
")." <<
G4endl;
426 assert( masterScM != NULL );
431 for(
G4int iw=0;iw<nPar;iw++)
441 ed<<
"Mesh name <"<<ScM->
GetWorldName(iw)<<
"> is not found in the masther thread.";
442 G4Exception(
"G4WorkerRunManager::ConstructScoringWorlds()",
"RUN79001",
453 if(theParallelWorldProcess)
461 particleIterator->
reset();
462 while( (*particleIterator)() ){
467 pmanager->
AddProcess(theParallelWorldProcess);
482 G4Exception(
"G4RunManager::SetUserInitialization(G4UserWorkerInitialization*)",
"Run3021",
483 FatalException,
"This method should be used only with an instance of G4MTRunManager");
488 G4Exception(
"G4RunManager::SetUserInitialization(G4UserWorkerThreadInitialization*)",
"Run3021",
489 FatalException,
"This method should be used only with an instance of G4MTRunManager");
494 G4Exception(
"G4RunManager::SetUserInitialization(G4VUserActionInitialization*)",
"Run3021",
495 FatalException,
"This method should be used only with an instance of G4MTRunManager");
500 G4Exception(
"G4RunManager::SetUserInitialization(G4VUserDetectorConstruction*)",
"Run3021",
501 FatalException,
"This method should be used only with an instance of G4MTRunManager");
554 std::ostringstream os;
556 G4Random::saveEngineStatus(os.str().c_str());
void SetNumberOfEventToBeProcessed(G4int n_ev)
G4VPhysicalVolume * IsWorldExisting(const G4String &worldName)
void SetMaster(G4bool val=true)
void WorkerG4ParticleTable()
G4int numberOfEventToBeProcessed
static G4TemplateRNGHelper * GetInstance()
void SetDCtable(G4DCtable *DCtbl)
virtual G4int SetUpNEvents(G4Event *, G4SeedsQueue *seedsQueue, G4bool reseedRequired=true)
G4int GetNumberOfParallelWorld() const
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void RemoveProcessManager()
void SetParallelWorldProcess(G4ParallelWorldProcess *proc)
G4int numberOfEventProcessed
G4String GetWorldName(G4int i) const
G4String randomNumberStatusForThisRun
virtual void RunTermination()
std::ostringstream G4ExceptionDescription
virtual void ThisWorkerEndEventLoop()
virtual void SetupRNGEngine(const CLHEP::HepRandomEngine *aRNGEngine) const
G4VUserPhysicsList * physicsList
virtual void InitializeGeometry()
G4String randomNumberStatusForThisEvent
static G4bool fGeometryHasBeenDestroyed
G4WorkerThread * workerContext
void GeometryHasBeenDestroyed()
static G4VVisManager * GetConcreteInstance()
void SetIgnoreCmdNotFound(G4bool val)
void SetNumberOfParallelWorld(G4int i)
void SetProcessOrderingToSecond(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt)
G4VUserActionInitialization * userActionInitialization
void SetMeshElementLogical(G4LogicalVolume *val)
virtual void ConstructScoringWorlds()
static G4WorkerRunManager * GetWorkerRunManager()
virtual void WorkerRunEnd() const
G4bool storeRandomNumberStatus
G4bool IsAtRestRequired(G4ParticleDefinition *)
G4UserWorkerThreadInitialization * userWorkerThreadInitialization
virtual void TerminateEventLoop()
void ConstructParallelSD()
virtual void DoEventLoop(G4int n_event, const char *macroFile=0, G4int n_select=-1)
virtual void RunInitialization()
virtual const T GetSeed(const G4int &sdId)
virtual void WorkerRunStart() const
const G4UserWorkerInitialization * GetUserWorkerInitialization() const
void WorkerConstruct(G4VPhysicalVolume *fWorldPhys)
virtual void SetUserInitialization(G4VUserPhysicsList *userInit)
G4ProcessManager * GetProcessManager() const
#define G4MUTEX_INITIALIZER
G4bool RunInitialization(G4bool fakeRun=false)
void WorkerDefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
static G4UImanager * GetUIpointer()
static G4ParallelWorldProcessStore * GetInstance()
G4bool geometryInitialized
G4HCtable * GetHCtable() const
G4VUserPrimaryGeneratorAction * userPrimaryGeneratorAction
void SetParallelWorld(G4String parallelWorldName)
static G4RunManagerKernel * GetMasterRunManagerKernel()
G4GLOB_DLL std::ostream G4cout
void MergeRun(const G4Run *localRun)
void reset(G4bool ifSkipIon=true)
static G4ScoringManager * GetScoringManagerIfExist()
G4UserWorkerInitialization * userWorkerInitialization
G4String randomNumberStatusDir
G4bool rngStatusEventsFlag
virtual void AnalyzeEvent(G4Event *anEvent)
static G4MTRunManager * GetMasterRunManager()
G4int AddProcess(G4VProcess *aProcess, G4int ordAtRestDoIt=ordInActive, G4int ordAlongSteptDoIt=ordInActive, G4int ordPostStepDoIt=ordInActive)
G4int storeRandomNumberStatusToG4Event
G4int GetThreadId() const
void SetProcessOrdering(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt, G4int ordDoIt=ordDefault)
std::list< G4Event * > * previousEvents
G4UserRunAction * userRunAction
virtual void RunTermination()
virtual void ProcessOneEvent(G4int i_event)
void SetHCtable(G4HCtable *HCtbl)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
void SetRandomNumberStatus(G4String &st)
static G4TransportationManager * GetTransportationManager()
const G4UserWorkerThreadInitialization * GetUserWorkerThreadInitialization() const
static G4RunManager * GetRunManager()
void ClearParallelWorlds()
static G4ScoringManager * GetMasterScoringManager()
virtual void ConstructSDandField()
virtual void GeneratePrimaries(G4Event *anEvent)=0
virtual void ThisWorkerReady()
static G4ParticleTable * GetParticleTable()
void CleanUpPreviousEvents()
virtual G4Event * GenerateEvent(G4int i_event)
virtual G4bool SetUpAnEvent(G4Event *, long &s1, long &s2, long &s3, G4bool reseedRequired=true)
virtual void InitializeEventLoop(G4int n_event, const char *macroFile=0, G4int n_select=-1)
const CLHEP::HepRandomEngine * getMasterRandomEngine() const
G4int GetEventModulo() const
G4ParallelWorldProcess * GetParallelWorldProcess() const
virtual void BeginOfRunAction(const G4Run *aRun)
static G4int SeedOncePerCommunication()
G4LogicalVolume * GetMeshElementLogical() const
std::vector< G4InuclElementaryParticle >::iterator particleIterator
void ProcessOneEvent(G4Event *anEvent)
G4RunManagerKernel * kernel
static G4ScoringManager * GetScoringManager()
void SetupDefaultRNGEngine()
size_t GetNumberOfMesh() const
G4EventManager * eventManager
virtual void TerminateOneEvent()
G4VUserDetectorConstruction * userDetector
G4VScoringMesh * GetMesh(G4int i) const
virtual void SetUserAction(G4UserRunAction *userAction)
void SetRandomNumberStatus(G4String &st)
void WorkerUpdateWorldVolume()
virtual G4Run * GenerateRun()
void MergeScores(const G4ScoringManager *localScoringManager)
G4PTblDicIterator * GetIterator() const
G4int n_perviousEventsToBeStored
G4VPhysicalVolume * GetCurrentWorld() const
G4int ApplyCommand(const char *aCommand)
virtual void SetUserAction(G4UserRunAction *userAction)
static G4SDManager * GetSDMpointerIfExist()
static G4WorkerRunManagerKernel * GetWorkerRunManagerKernel()
virtual void MergePartialResults()
virtual void StoreRNGStatus(const G4String &filenamePrefix)