43G4ITTransportationManager::fpInstance(
nullptr);
45G4ITTransportationManager::G4ITTransportationManager()
50G4ITTransportationManager::~G4ITTransportationManager()
53 delete fpSafetyHelper;
58 if (fpInstance !=
nullptr)
71void G4ITTransportationManager::ClearNavigators()
73 std::vector<G4ITNavigator*>::iterator pNav;
74 for (pNav = fNavigators.begin(); pNav != fNavigators.end(); pNav++)
79 fActiveNavigators.clear();
83void G4ITTransportationManager::Initialize()
87 auto trackingNavigator =
new G4ITNavigator();
88 trackingNavigator->Activate(
true);
93 trackingNavigator->SetWorldVolume(world);
94 fNavigators.push_back(trackingNavigator);
95 fActiveNavigators.push_back(trackingNavigator);
103 for (
size_t i = 0; i < n_worlds; i++, it++)
105 fWorlds.push_back(*it);
132 worldName,
nullptr,
false, 0);
149 std::vector<G4ITNavigator*>::iterator pNav;
150 for (pNav = fNavigators.begin(); pNav != fNavigators.end(); pNav++)
152 if ((*pNav)->GetWorldVolume()->GetName() == worldName)
161 G4ITNavigator* aNavigator =
nullptr;
163 if (aWorld !=
nullptr)
165 aNavigator =
new G4ITNavigator();
166 aNavigator->SetWorldVolume(aWorld);
167 fNavigators.push_back(aNavigator);
171 G4String message =
"World volume with name -"
173 +
"- does not exist. Create it first by GetParallelWorld() method!";
174 G4Exception(
"G4ITTransportationManager::GetNavigator(name)",
"GeomNav0002",
190 std::vector<G4ITNavigator*>::iterator pNav;
191 for (pNav = fNavigators.begin(); pNav != fNavigators.end(); pNav++)
193 if ((*pNav)->GetWorldVolume() == aWorld)
198 G4ITNavigator* aNavigator =
nullptr;
199 auto pWorld = std::find(fWorlds.begin(),
202 if (pWorld != fWorlds.end())
204 aNavigator =
new G4ITNavigator();
205 aNavigator->SetWorldVolume(aWorld);
206 fNavigators.push_back(aNavigator);
210 G4String message =
"World volume with name -"
212 +
"- does not exist. Create it first by GetParallelWorld() method!";
213 G4Exception(
"G4ITTransportationManager::GetNavigator(pointer)",
230 if (aNavigator == fNavigators[0])
232 G4Exception(
"G4ITTransportationManager::DeRegisterNavigator()",
234 "The navigator for tracking CANNOT be deregistered!");
236 auto pNav = std::find(fNavigators.begin(),
239 if (pNav != fNavigators.end())
243 DeRegisterWorld((*pNav)->GetWorldVolume());
247 fNavigators.erase(pNav);
251 G4String message =
"Navigator for volume -"
252 + aNavigator->GetWorldVolume()->GetName() +
"- not found in memory!";
253 G4Exception(
"G4ITTransportationManager::DeRegisterNavigator()",
269 auto pNav = std::find(fNavigators.begin(),
272 if (pNav == fNavigators.end())
274 G4String message =
"Navigator for volume -"
275 + aNavigator->GetWorldVolume()->GetName() +
"- not found in memory!";
276 G4Exception(
"G4ITTransportationManager::ActivateNavigator()",
"GeomNav1002",
281 aNavigator->Activate(
true);
283 std::vector<G4ITNavigator*>::iterator pActiveNav;
284 for (pActiveNav = fActiveNavigators.begin();
285 pActiveNav != fActiveNavigators.end(); pActiveNav++)
287 if (*pActiveNav == aNavigator)
294 fActiveNavigators.push_back(aNavigator);
307 auto pNav = std::find(fNavigators.begin(),
310 if (pNav != fNavigators.end())
312 (*pNav)->Activate(
false);
316 G4String message =
"Navigator for volume -"
317 + aNavigator->GetWorldVolume()->GetName() +
"- not found in memory!";
318 G4Exception(
"G4ITTransportationManager::DeActivateNavigator()",
322 auto pActiveNav = std::find(
323 fActiveNavigators.begin(), fActiveNavigators.end(), aNavigator);
324 if (pActiveNav != fActiveNavigators.end())
326 fActiveNavigators.erase(pActiveNav);
338 std::vector<G4ITNavigator*>::iterator pNav;
339 for (pNav = fActiveNavigators.begin(); pNav != fActiveNavigators.end();
342 (*pNav)->Activate(
false);
344 fActiveNavigators.clear();
348 fNavigators[0]->Activate(
true);
349 fActiveNavigators.push_back(fNavigators[0]);
361 auto pWorld = fWorlds.begin();
364 *pWorld = fNavigators[0]->GetWorldVolume();
367 for (pWorld = fWorlds.begin(); pWorld != fWorlds.end(); pWorld++)
369 if ((*pWorld)->GetName() == name)
388 auto pWorld = std::find(fWorlds.begin(),
391 if (pWorld == fWorlds.end())
393 fWorlds.push_back(aWorld);
408 auto pWorld = std::find(fWorlds.begin(),
411 if (pWorld != fWorlds.end())
413 fWorlds.erase(pWorld);
418 +
"- not found in memory!";
419 G4Exception(
"G4ITTransportationManager::DeRegisterWorld()",
"GeomNav1002",
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4VPhysicalVolume * IsWorldExisting(const G4String &worldName)
static void DeleteInstance()
G4ITNavigator * GetNavigator(const G4String &worldName)
static G4ITTransportationManager * GetTransportationManager()
G4ITNavigator * GetNavigatorForTracking() const
G4int ActivateNavigator(G4ITNavigator *aNavigator)
G4VPhysicalVolume * GetParallelWorld(const G4String &worldName)
void DeActivateNavigator(G4ITNavigator *aNavigator)
void DeRegisterNavigator(G4ITNavigator *aNavigator)
G4bool RegisterWorld(G4VPhysicalVolume *aWorld)
G4VSolid * GetSolid() const
G4VPhysicalVolume * GetWorldVolume() const
static G4TransportationManager * GetTransportationManager()
std::vector< G4VPhysicalVolume * >::iterator GetWorldsIterator()
G4Navigator * GetNavigatorForTracking() const
std::size_t GetNoWorlds() const
const G4RotationMatrix * GetRotation() const
const G4ThreeVector GetTranslation() const
G4LogicalVolume * GetLogicalVolume() const
const G4String & GetName() const