32 std::vector<G4WorkerRunManager*>* G4MTRunManagerKernel::workerRMvector = 0;
41 #ifndef G4MULTITHREADED
43 msg<<
"Geant4 code is compiled without multi-threading support (-DG4MULTITHREADED is set to off).";
44 msg<<
" This type of RunManager can only be used in mult-threaded applications.";
47 if(!workerRMvector) workerRMvector =
new std::vector<G4WorkerRunManager*>;
54 if(workerRMvector->size()>0)
57 msg<<
"G4MTRunManagerKernel is to be deleted while "
58 <<workerRMvector->size()<<
" G4WorkerRunManager are still alive.";
59 G4Exception(
"G4RunManagerKernel::~G4RunManagerKernel()",
62 delete workerRMvector;
98 {
return wThreadContext; }
152 workerRMvector->push_back(wrm);
160 wrm->G4RunManager::SetUserInitialization(const_cast<G4VUserDetectorConstruction*>(detector));
183 if(skipInitialization)
186 skipInitialization =
false;
197 std::vector<G4String>::const_iterator it = cmds.begin();
198 for(;it!=cmds.end();it++)
204 if ( macroFile ==
"" || macroFile ==
" " )
206 wrm->
BeamOn(numevents,0,numSelect);
210 wrm->
BeamOn(numevents,macroFile,numSelect);
216 d<<
"Cannot continue, this worker has been requested an unknwon action: "
233 std::vector<G4WorkerRunManager*>::iterator itrWrm = workerRMvector->begin();
234 for(;itrWrm!=workerRMvector->end();itrWrm++)
238 workerRMvector->erase(itrWrm);
247 return static_cast<void*
>(0);
340 for(
G4int i=0;i<nCh;i++)
349 std::vector<G4WorkerRunManager*>::iterator itr = workerRMvector->begin();
350 for(;itr!=workerRMvector->end();itr++)
351 { (*itr)->AbortRun(softAbort); }
static void * StartThread(void *context)
std::vector< G4String > GetCommandStack()
virtual void SetupShadowProcess() const
void SetUpDecayChannels()
void SetUpForAThread(G4int tId)
std::ostringstream G4ExceptionDescription
virtual void SetupRNGEngine(const CLHEP::HepRandomEngine *aRNGEngine) const
static void UpdateGeometryAndPhysicsVectorFromMaster()
virtual void WorkerInitialize() const
G4String GetSelectMacro() const
const G4VUserDetectorConstruction * GetUserDetectorConstruction() const
virtual void WorkerStart() const
G4ParticleDefinition * GetDaughter(G4int anIndex)
static void BuildGeometryAndPhysicsVector()
void G4SetThreadId(G4int aNewValue)
virtual void BeamOn(G4int n_event, const char *macroFile=0, G4int n_select=-1)
G4VDecayChannel * GetDecayChannel(G4int index) const
const G4UserWorkerInitialization * GetUserWorkerInitialization() const
virtual G4WorkerRunManager * CreateWorkerRunManager() const
virtual void SetUserInitialization(G4VUserPhysicsList *userInit)
virtual ~G4MTRunManagerKernel()
#define G4MUTEX_INITIALIZER
static G4UImanager * GetUIpointer()
void SetupShadowProcess() const
void reset(G4bool ifSkipIon=true)
static G4WorkerThread * GetWorkerThread()
static G4MTRunManager * GetMasterRunManager()
virtual WorkerActionRequest ThisWorkerWaitForNextAction()
virtual void Build() const =0
G4int GetThreadId() const
G4int GetNumberOfEventsToBeProcessed() const
const G4VUserActionInitialization * GetUserActionInitialization() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4int GetNumberOfSelectEvents() const
void SetWorkerThread(G4WorkerThread *wc)
Sets the worker context.
const G4UserWorkerThreadInitialization * GetUserWorkerThreadInitialization() const
static void SetInstance(G4VSteppingVerbose *Instance)
static G4ParticleTable * GetParticleTable()
virtual void WorkerStop() const
G4VUserActionInitialization * GetNonConstUserActionInitialization() const
const CLHEP::HepRandomEngine * getMasterRandomEngine() const
virtual G4VSteppingVerbose * InitializeSteppingVerbose() const
static void DestroyGeometryAndPhysicsVector()
virtual void Initialize()
const G4VUserPhysicsList * GetUserPhysicsList() const
void BroadcastAbortRun(G4bool softAbort)
G4PTblDicIterator * GetIterator() const
G4int ApplyCommand(const char *aCommand)