Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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 61 of file G4ITTransportationManager.hh.

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

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

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

◆ 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

◆ GetActiveNavigatorsIterator()

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

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

◆ GetNavigatorForTracking()

◆ 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

◆ GetSafetyHelper()

G4ITSafetyHelper * G4ITTransportationManager::GetSafetyHelper ( ) const
inline

◆ GetTransportationManager()

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

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

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

Referenced by GetParallelWorld().

◆ SetWorldForTracking()

void G4ITTransportationManager::SetWorldForTracking ( G4VPhysicalVolume theWorld)
inline

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