51 G4TransportationManager::fTransportationManager=0;
58 if (fTransportationManager)
60 G4Exception(
"G4TransportationManager::G4TransportationManager()",
62 "Only ONE instance of G4TransportationManager is allowed!");
69 fNavigators.push_back(trackingNavigator);
70 fActiveNavigators.push_back(trackingNavigator);
85 delete fPropagatorInField;
87 delete fGeomMessenger;
89 if (fTransportationManager)
91 delete fTransportationManager; fTransportationManager=0;
102 if (!fTransportationManager)
106 return fTransportationManager;
116 fFieldManager = newFieldManager;
121 if( fPropagatorInField )
123 fPropagatorInField -> SetDetectorFieldManager( newFieldManager );
135 fNavigators[0] = newNavigator;
136 fActiveNavigators[0] = newNavigator;
146 void G4TransportationManager::ClearNavigators()
148 std::vector<G4Navigator*>::iterator pNav;
149 for (pNav=fNavigators.begin(); pNav!=fNavigators.end(); pNav++)
154 fActiveNavigators.clear();
175 wPV->GetTranslation(),
176 wLV, worldName, 0,
false, 0);
193 std::vector<G4Navigator*>::iterator pNav;
194 for (pNav=fNavigators.begin(); pNav!=fNavigators.end(); pNav++)
196 if ((*pNav)->GetWorldVolume()->GetName() == worldName) {
return *pNav; }
208 fNavigators.push_back(aNavigator);
213 =
"World volume with name -" + worldName
214 +
"- does not exist. Create it first by GetParallelWorld() method!";
215 G4Exception(
"G4TransportationManager::GetNavigator(name)",
231 std::vector<G4Navigator*>::iterator pNav;
232 for (pNav=fNavigators.begin(); pNav!=fNavigators.end(); pNav++)
234 if ((*pNav)->GetWorldVolume() == aWorld) {
return *pNav; }
237 std::vector<G4VPhysicalVolume*>::iterator pWorld =
238 std::find(fWorlds.begin(), fWorlds.end(), aWorld);
239 if (pWorld != fWorlds.end())
243 fNavigators.push_back(aNavigator);
248 =
"World volume with name -" + aWorld->
GetName()
249 +
"- does not exist. Create it first by GetParallelWorld() method!";
250 G4Exception(
"G4TransportationManager::GetNavigator(pointer)",
267 if (aNavigator == fNavigators[0])
269 G4Exception(
"G4TransportationManager::DeRegisterNavigator()",
271 "The navigator for tracking CANNOT be deregistered!");
273 std::vector<G4Navigator*>::iterator pNav =
274 std::find(fNavigators.begin(), fNavigators.end(), aNavigator);
275 if (pNav != fNavigators.end())
279 DeRegisterWorld((*pNav)->GetWorldVolume());
283 fNavigators.erase(pNav);
289 +
"- not found in memory!";
290 G4Exception(
"G4TransportationManager::DeRegisterNavigator()",
306 std::vector<G4Navigator*>::iterator pNav =
307 std::find(fNavigators.begin(), fNavigators.end(), aNavigator);
308 if (pNav == fNavigators.end())
312 +
"- not found in memory!";
313 G4Exception(
"G4TransportationManager::ActivateNavigator()",
320 std::vector<G4Navigator*>::iterator pActiveNav;
321 for(pActiveNav=fActiveNavigators.begin();
322 pActiveNav!=fActiveNavigators.end(); pActiveNav++)
324 if (*pActiveNav == aNavigator) {
return id; }
328 fActiveNavigators.push_back(aNavigator);
341 std::vector<G4Navigator*>::iterator pNav =
342 std::find(fNavigators.begin(), fNavigators.end(), aNavigator);
343 if (pNav != fNavigators.end())
345 (*pNav)->Activate(
false);
351 +
"- not found in memory!";
352 G4Exception(
"G4TransportationManager::DeActivateNavigator()",
356 std::vector<G4Navigator*>::iterator pActiveNav =
357 std::find(fActiveNavigators.begin(), fActiveNavigators.end(), aNavigator);
358 if (pActiveNav != fActiveNavigators.end())
360 fActiveNavigators.erase(pActiveNav);
372 std::vector<G4Navigator*>::iterator pNav;
373 for (pNav=fActiveNavigators.begin(); pNav!=fActiveNavigators.end(); pNav++)
375 (*pNav)->Activate(
false);
377 fActiveNavigators.clear();
381 fNavigators[0]->Activate(
true);
382 fActiveNavigators.push_back(fNavigators[0]);
394 std::vector<G4VPhysicalVolume*>::iterator pWorld = fWorlds.begin();
395 if (*pWorld==0) { *pWorld=fNavigators[0]->GetWorldVolume(); }
397 for (pWorld=fWorlds.begin(); pWorld!=fWorlds.end(); pWorld++)
399 if ((*pWorld)->GetName() ==
name ) {
return *pWorld; }
415 std::vector<G4VPhysicalVolume*>::iterator pWorld =
416 std::find(fWorlds.begin(), fWorlds.end(), aWorld);
417 if (pWorld == fWorlds.end())
419 fWorlds.push_back(aWorld);
434 std::vector<G4VPhysicalVolume*>::iterator pWorld =
435 std::find(fWorlds.begin(), fWorlds.end(), aWorld);
436 if (pWorld != fWorlds.end())
438 fWorlds.erase(pWorld);
443 =
"World volume -" + aWorld->
GetName() +
"- not found in memory!";
444 G4Exception(
"G4TransportationManager::DeRegisterWorld()",
459 std::vector<G4Navigator*>::iterator pNav = fNavigators.begin();
461 for (pNav=fNavigators.begin(); pNav!=fNavigators.end(); pNav++)
463 if (*pNav != trackingNavigator) {
delete *pNav; }
466 fActiveNavigators.clear();
470 fNavigators.push_back(trackingNavigator);
471 fActiveNavigators.push_back(trackingNavigator);
473 fWorlds.push_back(0);
G4VPhysicalVolume * IsWorldExisting(const G4String &worldName)
void SetNavigatorForPropagating(G4Navigator *SimpleOrMultiNavigator)
G4TransportationManager()
G4Navigator * GetNavigatorForTracking() const
G4VSolid * GetSolid() const
void SetFieldManager(G4FieldManager *newFieldManager)
~G4TransportationManager()
const G4String & GetName() const
void DeActivateNavigator(G4Navigator *aNavigator)
void Activate(G4bool flag)
void DeRegisterNavigator(G4Navigator *aNavigator)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
static G4TransportationManager * GetTransportationManager()
void ClearParallelWorlds()
G4VPhysicalVolume * GetParallelWorld(const G4String &worldName)
G4int ActivateNavigator(G4Navigator *aNavigator)
G4LogicalVolume * GetLogicalVolume() const
G4Navigator * GetNavigator(const G4String &worldName)
void SetWorldVolume(G4VPhysicalVolume *pWorld)
G4bool RegisterWorld(G4VPhysicalVolume *aWorld)
void SetNavigatorForTracking(G4Navigator *newNavigator)
G4VPhysicalVolume * GetWorldVolume() const