58 #ifndef G4MULTITHREADED
60 msg<<
"Geant4 code is compiled without multi-threading support (-DG4MULTITHREADED is set to off).";
61 msg<<
" This type of RunManager can only be used in mult-threaded applications.";
74 #ifdef G4MULTITHREADED
78 pVVis->SetUpForAThread();
82 { visIsSetUp =
false; }
107 G4Exception(
"G4RunManager::InitializeGeometry",
"Run0033",
125 #ifdef G4MULTITHREADED
131 pVVis->SetUpForAThread();
163 std::ostringstream oss;
164 G4Random::saveFullState(oss);
182 std::ostringstream os;
198 "G4VUserPrimaryGeneratorAction is not defined!");
297 s1 = helper->
GetSeed(i_event*2);
298 s2 = helper->
GetSeed(i_event*2+1);
301 long seeds[3] = { s1, s2, 0 };
302 G4Random::setTheSeeds(seeds,-1);
306 std::ostringstream oss;
307 G4Random::saveFullState(oss);
315 std::ostringstream os;
324 G4cout <<
"--> Event " << anEvent->
GetEventID() <<
" starts with initial seeds ("
325 << s1 <<
"," << s2 <<
")." <<
G4endl;
389 assert( masterScM != NULL );
394 for(
G4int iw=0;iw<nPar;iw++)
403 ed<<
"Mesh name <"<<ScM->
GetWorldName(iw)<<
"> is not found in the masther thread.";
404 G4Exception(
"G4WorkerRunManager::ConstructScoringWorlds()",
"RUN79001",
418 particleIterator->
reset();
419 while( (*particleIterator)() ){
424 pmanager->
AddProcess(theParallelWorldProcess);
438 G4Exception(
"G4RunManager::SetUserInitialization(G4UserWorkerInitialization*)",
"Run3021",
439 FatalException,
"This method should be used only with an instance of G4MTRunManager");
444 G4Exception(
"G4RunManager::SetUserInitialization(G4UserWorkerThreadInitialization*)",
"Run3021",
445 FatalException,
"This method should be used only with an instance of G4MTRunManager");
450 G4Exception(
"G4RunManager::SetUserInitialization(G4VUserActionInitialization*)",
"Run3021",
451 FatalException,
"This method should be used only with an instance of G4MTRunManager");
456 G4Exception(
"G4RunManager::SetUserInitialization(G4VUserDetectorConstruction*)",
"Run3021",
457 FatalException,
"This method should be used only with an instance of G4MTRunManager");
510 std::ostringstream os;
512 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()
virtual void TerminateEventLoop()
void SetDCtable(G4DCtable *DCtbl)
G4int GetNumberOfParallelWorld() const
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void RemoveProcessManager()
virtual G4bool SetUpAnEvent(G4Event *, long &s1, long &s2, long &s3)
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
G4WorkerThread * workerContext
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
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
virtual 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()
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)
virtual G4int SetUpNEvents(G4Event *, G4SeedsQueue *seedsQueue)
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)
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()
static G4ScoringManager * GetMasterScoringManager()
virtual void ConstructSDandField()
virtual void GeneratePrimaries(G4Event *anEvent)=0
virtual void ThisWorkerReady()
static G4ParticleTable * GetParticleTable()
virtual G4Event * GenerateEvent(G4int i_event)
virtual void InitializeEventLoop(G4int n_event, const char *macroFile=0, G4int n_select=-1)
const CLHEP::HepRandomEngine * getMasterRandomEngine() const
G4int GetEventModulo() const
virtual void BeginOfRunAction(const G4Run *aRun)
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)
std::vector< G4Event * > * previousEvents
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)