Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
G4RunManagerKernel Class Reference

#include <G4RunManagerKernel.hh>

Inheritance diagram for G4RunManagerKernel:
G4MTRunManagerKernel G4WorkerRunManagerKernel

Public Types

enum  RMKType { sequentialRMK, masterRMK, workerRMK }
 

Public Member Functions

 G4RunManagerKernel ()
 
virtual ~G4RunManagerKernel ()
 
void DefineWorldVolume (G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
 
void WorkerDefineWorldVolume (G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
 
void SetPhysics (G4VUserPhysicsList *uPhys)
 
void InitializePhysics ()
 
G4bool RunInitialization (G4bool fakeRun=false)
 
void RunTermination ()
 
void WorkerUpdateWorldVolume ()
 
void UpdateRegion ()
 
void DumpRegion (const G4String &rname) const
 
void DumpRegion (G4Region *region=0) const
 
void GeometryHasBeenModified ()
 
void PhysicsHasBeenModified ()
 
G4EventManagerGetEventManager () const
 
G4StackManagerGetStackManager () const
 
G4TrackingManagerGetTrackingManager () const
 
void SetPrimaryTransformer (G4PrimaryTransformer *pt)
 
G4PrimaryTransformerGetPrimaryTransformer () const
 
const G4StringGetVersionString () const
 
void SetVerboseLevel (G4int vl)
 
void SetGeometryToBeOptimized (G4bool vl)
 
G4int GetNumberOfParallelWorld () const
 
void SetNumberOfParallelWorld (G4int i)
 
G4VUserPhysicsListGetPhysicsList () const
 
G4VPhysicalVolumeGetCurrentWorld () const
 
G4int GetNumberOfStaticAllocators () const
 

Static Public Member Functions

static G4RunManagerKernelGetRunManagerKernel ()
 

Protected Member Functions

 G4RunManagerKernel (RMKType rmkType)
 
void SetupDefaultRegion ()
 
void SetupPhysics ()
 
void ResetNavigator ()
 
void BuildPhysicsTables (G4bool fakeRun)
 
void CheckRegions ()
 
virtual void SetupShadowProcess () const
 

Protected Attributes

RMKType runManagerKernelType
 
G4RegiondefaultRegion
 
G4RegiondefaultRegionForParallelWorld
 
G4bool geometryNeedsToBeClosed
 

Detailed Description

Definition at line 68 of file G4RunManagerKernel.hh.

Member Enumeration Documentation

Constructor & Destructor Documentation

G4RunManagerKernel::G4RunManagerKernel ( )

Definition at line 76 of file G4RunManagerKernel.cc.

References defaultRegion, defaultRegionForParallelWorld, G4ParticleTable::entries(), FatalException, G4cout, G4endl, G4Exception(), G4State_PreInit, G4AllocatorList::GetAllocatorListIfExist(), G4ParticleTable::GetParticle(), G4ParticleDefinition::GetParticleName(), G4ParticleTable::GetParticleTable(), G4ProductionCutsTable::GetProductionCutsTable(), G4StateManager::GetStateManager(), runManagerKernelType, sequentialRMK, G4StateManager::SetNewState(), G4Region::SetProductionCuts(), and G4AllocatorList::Size().

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)
83 {
84 #ifdef G4FPE_DEBUG
85  InvalidOperationDetection();
86 #endif
88  if(allocList) numberOfStaticAllocators = allocList->Size();
89  defaultExceptionHandler = new G4ExceptionHandler();
90  if(fRunManagerKernel)
91  {
92  G4Exception("G4RunManagerKernel::G4RunManagerKernel()","Run0001",
93  FatalException,"More than one G4RunManagerKernel is constructed.");
94  }
95  fRunManagerKernel = this;
96 
98  if(particleTable->entries()>0)
99  {
100  // No particle should be registered beforehand
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++)
107  { ED<<" "<<particleTable->GetParticle(i)->GetParticleName()<<G4endl; }
108  ED<<"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<<G4endl;
109  G4Exception("G4RunManagerKernel::G4RunManagerKernel()","Run0002",
110  FatalException,ED);
111  }
112 
113  // construction of Geant4 kernel classes
114  eventManager = new G4EventManager();
115 
116  defaultRegion = new G4Region("DefaultRegionForTheWorld"); // deleted by store
117  defaultRegionForParallelWorld = new G4Region("DefaultRegionForParallelWorld"); // deleted by store
119  G4ProductionCutsTable::GetProductionCutsTable()->GetDefaultProductionCuts());
121  G4ProductionCutsTable::GetProductionCutsTable()->GetDefaultProductionCuts());
122 
124  // set the initial application state
126 
127  // version banner
128  G4String vs = G4Version;
129  vs = vs.substr(1,vs.size()-2);
130  versionString = " Geant4 version ";
131  versionString += vs;
132  versionString += " ";
133  versionString += G4Date;
134  G4cout << G4endl
135  << "*************************************************************" << G4endl
136  << versionString << G4endl
137  << " Copyright : Geant4 Collaboration" << G4endl
138  << " Reference : NIM A 506 (2003), 250-303" << G4endl
139  << " WWW : http://cern.ch/geant4" << G4endl
140  << "*************************************************************" << G4endl
141  << G4endl;
142 }
G4Region * defaultRegionForParallelWorld
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
G4int Size() const
static G4AllocatorList * GetAllocatorListIfExist()
const G4String & GetParticleName() const
static G4StateManager * GetStateManager()
G4ParticleDefinition * GetParticle(G4int index) const
G4GLOB_DLL std::ostream G4cout
G4bool SetNewState(G4ApplicationState requestedState)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static G4ProductionCutsTable * GetProductionCutsTable()
static G4ParticleTable * GetParticleTable()
#define G4endl
Definition: G4ios.hh:61
void SetProductionCuts(G4ProductionCuts *cut)
G4int entries() const
G4RunManagerKernel::~G4RunManagerKernel ( )
virtual

Definition at line 255 of file G4RunManagerKernel.cc.

References G4UnitDefinition::ClearUnitsTable(), G4AllocatorList::Destroy(), G4cout, G4endl, G4State_Quit, G4AllocatorList::GetAllocatorListIfExist(), G4StateManager::GetCurrentState(), G4GeometryManager::GetInstance(), G4SDManager::GetSDMpointerIfExist(), G4StateManager::GetStateManager(), G4UImanager::GetUIpointer(), G4GeometryManager::OpenGeometry(), runManagerKernelType, G4StateManager::SetNewState(), and workerRMK.

256 {
258  // set the application state to the quite state
259  if(pStateManager->GetCurrentState()!=G4State_Quit)
260  {
261  if(verboseLevel>0) G4cout << "G4 kernel has come to Quit state." << G4endl;
262  pStateManager->SetNewState(G4State_Quit);
263  }
264 
265  // open geometry for deletion
267 
268  // deletion of Geant4 kernel classes
270  if(fSDM)
271  {
272  delete fSDM;
273  if(verboseLevel>1) G4cout << "G4SDManager deleted." << G4endl;
274  }
275  delete eventManager;
276  if(verboseLevel>1) G4cout << "EventManager deleted." << G4endl;
277 
279  if(verboseLevel>1) G4cout << "Units table cleared." << G4endl;
281  if(allocList)
282  {
283  allocList->Destroy(numberOfStaticAllocators,verboseLevel);
284  delete allocList;
285  if(verboseLevel>1) G4cout << "G4Allocator objects are deleted." << G4endl;
286  }
287 
288  G4UImanager* pUImanager = G4UImanager::GetUIpointer();
289  if((runManagerKernelType==workerRMK) && (verboseLevel>0))
290  {
291  G4cout << "Thread-local UImanager is to be deleted." << G4endl
292  << "There should not be any thread-local G4cout/G4cerr hereafter."
293  << G4endl;
294  verboseLevel = 0;
295  }
296  if(pUImanager) delete pUImanager;
297  if(verboseLevel>1) G4cout << "UImanager deleted." << G4endl;
298 
299  delete pStateManager;
300  if(verboseLevel>1) G4cout << "StateManager deleted." << G4endl;
301  delete defaultExceptionHandler;
302  if(verboseLevel>0) G4cout << "RunManagerKernel is deleted. Good bye :)" << G4endl;
303  fRunManagerKernel = 0;
304 }
static G4AllocatorList * GetAllocatorListIfExist()
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
static G4StateManager * GetStateManager()
G4GLOB_DLL std::ostream G4cout
G4bool SetNewState(G4ApplicationState requestedState)
G4ApplicationState GetCurrentState() const
static G4GeometryManager * GetInstance()
static void ClearUnitsTable()
void Destroy(G4int nStat=0, G4int verboseLevel=0)
#define G4endl
Definition: G4ios.hh:61
void OpenGeometry(G4VPhysicalVolume *vol=0)
static G4SDManager * GetSDMpointerIfExist()
Definition: G4SDManager.cc:49
G4RunManagerKernel::G4RunManagerKernel ( RMKType  rmkType)
protected

Definition at line 144 of file G4RunManagerKernel.cc.

References defaultRegion, defaultRegionForParallelWorld, FatalException, G4cout, G4endl, G4Exception(), G4State_PreInit, G4RegionStore::GetInstance(), G4ProductionCutsTable::GetProductionCutsTable(), G4RegionStore::GetRegion(), G4StateManager::GetStateManager(), masterRMK, runManagerKernelType, G4StateManager::SetNewState(), G4Region::SetProductionCuts(), and workerRMK.

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)
151 {
152 //This version of the constructor should never be called in sequential mode!
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.";
157  G4Exception("G4RunManagerKernel::G4RunManagerKernel(G4bool)","Run0035",FatalException,msg);
158 #endif
159 
160 #ifdef G4FPE_DEBUG
161  InvalidOperationDetection();
162 #endif
163 
164  defaultExceptionHandler = new G4ExceptionHandler();
165  if(fRunManagerKernel)
166  {
167  G4Exception("G4RunManagerKernel::G4RunManagerKernel()","Run0001",
168  FatalException,"More than one G4RunManagerKernel is constructed.");
169  }
170  fRunManagerKernel = this;
171  // construction of Geant4 kernel classes
172  eventManager = new G4EventManager();
173 
174  switch(rmkType)
175  {
176  case masterRMK:
177  //Master thread behvior
178  defaultRegion = new G4Region("DefaultRegionForTheWorld"); // deleted by store
179  defaultRegionForParallelWorld = new G4Region("DefaultRegionForParallelWorld"); // deleted by store
181  G4ProductionCutsTable::GetProductionCutsTable()->GetDefaultProductionCuts());
183  G4ProductionCutsTable::GetProductionCutsTable()->GetDefaultProductionCuts());
184  break;
185  case workerRMK:
186  //Worker thread behavior
187  defaultRegion = G4RegionStore::GetInstance()->GetRegion("DefaultRegionForTheWorld", true);
189  = G4RegionStore::GetInstance()->GetRegion("DefaultRegionForParallelWorld", true);
190  break;
191  default:
193  msgx<<" This type of RunManagerKernel can only be used in mult-threaded applications.";
194  G4Exception("G4RunManagerKernel::G4RunManagerKernel(G4bool)","Run0035",FatalException,msgx);
195  }
196  runManagerKernelType = rmkType;
197 
198  // set the initial application state
200 
201  // version banner
202  G4String vs = G4Version;
203  vs = vs.substr(1,vs.size()-2);
204  switch(rmkType)
205  {
206  case masterRMK:
207  versionString = " Geant4 version ";
208  versionString += vs;
209  versionString += " ";
210  versionString += G4Date;
211  G4cout << G4endl
212  << "*************************************************************" << G4endl
213  << versionString << 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
219  << G4endl;
220  break;
221  default:
222  versionString = " Local thread RunManagerKernel version ";
223  versionString += vs;
224  G4cout << G4endl
225  << "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" << G4endl
226  << versionString << G4endl
227  << "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" << G4endl
228  << G4endl;
229  }
230 }
G4Region * defaultRegionForParallelWorld
G4Region * GetRegion(const G4String &name, G4bool verbose=true) const
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
static G4RegionStore * GetInstance()
static G4StateManager * GetStateManager()
G4GLOB_DLL std::ostream G4cout
G4bool SetNewState(G4ApplicationState requestedState)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static G4ProductionCutsTable * GetProductionCutsTable()
#define G4endl
Definition: G4ios.hh:61
void SetProductionCuts(G4ProductionCuts *cut)

Member Function Documentation

void G4RunManagerKernel::BuildPhysicsTables ( G4bool  fakeRun)
protected

Definition at line 662 of file G4RunManagerKernel.cc.

References G4UImanager::ApplyCommand(), G4VUserPhysicsList::BuildPhysicsTable(), G4VUserPhysicsList::DumpCutValuesTable(), G4VUserPhysicsList::DumpCutValuesTableIfRequested(), DumpRegion(), G4ProductionCutsTable::GetProductionCutsTable(), G4UImanager::GetUIpointer(), masterRMK, and runManagerKernelType.

Referenced by RunInitialization().

663 {
665  || physicsNeedsToBeReBuilt)
666  {
667 #ifdef G4MULTITHREADED
669  {
670  // make sure workers also rebuild physics tables
671  G4UImanager* pUImanager = G4UImanager::GetUIpointer();
672  pUImanager->ApplyCommand("/run/physicsModified");
673  }
674 #endif
675  physicsList->BuildPhysicsTable();
676  ////G4ProductionCutsTable::GetProductionCutsTable()->PhysicsTableUpdated();
677  physicsNeedsToBeReBuilt = false;
678  }
679 
680  if(!fakeRun && verboseLevel>1) DumpRegion();
681  if(!fakeRun && verboseLevel>0) physicsList->DumpCutValuesTable();
682  if(!fakeRun) physicsList->DumpCutValuesTableIfRequested();
683 }
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
void DumpCutValuesTable(G4int flag=1)
void DumpRegion(const G4String &rname) const
static G4ProductionCutsTable * GetProductionCutsTable()
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419
void G4RunManagerKernel::CheckRegions ( )
protected

Definition at line 685 of file G4RunManagerKernel.cc.

References G4Region::AddRootLogicalVolume(), G4Region::BelongsTo(), defaultRegionForParallelWorld, G4cerr, G4endl, G4RegionStore::GetInstance(), G4Region::GetName(), G4TransportationManager::GetNoWorlds(), G4Region::GetProductionCuts(), G4ProductionCutsTable::GetProductionCutsTable(), G4LogicalVolume::GetRegion(), G4TransportationManager::GetTransportationManager(), G4TransportationManager::GetWorldsIterator(), G4Region::IsInMassGeometry(), G4Region::IsInParallelGeometry(), G4Region::SetProductionCuts(), G4LogicalVolume::SetRegion(), G4Region::SetWorld(), G4Region::UsedInMassGeometry(), and G4Region::UsedInParallelGeometry().

Referenced by InitializePhysics(), and UpdateRegion().

686 {
688  size_t nWorlds = transM->GetNoWorlds();
689  std::vector<G4VPhysicalVolume*>::iterator wItr;
690  for(size_t i=0;i<G4RegionStore::GetInstance()->size();i++)
691  {
692  G4Region* region = (*(G4RegionStore::GetInstance()))[i];
693 
694  //Let each region have a pointer to the world volume where it belongs to.
695  //G4Region::SetWorld() checks if the region belongs to the given world and set it
696  //only if it does. Thus, here we go through all the registered world volumes.
697  region->SetWorld(0); // reset
698  region->UsedInMassGeometry(false);
699  region->UsedInParallelGeometry(false);
700  wItr = transM->GetWorldsIterator();
701  for(size_t iw=0;iw<nWorlds;iw++)
702  {
703  if(region->BelongsTo(*wItr))
704  {
705  if(*wItr==currentWorld)
706  { region->UsedInMassGeometry(true); }
707  else
708  { region->UsedInParallelGeometry(true); }
709  }
710  region->SetWorld(*wItr);
711  wItr++;
712  }
713 
714  G4ProductionCuts* cuts = region->GetProductionCuts();
715  if(!cuts)
716  {
717  if(region->IsInMassGeometry())
718  {
719  G4cerr << "Warning : Region <" << region->GetName()
720  << "> does not have specific production cuts," << G4endl
721  << "even though it appears in the current tracking world." << G4endl;
722  G4cerr << "Default cuts are used for this region." << G4endl;
723  }
724 
725  if(region->IsInMassGeometry()||region->IsInParallelGeometry())
726  {
727  region->SetProductionCuts(
729  ->GetDefaultProductionCuts());
730  }
731  }
732  }
733 
734  //
735  // If a parallel world has no region, set default region for parallel world
736  //
737 
738  wItr = transM->GetWorldsIterator();
739  for(size_t iw=0;iw<nWorlds;iw++)
740  {
741  //G4cout << "+++ " << (*wItr)->GetName() << G4endl;
742  if(*wItr!=currentWorld)
743  {
744  G4LogicalVolume* pwLogical = (*wItr)->GetLogicalVolume();
745  if(!(pwLogical->GetRegion()))
746  {
749  //G4cout << "+++++ defaultRegionForParallelWorld is set to "
750  // << (*wItr)->GetName() << " +++++" << G4endl;
751  }
752  }
753  wItr++;
754  }
755 
756 }
G4Region * defaultRegionForParallelWorld
G4ProductionCuts * GetProductionCuts() const
const G4String & GetName() const
void AddRootLogicalVolume(G4LogicalVolume *lv)
Definition: G4Region.cc:254
void UsedInParallelGeometry(G4bool val=true)
std::vector< G4VPhysicalVolume * >::iterator GetWorldsIterator()
G4Region * GetRegion() const
static G4RegionStore * GetInstance()
void SetRegion(G4Region *reg)
void UsedInMassGeometry(G4bool val=true)
static G4TransportationManager * GetTransportationManager()
static G4ProductionCutsTable * GetProductionCutsTable()
G4bool BelongsTo(G4VPhysicalVolume *thePhys) const
Definition: G4Region.cc:362
void SetWorld(G4VPhysicalVolume *wp)
Definition: G4Region.cc:346
G4bool IsInMassGeometry() const
size_t GetNoWorlds() const
#define G4endl
Definition: G4ios.hh:61
void SetProductionCuts(G4ProductionCuts *cut)
G4bool IsInParallelGeometry() const
G4GLOB_DLL std::ostream G4cerr
void G4RunManagerKernel::DefineWorldVolume ( G4VPhysicalVolume worldVol,
G4bool  topologyIsChanged = true 
)

Definition at line 375 of file G4RunManagerKernel.cc.

References G4Region::AddRootLogicalVolume(), defaultRegion, FatalException, G4cout, G4endl, G4Exception(), G4State_Idle, G4State_PreInit, G4VVisManager::GeometryHasChanged(), geometryNeedsToBeClosed, G4VVisManager::GetConcreteInstance(), G4StateManager::GetCurrentState(), G4VPhysicalVolume::GetLogicalVolume(), G4Region::GetName(), G4LogicalVolume::GetName(), G4LogicalVolume::GetRegion(), G4StateManager::GetStateManager(), G4TransportationManager::GetTransportationManager(), G4Threading::IsWorkerThread(), JustWarning, G4StateManager::SetNewState(), G4LogicalVolume::SetRegion(), SetupDefaultRegion(), and G4TransportationManager::SetWorldForTracking().

Referenced by G4RunManager::DefineWorldVolume(), G4ErrorRunManagerHelper::InitializeGeometry(), and G4RunManager::InitializeGeometry().

377 {
379  G4ApplicationState currentState = stateManager->GetCurrentState();
380  if(!(currentState==G4State_Idle||currentState==G4State_PreInit))
381  {
382  G4Exception("G4RunManagerKernel::DefineWorldVolume",
383  "Run00031",
384  JustWarning,
385  "Geant4 kernel is not PreInit or Idle state : Method ignored.");
386  return;
387  }
388 
389  // The world volume MUST NOT have a region defined by the user
390  if(worldVol->GetLogicalVolume()->GetRegion())
391  {
392  if(worldVol->GetLogicalVolume()->GetRegion()!=defaultRegion)
393  {
395  ED << "The world volume has a user-defined region <"
396  << worldVol->GetLogicalVolume()->GetRegion()->GetName()
397  << ">." << G4endl;
398  ED << "World would have a default region assigned by RunManagerKernel."
399  << G4endl;
400  G4Exception("G4RunManager::DefineWorldVolume",
401  "Run0004", FatalException, ED);
402  }
403  }
404 
406 
407  // Accept the world volume
408  currentWorld = worldVol;
409 
410  // Set the default region to the world
411 
412  G4LogicalVolume* worldLog = currentWorld->GetLogicalVolume();
413  worldLog->SetRegion(defaultRegion);
415  if(verboseLevel>1) G4cout << worldLog->GetName()
416  << " is registered to the default region." << G4endl;
417 
418  // Set the world volume, notify the Navigator and reset its state
420  ->SetWorldForTracking(currentWorld);
421  if(topologyIsChanged) geometryNeedsToBeClosed = true;
422 
423  // Notify the VisManager as well
425  {
427  if(pVVisManager) pVVisManager->GeometryHasChanged();
428  }
429 
430  geometryInitialized = true;
431  if(physicsInitialized && currentState!=G4State_Idle)
432  { stateManager->SetNewState(G4State_Idle); }
433 }
virtual void GeometryHasChanged()=0
const G4String & GetName() const
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
G4String GetName() const
void AddRootLogicalVolume(G4LogicalVolume *lv)
Definition: G4Region.cc:254
static G4VVisManager * GetConcreteInstance()
G4Region * GetRegion() const
static G4StateManager * GetStateManager()
void SetRegion(G4Region *reg)
G4GLOB_DLL std::ostream G4cout
G4bool SetNewState(G4ApplicationState requestedState)
G4ApplicationState GetCurrentState() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4bool IsWorkerThread()
Definition: G4Threading.cc:104
static G4TransportationManager * GetTransportationManager()
G4LogicalVolume * GetLogicalVolume() const
#define G4endl
Definition: G4ios.hh:61
void SetWorldForTracking(G4VPhysicalVolume *theWorld)
G4ApplicationState
void G4RunManagerKernel::DumpRegion ( const G4String rname) const

Definition at line 758 of file G4RunManagerKernel.cc.

References G4RegionStore::GetInstance(), and G4RegionStore::GetRegion().

Referenced by BuildPhysicsTables(), DumpRegion(), and G4RunManager::DumpRegion().

759 {
760  G4Region* region = G4RegionStore::GetInstance()->GetRegion(rname);
761  if(region) DumpRegion(region);
762 }
G4Region * GetRegion(const G4String &name, G4bool verbose=true) const
static G4RegionStore * GetInstance()
void DumpRegion(const G4String &rname) const
void G4RunManagerKernel::DumpRegion ( G4Region region = 0) const

Definition at line 764 of file G4RunManagerKernel.cc.

References DumpRegion(), G4BestUnit, G4cerr, G4cout, G4endl, G4Region::GetFastSimulationManager(), G4RegionStore::GetInstance(), G4Region::GetMaterialIterator(), G4Region::GetName(), G4VPhysicalVolume::GetName(), G4Region::GetNumberOfMaterials(), G4Region::GetNumberOfRootVolumes(), G4ProductionCuts::GetProductionCut(), G4Region::GetProductionCuts(), G4ProductionCutsTable::GetProductionCutsTable(), G4Region::GetRegionalSteppingAction(), G4Region::GetRootLogicalVolumeIterator(), G4Region::GetUserInformation(), G4Region::GetUserLimits(), G4Region::GetWorldPhysical(), G4Region::IsInMassGeometry(), G4Region::IsInParallelGeometry(), G4Threading::IsWorkerThread(), and G4Region::SetProductionCuts().

765 {
766  if(!region)
767  {
768  for(size_t i=0;i<G4RegionStore::GetInstance()->size();i++)
769  { DumpRegion((*(G4RegionStore::GetInstance()))[i]); }
770  }
771  else
772  {
773  if(G4Threading::IsWorkerThread()) return;
774  G4cout << G4endl;
775  G4cout << "Region <" << region->GetName() << "> -- ";
776  if(region->GetWorldPhysical())
777  {
778  G4cout << " -- appears in <"
779  << region->GetWorldPhysical()->GetName() << "> world volume";
780  }
781  else
782  { G4cout << " -- is not associated to any world."; }
783  G4cout << G4endl;
784  if(region->IsInMassGeometry())
785  { G4cout << " This region is in the mass world." << G4endl; }
786  if(region->IsInParallelGeometry())
787  { G4cout << " This region is in the parallel world." << G4endl; }
788 
789  G4cout << " Root logical volume(s) : ";
790  size_t nRootLV = region->GetNumberOfRootVolumes();
791  std::vector<G4LogicalVolume*>::iterator lvItr = region->GetRootLogicalVolumeIterator();
792  for(size_t j=0;j<nRootLV;j++)
793  { G4cout << (*lvItr)->GetName() << " "; lvItr++; }
794  G4cout << G4endl;
795 
796  G4cout << " Pointers : G4VUserRegionInformation[" << region->GetUserInformation()
797  << "], G4UserLimits[" << region->GetUserLimits()
798  << "], G4FastSimulationManager[" << region->GetFastSimulationManager()
799  << "], G4UserSteppingAction[" << region->GetRegionalSteppingAction() << "]" << G4endl;
800 
801  G4cout << " Materials : ";
802  std::vector<G4Material*>::const_iterator mItr = region->GetMaterialIterator();
803  size_t nMaterial = region->GetNumberOfMaterials();
804  for(size_t iMate=0;iMate<nMaterial;iMate++)
805  {
806  G4cout << (*mItr)->GetName() << " ";
807  mItr++;
808  }
809  G4cout << G4endl;
810  G4ProductionCuts* cuts = region->GetProductionCuts();
811  if(!cuts && region->IsInMassGeometry())
812  {
813  G4cerr << "Warning : Region <" << region->GetName()
814  << "> does not have specific production cuts." << G4endl;
815  G4cerr << "Default cuts are used for this region." << G4endl;
816  region->SetProductionCuts(
817  G4ProductionCutsTable::GetProductionCutsTable()->GetDefaultProductionCuts());
818  }
819  else if(cuts)
820  {
821  G4cout << " Production cuts : "
822  << " gamma "
823  << G4BestUnit(cuts->GetProductionCut("gamma"),"Length")
824  << " e- "
825  << G4BestUnit(cuts->GetProductionCut("e-"),"Length")
826  << " e+ "
827  << G4BestUnit(cuts->GetProductionCut("e+"),"Length")
828  << " proton "
829  << G4BestUnit(cuts->GetProductionCut("proton"),"Length")
830  << G4endl;
831  }
832  }
833 }
G4ProductionCuts * GetProductionCuts() const
std::vector< G4Material * >::const_iterator GetMaterialIterator() const
const G4String & GetName() const
G4double GetProductionCut(G4int index) const
G4VUserRegionInformation * GetUserInformation() const
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
static G4RegionStore * GetInstance()
G4VPhysicalVolume * GetWorldPhysical() const
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
void DumpRegion(const G4String &rname) const
G4bool IsWorkerThread()
Definition: G4Threading.cc:104
static G4ProductionCutsTable * GetProductionCutsTable()
G4bool IsInMassGeometry() const
G4FastSimulationManager * GetFastSimulationManager() const
#define G4endl
Definition: G4ios.hh:61
void SetProductionCuts(G4ProductionCuts *cut)
size_t GetNumberOfMaterials() const
size_t GetNumberOfRootVolumes() const
G4bool IsInParallelGeometry() const
G4UserLimits * GetUserLimits() const
G4UserSteppingAction * GetRegionalSteppingAction() const
G4GLOB_DLL std::ostream G4cerr
std::vector< G4LogicalVolume * >::iterator GetRootLogicalVolumeIterator()
void G4RunManagerKernel::GeometryHasBeenModified ( )
inline
G4VPhysicalVolume* G4RunManagerKernel::GetCurrentWorld ( ) const
inline

Definition at line 212 of file G4RunManagerKernel.hh.

Referenced by G4WorkerRunManager::InitializeGeometry().

213  { return currentWorld; }
G4EventManager* G4RunManagerKernel::GetEventManager ( ) const
inline

Definition at line 178 of file G4RunManagerKernel.hh.

Referenced by G4RunManager::G4RunManager().

179  { return eventManager; }
G4int G4RunManagerKernel::GetNumberOfParallelWorld ( ) const
inline

Definition at line 204 of file G4RunManagerKernel.hh.

Referenced by G4PhysicsListHelper::AddTransportation(), and G4WorkerRunManager::InitializeGeometry().

205  { return numberOfParallelWorld; }
G4int G4RunManagerKernel::GetNumberOfStaticAllocators ( ) const
inline

Definition at line 222 of file G4RunManagerKernel.hh.

Referenced by G4MTRunManager::G4MTRunManager().

223  { return numberOfStaticAllocators; }
G4VUserPhysicsList* G4RunManagerKernel::GetPhysicsList ( ) const
inline

Definition at line 209 of file G4RunManagerKernel.hh.

210  { return physicsList; }
G4PrimaryTransformer* G4RunManagerKernel::GetPrimaryTransformer ( ) const
inline

Definition at line 186 of file G4RunManagerKernel.hh.

References G4EventManager::GetPrimaryTransformer().

Referenced by RunInitialization().

187  { return eventManager->GetPrimaryTransformer(); }
G4PrimaryTransformer * GetPrimaryTransformer() const
G4RunManagerKernel * G4RunManagerKernel::GetRunManagerKernel ( )
static
G4StackManager* G4RunManagerKernel::GetStackManager ( ) const
inline

Definition at line 180 of file G4RunManagerKernel.hh.

References G4EventManager::GetStackManager().

181  { return eventManager->GetStackManager(); }
G4StackManager * GetStackManager() const
G4TrackingManager* G4RunManagerKernel::GetTrackingManager ( ) const
inline

Definition at line 182 of file G4RunManagerKernel.hh.

References G4EventManager::GetTrackingManager().

Referenced by RE06SteppingVerbose::InitializeTimers().

183  { return eventManager->GetTrackingManager(); }
G4TrackingManager * GetTrackingManager() const
const G4String& G4RunManagerKernel::GetVersionString ( ) const
inline

Definition at line 189 of file G4RunManagerKernel.hh.

Referenced by G4RunManager::GetVersionString().

190  { return versionString; }
void G4RunManagerKernel::InitializePhysics ( )

Definition at line 498 of file G4RunManagerKernel.cc.

References G4VUserPhysicsList::CheckParticleList(), CheckRegions(), G4VUserPhysicsList::Construct(), G4IonTable::CreateAllIsomer(), FatalException, G4cout, G4endl, G4Exception(), G4State_Idle, G4State_PreInit, G4StateManager::GetCurrentState(), G4ParticleTable::GetGenericIon(), G4ParticleTable::GetIonTable(), G4ParticleTable::GetIterator(), G4ParticleDefinition::GetParticleDefinitionID(), G4ParticleTable::GetParticleTable(), G4StateManager::GetStateManager(), G4ParticleDefinition::IsGeneralIon(), G4Threading::IsWorkerThread(), JustWarning, G4ParticleTableIterator< K, V >::reset(), G4VUserPhysicsList::SetCuts(), G4StateManager::SetNewState(), G4ParticleDefinition::SetParticleDefinitionID(), G4TemplateAutoLock< M, L, U >::unlock(), G4VUserPhysicsList::UseCoupledTransportation(), and G4ParticleTableIterator< K, V >::value().

Referenced by G4ErrorRunManagerHelper::InitializePhysics(), and G4RunManager::InitializePhysics().

499 {
501  G4ApplicationState currentState = stateManager->GetCurrentState();
502  if(!(currentState==G4State_Idle||currentState==G4State_PreInit))
503  {
504  G4Exception("G4RunManagerKernel::InitializePhysics",
505  "Run0011", JustWarning,
506  "Geant4 kernel is not PreInit or Idle state : Method ignored.");
507  return;
508  }
509 
510  if(!physicsList)
511  {
512  G4Exception("G4RunManagerKernel::InitializePhysics",
513  "Run0012", FatalException,
514  "G4VUserPhysicsList is not defined");
515  return;
516  }
517 
518  if(verboseLevel>1) G4cout << "physicsList->Construct() start." << G4endl;
519  if(numberOfParallelWorld>0) physicsList->UseCoupledTransportation();
520  physicsList->Construct();
521 
522  if(verboseLevel>1) G4cout << "physicsList->CheckParticleList() start." << G4endl;
523  physicsList->CheckParticleList();
524  //Cannot assume that SetCuts and CheckRegions are thread safe. We need to mutex
525  //Report from valgrind --tool=drd
526  if(verboseLevel>1) G4cout << "physicsList->setCut() start." << G4endl;
527  G4AutoLock l(&initphysicsmutex);
528  physicsList->SetCuts();
529  CheckRegions();
530  l.unlock();
531 
532  static G4bool createIsomerOnlyOnce = false;
534  {
535  if(!createIsomerOnlyOnce)
536  {
537  createIsomerOnlyOnce = true;
539  if(gion)
540  {
542  G4int gionId = gion->GetParticleDefinitionID();
544  pItr->reset(false);
545  while( (*pItr)() )
546  {
547  G4ParticleDefinition* particle = pItr->value();
548  if(particle->IsGeneralIon()) particle->SetParticleDefinitionID(gionId);
549  }
550  }
551  }
552  }
553 
554  physicsInitialized = true;
555  if(geometryInitialized && currentState!=G4State_Idle)
556  { stateManager->SetNewState(G4State_Idle); }
557 }
G4int GetParticleDefinitionID() const
void SetParticleDefinitionID(G4int id=-1)
G4ParticleDefinition * GetGenericIon() const
int G4int
Definition: G4Types.hh:78
G4bool IsGeneralIon() const
void CreateAllIsomer()
Definition: G4IonTable.cc:1508
static G4StateManager * GetStateManager()
G4IonTable * GetIonTable() const
G4GLOB_DLL std::ostream G4cout
G4bool SetNewState(G4ApplicationState requestedState)
void reset(G4bool ifSkipIon=true)
bool G4bool
Definition: G4Types.hh:79
G4ApplicationState GetCurrentState() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4bool IsWorkerThread()
Definition: G4Threading.cc:104
void UseCoupledTransportation(G4bool vl=true)
static G4ParticleTable * GetParticleTable()
#define G4endl
Definition: G4ios.hh:61
G4PTblDicIterator * GetIterator() const
G4ApplicationState
void G4RunManagerKernel::PhysicsHasBeenModified ( )
inline

Definition at line 170 of file G4RunManagerKernel.hh.

Referenced by G4RunManager::PhysicsHasBeenModified().

171  { physicsNeedsToBeReBuilt = true; }
void G4RunManagerKernel::ResetNavigator ( )
protected

Definition at line 621 of file G4RunManagerKernel.cc.

References G4GeometryManager::CloseGeometry(), G4cout, G4endl, geometryNeedsToBeClosed, G4GeometryManager::GetInstance(), G4GeometryManager::OpenGeometry(), runManagerKernelType, and workerRMK.

Referenced by RunInitialization().

622 {
624  { geometryNeedsToBeClosed = false; return; }
625 
626  // We have to tweak the navigator's state in case a geometry has been
627  // modified between runs. By the following calls we ensure that navigator's
628  // state is reset properly. It is required the geometry to be closed
629  // and previous optimisations to be cleared.
630 
632  if(verboseLevel>1) G4cout << "Start closing geometry." << G4endl;
633 
634  geomManager->OpenGeometry();
635  geomManager->CloseGeometry(geometryToBeOptimized, verboseLevel>1);
636 
637  geometryNeedsToBeClosed = false;
638 }
G4GLOB_DLL std::ostream G4cout
static G4GeometryManager * GetInstance()
#define G4endl
Definition: G4ios.hh:61
void OpenGeometry(G4VPhysicalVolume *vol=0)
G4bool CloseGeometry(G4bool pOptimise=true, G4bool verbose=false, G4VPhysicalVolume *vol=0)
G4bool G4RunManagerKernel::RunInitialization ( G4bool  fakeRun = false)

Definition at line 559 of file G4RunManagerKernel.cc.

References BuildPhysicsTables(), G4PrimaryTransformer::CheckUnknown(), G4Exception(), G4State_GeomClosed, G4State_Idle, G4VVisManager::GeometryHasChanged(), geometryNeedsToBeClosed, G4VVisManager::GetConcreteInstance(), G4StateManager::GetCurrentState(), GetPrimaryTransformer(), G4StateManager::GetStateManager(), G4Threading::IsWorkerThread(), JustWarning, ResetNavigator(), G4StateManager::SetNewState(), SetupShadowProcess(), and UpdateRegion().

Referenced by export_G4RunManagerKernel(), G4WorkerRunManager::RunInitialization(), G4ErrorRunManagerHelper::RunInitialization(), and G4RunManager::RunInitialization().

560 {
562  G4ApplicationState currentState = stateManager->GetCurrentState();
563 
564  if(!geometryInitialized)
565  {
566  G4Exception("G4RunManagerKernel::RunInitialization",
567  "Run0021",
568  JustWarning,
569  "Geometry has not yet initialized : method ignored.");
570  return false;
571  }
572 
573  if(!physicsInitialized)
574  {
575  G4Exception("G4RunManagerKernel::RunInitialization",
576  "Run0022",
577  JustWarning,
578  "Physics has not yet initialized : method ignored.");
579  return false;
580  }
581 
582  if( currentState != G4State_Idle )
583  {
584  G4Exception("G4RunManagerKernel::RunInitialization",
585  "Run0023",
586  JustWarning,
587  "Geant4 kernel not in Idle state : method ignored.");
588  return false;
589  }
590 
591  if(geometryNeedsToBeClosed) CheckRegularGeometry();
592 
594  UpdateRegion();
595  BuildPhysicsTables(fakeRun);
596 
598  {
599  ResetNavigator();
600  // CheckRegularGeometry();
601  // Notify the VisManager as well
603  {
605  if(pVVisManager) pVVisManager->GeometryHasChanged();
606  }
607  }
608 
610 
611  stateManager->SetNewState(G4State_GeomClosed);
612  return true;
613 }
virtual void GeometryHasChanged()=0
virtual void SetupShadowProcess() const
static G4VVisManager * GetConcreteInstance()
static G4StateManager * GetStateManager()
G4bool SetNewState(G4ApplicationState requestedState)
G4ApplicationState GetCurrentState() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4bool IsWorkerThread()
Definition: G4Threading.cc:104
G4PrimaryTransformer * GetPrimaryTransformer() const
void BuildPhysicsTables(G4bool fakeRun)
G4ApplicationState
void G4RunManagerKernel::RunTermination ( )
void G4RunManagerKernel::SetGeometryToBeOptimized ( G4bool  vl)
inline

Definition at line 195 of file G4RunManagerKernel.hh.

References geometryNeedsToBeClosed.

Referenced by G4RunManager::SetGeometryToBeOptimized().

196  {
197  if(geometryToBeOptimized != vl)
198  {
199  geometryToBeOptimized = vl;
201  }
202  }
void G4RunManagerKernel::SetNumberOfParallelWorld ( G4int  i)
inline

Definition at line 206 of file G4RunManagerKernel.hh.

Referenced by G4WorkerRunManager::InitializeGeometry(), and G4RunManager::InitializeGeometry().

207  { numberOfParallelWorld = i; }
void G4RunManagerKernel::SetPhysics ( G4VUserPhysicsList uPhys)

Definition at line 435 of file G4RunManagerKernel.cc.

References G4ParticleTable::DumpTable(), G4ParticleTable::entries(), G4cout, G4endl, G4ParticleTable::GetParticle(), G4ParticleDefinition::GetParticleName(), G4ParticleTable::GetParticleTable(), and SetupPhysics().

Referenced by G4ErrorRunManagerHelper::InitializePhysics(), and G4RunManager::SetUserInitialization().

436 {
437  physicsList = uPhys;
438 
439  SetupPhysics();
440  if(verboseLevel>2) G4ParticleTable::GetParticleTable()->DumpTable();
441  if(verboseLevel>1)
442  {
443  G4cout << "List of instantiated particles ============================================" << G4endl;
445  for(G4int i=0;i<nPtcl;i++)
446  {
448  G4cout << pd->GetParticleName() << " ";
449  if(i%10==9) G4cout << G4endl;
450  }
451  G4cout << G4endl;
452  }
453 }
void DumpTable(const G4String &particle_name="ALL")
int G4int
Definition: G4Types.hh:78
const G4String & GetParticleName() const
G4ParticleDefinition * GetParticle(G4int index) const
G4GLOB_DLL std::ostream G4cout
static G4ParticleTable * GetParticleTable()
#define G4endl
Definition: G4ios.hh:61
G4int entries() const
void G4RunManagerKernel::SetPrimaryTransformer ( G4PrimaryTransformer pt)
inline

Definition at line 184 of file G4RunManagerKernel.hh.

References G4EventManager::SetPrimaryTransformer().

Referenced by G4RunManager::SetPrimaryTransformer().

185  { eventManager->SetPrimaryTransformer(pt); }
void SetPrimaryTransformer(G4PrimaryTransformer *tf)
void G4RunManagerKernel::SetupDefaultRegion ( )
protected

Definition at line 232 of file G4RunManagerKernel.cc.

References defaultRegion, FatalException, G4cout, G4endl, G4Exception(), G4Region::GetNumberOfRootVolumes(), G4Region::GetRootLogicalVolumeIterator(), G4Region::RemoveRootLogicalVolume(), runManagerKernelType, and workerRMK.

Referenced by DefineWorldVolume().

233 {
234  if(runManagerKernelType==workerRMK) return;
235 
236  // Remove old world logical volume from the default region, if exist
238  {
239  if(defaultRegion->GetNumberOfRootVolumes()>size_t(1))
240  {
241  G4Exception("G4RunManager::SetupDefaultRegion",
242  "Run0005",
244  "Default world region should have a unique logical volume.");
245  }
246  std::vector<G4LogicalVolume*>::iterator lvItr
248  defaultRegion->RemoveRootLogicalVolume(*lvItr,false);
249  if(verboseLevel>1) G4cout
250  << "Obsolete world logical volume is removed from the default region." << G4endl;
251  }
252 
253 }
G4GLOB_DLL std::ostream G4cout
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61
size_t GetNumberOfRootVolumes() const
void RemoveRootLogicalVolume(G4LogicalVolume *lv, G4bool scan=true)
Definition: G4Region.cc:283
std::vector< G4LogicalVolume * >::iterator GetRootLogicalVolumeIterator()
void G4RunManagerKernel::SetupPhysics ( )
protected

Definition at line 460 of file G4RunManagerKernel.cc.

References G4IonConstructor::ConstructParticle(), G4VUserPhysicsList::ConstructParticle(), G4Geantino::GeantinoDefinition(), G4ParticleTable::GetGenericIon(), G4ParticleTable::GetIonTable(), G4ParticleTable::GetIterator(), G4ParticleDefinition::GetParticleDefinitionID(), G4ParticleTable::GetParticleTable(), G4IonTable::InitializeLightIons(), G4ParticleDefinition::IsGeneralIon(), G4ParticleTableIterator< K, V >::reset(), runManagerKernelType, G4ParticleDefinition::SetParticleDefinitionID(), G4ParticleTable::SetReadiness(), G4ParticleTableIterator< K, V >::value(), and workerRMK.

Referenced by SetPhysics().

461 {
463  if(runManagerKernelType==workerRMK) return;
464 
465  physicsList->ConstructParticle();
466 
467  // For sanity reason
470  if(gion)
473 
475  pItr->reset();
476  while( (*pItr)() )
477  {
478  G4ParticleDefinition* particle = pItr->value();
479  if(!(particle->IsGeneralIon())) particle->SetParticleDefinitionID();
480  }
481 
482  if(gion)
483  {
484  G4int gionId = gion->GetParticleDefinitionID();
485  pItr->reset(false);
486  while( (*pItr)() )
487  {
488  G4ParticleDefinition* particle = pItr->value();
489  if(particle->IsGeneralIon()) particle->SetParticleDefinitionID(gionId);
490  }
491  }
492 }
static G4Geantino * GeantinoDefinition()
Definition: G4Geantino.cc:82
G4int GetParticleDefinitionID() const
void InitializeLightIons()
Definition: G4IonTable.cc:177
void SetParticleDefinitionID(G4int id=-1)
void SetReadiness(G4bool val=true)
G4ParticleDefinition * GetGenericIon() const
int G4int
Definition: G4Types.hh:78
G4bool IsGeneralIon() const
static void ConstructParticle()
G4IonTable * GetIonTable() const
void reset(G4bool ifSkipIon=true)
static G4ParticleTable * GetParticleTable()
virtual void ConstructParticle()=0
G4PTblDicIterator * GetIterator() const
void G4RunManagerKernel::SetupShadowProcess ( ) const
protectedvirtual

Reimplemented in G4MTRunManagerKernel, and G4WorkerRunManagerKernel.

Definition at line 904 of file G4RunManagerKernel.cc.

References G4ParticleTable::GetIterator(), G4ParticleTable::GetParticleTable(), G4ProcessManager::GetProcessList(), G4ParticleDefinition::GetProcessManager(), G4ParticleTableIterator< K, V >::reset(), G4ProcessVector::size(), and G4ParticleTableIterator< K, V >::value().

Referenced by RunInitialization(), and G4MTRunManagerKernel::SetupShadowProcess().

905 {
908  theParticleIterator->reset();
909  //loop on particles and get process manager from there list of processes
910  while((*theParticleIterator)())
911  {
912  G4ParticleDefinition* pd = theParticleIterator->value();
914  if(pm)
915  {
916  G4ProcessVector& procs = *(pm->GetProcessList());
917  for ( G4int idx = 0 ; idx<procs.size() ; ++idx)
918  {
919  const G4VProcess* masterP = procs[idx]->GetMasterProcess();
920  if ( ! masterP )
921  {
922  //Process does not have an associated shadow master process
923  //We are in master mode or sequential
924  procs[idx]->SetMasterProcess(const_cast<G4VProcess*>(procs[idx]));
925  }
926  }
927  }
928  }
929 }
G4ProcessManager * GetProcessManager() const
int G4int
Definition: G4Types.hh:78
void reset(G4bool ifSkipIon=true)
G4int size() const
static G4ParticleTable * GetParticleTable()
G4PTblDicIterator * GetIterator() const
#define theParticleIterator
G4ProcessVector * GetProcessList() const
void G4RunManagerKernel::SetVerboseLevel ( G4int  vl)
inline

Definition at line 192 of file G4RunManagerKernel.hh.

Referenced by G4ErrorRunManagerHelper::G4ErrorRunManagerHelper(), and G4RunManager::SetVerboseLevel().

193  { verboseLevel = vl; }
void G4RunManagerKernel::UpdateRegion ( )

Definition at line 640 of file G4RunManagerKernel.cc.

References CheckRegions(), G4Exception(), G4State_Idle, G4StateManager::GetCurrentState(), G4RegionStore::GetInstance(), G4ProductionCutsTable::GetProductionCutsTable(), G4StateManager::GetStateManager(), JustWarning, runManagerKernelType, G4ProductionCutsTable::UpdateCoupleTable(), G4RegionStore::UpdateMaterialList(), and workerRMK.

Referenced by RunInitialization().

641 {
643  G4ApplicationState currentState = stateManager->GetCurrentState();
644  if( currentState != G4State_Idle )
645  {
646  G4Exception("G4RunManagerKernel::UpdateRegion",
647  "Run0024",
648  JustWarning,
649  "Geant4 kernel not in Idle state : method ignored.");
650  return;
651  }
652 
653  if(runManagerKernelType==workerRMK) return;
654 
655  CheckRegions();
656 
658 
660 }
void UpdateMaterialList(G4VPhysicalVolume *currentWorld=0)
static G4RegionStore * GetInstance()
static G4StateManager * GetStateManager()
G4ApplicationState GetCurrentState() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static G4ProductionCutsTable * GetProductionCutsTable()
void UpdateCoupleTable(G4VPhysicalVolume *currentWorld)
G4ApplicationState
void G4RunManagerKernel::WorkerDefineWorldVolume ( G4VPhysicalVolume worldVol,
G4bool  topologyIsChanged = true 
)

Definition at line 323 of file G4RunManagerKernel.cc.

References FatalException, G4cerr, G4endl, G4Exception(), G4State_Idle, G4State_PreInit, G4VVisManager::GeometryHasChanged(), geometryNeedsToBeClosed, G4VVisManager::GetConcreteInstance(), G4StateManager::GetCurrentState(), G4MTRunManager::GetMasterRunManager(), G4MTRunManager::GetMasterWorlds(), G4StateManager::GetStateManager(), G4StateManager::GetStateString(), G4TransportationManager::GetTransportationManager(), G4Threading::IsWorkerThread(), JustWarning, G4TransportationManager::RegisterWorld(), G4StateManager::SetNewState(), and G4TransportationManager::SetWorldForTracking().

Referenced by G4WorkerRunManager::InitializeGeometry().

325 {
327  G4ApplicationState currentState = stateManager->GetCurrentState();
328  if(!(currentState==G4State_Idle||currentState==G4State_PreInit))
329  {
330  G4Exception("G4RunManagerKernel::DefineWorldVolume",
331  "DefineWorldVolumeAtIncorrectState",
332  JustWarning,
333  "Geant4 kernel is not PreInit or Idle state : Method ignored.");
334  if(verboseLevel>1) G4cerr << "Current application state is "
335  << stateManager->GetStateString(currentState) << G4endl;
336  return;
337  }
338 
339  currentWorld = worldVol;
342  G4MTRunManager::masterWorlds_t masterWorlds= masterRM->GetMasterWorlds();
343  G4MTRunManager::masterWorlds_t::iterator itrMW = masterWorlds.begin();
344  for(;itrMW!=masterWorlds.end();itrMW++)
345  {
346  if((*itrMW).first == 0)
347  {
348  if((*itrMW).second != currentWorld)
349  {
350  G4Exception("G4RunManagerKernel::WorkerDefineWorldVolume","RUN3091",
351  FatalException,"Mass world is inconsistent");
352  }
353  transM->SetWorldForTracking((*itrMW).second);
354  }
355  else
356  {
357  transM->RegisterWorld((*itrMW).second);
358  }
359  }
360 
361  if(topologyIsChanged) geometryNeedsToBeClosed = true;
362 
363  // Notify the VisManager as well
365  {
367  if(pVVisManager) pVVisManager->GeometryHasChanged();
368  }
369 
370  geometryInitialized = true;
371  if(physicsInitialized && currentState!=G4State_Idle)
372  { stateManager->SetNewState(G4State_Idle); }
373 }
virtual void GeometryHasChanged()=0
std::map< G4int, G4VPhysicalVolume * > masterWorlds_t
static G4VVisManager * GetConcreteInstance()
static masterWorlds_t & GetMasterWorlds()
static G4StateManager * GetStateManager()
G4bool SetNewState(G4ApplicationState requestedState)
static G4MTRunManager * GetMasterRunManager()
G4ApplicationState GetCurrentState() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4bool IsWorkerThread()
Definition: G4Threading.cc:104
static G4TransportationManager * GetTransportationManager()
#define G4endl
Definition: G4ios.hh:61
G4bool RegisterWorld(G4VPhysicalVolume *aWorld)
void SetWorldForTracking(G4VPhysicalVolume *theWorld)
G4ApplicationState
G4GLOB_DLL std::ostream G4cerr
G4String GetStateString(G4ApplicationState aState) const
void G4RunManagerKernel::WorkerUpdateWorldVolume ( )

Definition at line 306 of file G4RunManagerKernel.cc.

References G4MTRunManager::GetMasterRunManager(), G4MTRunManager::GetMasterWorlds(), G4VPhysicalVolume::GetName(), G4TransportationManager::GetTransportationManager(), G4TransportationManager::IsWorldExisting(), and G4TransportationManager::RegisterWorld().

Referenced by G4WorkerRunManager::ConstructScoringWorlds().

307 {
310  G4MTRunManager::masterWorlds_t masterWorlds= masterRM->GetMasterWorlds();
311  G4MTRunManager::masterWorlds_t::iterator itrMW = masterWorlds.begin();
312  for(;itrMW!=masterWorlds.end();itrMW++)
313  {
314  G4VPhysicalVolume* wv = (*itrMW).second;
315  G4VPhysicalVolume* pWorld
317  ->IsWorldExisting(wv->GetName());
318  if(!pWorld)
319  { transM->RegisterWorld(wv); }
320  }
321 }
G4VPhysicalVolume * IsWorldExisting(const G4String &worldName)
std::map< G4int, G4VPhysicalVolume * > masterWorlds_t
static masterWorlds_t & GetMasterWorlds()
const G4String & GetName() const
static G4MTRunManager * GetMasterRunManager()
static G4TransportationManager * GetTransportationManager()
G4bool RegisterWorld(G4VPhysicalVolume *aWorld)

Field Documentation

G4Region* G4RunManagerKernel::defaultRegion
protected
G4Region* G4RunManagerKernel::defaultRegionForParallelWorld
protected

Definition at line 161 of file G4RunManagerKernel.hh.

Referenced by CheckRegions(), and G4RunManagerKernel().

G4bool G4RunManagerKernel::geometryNeedsToBeClosed
protected
RMKType G4RunManagerKernel::runManagerKernelType
protected

The documentation for this class was generated from the following files: