44 G4ITTransportationManager::fpInstance(0);
46 G4ITTransportationManager::G4ITTransportationManager()
51 G4ITTransportationManager::~G4ITTransportationManager()
54 if (fpSafetyHelper)
delete fpSafetyHelper;
72 void G4ITTransportationManager::ClearNavigators()
74 std::vector<G4ITNavigator*>::iterator pNav;
75 for (pNav = fNavigators.begin(); pNav != fNavigators.end(); pNav++)
80 fActiveNavigators.clear();
84 void G4ITTransportationManager::Initialize()
88 G4ITNavigator* trackingNavigator =
new G4ITNavigator();
89 trackingNavigator->Activate(
true);
94 trackingNavigator->SetWorldVolume(world);
95 fNavigators.push_back(trackingNavigator);
96 fActiveNavigators.push_back(trackingNavigator);
101 std::vector<G4VPhysicalVolume*>::iterator it =
104 for (
size_t i = 0; i < n_worlds; i++, it++)
106 fWorlds.push_back(*it);
132 wPV =
new G4PVPlacement(wPV->GetRotation(), wPV->GetTranslation(), wLV,
133 worldName, 0,
false, 0);
150 std::vector<G4ITNavigator*>::iterator pNav;
151 for (pNav = fNavigators.begin(); pNav != fNavigators.end(); pNav++)
153 if ((*pNav)->GetWorldVolume()->GetName() == worldName)
162 G4ITNavigator* aNavigator = 0;
166 aNavigator =
new G4ITNavigator();
167 aNavigator->SetWorldVolume(aWorld);
168 fNavigators.push_back(aNavigator);
172 G4String message =
"World volume with name -"
174 +
"- does not exist. Create it first by GetParallelWorld() method!";
175 G4Exception(
"G4ITTransportationManager::GetNavigator(name)",
"GeomNav0002",
191 std::vector<G4ITNavigator*>::iterator pNav;
192 for (pNav = fNavigators.begin(); pNav != fNavigators.end(); pNav++)
194 if ((*pNav)->GetWorldVolume() == aWorld)
199 G4ITNavigator* aNavigator = 0;
200 std::vector<G4VPhysicalVolume*>::iterator pWorld = std::find(fWorlds.begin(),
203 if (pWorld != fWorlds.end())
205 aNavigator =
new G4ITNavigator();
206 aNavigator->SetWorldVolume(aWorld);
207 fNavigators.push_back(aNavigator);
211 G4String message =
"World volume with name -"
213 +
"- does not exist. Create it first by GetParallelWorld() method!";
214 G4Exception(
"G4ITTransportationManager::GetNavigator(pointer)",
231 if (aNavigator == fNavigators[0])
233 G4Exception(
"G4ITTransportationManager::DeRegisterNavigator()",
235 "The navigator for tracking CANNOT be deregistered!");
237 std::vector<G4ITNavigator*>::iterator pNav = std::find(fNavigators.begin(),
240 if (pNav != fNavigators.end())
244 DeRegisterWorld((*pNav)->GetWorldVolume());
248 fNavigators.erase(pNav);
252 G4String message =
"Navigator for volume -"
253 + aNavigator->GetWorldVolume()->GetName() +
"- not found in memory!";
254 G4Exception(
"G4ITTransportationManager::DeRegisterNavigator()",
270 std::vector<G4ITNavigator*>::iterator pNav = std::find(fNavigators.begin(),
273 if (pNav == fNavigators.end())
275 G4String message =
"Navigator for volume -"
276 + aNavigator->GetWorldVolume()->GetName() +
"- not found in memory!";
277 G4Exception(
"G4ITTransportationManager::ActivateNavigator()",
"GeomNav1002",
282 aNavigator->Activate(
true);
284 std::vector<G4ITNavigator*>::iterator pActiveNav;
285 for (pActiveNav = fActiveNavigators.begin();
286 pActiveNav != fActiveNavigators.end(); pActiveNav++)
288 if (*pActiveNav == aNavigator)
295 fActiveNavigators.push_back(aNavigator);
308 std::vector<G4ITNavigator*>::iterator pNav = std::find(fNavigators.begin(),
311 if (pNav != fNavigators.end())
313 (*pNav)->Activate(
false);
317 G4String message =
"Navigator for volume -"
318 + aNavigator->GetWorldVolume()->GetName() +
"- not found in memory!";
319 G4Exception(
"G4ITTransportationManager::DeActivateNavigator()",
323 std::vector<G4ITNavigator*>::iterator pActiveNav = std::find(
324 fActiveNavigators.begin(), fActiveNavigators.end(), aNavigator);
325 if (pActiveNav != fActiveNavigators.end())
327 fActiveNavigators.erase(pActiveNav);
339 std::vector<G4ITNavigator*>::iterator pNav;
340 for (pNav = fActiveNavigators.begin(); pNav != fActiveNavigators.end();
343 (*pNav)->Activate(
false);
345 fActiveNavigators.clear();
349 fNavigators[0]->Activate(
true);
350 fActiveNavigators.push_back(fNavigators[0]);
362 std::vector<G4VPhysicalVolume*>::iterator pWorld = fWorlds.begin();
365 *pWorld = fNavigators[0]->GetWorldVolume();
368 for (pWorld = fWorlds.begin(); pWorld != fWorlds.end(); pWorld++)
370 if ((*pWorld)->GetName() ==
name)
389 std::vector<G4VPhysicalVolume*>::iterator pWorld = std::find(fWorlds.begin(),
392 if (pWorld == fWorlds.end())
394 fWorlds.push_back(aWorld);
409 std::vector<G4VPhysicalVolume*>::iterator pWorld = std::find(fWorlds.begin(),
412 if (pWorld != fWorlds.end())
414 fWorlds.erase(pWorld);
419 +
"- not found in memory!";
420 G4Exception(
"G4ITTransportationManager::DeRegisterWorld()",
"GeomNav1002",
static void DeleteInstance()
std::vector< G4VPhysicalVolume * >::iterator GetWorldsIterator()
G4Navigator * GetNavigatorForTracking() const
G4VSolid * GetSolid() const
G4bool RegisterWorld(G4VPhysicalVolume *aWorld)
static G4ITTransportationManager * GetTransportationManager()
G4VPhysicalVolume * IsWorldExisting(const G4String &worldName)
const G4String & GetName() const
void DeRegisterNavigator(G4ITNavigator *aNavigator)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
static G4TransportationManager * GetTransportationManager()
virtual void Initialize(G4HCofThisEvent *)
G4ITNavigator * GetNavigator(const G4String &worldName)
G4int ActivateNavigator(G4ITNavigator *aNavigator)
G4LogicalVolume * GetLogicalVolume() const
G4ITNavigator * GetNavigatorForTracking() const
size_t GetNoWorlds() const
G4VPhysicalVolume * GetParallelWorld(const G4String &worldName)
G4VPhysicalVolume * GetWorldVolume() const
void DeActivateNavigator(G4ITNavigator *aNavigator)