90#ifdef theParticleIterator
91# undef theParticleIterator
111 auto _signals = G4GetEnv<std::string>(
"G4BACKTRACE",
"");
123 if(allocList !=
nullptr)
132 G4Exception(
"G4RunManagerKernel::G4RunManagerKernel()",
"Run0001",
134 "More than one G4RunManagerKernel is constructed.");
139 if(particleTable->
entries() > 0)
143 ED <<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" <<
G4endl;
144 ED <<
" G4RunManagerKernel fatal exception" <<
G4endl;
145 ED <<
" -- Following particles have already been registered" <<
G4endl;
146 ED <<
" before G4RunManagerKernel is instantiated." <<
G4endl;
152 ED <<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" <<
G4endl;
153 G4Exception(
"G4RunManagerKernel::G4RunManagerKernel()",
"Run0002",
162 new G4Region(
"DefaultRegionForParallelWorld");
165 ->GetDefaultProductionCuts());
168 ->GetDefaultProductionCuts());
176 vs = vs.substr(1, vs.size() - 2);
182 <<
"**************************************************************"
184 <<
" Copyright : Geant4 Collaboration" <<
G4endl
185 <<
" References : NIM A 506 (2003), 250-303"
187 <<
" : IEEE-TNS 53 (2006), 270-278"
189 <<
" : NIM A 835 (2016), 186-225"
190 <<
G4endl <<
" WWW : http://geant4.org/"
192 <<
"**************************************************************"
200 #ifndef G4MULTITHREADED
202 msg <<
"Geant4 code is compiled without multi-threading support "
203 "(-DG4MULTITHREADED is set to off).";
204 msg <<
" This type of RunManagerKernel can only be used in mult-threaded "
206 G4Exception(
"G4RunManagerKernel::G4RunManagerKernel(G4bool)",
"Run0105",
218 auto _signals = G4GetEnv<std::string>(
"G4BACKTRACE",
"");
236 G4Exception(
"G4RunManagerKernel::G4RunManagerKernel()",
"Run0001",
238 "More than one G4RunManagerKernel is constructed.");
249 new G4Region(
"DefaultRegionForTheWorld");
251 new G4Region(
"DefaultRegionForParallelWorld");
254 ->GetDefaultProductionCuts());
257 ->GetDefaultProductionCuts());
262 "DefaultRegionForTheWorld",
true);
264 "DefaultRegionForParallelWorld",
true);
271 <<
" This type of RunManagerKernel can only be used in mult-threaded "
273 G4Exception(
"G4RunManagerKernel::G4RunManagerKernel(G4bool)",
"Run0106",
283 vs = vs.substr(1, vs.size() - 2);
292 <<
"**************************************************************"
294 <<
" << in Multi-threaded mode >> " <<
G4endl
295 <<
" Copyright : Geant4 Collaboration"
297 <<
" References : NIM A 506 (2003), 250-303"
299 <<
" : IEEE-TNS 53 (2006), 270-278"
301 <<
" : NIM A 835 (2016), 186-225"
303 <<
" WWW : http://geant4.org/"
305 <<
"**************************************************************"
315 <<
"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
318 <<
"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
324 #ifdef G4MULTITHREADED
341 "Default world region should have a unique logical volume.");
347 <<
"Obsolete world logical volume is removed from the default region."
360 G4cout <<
"G4 kernel has come to Quit state." <<
G4endl;
415 G4cout <<
"Thread-local UImanager is to be deleted." <<
G4endl
416 <<
"There should not be any thread-local G4cout/G4cerr hereafter."
424 delete pStateManager;
429 G4cout <<
"RunManagerKernel is deleted. Good bye :)" <<
G4endl;
440 for(
auto itrMW = masterWorlds.cbegin();
441 itrMW != masterWorlds.cend(); ++itrMW)
447 if(pWorld ==
nullptr)
464 G4cout <<
"Current application state is "
466 G4Exception(
"G4RunManagerKernel::DefineWorldVolume",
468 "Geant4 kernel is not Init state : Method ignored.");
482 for(
auto itrMW = masterWorlds.cbegin();
483 itrMW != masterWorlds.cend(); ++itrMW)
485 if((*itrMW).first == 0)
489 G4Exception(
"G4RunManagerKernel::WorkerDefineWorldVolume",
"RUN3091",
500 if(topologyIsChanged)
507 if(pVVisManager !=
nullptr)
530 G4cout <<
"Current application state is "
532 G4Exception(
"G4RunManagerKernel::DefineWorldVolume",
534 "Geant4 kernel is not Init state : Method ignored.");
549 ED <<
"The world volume has a user-defined region <"
552 ED <<
"World would have a default region assigned by RunManagerKernel."
570 G4cout << worldLog->
GetName() <<
" is registered to the default region."
576 if(topologyIsChanged)
583 if(pVVisManager !=
nullptr)
608 G4cout <<
"List of instantiated particles "
609 "============================================"
612 for(
G4int i = 0; i < nPtcl; ++i)
661#ifdef G4MULTITHREADED
679 G4cout <<
"Current application state is "
683 G4Exception(
"G4RunManagerKernel::InitializePhysics",
685 "Geant4 kernel is not Init state : Method ignored.");
694 <<
"Warning : Geant4 kernel is not Init state : Assuming Init state."
702 G4Exception(
"G4RunManagerKernel::InitializePhysics",
"Run0012",
714 G4cout <<
"physicsList->CheckParticleList() start." <<
G4endl;
750#ifdef G4MULTITHREADED
769 "Geometry has not yet initialized : method ignored.");
776 "Physics has not yet initialized : method ignored.");
783 "Geant4 kernel not in Idle state : method ignored.");
804 if(pVVisManager !=
nullptr)
811#ifdef G4MULTITHREADED
879 "Geant4 kernel not in Init state : method ignored.");
900 #ifdef G4MULTITHREADED
927 std::vector<G4VPhysicalVolume*>::iterator wItr;
940 for(std::size_t iw = 0; iw < nWorlds; ++iw)
963 <<
"> does not have specific production cuts," <<
G4endl
964 <<
"even though it appears in the current tracking world."
966 G4cout <<
"Default cuts are used for this region." <<
G4endl;
983 for(std::size_t iw = 0; iw < nWorlds; ++iw)
1002 if(region !=
nullptr)
1009 if(region ==
nullptr)
1025 <<
"> world volume";
1029 G4cout <<
" -- is not associated to any world.";
1034 G4cout <<
" This region is in the mass world." <<
G4endl;
1038 G4cout <<
" This region is in the parallel world." <<
G4endl;
1041 G4cout <<
" Root logical volume(s) : ";
1044 for(std::size_t j = 0; j < nRootLV; ++j)
1046 G4cout << (*lvItr)->GetName() <<
" ";
1051 G4cout <<
" Pointers : G4VUserRegionInformation["
1057 G4cout <<
" Materials : ";
1060 for(std::size_t iMate = 0; iMate < nMaterial; ++iMate)
1062 G4cout << (*mItr)->GetName() <<
" ";
1070 <<
"> does not have specific production cuts." <<
G4endl;
1071 G4cerr <<
"Default cuts are used for this region." <<
G4endl;
1073 ->GetDefaultProductionCuts());
1075 else if(cuts !=
nullptr)
1077 G4cout <<
" Production cuts : "
1093 for(
auto pos = store->cbegin();
pos != store->cend(); ++
pos)
1095 if((*
pos) && ((*pos)->GetNoDaughters() == 1))
1097 if((*pos)->GetDaughter(0)->IsRegularStructure())
1137 InitSplitter =
true;
1153 <<
"G4RunManagerKernel -- G4ScoreSplittingProcess is appended to all "
1174 for(std::size_t idx = 0; idx < procs.
size(); ++idx)
1176 const G4VProcess* masterP = procs[idx]->GetMasterProcess();
1177 if(masterP ==
nullptr)
1181 procs[idx]->SetMasterProcess(
const_cast<G4VProcess*
>(procs[idx]));
static const G4double pos
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
static void InvalidOperationDetection()
#define G4MUTEX_INITIALIZER
#define theParticleIterator
static const G4String G4Date
static const G4String G4Version
G4GLOB_DLL std::ostream G4cerr
G4GLOB_DLL std::ostream G4cout
static G4AllocatorList * GetAllocatorListIfExist()
void Destroy(G4int nStat=0, G4int verboseLevel=0)
static int Enable(const std::string &)
static G4FieldManagerStore * GetInstanceIfExist()
static G4Geantino * GeantinoDefinition()
static G4GeometryManager * GetInstance()
G4bool CloseGeometry(G4bool pOptimise=true, G4bool verbose=false, G4VPhysicalVolume *vol=nullptr)
void OpenGeometry(G4VPhysicalVolume *vol=nullptr)
static G4GeometryManager * GetInstanceIfExist()
static void ConstructParticle()
void InitializeLightIons()
static G4LogicalVolumeStore * GetInstance()
void SetRegion(G4Region *reg)
G4Region * GetRegion() const
const G4String & GetName() const
static G4MTRunManager * GetMasterRunManager()
std::map< G4int, G4VPhysicalVolume * > masterWorlds_t
static masterWorlds_t & GetMasterWorlds()
static G4NavigationHistoryPool * GetInstance()
static G4ParallelWorldProcessStore * GetInstanceIfExist()
G4ProcessManager * GetProcessManager() const
G4bool IsGeneralIon() const
void SetParticleDefinitionID(G4int id=-1)
G4int GetParticleDefinitionID() const
const G4String & GetParticleName() const
void reset(G4bool ifSkipIon=true)
G4IonTable * GetIonTable() const
G4ParticleDefinition * GetParticle(G4int index) const
G4PTblDicIterator * GetIterator() const
static G4ParticleTable * GetParticleTable()
void SetReadiness(G4bool val=true)
G4ParticleDefinition * GetGenericIon() const
void DumpTable(const G4String &particle_name="ALL")
static G4PathFinder * GetInstanceIfExist()
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord=ordDefault)
G4ProcessVector * GetAlongStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
G4ProcessVector * GetProcessList() const
void UpdateCoupleTable(G4VPhysicalVolume *currentWorld)
void PhysicsTableUpdated()
static G4ProductionCutsTable * GetProductionCutsTable()
G4ProductionCuts * GetDefaultProductionCuts() const
G4double GetProductionCut(G4int index) const
static G4RegionStore * GetInstance()
void UpdateMaterialList(G4VPhysicalVolume *currentWorld=nullptr)
G4Region * GetRegion(const G4String &name, G4bool verbose=true) const
G4bool BelongsTo(G4VPhysicalVolume *thePhys) const
G4FastSimulationManager * GetFastSimulationManager() const
G4VUserRegionInformation * GetUserInformation() const
void SetWorld(G4VPhysicalVolume *wp)
G4bool IsInParallelGeometry() const
G4ProductionCuts * GetProductionCuts() const
void RemoveRootLogicalVolume(G4LogicalVolume *lv, G4bool scan=true)
G4VPhysicalVolume * GetWorldPhysical() const
void SetProductionCuts(G4ProductionCuts *cut)
G4UserLimits * GetUserLimits() const
const G4String & GetName() const
G4bool IsInMassGeometry() const
size_t GetNumberOfRootVolumes() const
G4UserSteppingAction * GetRegionalSteppingAction() const
size_t GetNumberOfMaterials() const
void UsedInParallelGeometry(G4bool val=true)
std::vector< G4Material * >::const_iterator GetMaterialIterator() const
void AddRootLogicalVolume(G4LogicalVolume *lv, G4bool search=true)
std::vector< G4LogicalVolume * >::iterator GetRootLogicalVolumeIterator()
void UsedInMassGeometry(G4bool val=true)
void SetupDefaultRegion()
G4bool physicsNeedsToBeReBuilt
G4PrimaryTransformer * GetPrimaryTransformer() const
G4int numberOfStaticAllocators
void CheckRegularGeometry()
G4bool geometryInitialized
G4int numberOfParallelWorld
G4Region * defaultRegionForParallelWorld
static G4RunManagerKernel * GetRunManagerKernel()
void SetPhysics(G4VUserPhysicsList *uPhys)
G4ExceptionHandler * defaultExceptionHandler
static G4ThreadLocal G4RunManagerKernel * fRunManagerKernel
RMKType runManagerKernelType
G4bool ConfirmCoupledTransportation()
void WorkerUpdateWorldVolume()
void DefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
void PropagateGenericIonID()
G4bool physicsInitialized
G4bool RunInitialization(G4bool fakeRun=false)
void WorkerDefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
G4VPhysicalVolume * currentWorld
virtual void SetupShadowProcess() const
G4VUserPhysicsList * physicsList
virtual ~G4RunManagerKernel()
void DumpRegion(const G4String &rname) const
G4EventManager * eventManager
G4bool geometryNeedsToBeClosed
void BuildPhysicsTables(G4bool fakeRun)
G4bool geometryToBeOptimized
static G4SDManager * GetSDMpointerIfExist()
const G4ApplicationState & GetCurrentState() const
G4String GetStateString(const G4ApplicationState &aState) const
static G4StateManager * GetStateManager()
G4bool SetNewState(const G4ApplicationState &requestedState)
static G4TemplateRNGHelper< T > * GetInstanceIfExist()
G4bool RegisterWorld(G4VPhysicalVolume *aWorld)
static G4TransportationManager * GetTransportationManager()
static G4TransportationManager * GetInstanceIfExist()
G4VPhysicalVolume * IsWorldExisting(const G4String &worldName)
void SetWorldForTracking(G4VPhysicalVolume *theWorld)
std::vector< G4VPhysicalVolume * >::iterator GetWorldsIterator()
size_t GetNoWorlds() const
G4int ApplyCommand(const char *aCommand)
static G4UImanager * GetUIpointer()
static void ClearUnitsTable()
static G4UnitsTable & GetUnitsTable()
G4LogicalVolume * GetLogicalVolume() const
const G4String & GetName() const
const G4String & GetProcessName() const
void UseCoupledTransportation(G4bool vl=true)
virtual void ConstructParticle()=0
void DumpCutValuesTableIfRequested()
void DumpCutValuesTable(G4int flag=1)
static G4VVisManager * GetConcreteInstance()
virtual void GeometryHasChanged()=0