73 #ifdef theParticleIterator
74 #undef theParticleIterator
83 : physicsList(0),currentWorld(0),
84 geometryInitialized(false),physicsInitialized(false),
85 geometryToBeOptimized(true),
86 physicsNeedsToBeReBuilt(true),verboseLevel(0),
87 numberOfParallelWorld(0),geometryNeedsToBeClosed(true),
88 numberOfStaticAllocators(0)
98 G4Exception(
"G4RunManagerKernel::G4RunManagerKernel()",
"Run0001",
99 FatalException,
"More than one G4RunManagerKernel is constructed.");
108 ED<<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<<
G4endl;
109 ED<<
" G4RunManagerKernel fatal exception"<<
G4endl;
110 ED<<
" -- Following particles have already been registered"<<
G4endl;
111 ED<<
" before G4RunManagerKernel is instantiated."<<
G4endl;
112 for(
int i=0;i<particleTable->
entries();i++)
114 ED<<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<<
G4endl;
115 G4Exception(
"G4RunManagerKernel::G4RunManagerKernel()",
"Run0002",
135 vs = vs.substr(1,vs.size()-2);
141 <<
"**************************************************************" <<
G4endl
143 <<
" Copyright : Geant4 Collaboration" <<
G4endl
144 <<
" References : NIM A 506 (2003), 250-303" <<
G4endl
145 <<
" : IEEE-TNS 53 (2006), 270-278" <<
G4endl
146 <<
" : NIM A 835 (2016), 186-225" <<
G4endl
147 <<
" WWW : http://geant4.org/" <<
G4endl
148 <<
"**************************************************************" <<
G4endl
153 : physicsList(0),currentWorld(0),
154 geometryInitialized(false),physicsInitialized(false),
155 geometryToBeOptimized(true),
156 physicsNeedsToBeReBuilt(true),verboseLevel(0),
157 numberOfParallelWorld(0),geometryNeedsToBeClosed(true),
158 numberOfStaticAllocators(0)
161 #ifndef G4MULTITHREADED
163 msg<<
"Geant4 code is compiled without multi-threading support (-DG4MULTITHREADED is set to off).";
164 msg<<
" This type of RunManagerKernel can only be used in mult-threaded applications.";
177 G4Exception(
"G4RunManagerKernel::G4RunManagerKernel()",
"Run0001",
178 FatalException,
"More than one G4RunManagerKernel is constructed.");
205 msgx<<
" This type of RunManagerKernel can only be used in mult-threaded applications.";
215 vs = vs.substr(1,vs.size()-2);
224 <<
"**************************************************************" <<
G4endl
226 <<
" << in Multi-threaded mode >> " <<
G4endl
227 <<
" Copyright : Geant4 Collaboration" <<
G4endl
228 <<
" References : NIM A 506 (2003), 250-303" <<
G4endl
229 <<
" : IEEE-TNS 53 (2006), 270-278" <<
G4endl
230 <<
" : NIM A 835 (2016), 186-225" <<
G4endl
231 <<
" WWW : http://geant4.org/" <<
G4endl
232 <<
"**************************************************************" <<
G4endl
240 <<
"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" << G4endl
242 <<
"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" << G4endl
247 #ifdef G4MULTITHREADED
264 "Default world region should have a unique logical volume.");
266 std::vector<G4LogicalVolume*>::iterator lvItr
270 <<
"Obsolete world logical volume is removed from the default region." <<
G4endl;
290 if(pwps)
delete pwps;
305 if (pFinder)
delete pFinder;
307 if (fmStore)
delete fmStore;
309 if (gManager)
delete gManager;
344 G4cout <<
"Thread-local UImanager is to be deleted." << G4endl
345 <<
"There should not be any thread-local G4cout/G4cerr hereafter."
349 if(pUImanager)
delete pUImanager;
352 delete pStateManager;
364 G4MTRunManager::masterWorlds_t::iterator itrMW = masterWorlds.begin();
365 for(;itrMW!=masterWorlds.end();itrMW++)
385 G4cout <<
"Current application state is "
387 G4Exception(
"G4RunManagerKernel::DefineWorldVolume",
388 "DefineWorldVolumeAtIncorrectState",
390 "Geant4 kernel is not Init state : Method ignored.");
407 G4MTRunManager::masterWorlds_t::iterator itrMW = masterWorlds.begin();
408 for(;itrMW!=masterWorlds.end();itrMW++)
410 if((*itrMW).first == 0)
414 G4Exception(
"G4RunManagerKernel::WorkerDefineWorldVolume",
"RUN3091",
449 G4cout <<
"Current application state is "
451 G4Exception(
"G4RunManagerKernel::DefineWorldVolume",
452 "DefineWorldVolumeAtIncorrectState",
454 "Geant4 kernel is not Init state : Method ignored.");
473 ED <<
"The world volume has a user-defined region <"
476 ED <<
"World would have a default region assigned by RunManagerKernel."
494 <<
" is registered to the default region." <<
G4endl;
524 G4cout <<
"List of instantiated particles ============================================" <<
G4endl;
526 for(
G4int i=0;i<nPtcl;i++)
572 #ifdef G4MULTITHREADED
587 G4cout <<
"Current application state is "
591 G4Exception(
"G4RunManagerKernel::InitializePhysics",
592 "InitializePhysicsIncorrectState",
594 "Geant4 kernel is not Init state : Method ignored.");
601 G4cout<<
"Warning : Geant4 kernel is not Init state : Assuming Init state."
609 G4Exception(
"G4RunManagerKernel::InitializePhysics",
611 "G4VUserPhysicsList is not defined");
650 #ifdef G4MULTITHREADED
666 G4Exception(
"G4RunManagerKernel::RunInitialization",
669 "Geometry has not yet initialized : method ignored.");
675 G4Exception(
"G4RunManagerKernel::RunInitialization",
678 "Physics has not yet initialized : method ignored.");
684 G4Exception(
"G4RunManagerKernel::RunInitialization",
687 "Geant4 kernel not in Idle state : method ignored.");
713 #ifdef G4MULTITHREADED
773 "Geant4 kernel not in Init state : method ignored.");
792 #ifdef G4MULTITHREADED
814 std::vector<G4VPhysicalVolume*>::iterator wItr;
826 for(
size_t iw=0;iw<nWorlds;iw++)
845 <<
"> does not have specific production cuts," <<
G4endl
846 <<
"even though it appears in the current tracking world." <<
G4endl;
847 G4cout <<
"Default cuts are used for this region." <<
G4endl;
854 ->GetDefaultProductionCuts());
864 for(
size_t iw=0;iw<nWorlds;iw++)
903 G4cout <<
" -- appears in <"
907 {
G4cout <<
" -- is not associated to any world."; }
910 {
G4cout <<
" This region is in the mass world." <<
G4endl; }
912 {
G4cout <<
" This region is in the parallel world." <<
G4endl; }
914 G4cout <<
" Root logical volume(s) : ";
917 for(
size_t j=0;j<nRootLV;j++)
918 {
G4cout << (*lvItr)->GetName() <<
" "; lvItr++; }
926 G4cout <<
" Materials : ";
929 for(
size_t iMate=0;iMate<nMaterial;iMate++)
931 G4cout << (*mItr)->GetName() <<
" ";
939 <<
"> does not have specific production cuts." <<
G4endl;
940 G4cerr <<
"Default cuts are used for this region." <<
G4endl;
946 G4cout <<
" Production cuts : "
964 for(G4LogicalVolumeStore::iterator
pos=store->begin();
pos!=store->end();
pos++)
966 if((*
pos)&&((*pos)->GetNoDaughters()==1))
968 if((*pos)->GetDaughter(0)->IsRegularStructure())
986 theParticleIterator->
reset();
987 while((*theParticleIterator)())
1010 if( ! InitSplitter ) {
1011 InitSplitter =
true;
1013 theParticleIterator->
reset();
1014 while( (*theParticleIterator)() )
1024 G4cout <<
"G4RunManagerKernel -- G4ScoreSplittingProcess is appended to all particles." <<
G4endl;
1033 theParticleIterator->
reset();
1035 while((*theParticleIterator)())
1042 for (
G4int idx = 0 ; idx<procs.
size() ; ++idx)
1044 const G4VProcess* masterP = procs[idx]->GetMasterProcess();
1049 procs[idx]->SetMasterProcess(const_cast<G4VProcess*>(procs[idx]));
static G4FieldManagerStore * GetInstanceIfExist()
G4bool RunInitialization(G4bool fakeRun=false)
void Destroy(G4int nStat=0, G4int verboseLevel=0)
void DumpTable(const G4String &particle_name="ALL")
void AddRootLogicalVolume(G4LogicalVolume *lv)
void WorkerUpdateWorldVolume()
static G4MTRunManager * GetMasterRunManager()
static G4GeometryManager * GetInstanceIfExist()
void SetupDefaultRegion()
G4FastSimulationManager * GetFastSimulationManager() const
G4bool SetNewState(G4ApplicationState requestedState)
static G4PathFinder * GetInstanceIfExist()
std::ostringstream G4ExceptionDescription
static const G4double pos
virtual void GeometryHasChanged()=0
G4LogicalVolume * GetLogicalVolume() const
G4bool IsGeneralIon() const
static G4ParticleTable * GetParticleTable()
G4bool geometryToBeOptimized
void BuildPhysicsTables(G4bool fakeRun)
static G4TransportationManager * GetInstanceIfExist()
G4PrimaryTransformer * GetPrimaryTransformer() const
#define theParticleIterator
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord=ordDefault)
G4bool IsInMassGeometry() const
G4int numberOfParallelWorld
G4int ApplyCommand(const char *aCommand)
const G4String & GetName() const
G4bool IsInParallelGeometry() const
void DefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
void SetParticleDefinitionID(G4int id=-1)
static void ConstructParticle()
G4UserSteppingAction * GetRegionalSteppingAction() const
void PropagateGenericIonID()
const G4String & GetParticleName() const
std::vector< G4VPhysicalVolume * >::iterator GetWorldsIterator()
G4IonTable * GetIonTable() const
void SetWorld(G4VPhysicalVolume *wp)
void SetProductionCuts(G4ProductionCuts *cut)
G4UserLimits * GetUserLimits() const
G4ProcessVector * GetProcessList() const
G4PTblDicIterator * GetIterator() const
void RemoveRootLogicalVolume(G4LogicalVolume *lv, G4bool scan=true)
G4ProcessVector * GetAlongStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
void reset(G4bool ifSkipIon=true)
void UpdateMaterialList(G4VPhysicalVolume *currentWorld=0)
void PhysicsTableUpdated()
static G4AllocatorList * GetAllocatorListIfExist()
G4bool ConfirmCoupledTransportation()
static G4UImanager * GetUIpointer()
std::map< G4int, G4VPhysicalVolume * > masterWorlds_t
G4Region * GetRegion(const G4String &name, G4bool verbose=true) const
G4double GetProductionCut(G4int index) const
size_t GetNumberOfMaterials() const
static G4VVisManager * GetConcreteInstance()
void CheckRegularGeometry()
static const G4String G4Date
G4VPhysicalVolume * IsWorldExisting(const G4String &worldName)
G4ParticleDefinition * GetParticle(G4int index) const
static void InvalidOperationDetection()
static G4RunManagerKernel * GetRunManagerKernel()
G4bool physicsInitialized
G4int GetParticleDefinitionID() const
void SetPhysics(G4VUserPhysicsList *uPhys)
#define G4MUTEX_INITIALIZER
G4bool geometryNeedsToBeClosed
static G4ThreadLocal G4RunManagerKernel * fRunManagerKernel
static G4ParallelWorldProcessStore * GetInstanceIfExist()
G4bool RegisterWorld(G4VPhysicalVolume *aWorld)
static G4SDManager * GetSDMpointerIfExist()
static G4TemplateRNGHelper< T > * GetInstanceIfExist()
static G4GeometryManager * GetInstance()
G4Region * defaultRegionForParallelWorld
static void ClearUnitsTable()
G4String GetStateString(G4ApplicationState aState) const
G4bool physicsNeedsToBeReBuilt
void UseCoupledTransportation(G4bool vl=true)
static const G4String G4Version
const G4String & GetProcessName() const
G4ParticleDefinition * GetGenericIon() const
std::vector< G4Material * >::const_iterator GetMaterialIterator() const
void SetWorldForTracking(G4VPhysicalVolume *theWorld)
static G4UnitsTable & GetUnitsTable()
G4bool BelongsTo(G4VPhysicalVolume *thePhys) const
void OpenGeometry(G4VPhysicalVolume *vol=0)
size_t GetNoWorlds() const
G4EventManager * eventManager
void SetRegion(G4Region *reg)
virtual void ConstructParticle()=0
G4GLOB_DLL std::ostream G4cerr
G4ProductionCuts * GetProductionCuts() const
static G4NavigationHistoryPool * GetInstance()
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
static G4TransportationManager * GetTransportationManager()
void InitializeLightIons()
void UsedInParallelGeometry(G4bool val=true)
static G4ProductionCutsTable * GetProductionCutsTable()
G4VPhysicalVolume * GetWorldPhysical() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::vector< G4LogicalVolume * >::iterator GetRootLogicalVolumeIterator()
static masterWorlds_t & GetMasterWorlds()
G4VPhysicalVolume * currentWorld
static G4RegionStore * GetInstance()
G4ApplicationState GetCurrentState() const
G4ProcessManager * GetProcessManager() const
void DumpCutValuesTableIfRequested()
void SetReadiness(G4bool val=true)
G4bool CloseGeometry(G4bool pOptimise=true, G4bool verbose=false, G4VPhysicalVolume *vol=0)
void DumpRegion(const G4String &rname) const
G4GLOB_DLL std::ostream G4cout
void WorkerDefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
G4ExceptionHandler * defaultExceptionHandler
static G4Geantino * GeantinoDefinition()
#define TIMEMORY_AUTO_TIMER(str)
G4VUserPhysicsList * physicsList
void DumpCutValuesTable(G4int flag=1)
virtual ~G4RunManagerKernel()
void UpdateCoupleTable(G4VPhysicalVolume *currentWorld)
G4bool geometryInitialized
G4Region * GetRegion() const
virtual void SetupShadowProcess() const
RMKType runManagerKernelType
static G4LogicalVolumeStore * GetInstance()
G4int numberOfStaticAllocators
const G4String & GetName() const
const G4String & GetName() const
void UsedInMassGeometry(G4bool val=true)
static G4StateManager * GetStateManager()
G4VUserRegionInformation * GetUserInformation() const
size_t GetNumberOfRootVolumes() const