57 if (fTransportationManager)
59 G4Exception(
"G4TransportationManager::G4TransportationManager()",
61 "Only ONE instance of G4TransportationManager is allowed!");
68 fNavigators.push_back(trackingNavigator);
69 fActiveNavigators.push_back(trackingNavigator);
84 delete fPropagatorInField;
86 delete fGeomMessenger;
98 if (!fTransportationManager)
99 fTransportationManager = &theInstance;
101 return fTransportationManager;
111 fFieldManager = newFieldManager;
116 if( fPropagatorInField )
118 fPropagatorInField -> SetDetectorFieldManager( newFieldManager );
128void G4TransportationManager::ClearNavigators()
130 std::vector<G4Navigator*>::iterator pNav;
131 for (pNav=fNavigators.begin(); pNav!=fNavigators.end(); pNav++)
136 fActiveNavigators.clear();
158 wLV, worldName, 0,
false, 0);
175 std::vector<G4Navigator*>::iterator pNav;
176 for (pNav=fNavigators.begin(); pNav!=fNavigators.end(); pNav++)
178 if ((*pNav)->GetWorldVolume()->GetName() == worldName) {
return *pNav; }
190 fNavigators.push_back(aNavigator);
195 =
"World volume with name -" + worldName
196 +
"- does not exist. Create it first by GetParallelWorld() method!";
197 G4Exception(
"G4TransportationManager::GetNavigator(name)",
213 std::vector<G4Navigator*>::iterator pNav;
214 for (pNav=fNavigators.begin(); pNav!=fNavigators.end(); pNav++)
216 if ((*pNav)->GetWorldVolume() == aWorld) {
return *pNav; }
219 std::vector<G4VPhysicalVolume*>::iterator pWorld =
220 std::find(fWorlds.begin(), fWorlds.end(), aWorld);
221 if (pWorld != fWorlds.end())
225 fNavigators.push_back(aNavigator);
230 =
"World volume with name -" + aWorld->
GetName()
231 +
"- does not exist. Create it first by GetParallelWorld() method!";
232 G4Exception(
"G4TransportationManager::GetNavigator(pointer)",
249 if (aNavigator == fNavigators[0])
251 G4Exception(
"G4TransportationManager::DeRegisterNavigator()",
253 "The navigator for tracking CANNOT be deregistered!");
255 std::vector<G4Navigator*>::iterator pNav =
256 std::find(fNavigators.begin(), fNavigators.end(), aNavigator);
257 if (pNav != fNavigators.end())
261 DeRegisterWorld((*pNav)->GetWorldVolume());
265 fNavigators.erase(pNav);
271 +
"- not found in memory!";
272 G4Exception(
"G4TransportationManager::DeRegisterNavigator()",
288 std::vector<G4Navigator*>::iterator pNav =
289 std::find(fNavigators.begin(), fNavigators.end(), aNavigator);
290 if (pNav == fNavigators.end())
294 +
"- not found in memory!";
295 G4Exception(
"G4TransportationManager::ActivateNavigator()",
302 std::vector<G4Navigator*>::iterator pActiveNav;
303 for(pActiveNav=fActiveNavigators.begin();
304 pActiveNav!=fActiveNavigators.end(); pActiveNav++)
306 if (*pActiveNav == aNavigator) {
return id; }
310 fActiveNavigators.push_back(aNavigator);
323 std::vector<G4Navigator*>::iterator pNav =
324 std::find(fNavigators.begin(), fNavigators.end(), aNavigator);
325 if (pNav != fNavigators.end())
327 (*pNav)->Activate(
false);
333 +
"- not found in memory!";
334 G4Exception(
"G4TransportationManager::DeActivateNavigator()",
338 std::vector<G4Navigator*>::iterator pActiveNav =
339 std::find(fActiveNavigators.begin(), fActiveNavigators.end(), aNavigator);
340 if (pActiveNav != fActiveNavigators.end())
342 fActiveNavigators.erase(pActiveNav);
354 std::vector<G4Navigator*>::iterator pNav;
355 for (pNav=fActiveNavigators.begin(); pNav!=fActiveNavigators.end(); pNav++)
357 (*pNav)->Activate(
false);
359 fActiveNavigators.clear();
363 fNavigators[0]->Activate(
true);
364 fActiveNavigators.push_back(fNavigators[0]);
376 std::vector<G4VPhysicalVolume*>::iterator pWorld = fWorlds.begin();
377 if (*pWorld==0) { *pWorld=fNavigators[0]->GetWorldVolume(); }
379 for (pWorld=fWorlds.begin(); pWorld!=fWorlds.end(); pWorld++)
381 if ((*pWorld)->GetName() == name ) {
return *pWorld; }
397 std::vector<G4VPhysicalVolume*>::iterator pWorld =
398 std::find(fWorlds.begin(), fWorlds.end(), aWorld);
399 if (pWorld == fWorlds.end())
401 fWorlds.push_back(aWorld);
416 std::vector<G4VPhysicalVolume*>::iterator pWorld =
417 std::find(fWorlds.begin(), fWorlds.end(), aWorld);
418 if (pWorld != fWorlds.end())
420 fWorlds.erase(pWorld);
425 =
"World volume -" + aWorld->
GetName() +
"- not found in memory!";
426 G4Exception(
"G4TransportationManager::DeRegisterWorld()",
G4VSolid * GetSolid() const
void Activate(G4bool flag)
void SetWorldVolume(G4VPhysicalVolume *pWorld)
G4VPhysicalVolume * GetWorldVolume() const
G4TransportationManager()
G4VPhysicalVolume * GetParallelWorld(const G4String &worldName)
static G4TransportationManager * GetTransportationManager()
void SetFieldManager(G4FieldManager *newFieldManager)
G4VPhysicalVolume * IsWorldExisting(const G4String &worldName)
G4Navigator * GetNavigatorForTracking() const
~G4TransportationManager()
G4int ActivateNavigator(G4Navigator *aNavigator)
void DeActivateNavigator(G4Navigator *aNavigator)
G4Navigator * GetNavigator(const G4String &worldName)
void DeRegisterNavigator(G4Navigator *aNavigator)
const G4RotationMatrix * GetRotation() const
G4LogicalVolume * GetLogicalVolume() const
const G4String & GetName() const
const G4ThreeVector & GetTranslation() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)