Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ITTransportationManager Class Reference

#include <G4ITTransportationManager.hh>

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 ()
 

Detailed Description

Definition at line 62 of file G4ITTransportationManager.hh.

Member Function Documentation

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
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:

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 }
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:

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 }
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 G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Here is the call graph for this function:

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

Here is the caller graph for this function:

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)
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:

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 }
const G4String & GetName() const
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:

G4ITNavigator* G4ITTransportationManager::GetNavigatorForTracking ( ) const

Here is the caller graph for this function:

size_t G4ITTransportationManager::GetNoActiveNavigators ( ) const
inline
size_t G4ITTransportationManager::GetNoWorlds ( ) const
inline
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 }
G4VSolid * GetSolid() const
G4bool RegisterWorld(G4VPhysicalVolume *aWorld)
G4VPhysicalVolume * IsWorldExisting(const G4String &worldName)
G4LogicalVolume * GetLogicalVolume() const
G4ITNavigator * GetNavigatorForTracking() const

Here is the call graph for this function:

G4ITSafetyHelper* G4ITTransportationManager::GetSafetyHelper ( ) const
inline

Here is the caller graph for this function:

G4ITTransportationManager * G4ITTransportationManager::GetTransportationManager ( )
static

Definition at line 111 of file G4ITTransportationManager.cc.

112 {
113  if (fpInstance == 0) fpInstance = new G4ITTransportationManager;
114  return fpInstance;
115 }

Here is the caller graph for this function:

std::vector<G4VPhysicalVolume*>::iterator G4ITTransportationManager::GetWorldsIterator ( )
inline
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 }
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 }
const XML_Char * name
Definition: expat.h:151

Here is the caller graph for this function:

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 }
bool G4bool
Definition: G4Types.hh:79

Here is the caller graph for this function:

void G4ITTransportationManager::SetWorldForTracking ( G4VPhysicalVolume theWorld)
inline

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