Geant4  10.02.p03
G4ITTransportationManager Class Reference

#include <G4ITTransportationManager.hh>

Collaboration diagram for G4ITTransportationManager:

Public Member Functions

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

Static Public Member Functions

static void DeleteInstance ()
 
static G4ITTransportationManagerGetTransportationManager ()
 

Private Member Functions

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

Private Attributes

G4ITSafetyHelperfpSafetyHelper
 
std::vector< G4ITNavigator * > fNavigators
 
std::vector< G4ITNavigator * > fActiveNavigators
 
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 62 of file G4ITTransportationManager.hh.

Constructor & Destructor Documentation

◆ G4ITTransportationManager()

G4ITTransportationManager::G4ITTransportationManager ( )
private

Definition at line 46 of file G4ITTransportationManager.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~G4ITTransportationManager()

G4ITTransportationManager::~G4ITTransportationManager ( )
private

Definition at line 51 of file G4ITTransportationManager.cc.

Here is the call graph for this function:

Member Function Documentation

◆ ActivateNavigator()

G4int G4ITTransportationManager::ActivateNavigator ( G4ITNavigator *  aNavigator)

Definition at line 268 of file G4ITTransportationManager.cc.

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

◆ ClearNavigators()

void G4ITTransportationManager::ClearNavigators ( )
private

Definition at line 72 of file G4ITTransportationManager.cc.

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

◆ DeActivateNavigator()

void G4ITTransportationManager::DeActivateNavigator ( G4ITNavigator *  aNavigator)

Definition at line 306 of file G4ITTransportationManager.cc.

307 {
308  std::vector<G4ITNavigator*>::iterator pNav = std::find(fNavigators.begin(),
309  fNavigators.end(),
310  aNavigator);
311  if (pNav != fNavigators.end())
312  {
313  (*pNav)->Activate(false);
314  }
315  else
316  {
317  G4String message = "Navigator for volume -"
318  + aNavigator->GetWorldVolume()->GetName() + "- not found in memory!";
319  G4Exception("G4ITTransportationManager::DeActivateNavigator()",
320  "GeomNav1002", JustWarning, message);
321  }
322 
323  std::vector<G4ITNavigator*>::iterator pActiveNav = std::find(
324  fActiveNavigators.begin(), fActiveNavigators.end(), aNavigator);
325  if (pActiveNav != fActiveNavigators.end())
326  {
327  fActiveNavigators.erase(pActiveNav);
328  }
329 }
std::vector< G4ITNavigator * > fActiveNavigators
std::vector< G4ITNavigator * > fNavigators
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
Here is the call graph for this function:

◆ DeleteInstance()

void G4ITTransportationManager::DeleteInstance ( )
static

Definition at line 57 of file G4ITTransportationManager.cc.

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

◆ DeRegisterNavigator()

void G4ITTransportationManager::DeRegisterNavigator ( G4ITNavigator *  aNavigator)

Definition at line 229 of file G4ITTransportationManager.cc.

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

◆ DeRegisterWorld()

void G4ITTransportationManager::DeRegisterWorld ( G4VPhysicalVolume aWorld)
private

Definition at line 407 of file G4ITTransportationManager.cc.

408 {
409  std::vector<G4VPhysicalVolume*>::iterator pWorld = std::find(fWorlds.begin(),
410  fWorlds.end(),
411  aWorld);
412  if (pWorld != fWorlds.end())
413  {
414  fWorlds.erase(pWorld);
415  }
416  else
417  {
418  G4String message = "World volume -" + aWorld->GetName()
419  + "- not found in memory!";
420  G4Exception("G4ITTransportationManager::DeRegisterWorld()", "GeomNav1002",
421  JustWarning, message);
422  }
423 }
std::vector< G4VPhysicalVolume * > fWorlds
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
const G4String & GetName() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetActiveNavigatorsIterator()

std::vector<G4ITNavigator*>::iterator G4ITTransportationManager::GetActiveNavigatorsIterator ( )
inline
Here is the caller graph for this function:

◆ GetNavigator() [1/2]

G4ITNavigator * G4ITTransportationManager::GetNavigator ( const G4String worldName)

Definition at line 146 of file G4ITTransportationManager.cc.

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

◆ GetNavigator() [2/2]

G4ITNavigator * G4ITTransportationManager::GetNavigator ( G4VPhysicalVolume aWorld)

Definition at line 189 of file G4ITTransportationManager.cc.

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

◆ GetNavigatorForTracking()

G4ITNavigator* G4ITTransportationManager::GetNavigatorForTracking ( ) const
Here is the caller graph for this function:

◆ GetNoActiveNavigators()

size_t G4ITTransportationManager::GetNoActiveNavigators ( ) const
inline

◆ GetNoWorlds()

size_t G4ITTransportationManager::GetNoWorlds ( ) const
inline

◆ GetParallelWorld()

G4VPhysicalVolume * G4ITTransportationManager::GetParallelWorld ( const G4String worldName)

Definition at line 124 of file G4ITTransportationManager.cc.

125 {
126  G4VPhysicalVolume* wPV = IsWorldExisting(worldName);
127  if (!wPV)
128  {
129  wPV = GetNavigatorForTracking()->GetWorldVolume();
130  G4LogicalVolume* wLV = wPV->GetLogicalVolume();
131  wLV = new G4LogicalVolume(wLV->GetSolid(), 0, worldName);
132  wPV = new G4PVPlacement(wPV->GetRotation(), wPV->GetTranslation(), wLV,
133  worldName, 0, false, 0);
134  RegisterWorld(wPV);
135  }
136  return wPV;
137 }
G4ITNavigator * GetNavigatorForTracking() const
G4bool RegisterWorld(G4VPhysicalVolume *aWorld)
G4VPhysicalVolume * IsWorldExisting(const G4String &worldName)
G4LogicalVolume * GetLogicalVolume() const
G4VSolid * GetSolid() const
Here is the call graph for this function:

◆ GetSafetyHelper()

G4ITSafetyHelper* G4ITTransportationManager::GetSafetyHelper ( ) const
inline
Here is the caller graph for this function:

◆ GetTransportationManager()

G4ITTransportationManager * G4ITTransportationManager::GetTransportationManager ( )
static

Definition at line 111 of file G4ITTransportationManager.cc.

112 {
114  return fpInstance;
115 }
static G4ThreadLocal G4ITTransportationManager * fpInstance
{Duplicated version of G4TransportationManager. This class just contains the pointer to the navigator...
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetWorldsIterator()

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

◆ InactivateAll()

void G4ITTransportationManager::InactivateAll ( )

Definition at line 337 of file G4ITTransportationManager.cc.

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

◆ Initialize()

void G4ITTransportationManager::Initialize ( )
private

Definition at line 84 of file G4ITTransportationManager.cc.

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

◆ IsWorldExisting()

G4VPhysicalVolume * G4ITTransportationManager::IsWorldExisting ( const G4String worldName)

Definition at line 360 of file G4ITTransportationManager.cc.

361 {
362  std::vector<G4VPhysicalVolume*>::iterator pWorld = fWorlds.begin();
363  if (*pWorld == 0)
364  {
365  *pWorld = fNavigators[0]->GetWorldVolume();
366  }
367 
368  for (pWorld = fWorlds.begin(); pWorld != fWorlds.end(); pWorld++)
369  {
370  if ((*pWorld)->GetName() == name)
371  {
372  return *pWorld;
373  }
374  }
375  return 0;
376 }
G4String name
Definition: TRTMaterials.hh:40
std::vector< G4VPhysicalVolume * > fWorlds
std::vector< G4ITNavigator * > fNavigators
Here is the caller graph for this function:

◆ RegisterWorld()

G4bool G4ITTransportationManager::RegisterWorld ( G4VPhysicalVolume aWorld)

Definition at line 385 of file G4ITTransportationManager.cc.

386 {
387  G4bool done = false;
388 
389  std::vector<G4VPhysicalVolume*>::iterator pWorld = std::find(fWorlds.begin(),
390  fWorlds.end(),
391  aWorld);
392  if (pWorld == fWorlds.end())
393  {
394  fWorlds.push_back(aWorld);
395  done = true;
396  }
397  return done;
398 }
std::vector< G4VPhysicalVolume * > fWorlds
bool G4bool
Definition: G4Types.hh:79
Here is the caller graph for this function:

◆ SetWorldForTracking()

void G4ITTransportationManager::SetWorldForTracking ( G4VPhysicalVolume theWorld)
inline

Member Data Documentation

◆ fActiveNavigators

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

Definition at line 123 of file G4ITTransportationManager.hh.

◆ fNavigators

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

Definition at line 121 of file G4ITTransportationManager.hh.

◆ 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 117 of file G4ITTransportationManager.hh.

◆ fpSafetyHelper

G4ITSafetyHelper* G4ITTransportationManager::fpSafetyHelper
private

Definition at line 120 of file G4ITTransportationManager.hh.

◆ fWorlds

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

Definition at line 125 of file G4ITTransportationManager.hh.


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