Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4TransportationManager Class Reference

#include <G4TransportationManager.hh>

Public Member Functions

G4PropagatorInFieldGetPropagatorInField () const
 
void SetPropagatorInField (G4PropagatorInField *newFieldPropagator)
 
G4FieldManagerGetFieldManager () const
 
void SetFieldManager (G4FieldManager *newFieldManager)
 
G4NavigatorGetNavigatorForTracking () const
 
void SetNavigatorForTracking (G4Navigator *newNavigator)
 
void SetWorldForTracking (G4VPhysicalVolume *theWorld)
 
size_t GetNoActiveNavigators () const
 
std::vector< G4Navigator * >
::iterator 
GetActiveNavigatorsIterator ()
 
size_t GetNoWorlds () const
 
std::vector< G4VPhysicalVolume * >
::iterator 
GetWorldsIterator ()
 
G4SafetyHelperGetSafetyHelper () const
 
G4VPhysicalVolumeGetParallelWorld (const G4String &worldName)
 
G4VPhysicalVolumeIsWorldExisting (const G4String &worldName)
 
G4NavigatorGetNavigator (const G4String &worldName)
 
G4NavigatorGetNavigator (G4VPhysicalVolume *aWorld)
 
G4bool RegisterWorld (G4VPhysicalVolume *aWorld)
 
void DeRegisterNavigator (G4Navigator *aNavigator)
 
G4int ActivateNavigator (G4Navigator *aNavigator)
 
void DeActivateNavigator (G4Navigator *aNavigator)
 
void InactivateAll ()
 
void ClearParallelWorlds ()
 

Static Public Member Functions

static G4TransportationManagerGetTransportationManager ()
 

Protected Member Functions

 G4TransportationManager ()
 
 ~G4TransportationManager ()
 

Detailed Description

Definition at line 57 of file G4TransportationManager.hh.

Constructor & Destructor Documentation

G4TransportationManager::G4TransportationManager ( )
protected

Definition at line 56 of file G4TransportationManager.cc.

57 {
58  if (fTransportationManager)
59  {
60  G4Exception("G4TransportationManager::G4TransportationManager()",
61  "GeomNav0002", FatalException,
62  "Only ONE instance of G4TransportationManager is allowed!");
63  }
64 
65  // Create the navigator for tracking and activate it; add to collections
66  //
67  G4Navigator* trackingNavigator = new G4Navigator();
68  trackingNavigator->Activate(true);
69  fNavigators.push_back(trackingNavigator);
70  fActiveNavigators.push_back(trackingNavigator);
71  fWorlds.push_back(trackingNavigator->GetWorldVolume()); // NULL registered
72 
73  fGeomMessenger = new G4GeometryMessenger(this);
74  fFieldManager = new G4FieldManager();
75  fPropagatorInField= new G4PropagatorInField(trackingNavigator,fFieldManager);
76  fSafetyHelper = new G4SafetyHelper();
77 }
void Activate(G4bool flag)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4VPhysicalVolume * GetWorldVolume() const

Here is the call graph for this function:

Here is the caller graph for this function:

G4TransportationManager::~G4TransportationManager ( )
protected

Definition at line 82 of file G4TransportationManager.cc.

83 {
84  delete fFieldManager;
85  delete fPropagatorInField;
86  ClearNavigators();
87  delete fGeomMessenger;
88  delete fSafetyHelper;
89  if (fTransportationManager)
90  {
91  delete fTransportationManager; fTransportationManager=0;
92  }
93 }

Member Function Documentation

G4int G4TransportationManager::ActivateNavigator ( G4Navigator aNavigator)

Definition at line 304 of file G4TransportationManager.cc.

305 {
306  std::vector<G4Navigator*>::iterator pNav =
307  std::find(fNavigators.begin(), fNavigators.end(), aNavigator);
308  if (pNav == fNavigators.end())
309  {
310  G4String message
311  = "Navigator for volume -" + aNavigator->GetWorldVolume()->GetName()
312  + "- not found in memory!";
313  G4Exception("G4TransportationManager::ActivateNavigator()",
314  "GeomNav1002", FatalException, message);
315  return -1;
316  }
317 
318  aNavigator->Activate(true);
319  G4int id = 0;
320  std::vector<G4Navigator*>::iterator pActiveNav;
321  for(pActiveNav=fActiveNavigators.begin();
322  pActiveNav!=fActiveNavigators.end(); pActiveNav++)
323  {
324  if (*pActiveNav == aNavigator) { return id; }
325  id++;
326  }
327 
328  fActiveNavigators.push_back(aNavigator);
329  return id;
330 }
int G4int
Definition: G4Types.hh:78
const G4String & GetName() const
void Activate(G4bool flag)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4VPhysicalVolume * GetWorldVolume() const

Here is the call graph for this function:

Here is the caller graph for this function:

void G4TransportationManager::ClearParallelWorlds ( )

Definition at line 457 of file G4TransportationManager.cc.

458 {
459  std::vector<G4Navigator*>::iterator pNav = fNavigators.begin();
460  G4Navigator* trackingNavigator = *pNav;
461  for (pNav=fNavigators.begin(); pNav!=fNavigators.end(); pNav++)
462  {
463  if (*pNav != trackingNavigator) { delete *pNav; }
464  }
465  fNavigators.clear();
466  fActiveNavigators.clear();
467  fWorlds.clear();
468 
469  // trackingNavigator->SetWorldVolume(0);
470  fNavigators.push_back(trackingNavigator);
471  fActiveNavigators.push_back(trackingNavigator);
472  // fWorlds.push_back(trackingNavigator->GetWorldVolume()); // NULL registered
473  fWorlds.push_back(0); // NULL registered
474 }

Here is the caller graph for this function:

void G4TransportationManager::DeActivateNavigator ( G4Navigator aNavigator)

Definition at line 339 of file G4TransportationManager.cc.

340 {
341  std::vector<G4Navigator*>::iterator pNav =
342  std::find(fNavigators.begin(), fNavigators.end(), aNavigator);
343  if (pNav != fNavigators.end())
344  {
345  (*pNav)->Activate(false);
346  }
347  else
348  {
349  G4String message
350  = "Navigator for volume -" + aNavigator->GetWorldVolume()->GetName()
351  + "- not found in memory!";
352  G4Exception("G4TransportationManager::DeActivateNavigator()",
353  "GeomNav1002", JustWarning, message);
354  }
355 
356  std::vector<G4Navigator*>::iterator pActiveNav =
357  std::find(fActiveNavigators.begin(), fActiveNavigators.end(), aNavigator);
358  if (pActiveNav != fActiveNavigators.end())
359  {
360  fActiveNavigators.erase(pActiveNav);
361  }
362 }
const G4String & GetName() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4VPhysicalVolume * GetWorldVolume() const

Here is the call graph for this function:

Here is the caller graph for this function:

void G4TransportationManager::DeRegisterNavigator ( G4Navigator aNavigator)

Definition at line 265 of file G4TransportationManager.cc.

266 {
267  if (aNavigator == fNavigators[0])
268  {
269  G4Exception("G4TransportationManager::DeRegisterNavigator()",
270  "GeomNav0003", FatalException,
271  "The navigator for tracking CANNOT be deregistered!");
272  }
273  std::vector<G4Navigator*>::iterator pNav =
274  std::find(fNavigators.begin(), fNavigators.end(), aNavigator);
275  if (pNav != fNavigators.end())
276  {
277  // Deregister associated world volume
278  //
279  DeRegisterWorld((*pNav)->GetWorldVolume());
280 
281  // Deregister the navigator
282  //
283  fNavigators.erase(pNav);
284  }
285  else
286  {
287  G4String message
288  = "Navigator for volume -" + aNavigator->GetWorldVolume()->GetName()
289  + "- not found in memory!";
290  G4Exception("G4TransportationManager::DeRegisterNavigator()",
291  "GeomNav1002", JustWarning, message);
292  }
293 }
const G4String & GetName() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4VPhysicalVolume * GetWorldVolume() const

Here is the call graph for this function:

std::vector<G4Navigator*>::iterator G4TransportationManager::GetActiveNavigatorsIterator ( )
inline

Here is the caller graph for this function:

G4FieldManager* G4TransportationManager::GetFieldManager ( ) const
inline

Here is the caller graph for this function:

G4Navigator * G4TransportationManager::GetNavigator ( const G4String worldName)

Definition at line 189 of file G4TransportationManager.cc.

190 {
191  // If already existing, return the stored pointer to the navigator
192  //
193  std::vector<G4Navigator*>::iterator pNav;
194  for (pNav=fNavigators.begin(); pNav!=fNavigators.end(); pNav++)
195  {
196  if ((*pNav)->GetWorldVolume()->GetName() == worldName) { return *pNav; }
197  }
198 
199  // Check if world of that name already exists,
200  // create a navigator and register it
201  //
202  G4Navigator* aNavigator = 0;
203  G4VPhysicalVolume* aWorld = IsWorldExisting(worldName);
204  if(aWorld)
205  {
206  aNavigator = new G4Navigator();
207  aNavigator->SetWorldVolume(aWorld);
208  fNavigators.push_back(aNavigator);
209  }
210  else
211  {
212  G4String message
213  = "World volume with name -" + worldName
214  + "- does not exist. Create it first by GetParallelWorld() method!";
215  G4Exception("G4TransportationManager::GetNavigator(name)",
216  "GeomNav0002", FatalException, message);
217  }
218 
219  return aNavigator;
220 }
G4VPhysicalVolume * IsWorldExisting(const G4String &worldName)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
void SetWorldVolume(G4VPhysicalVolume *pWorld)

Here is the call graph for this function:

Here is the caller graph for this function:

G4Navigator * G4TransportationManager::GetNavigator ( G4VPhysicalVolume aWorld)

Definition at line 229 of file G4TransportationManager.cc.

230 {
231  std::vector<G4Navigator*>::iterator pNav;
232  for (pNav=fNavigators.begin(); pNav!=fNavigators.end(); pNav++)
233  {
234  if ((*pNav)->GetWorldVolume() == aWorld) { return *pNav; }
235  }
236  G4Navigator* aNavigator = 0;
237  std::vector<G4VPhysicalVolume*>::iterator pWorld =
238  std::find(fWorlds.begin(), fWorlds.end(), aWorld);
239  if (pWorld != fWorlds.end())
240  {
241  aNavigator = new G4Navigator();
242  aNavigator->SetWorldVolume(aWorld);
243  fNavigators.push_back(aNavigator);
244  }
245  else
246  {
247  G4String message
248  = "World volume with name -" + aWorld->GetName()
249  + "- does not exist. Create it first by GetParallelWorld() method!";
250  G4Exception("G4TransportationManager::GetNavigator(pointer)",
251  "GeomNav0002", FatalException, message);
252  }
253 
254  return aNavigator;
255 }
const G4String & GetName() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
void SetWorldVolume(G4VPhysicalVolume *pWorld)

Here is the call graph for this function:

G4Navigator* G4TransportationManager::GetNavigatorForTracking ( ) const
inline

Here is the caller graph for this function:

size_t G4TransportationManager::GetNoActiveNavigators ( ) const
inline
size_t G4TransportationManager::GetNoWorlds ( ) const
inline

Here is the caller graph for this function:

G4VPhysicalVolume * G4TransportationManager::GetParallelWorld ( const G4String worldName)

Definition at line 165 of file G4TransportationManager.cc.

166 {
167  G4VPhysicalVolume* wPV = IsWorldExisting(worldName);
168  if (!wPV)
169  {
171  G4LogicalVolume* wLV = wPV->GetLogicalVolume();
172  wLV = new G4LogicalVolume(wLV->GetSolid(), 0,
173  worldName);
174  wPV = new G4PVPlacement (wPV->GetRotation(),
175  wPV->GetTranslation(),
176  wLV, worldName, 0, false, 0);
177  RegisterWorld(wPV);
178  }
179  return wPV;
180 }
G4VPhysicalVolume * IsWorldExisting(const G4String &worldName)
G4Navigator * GetNavigatorForTracking() const
G4VSolid * GetSolid() const
G4LogicalVolume * GetLogicalVolume() const
G4bool RegisterWorld(G4VPhysicalVolume *aWorld)
G4VPhysicalVolume * GetWorldVolume() const

Here is the call graph for this function:

Here is the caller graph for this function:

G4PropagatorInField* G4TransportationManager::GetPropagatorInField ( ) const
inline

Here is the caller graph for this function:

G4SafetyHelper* G4TransportationManager::GetSafetyHelper ( ) const
inline

Here is the caller graph for this function:

G4TransportationManager * G4TransportationManager::GetTransportationManager ( )
static

Definition at line 100 of file G4TransportationManager.cc.

101 {
102  if (!fTransportationManager)
103  {
104  fTransportationManager = new G4TransportationManager;
105  }
106  return fTransportationManager;
107 }

Here is the call graph for this function:

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

Here is the caller graph for this function:

void G4TransportationManager::InactivateAll ( )

Definition at line 370 of file G4TransportationManager.cc.

371 {
372  std::vector<G4Navigator*>::iterator pNav;
373  for (pNav=fActiveNavigators.begin(); pNav!=fActiveNavigators.end(); pNav++)
374  {
375  (*pNav)->Activate(false);
376  }
377  fActiveNavigators.clear();
378 
379  // Restore status for the navigator for tracking
380  //
381  fNavigators[0]->Activate(true);
382  fActiveNavigators.push_back(fNavigators[0]);
383 }

Here is the caller graph for this function:

G4VPhysicalVolume * G4TransportationManager::IsWorldExisting ( const G4String worldName)

Definition at line 392 of file G4TransportationManager.cc.

393 {
394  std::vector<G4VPhysicalVolume*>::iterator pWorld = fWorlds.begin();
395  if (*pWorld==0) { *pWorld=fNavigators[0]->GetWorldVolume(); }
396 
397  for (pWorld=fWorlds.begin(); pWorld!=fWorlds.end(); pWorld++)
398  {
399  if ((*pWorld)->GetName() == name ) { return *pWorld; }
400  }
401  return 0;
402 }
const XML_Char * name
Definition: expat.h:151

Here is the caller graph for this function:

G4bool G4TransportationManager::RegisterWorld ( G4VPhysicalVolume aWorld)

Definition at line 411 of file G4TransportationManager.cc.

412 {
413  G4bool done = false;
414 
415  std::vector<G4VPhysicalVolume*>::iterator pWorld =
416  std::find(fWorlds.begin(), fWorlds.end(), aWorld);
417  if (pWorld == fWorlds.end())
418  {
419  fWorlds.push_back(aWorld);
420  done = true;
421  }
422  return done;
423 }
bool G4bool
Definition: G4Types.hh:79

Here is the caller graph for this function:

void G4TransportationManager::SetFieldManager ( G4FieldManager newFieldManager)

Definition at line 114 of file G4TransportationManager.cc.

115 {
116  fFieldManager = newFieldManager;
117 
118  // Message the PropagatorInField,
119  // which also maintains this information (to be reviewed)
120  //
121  if( fPropagatorInField )
122  {
123  fPropagatorInField -> SetDetectorFieldManager( newFieldManager );
124  }
125 }
void G4TransportationManager::SetNavigatorForTracking ( G4Navigator newNavigator)

Definition at line 133 of file G4TransportationManager.cc.

134 {
135  fNavigators[0] = newNavigator;
136  fActiveNavigators[0] = newNavigator;
137  fPropagatorInField->SetNavigatorForPropagating(newNavigator);
138 }
void SetNavigatorForPropagating(G4Navigator *SimpleOrMultiNavigator)

Here is the call graph for this function:

void G4TransportationManager::SetPropagatorInField ( G4PropagatorInField newFieldPropagator)
inline
void G4TransportationManager::SetWorldForTracking ( G4VPhysicalVolume theWorld)
inline

Here is the caller graph for this function:


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