67 #ifdef theParticleIterator
68 #undef theParticleIterator
77 : physicsList(0),currentWorld(0),
78 geometryInitialized(false),physicsInitialized(false),
79 geometryToBeOptimized(true),
80 physicsNeedsToBeReBuilt(true),verboseLevel(0),
81 numberOfParallelWorld(0),geometryNeedsToBeClosed(true),
82 numberOfStaticAllocators(0)
92 G4Exception(
"G4RunManagerKernel::G4RunManagerKernel()",
"Run0001",
93 FatalException,
"More than one G4RunManagerKernel is constructed.");
102 ED<<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<<
G4endl;
103 ED<<
" G4RunManagerKernel fatal exception"<<
G4endl;
104 ED<<
" -- Following particles have already been registered"<<
G4endl;
105 ED<<
" before G4RunManagerKernel is instantiated."<<
G4endl;
106 for(
int i=0;i<particleTable->
entries();i++)
108 ED<<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<<
G4endl;
109 G4Exception(
"G4RunManagerKernel::G4RunManagerKernel()",
"Run0002",
129 vs = vs.substr(1,vs.size()-2);
135 <<
"*************************************************************" <<
G4endl
137 <<
" Copyright : Geant4 Collaboration" <<
G4endl
138 <<
" Reference : NIM A 506 (2003), 250-303" <<
G4endl
139 <<
" WWW : http://cern.ch/geant4" <<
G4endl
140 <<
"*************************************************************" <<
G4endl
145 : physicsList(0),currentWorld(0),
146 geometryInitialized(false),physicsInitialized(false),
147 geometryToBeOptimized(true),
148 physicsNeedsToBeReBuilt(true),verboseLevel(0),
149 numberOfParallelWorld(0),geometryNeedsToBeClosed(true),
150 numberOfStaticAllocators(0)
153 #ifndef G4MULTITHREADED
155 msg<<
"Geant4 code is compiled without multi-threading support (-DG4MULTITHREADED is set to off).";
156 msg<<
" This type of RunManagerKernel can only be used in mult-threaded applications.";
167 G4Exception(
"G4RunManagerKernel::G4RunManagerKernel()",
"Run0001",
168 FatalException,
"More than one G4RunManagerKernel is constructed.");
193 msgx<<
" This type of RunManagerKernel can only be used in mult-threaded applications.";
203 vs = vs.substr(1,vs.size()-2);
212 <<
"*************************************************************" <<
G4endl
214 <<
" << in Multi-threaded mode >> " <<
G4endl
215 <<
" Copyright : Geant4 Collaboration" <<
G4endl
216 <<
" Reference : NIM A 506 (2003), 250-303" <<
G4endl
217 <<
" WWW : http://cern.ch/geant4" <<
G4endl
218 <<
"*************************************************************" <<
G4endl
225 <<
"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" << G4endl
227 <<
"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" << G4endl
244 "Default world region should have a unique logical volume.");
246 std::vector<G4LogicalVolume*>::iterator lvItr
250 <<
"Obsolete world logical volume is removed from the default region." <<
G4endl;
291 G4cout <<
"Thread-local UImanager is to be deleted." << G4endl
292 <<
"There should not be any thread-local G4cout/G4cerr hereafter."
296 if(pUImanager)
delete pUImanager;
299 delete pStateManager;
311 G4MTRunManager::masterWorlds_t::iterator itrMW = masterWorlds.begin();
312 for(;itrMW!=masterWorlds.end();itrMW++)
330 G4Exception(
"G4RunManagerKernel::DefineWorldVolume",
331 "DefineWorldVolumeAtIncorrectState",
333 "Geant4 kernel is not PreInit or Idle state : Method ignored.");
343 G4MTRunManager::masterWorlds_t::iterator itrMW = masterWorlds.begin();
344 for(;itrMW!=masterWorlds.end();itrMW++)
346 if((*itrMW).first == 0)
350 G4Exception(
"G4RunManagerKernel::WorkerDefineWorldVolume",
"RUN3091",
382 G4Exception(
"G4RunManagerKernel::DefineWorldVolume",
385 "Geant4 kernel is not PreInit or Idle state : Method ignored.");
395 ED <<
"The world volume has a user-defined region <"
398 ED <<
"World would have a default region assigned by RunManagerKernel."
416 <<
" is registered to the default region." <<
G4endl;
445 G4cout <<
"List of instantiated particles ============================================" <<
G4endl;
447 for(
G4int i=0;i<nPtcl;i++)
505 G4Exception(
"G4RunManagerKernel::InitializePhysics",
507 "Geant4 kernel is not PreInit or Idle state : Method ignored.");
513 G4Exception(
"G4RunManagerKernel::InitializePhysics",
515 "G4VUserPhysicsList is not defined");
533 static G4bool createIsomerOnlyOnce =
false;
536 if(!createIsomerOnlyOnce)
538 createIsomerOnlyOnce =
true;
567 G4Exception(
"G4RunManagerKernel::RunInitialization",
570 "Geometry has not yet initialized : method ignored.");
576 G4Exception(
"G4RunManagerKernel::RunInitialization",
579 "Physics has not yet initialized : method ignored.");
585 G4Exception(
"G4RunManagerKernel::RunInitialization",
588 "Geant4 kernel not in Idle state : method ignored.");
650 "Geant4 kernel not in Idle state : method ignored.");
668 #ifdef G4MULTITHREADED
690 std::vector<G4VPhysicalVolume*>::iterator wItr;
702 for(
size_t iw=0;iw<nWorlds;iw++)
721 <<
"> does not have specific production cuts," <<
G4endl
722 <<
"even though it appears in the current tracking world." <<
G4endl;
723 G4cerr <<
"Default cuts are used for this region." <<
G4endl;
730 ->GetDefaultProductionCuts());
740 for(
size_t iw=0;iw<nWorlds;iw++)
779 G4cout <<
" -- appears in <"
783 {
G4cout <<
" -- is not associated to any world."; }
786 {
G4cout <<
" This region is in the mass world." <<
G4endl; }
788 {
G4cout <<
" This region is in the parallel world." <<
G4endl; }
790 G4cout <<
" Root logical volume(s) : ";
793 for(
size_t j=0;j<nRootLV;j++)
794 {
G4cout << (*lvItr)->GetName() <<
" "; lvItr++; }
802 G4cout <<
" Materials : ";
805 for(
size_t iMate=0;iMate<nMaterial;iMate++)
807 G4cout << (*mItr)->GetName() <<
" ";
815 <<
"> does not have specific production cuts." <<
G4endl;
816 G4cerr <<
"Default cuts are used for this region." <<
G4endl;
822 G4cout <<
" Production cuts : "
840 for(G4LogicalVolumeStore::iterator
pos=store->begin();
pos!=store->end();
pos++)
842 if((*
pos)&&((*pos)->GetNoDaughters()==1))
844 if((*pos)->GetDaughter(0)->IsRegularStructure())
862 theParticleIterator->
reset();
863 while((*theParticleIterator)())
886 if( ! InitSplitter ) {
889 theParticleIterator->
reset();
890 while( (*theParticleIterator)() )
900 G4cout <<
"G4RunManagerKernel -- G4ScoreSplittingProcess is appended to all particles." <<
G4endl;
909 theParticleIterator->
reset();
911 while((*theParticleIterator)())
918 for (
G4int idx = 0 ; idx<procs.
size() ; ++idx)
920 const G4VProcess* masterP = procs[idx]->GetMasterProcess();
925 procs[idx]->SetMasterProcess(const_cast<G4VProcess*>(procs[idx]));
virtual void GeometryHasChanged()=0
G4bool ConfirmCoupledTransportation()
static G4Geantino * GeantinoDefinition()
G4VPhysicalVolume * IsWorldExisting(const G4String &worldName)
G4int GetParticleDefinitionID() const
G4Region * defaultRegionForParallelWorld
void InitializeLightIons()
G4ProductionCuts * GetProductionCuts() const
std::vector< G4Material * >::const_iterator GetMaterialIterator() const
std::map< G4int, G4VPhysicalVolume * > masterWorlds_t
virtual void SetupShadowProcess() const
G4Region * GetRegion(const G4String &name, G4bool verbose=true) const
void DumpCutValuesTableIfRequested()
const G4String & GetName() const
void SetPhysics(G4VUserPhysicsList *uPhys)
void SetParticleDefinitionID(G4int id=-1)
void UpdateMaterialList(G4VPhysicalVolume *currentWorld=0)
G4VPhysicalVolume * currentWorld
void DumpTable(const G4String &particle_name="ALL")
G4EventManager * eventManager
std::ostringstream G4ExceptionDescription
void AddRootLogicalVolume(G4LogicalVolume *lv)
void UsedInParallelGeometry(G4bool val=true)
G4bool geometryInitialized
static G4VVisManager * GetConcreteInstance()
static G4AllocatorList * GetAllocatorListIfExist()
std::vector< G4VPhysicalVolume * >::iterator GetWorldsIterator()
G4double GetProductionCut(G4int index) const
G4VUserRegionInformation * GetUserInformation() const
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord=ordDefault)
static masterWorlds_t & GetMasterWorlds()
void SetReadiness(G4bool val=true)
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
G4Region * GetRegion() const
G4ParticleDefinition * GetGenericIon() const
G4int numberOfStaticAllocators
G4ProcessManager * GetProcessManager() const
static G4RunManagerKernel * GetRunManagerKernel()
#define G4MUTEX_INITIALIZER
G4bool RunInitialization(G4bool fakeRun=false)
const G4String & GetParticleName() const
void WorkerDefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
G4bool IsGeneralIon() const
G4int numberOfParallelWorld
static void ConstructParticle()
G4ExceptionHandler * defaultExceptionHandler
static G4UImanager * GetUIpointer()
static G4RegionStore * GetInstance()
G4bool physicsInitialized
static G4StateManager * GetStateManager()
void SetRegion(G4Region *reg)
G4VPhysicalVolume * GetWorldPhysical() const
G4ParticleDefinition * GetParticle(G4int index) const
G4IonTable * GetIonTable() const
void DumpCutValuesTable(G4int flag=1)
G4GLOB_DLL std::ostream G4cout
G4bool SetNewState(G4ApplicationState requestedState)
void PhysicsTableUpdated()
void reset(G4bool ifSkipIon=true)
const G4String & GetName() const
static void InvalidOperationDetection()
void DumpRegion(const G4String &rname) const
static G4MTRunManager * GetMasterRunManager()
void UsedInMassGeometry(G4bool val=true)
static const G4String G4Version
static G4LogicalVolumeStore * GetInstance()
static const G4String G4Date
G4ApplicationState GetCurrentState() const
RMKType runManagerKernelType
static G4GeometryManager * GetInstance()
G4bool geometryToBeOptimized
const G4String & GetProcessName() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
void SetupDefaultRegion()
static G4TransportationManager * GetTransportationManager()
static void ClearUnitsTable()
static G4ProductionCutsTable * GetProductionCutsTable()
G4bool BelongsTo(G4VPhysicalVolume *thePhys) const
void UseCoupledTransportation(G4bool vl=true)
G4LogicalVolume * GetLogicalVolume() const
void SetWorld(G4VPhysicalVolume *wp)
static G4ParticleTable * GetParticleTable()
G4PrimaryTransformer * GetPrimaryTransformer() const
G4bool IsInMassGeometry() const
G4FastSimulationManager * GetFastSimulationManager() const
G4VUserPhysicsList * physicsList
static G4ThreadLocal G4RunManagerKernel * fRunManagerKernel
size_t GetNoWorlds() const
void Destroy(G4int nStat=0, G4int verboseLevel=0)
void SetProductionCuts(G4ProductionCuts *cut)
void OpenGeometry(G4VPhysicalVolume *vol=0)
void UpdateCoupleTable(G4VPhysicalVolume *currentWorld)
void CheckRegularGeometry()
virtual void ConstructParticle()=0
G4bool physicsNeedsToBeReBuilt
G4bool RegisterWorld(G4VPhysicalVolume *aWorld)
size_t GetNumberOfMaterials() const
void SetWorldForTracking(G4VPhysicalVolume *theWorld)
void BuildPhysicsTables(G4bool fakeRun)
G4ProcessVector * GetAlongStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
size_t GetNumberOfRootVolumes() const
virtual ~G4RunManagerKernel()
void RemoveRootLogicalVolume(G4LogicalVolume *lv, G4bool scan=true)
void WorkerUpdateWorldVolume()
G4bool IsInParallelGeometry() const
G4PTblDicIterator * GetIterator() const
G4UserLimits * GetUserLimits() const
static const G4double pos
G4UserSteppingAction * GetRegionalSteppingAction() const
G4bool CloseGeometry(G4bool pOptimise=true, G4bool verbose=false, G4VPhysicalVolume *vol=0)
#define theParticleIterator
G4int ApplyCommand(const char *aCommand)
G4ProcessVector * GetProcessList() const
G4GLOB_DLL std::ostream G4cerr
void DefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
G4String GetStateString(G4ApplicationState aState) const
static G4SDManager * GetSDMpointerIfExist()
std::vector< G4LogicalVolume * >::iterator GetRootLogicalVolumeIterator()
G4bool geometryNeedsToBeClosed