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 );
133 void G4TransportationManager::ClearNavigators()
135 std::vector<G4Navigator*>::iterator pNav;
136 for (pNav=fNavigators.begin(); pNav!=fNavigators.end(); pNav++)
141 fActiveNavigators.clear();
162 wPV->GetTranslation(),
163 wLV, worldName, 0,
false, 0);
180 std::vector<G4Navigator*>::iterator pNav;
181 for (pNav=fNavigators.begin(); pNav!=fNavigators.end(); pNav++)
183 if ((*pNav)->GetWorldVolume()->GetName() == worldName) {
return *pNav; }
195 fNavigators.push_back(aNavigator);
200 =
"World volume with name -" + worldName
201 +
"- does not exist. Create it first by GetParallelWorld() method!";
202 G4Exception(
"G4TransportationManager::GetNavigator(name)",
218 std::vector<G4Navigator*>::iterator pNav;
219 for (pNav=fNavigators.begin(); pNav!=fNavigators.end(); pNav++)
221 if ((*pNav)->GetWorldVolume() == aWorld) {
return *pNav; }
224 std::vector<G4VPhysicalVolume*>::iterator pWorld =
225 std::find(fWorlds.begin(), fWorlds.end(), aWorld);
226 if (pWorld != fWorlds.end())
230 fNavigators.push_back(aNavigator);
235 =
"World volume with name -" + aWorld->
GetName()
236 +
"- does not exist. Create it first by GetParallelWorld() method!";
237 G4Exception(
"G4TransportationManager::GetNavigator(pointer)",
254 if (aNavigator == fNavigators[0])
256 G4Exception(
"G4TransportationManager::DeRegisterNavigator()",
258 "The navigator for tracking CANNOT be deregistered!");
260 std::vector<G4Navigator*>::iterator pNav =
261 std::find(fNavigators.begin(), fNavigators.end(), aNavigator);
262 if (pNav != fNavigators.end())
266 DeRegisterWorld((*pNav)->GetWorldVolume());
270 fNavigators.erase(pNav);
276 +
"- not found in memory!";
277 G4Exception(
"G4TransportationManager::DeRegisterNavigator()",
293 std::vector<G4Navigator*>::iterator pNav =
294 std::find(fNavigators.begin(), fNavigators.end(), aNavigator);
295 if (pNav == fNavigators.end())
299 +
"- not found in memory!";
300 G4Exception(
"G4TransportationManager::ActivateNavigator()",
307 std::vector<G4Navigator*>::iterator pActiveNav;
308 for(pActiveNav=fActiveNavigators.begin();
309 pActiveNav!=fActiveNavigators.end(); pActiveNav++)
311 if (*pActiveNav == aNavigator) {
return id; }
315 fActiveNavigators.push_back(aNavigator);
328 std::vector<G4Navigator*>::iterator pNav =
329 std::find(fNavigators.begin(), fNavigators.end(), aNavigator);
330 if (pNav != fNavigators.end())
332 (*pNav)->Activate(
false);
338 +
"- not found in memory!";
339 G4Exception(
"G4TransportationManager::DeActivateNavigator()",
343 std::vector<G4Navigator*>::iterator pActiveNav =
344 std::find(fActiveNavigators.begin(), fActiveNavigators.end(), aNavigator);
345 if (pActiveNav != fActiveNavigators.end())
347 fActiveNavigators.erase(pActiveNav);
359 std::vector<G4Navigator*>::iterator pNav;
360 for (pNav=fActiveNavigators.begin(); pNav!=fActiveNavigators.end(); pNav++)
362 (*pNav)->Activate(
false);
364 fActiveNavigators.clear();
368 fNavigators[0]->Activate(
true);
369 fActiveNavigators.push_back(fNavigators[0]);
381 std::vector<G4VPhysicalVolume*>::iterator pWorld = fWorlds.begin();
382 if (*pWorld==0) { *pWorld=fNavigators[0]->GetWorldVolume(); }
384 for (pWorld=fWorlds.begin(); pWorld!=fWorlds.end(); pWorld++)
386 if ((*pWorld)->GetName() ==
name ) {
return *pWorld; }
402 std::vector<G4VPhysicalVolume*>::iterator pWorld =
403 std::find(fWorlds.begin(), fWorlds.end(), aWorld);
404 if (pWorld == fWorlds.end())
406 fWorlds.push_back(aWorld);
421 std::vector<G4VPhysicalVolume*>::iterator pWorld =
422 std::find(fWorlds.begin(), fWorlds.end(), aWorld);
423 if (pWorld != fWorlds.end())
425 fWorlds.erase(pWorld);
430 =
"World volume -" + aWorld->
GetName() +
"- not found in memory!";
431 G4Exception(
"G4TransportationManager::DeRegisterWorld()",
G4VPhysicalVolume * IsWorldExisting(const G4String &worldName)
G4TransportationManager()
G4Navigator * GetNavigatorForTracking() const
void SetFieldManager(G4FieldManager *newFieldManager)
~G4TransportationManager()
const G4String & GetName() const
G4FieldManager(G4Field *detectorField=0, G4ChordFinder *pChordFinder=0, G4bool b=true)
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()
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)
G4VPhysicalVolume * GetWorldVolume() const
G4VSolid * GetSolid() const