63{
return fRunManagerKernel; }
66:physicsList(0),currentWorld(0),
67 geometryInitialized(false),physicsInitialized(false),
68 geometryNeedsToBeClosed(true),geometryToBeOptimized(true),
69 physicsNeedsToBeReBuilt(true),verboseLevel(0),
70 numberOfParallelWorld(0)
73 InvalidOperationDetection();
79 G4Exception(
"G4RunManagerKernel::G4RunManagerKernel()",
"Run0001",
80 FatalException,
"More than one G4RunManagerKernel is constructed.");
82 fRunManagerKernel =
this;
89 ED<<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<<
G4endl;
90 ED<<
" G4RunManagerKernel fatal exception"<<
G4endl;
91 ED<<
" -- Following particles have already been registered"<<
G4endl;
92 ED<<
" before G4RunManagerKernel is instantiated."<<
G4endl;
93 for(
int i=0;i<particleTable->
entries();i++)
95 ED<<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<<
G4endl;
96 G4Exception(
"G4RunManagerKernel::G4RunManagerKernel()",
"Run0002",
102 defaultRegion =
new G4Region(
"DefaultRegionForTheWorld");
103 defaultRegionForParallelWorld =
new G4Region(
"DefaultRegionForParallelWorld");
116 vs = vs.substr(1,vs.size()-2);
117 versionString =
" Geant4 version ";
119 versionString +=
" ";
120 versionString += G4Date;
122 <<
"*************************************************************" <<
G4endl
123 << versionString <<
G4endl
124 <<
" Copyright : Geant4 Collaboration" <<
G4endl
125 <<
" Reference : NIM A 506 (2003), 250-303" <<
G4endl
126 <<
" WWW : http://cern.ch/geant4" <<
G4endl
127 <<
"*************************************************************" <<
G4endl
137 if(verboseLevel>0)
G4cout <<
"G4 kernel has come to Quit state." <<
G4endl;
149 if(verboseLevel>1)
G4cout <<
"G4SDManager deleted." <<
G4endl;
152 if(verboseLevel>1)
G4cout <<
"EventManager deleted." <<
G4endl;
155 if(pUImanager)
delete pUImanager;
156 if(verboseLevel>1)
G4cout <<
"UImanager deleted." <<
G4endl;
159 if(verboseLevel>1)
G4cout <<
"Units table cleared." <<
G4endl;
160 delete pStateManager;
161 if(verboseLevel>1)
G4cout <<
"StateManager deleted." <<
G4endl;
162 delete defaultExceptionHandler;
163 if(verboseLevel>1)
G4cout <<
"RunManagerKernel is deleted." <<
G4endl;
164 fRunManagerKernel = 0;
174 G4Exception(
"G4RunManagerKernel::DefineWorldVolume",
177 "Geant4 kernel is not PreInit or Idle state : Method ignored.");
187 ED <<
"The world volume has a user-defined region <"
190 ED <<
"World would have a default region assigned by RunManagerKernel."
205 "Default world region should have a unique logical volume.");
207 std::vector<G4LogicalVolume*>::iterator lvItr
211 <<
"Obsolete world logical volume is removed from the default region." <<
G4endl;
215 currentWorld = worldVol;
222 <<
" is registered to the default region." <<
G4endl;
227 if(topologyIsChanged) geometryNeedsToBeClosed =
true;
233 geometryInitialized =
true;
246 G4cout <<
"List of instantiated particles ============================================" <<
G4endl;
248 for(
G4int i=0;i<nPtcl;i++)
264 G4Exception(
"G4RunManagerKernel::InitializePhysics",
266 "Geant4 kernel is not PreInit or Idle state : Method ignored.");
272 G4Exception(
"G4RunManagerKernel::InitializePhysics",
274 "G4VUserPhysicsList is not defined");
278 if(verboseLevel>1)
G4cout <<
"physicsList->Construct() start." <<
G4endl;
282 if(verboseLevel>1)
G4cout <<
"physicsList->CheckParticleList() start." <<
G4endl;
284 if(verboseLevel>1)
G4cout <<
"physicsList->setCut() start." <<
G4endl;
287 physicsInitialized =
true;
297 if(!geometryInitialized)
299 G4Exception(
"G4RunManagerKernel::RunInitialization",
302 "Geometry has not yet initialized : method ignored.");
306 if(!physicsInitialized)
308 G4Exception(
"G4RunManagerKernel::RunInitialization",
311 "Physics has not yet initialized : method ignored.");
317 G4Exception(
"G4RunManagerKernel::RunInitialization",
320 "Geant4 kernel not in Idle state : method ignored.");
331 BuildPhysicsTables();
333 if(geometryNeedsToBeClosed)
336 CheckRegularGeometry();
351void G4RunManagerKernel::ResetNavigator()
359 if(verboseLevel>1)
G4cout <<
"Start closing geometry." <<
G4endl;
361 geomManager->
CloseGeometry(geometryToBeOptimized, verboseLevel>1);
370 geometryNeedsToBeClosed =
false;
382 "Geant4 kernel not in Idle state : method ignored.");
391void G4RunManagerKernel::BuildPhysicsTables()
394 || physicsNeedsToBeReBuilt)
398 physicsNeedsToBeReBuilt =
false;
406void G4RunManagerKernel::CheckRegions()
410 std::vector<G4VPhysicalVolume*>::iterator wItr;
422 for(
size_t iw=0;iw<nWorlds;iw++)
426 if(*wItr==currentWorld)
441 <<
"> does not have specific production cuts," <<
G4endl
442 <<
"even though it appears in the current tracking world." <<
G4endl;
443 G4cerr <<
"Default cuts are used for this region." <<
G4endl;
469 for(
size_t iw=0;iw<nWorlds;iw++)
472 if(*wItr!=currentWorld)
477 pwLogical->
SetRegion(defaultRegionForParallelWorld);
507 G4cout <<
" -- appears in <"
511 {
G4cout <<
" -- is not associated to any world."; }
514 {
G4cout <<
" This region is in the mass world." <<
G4endl; }
516 {
G4cout <<
" This region is in the parallel world." <<
G4endl; }
518 G4cout <<
" Root logical volume(s) : ";
521 for(
size_t j=0;j<nRootLV;j++)
522 {
G4cout << (*lvItr)->GetName() <<
" "; lvItr++; }
535 G4cout <<
" Materials : ";
538 for(
size_t iMate=0;iMate<nMaterial;iMate++)
540 G4cout << (*mItr)->GetName() <<
" ";
548 <<
"> does not have specific production cuts." <<
G4endl;
549 G4cerr <<
"Default cuts are used for this region." <<
G4endl;
555 G4cout <<
" Production cuts : "
570void G4RunManagerKernel::CheckRegularGeometry()
573 for(G4LogicalVolumeStore::iterator pos=store->begin(); pos!=store->end(); pos++)
575 if((*pos)&&((*pos)->GetNoDaughters()==1))
577 if((*pos)->GetDaughter(0)->IsRegularStructure())
591G4bool G4RunManagerKernel::ConfirmCoupledTransportation()
595 theParticleIterator->
reset();
596 while((*theParticleIterator)())
611void G4RunManagerKernel::SetScoreSplitter()
618 static bool InitSplitter=
false;
619 if( ! InitSplitter ) {
622 theParticleIterator->
reset();
623 while( (*theParticleIterator)() )
633 G4cout <<
"G4RunManagerKernel -- G4ScoreSplittingProcess is appended to all particles." <<
G4endl;
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
G4DLLIMPORT std::ostream G4cerr
G4DLLIMPORT std::ostream G4cout
G4bool CloseGeometry(G4bool pOptimise=true, G4bool verbose=false, G4VPhysicalVolume *vol=0)
void OpenGeometry(G4VPhysicalVolume *vol=0)
static G4GeometryManager * GetInstance()
static G4LogicalVolumeStore * GetInstance()
void SetRegion(G4Region *reg)
G4Region * GetRegion() const
G4ProcessManager * GetProcessManager() const
const G4String & GetParticleName() const
G4PTblDicIterator * GetIterator()
static G4ParticleTable * GetParticleTable()
void SetReadiness(G4bool val=true)
G4ParticleDefinition * GetParticle(G4int index)
void DumpTable(const G4String &particle_name="ALL")
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord=ordDefault)
G4ProcessVector * GetAlongStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) 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=0)
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)
std::vector< G4LogicalVolume * >::iterator GetRootLogicalVolumeIterator()
void UsedInMassGeometry(G4bool val=true)
G4PrimaryTransformer * GetPrimaryTransformer() const
static G4RunManagerKernel * GetRunManagerKernel()
void SetPhysics(G4VUserPhysicsList *uPhys)
void DefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
G4bool RunInitialization()
virtual ~G4RunManagerKernel()
void DumpRegion(const G4String &rname) const
static G4SDManager * GetSDMpointerIfExist()
G4ApplicationState GetCurrentState() const
static G4StateManager * GetStateManager()
G4bool SetNewState(G4ApplicationState requestedState)
static G4TransportationManager * GetTransportationManager()
void SetWorldForTracking(G4VPhysicalVolume *theWorld)
std::vector< G4VPhysicalVolume * >::iterator GetWorldsIterator()
size_t GetNoWorlds() const
static G4UImanager * GetUIpointer()
static void ClearUnitsTable()
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
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
std::ostringstream G4ExceptionDescription