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();
351 void 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.");
391 void G4RunManagerKernel::BuildPhysicsTables()
394 || physicsNeedsToBeReBuilt)
398 physicsNeedsToBeReBuilt =
false;
406 void 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;
450 ->GetDefaultProductionCuts());
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 : "
570 void 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())
591 G4bool G4RunManagerKernel::ConfirmCoupledTransportation()
595 theParticleIterator->
reset();
596 while((*theParticleIterator)())
611 void 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;