Geant4-11
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
G4ITTransportationManager Class Reference

#include <G4ITTransportationManager.hh>

Public Member Functions

G4int ActivateNavigator (G4ITNavigator *aNavigator)
 
void DeActivateNavigator (G4ITNavigator *aNavigator)
 
void DeRegisterNavigator (G4ITNavigator *aNavigator)
 
std::vector< G4ITNavigator * >::iterator GetActiveNavigatorsIterator ()
 
G4ITNavigator * GetNavigator (const G4String &worldName)
 
G4ITNavigator * GetNavigator (G4VPhysicalVolume *aWorld)
 
G4ITNavigator * GetNavigatorForTracking () const
 
size_t GetNoActiveNavigators () const
 
size_t GetNoWorlds () const
 
G4VPhysicalVolumeGetParallelWorld (const G4String &worldName)
 
G4ITSafetyHelperGetSafetyHelper () const
 
std::vector< G4VPhysicalVolume * >::iterator GetWorldsIterator ()
 
void InactivateAll ()
 
G4VPhysicalVolumeIsWorldExisting (const G4String &worldName)
 
G4bool RegisterWorld (G4VPhysicalVolume *aWorld)
 
void SetWorldForTracking (G4VPhysicalVolume *theWorld)
 

Static Public Member Functions

static void DeleteInstance ()
 
static G4ITTransportationManagerGetTransportationManager ()
 

Private Member Functions

void ClearNavigators ()
 
void DeRegisterWorld (G4VPhysicalVolume *aWorld)
 
 G4ITTransportationManager ()
 
void Initialize ()
 
 ~G4ITTransportationManager ()
 

Private Attributes

std::vector< G4ITNavigator * > fActiveNavigators
 
std::vector< G4ITNavigator * > fNavigators
 
G4ITSafetyHelperfpSafetyHelper
 
std::vector< G4VPhysicalVolume * > fWorlds
 

Static Private Attributes

static G4ThreadLocal G4ITTransportationManagerfpInstance
 {Duplicated version of G4TransportationManager. This class just contains the pointer to the navigator object of the simulation.} More...
 

Detailed Description

Definition at line 61 of file G4ITTransportationManager.hh.

Constructor & Destructor Documentation

◆ G4ITTransportationManager()

G4ITTransportationManager::G4ITTransportationManager ( )
private

Definition at line 45 of file G4ITTransportationManager.cc.

References Initialize().

Referenced by GetTransportationManager().

◆ ~G4ITTransportationManager()

G4ITTransportationManager::~G4ITTransportationManager ( )
private

Member Function Documentation

◆ ActivateNavigator()

G4int G4ITTransportationManager::ActivateNavigator ( G4ITNavigator *  aNavigator)

Definition at line 267 of file G4ITTransportationManager.cc.

268{
269 std::vector<G4ITNavigator*>::iterator pNav = std::find(fNavigators.begin(),
270 fNavigators.end(),
271 aNavigator);
272 if (pNav == fNavigators.end())
273 {
274 G4String message = "Navigator for volume -"
275 + aNavigator->GetWorldVolume()->GetName() + "- not found in memory!";
276 G4Exception("G4ITTransportationManager::ActivateNavigator()", "GeomNav1002",
277 JustWarning, message);
278 return -1;
279 }
280
281 aNavigator->Activate(true);
282 G4int id = 0;
283 std::vector<G4ITNavigator*>::iterator pActiveNav;
284 for (pActiveNav = fActiveNavigators.begin();
285 pActiveNav != fActiveNavigators.end(); pActiveNav++)
286 {
287 if (*pActiveNav == aNavigator)
288 {
289 return id;
290 }
291 id++;
292 }
293
294 fActiveNavigators.push_back(aNavigator);
295 return id;
296}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
int G4int
Definition: G4Types.hh:85
std::vector< G4ITNavigator * > fNavigators
std::vector< G4ITNavigator * > fActiveNavigators

References fActiveNavigators, fNavigators, G4Exception(), and JustWarning.

◆ ClearNavigators()

void G4ITTransportationManager::ClearNavigators ( )
private

Definition at line 71 of file G4ITTransportationManager.cc.

72{
73 std::vector<G4ITNavigator*>::iterator pNav;
74 for (pNav = fNavigators.begin(); pNav != fNavigators.end(); pNav++)
75 {
76 delete *pNav;
77 }
78 fNavigators.clear();
79 fActiveNavigators.clear();
80 fWorlds.clear();
81}
std::vector< G4VPhysicalVolume * > fWorlds

References fActiveNavigators, fNavigators, and fWorlds.

Referenced by ~G4ITTransportationManager().

◆ DeActivateNavigator()

void G4ITTransportationManager::DeActivateNavigator ( G4ITNavigator *  aNavigator)

Definition at line 305 of file G4ITTransportationManager.cc.

306{
307 std::vector<G4ITNavigator*>::iterator pNav = std::find(fNavigators.begin(),
308 fNavigators.end(),
309 aNavigator);
310 if (pNav != fNavigators.end())
311 {
312 (*pNav)->Activate(false);
313 }
314 else
315 {
316 G4String message = "Navigator for volume -"
317 + aNavigator->GetWorldVolume()->GetName() + "- not found in memory!";
318 G4Exception("G4ITTransportationManager::DeActivateNavigator()",
319 "GeomNav1002", JustWarning, message);
320 }
321
322 std::vector<G4ITNavigator*>::iterator pActiveNav = std::find(
323 fActiveNavigators.begin(), fActiveNavigators.end(), aNavigator);
324 if (pActiveNav != fActiveNavigators.end())
325 {
326 fActiveNavigators.erase(pActiveNav);
327 }
328}

References fActiveNavigators, fNavigators, G4Exception(), and JustWarning.

◆ DeleteInstance()

void G4ITTransportationManager::DeleteInstance ( )
static

Definition at line 56 of file G4ITTransportationManager.cc.

57{
58 if (fpInstance)
59 {
60 delete fpInstance;
61 fpInstance = 0;
62 }
63}
static G4ThreadLocal G4ITTransportationManager * fpInstance
{Duplicated version of G4TransportationManager. This class just contains the pointer to the navigator...

References fpInstance.

◆ DeRegisterNavigator()

void G4ITTransportationManager::DeRegisterNavigator ( G4ITNavigator *  aNavigator)

Definition at line 228 of file G4ITTransportationManager.cc.

229{
230 if (aNavigator == fNavigators[0])
231 {
232 G4Exception("G4ITTransportationManager::DeRegisterNavigator()",
233 "GeomNav0003", FatalException,
234 "The navigator for tracking CANNOT be deregistered!");
235 }
236 std::vector<G4ITNavigator*>::iterator pNav = std::find(fNavigators.begin(),
237 fNavigators.end(),
238 aNavigator);
239 if (pNav != fNavigators.end())
240 {
241 // Deregister associated world volume
242 //
243 DeRegisterWorld((*pNav)->GetWorldVolume());
244
245 // Deregister the navigator
246 //
247 fNavigators.erase(pNav);
248 }
249 else
250 {
251 G4String message = "Navigator for volume -"
252 + aNavigator->GetWorldVolume()->GetName() + "- not found in memory!";
253 G4Exception("G4ITTransportationManager::DeRegisterNavigator()",
254 "GeomNav1002", JustWarning, message);
255 }
256}
@ FatalException
void DeRegisterWorld(G4VPhysicalVolume *aWorld)

References DeRegisterWorld(), FatalException, fNavigators, G4Exception(), and JustWarning.

◆ DeRegisterWorld()

void G4ITTransportationManager::DeRegisterWorld ( G4VPhysicalVolume aWorld)
private

Definition at line 406 of file G4ITTransportationManager.cc.

407{
408 std::vector<G4VPhysicalVolume*>::iterator pWorld = std::find(fWorlds.begin(),
409 fWorlds.end(),
410 aWorld);
411 if (pWorld != fWorlds.end())
412 {
413 fWorlds.erase(pWorld);
414 }
415 else
416 {
417 G4String message = "World volume -" + aWorld->GetName()
418 + "- not found in memory!";
419 G4Exception("G4ITTransportationManager::DeRegisterWorld()", "GeomNav1002",
420 JustWarning, message);
421 }
422}
const G4String & GetName() const

References fWorlds, G4Exception(), G4VPhysicalVolume::GetName(), and JustWarning.

Referenced by DeRegisterNavigator().

◆ GetActiveNavigatorsIterator()

std::vector< G4ITNavigator * >::iterator G4ITTransportationManager::GetActiveNavigatorsIterator ( )
inline

◆ GetNavigator() [1/2]

G4ITNavigator * G4ITTransportationManager::GetNavigator ( const G4String worldName)

Definition at line 145 of file G4ITTransportationManager.cc.

146{
147 // If already existing, return the stored pointer to the navigator
148 //
149 std::vector<G4ITNavigator*>::iterator pNav;
150 for (pNav = fNavigators.begin(); pNav != fNavigators.end(); pNav++)
151 {
152 if ((*pNav)->GetWorldVolume()->GetName() == worldName)
153 {
154 return *pNav;
155 }
156 }
157
158 // Check if world of that name already exists,
159 // create a navigator and register it
160 //
161 G4ITNavigator* aNavigator = 0;
162 G4VPhysicalVolume* aWorld = IsWorldExisting(worldName);
163 if (aWorld)
164 {
165 aNavigator = new G4ITNavigator();
166 aNavigator->SetWorldVolume(aWorld);
167 fNavigators.push_back(aNavigator);
168 }
169 else
170 {
171 G4String message = "World volume with name -"
172 + worldName
173 + "- does not exist. Create it first by GetParallelWorld() method!";
174 G4Exception("G4ITTransportationManager::GetNavigator(name)", "GeomNav0002",
175 FatalException, message);
176 }
177
178 return aNavigator;
179}
G4VPhysicalVolume * IsWorldExisting(const G4String &worldName)

References FatalException, fNavigators, G4Exception(), and IsWorldExisting().

◆ GetNavigator() [2/2]

G4ITNavigator * G4ITTransportationManager::GetNavigator ( G4VPhysicalVolume aWorld)

Definition at line 188 of file G4ITTransportationManager.cc.

189{
190 std::vector<G4ITNavigator*>::iterator pNav;
191 for (pNav = fNavigators.begin(); pNav != fNavigators.end(); pNav++)
192 {
193 if ((*pNav)->GetWorldVolume() == aWorld)
194 {
195 return *pNav;
196 }
197 }
198 G4ITNavigator* aNavigator = 0;
199 std::vector<G4VPhysicalVolume*>::iterator pWorld = std::find(fWorlds.begin(),
200 fWorlds.end(),
201 aWorld);
202 if (pWorld != fWorlds.end())
203 {
204 aNavigator = new G4ITNavigator();
205 aNavigator->SetWorldVolume(aWorld);
206 fNavigators.push_back(aNavigator);
207 }
208 else
209 {
210 G4String message = "World volume with name -"
211 + aWorld->GetName()
212 + "- does not exist. Create it first by GetParallelWorld() method!";
213 G4Exception("G4ITTransportationManager::GetNavigator(pointer)",
214 "GeomNav0002", FatalException, message);
215 }
216
217 return aNavigator;
218}

References FatalException, fNavigators, fWorlds, G4Exception(), and G4VPhysicalVolume::GetName().

◆ GetNavigatorForTracking()

G4ITNavigator * G4ITTransportationManager::GetNavigatorForTracking ( ) const

◆ GetNoActiveNavigators()

size_t G4ITTransportationManager::GetNoActiveNavigators ( ) const
inline

◆ GetNoWorlds()

size_t G4ITTransportationManager::GetNoWorlds ( ) const
inline

◆ GetParallelWorld()

G4VPhysicalVolume * G4ITTransportationManager::GetParallelWorld ( const G4String worldName)

Definition at line 123 of file G4ITTransportationManager.cc.

124{
125 G4VPhysicalVolume* wPV = IsWorldExisting(worldName);
126 if (!wPV)
127 {
128 wPV = GetNavigatorForTracking()->GetWorldVolume();
129 G4LogicalVolume* wLV = wPV->GetLogicalVolume();
130 wLV = new G4LogicalVolume(wLV->GetSolid(), 0, worldName);
131 wPV = new G4PVPlacement(wPV->GetRotation(), wPV->GetTranslation(), wLV,
132 worldName, 0, false, 0);
133 RegisterWorld(wPV);
134 }
135 return wPV;
136}
G4ITNavigator * GetNavigatorForTracking() const
G4bool RegisterWorld(G4VPhysicalVolume *aWorld)
G4VSolid * GetSolid() const
const G4RotationMatrix * GetRotation() const
const G4ThreeVector GetTranslation() const
G4LogicalVolume * GetLogicalVolume() const

References G4VPhysicalVolume::GetLogicalVolume(), GetNavigatorForTracking(), G4VPhysicalVolume::GetRotation(), G4LogicalVolume::GetSolid(), G4VPhysicalVolume::GetTranslation(), IsWorldExisting(), and RegisterWorld().

◆ GetSafetyHelper()

G4ITSafetyHelper * G4ITTransportationManager::GetSafetyHelper ( ) const
inline

◆ GetTransportationManager()

G4ITTransportationManager * G4ITTransportationManager::GetTransportationManager ( )
static

◆ GetWorldsIterator()

std::vector< G4VPhysicalVolume * >::iterator G4ITTransportationManager::GetWorldsIterator ( )
inline

◆ InactivateAll()

void G4ITTransportationManager::InactivateAll ( )

Definition at line 336 of file G4ITTransportationManager.cc.

337{
338 std::vector<G4ITNavigator*>::iterator pNav;
339 for (pNav = fActiveNavigators.begin(); pNav != fActiveNavigators.end();
340 pNav++)
341 {
342 (*pNav)->Activate(false);
343 }
344 fActiveNavigators.clear();
345
346 // Restore status for the navigator for tracking
347 //
348 fNavigators[0]->Activate(true);
349 fActiveNavigators.push_back(fNavigators[0]);
350}

References fActiveNavigators, and fNavigators.

◆ Initialize()

void G4ITTransportationManager::Initialize ( )
private

Definition at line 83 of file G4ITTransportationManager.cc.

84{
85 // Create the navigator for tracking and activate it; add to collections
86 //
87 G4ITNavigator* trackingNavigator = new G4ITNavigator();
88 trackingNavigator->Activate(true);
89 G4Navigator* navForTracking =
92 G4VPhysicalVolume* world = navForTracking->GetWorldVolume();
93 trackingNavigator->SetWorldVolume(world);
94 fNavigators.push_back(trackingNavigator);
95 fActiveNavigators.push_back(trackingNavigator);
96 //fWorlds.push_back(world); // NULL registered
97
99 ->GetNoWorlds();
100 std::vector<G4VPhysicalVolume*>::iterator it =
102
103 for (size_t i = 0; i < n_worlds; i++, it++)
104 {
105 fWorlds.push_back(*it);
106 }
108}
G4VPhysicalVolume * GetWorldVolume() const
static G4TransportationManager * GetTransportationManager()
std::vector< G4VPhysicalVolume * >::iterator GetWorldsIterator()
G4Navigator * GetNavigatorForTracking() const
size_t GetNoWorlds() const

References fActiveNavigators, fNavigators, fpSafetyHelper, fWorlds, G4TransportationManager::GetNavigatorForTracking(), G4TransportationManager::GetNoWorlds(), G4TransportationManager::GetTransportationManager(), G4TransportationManager::GetWorldsIterator(), and G4Navigator::GetWorldVolume().

Referenced by G4ITTransportationManager().

◆ IsWorldExisting()

G4VPhysicalVolume * G4ITTransportationManager::IsWorldExisting ( const G4String worldName)

Definition at line 359 of file G4ITTransportationManager.cc.

360{
361 std::vector<G4VPhysicalVolume*>::iterator pWorld = fWorlds.begin();
362 if (*pWorld == 0)
363 {
364 *pWorld = fNavigators[0]->GetWorldVolume();
365 }
366
367 for (pWorld = fWorlds.begin(); pWorld != fWorlds.end(); pWorld++)
368 {
369 if ((*pWorld)->GetName() == name)
370 {
371 return *pWorld;
372 }
373 }
374 return 0;
375}
const char * name(G4int ptype)

References fNavigators, fWorlds, and G4InuclParticleNames::name().

Referenced by GetNavigator(), and GetParallelWorld().

◆ RegisterWorld()

G4bool G4ITTransportationManager::RegisterWorld ( G4VPhysicalVolume aWorld)

Definition at line 384 of file G4ITTransportationManager.cc.

385{
386 G4bool done = false;
387
388 std::vector<G4VPhysicalVolume*>::iterator pWorld = std::find(fWorlds.begin(),
389 fWorlds.end(),
390 aWorld);
391 if (pWorld == fWorlds.end())
392 {
393 fWorlds.push_back(aWorld);
394 done = true;
395 }
396 return done;
397}
bool G4bool
Definition: G4Types.hh:86

References fWorlds.

Referenced by GetParallelWorld().

◆ SetWorldForTracking()

void G4ITTransportationManager::SetWorldForTracking ( G4VPhysicalVolume theWorld)
inline

Field Documentation

◆ fActiveNavigators

std::vector<G4ITNavigator*> G4ITTransportationManager::fActiveNavigators
private

◆ fNavigators

std::vector<G4ITNavigator*> G4ITTransportationManager::fNavigators
private

◆ fpInstance

G4ThreadLocal G4ITTransportationManager * G4ITTransportationManager::fpInstance
staticprivate

{Duplicated version of G4TransportationManager. This class just contains the pointer to the navigator object of the simulation.}

Definition at line 116 of file G4ITTransportationManager.hh.

Referenced by DeleteInstance(), and GetTransportationManager().

◆ fpSafetyHelper

G4ITSafetyHelper* G4ITTransportationManager::fpSafetyHelper
private

Definition at line 119 of file G4ITTransportationManager.hh.

Referenced by Initialize(), and ~G4ITTransportationManager().

◆ fWorlds

std::vector<G4VPhysicalVolume*> G4ITTransportationManager::fWorlds
private

The documentation for this class was generated from the following files: