Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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)
 
void DeRegisterNavigator (G4Navigator *aNavigator)
 
G4int ActivateNavigator (G4Navigator *aNavigator)
 
void DeActivateNavigator (G4Navigator *aNavigator)
 
void InactivateAll ()
 

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::G4TransportationManager ( )
protected

Definition at line 55 of file G4TransportationManager.cc.

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

◆ ~G4TransportationManager()

G4TransportationManager::~G4TransportationManager ( )
protected

Definition at line 81 of file G4TransportationManager.cc.

82{
83 delete fFieldManager;
84 delete fPropagatorInField;
85 ClearNavigators();
86 delete fGeomMessenger;
87 delete fSafetyHelper;
88}

Member Function Documentation

◆ ActivateNavigator()

G4int G4TransportationManager::ActivateNavigator ( G4Navigator aNavigator)

Definition at line 286 of file G4TransportationManager.cc.

287{
288 std::vector<G4Navigator*>::iterator pNav =
289 std::find(fNavigators.begin(), fNavigators.end(), aNavigator);
290 if (pNav == fNavigators.end())
291 {
292 G4String message
293 = "Navigator for volume -" + aNavigator->GetWorldVolume()->GetName()
294 + "- not found in memory!";
295 G4Exception("G4TransportationManager::ActivateNavigator()",
296 "GeomNav1002", JustWarning, message);
297 return -1;
298 }
299
300 aNavigator->Activate(true);
301 G4int id = 0;
302 std::vector<G4Navigator*>::iterator pActiveNav;
303 for(pActiveNav=fActiveNavigators.begin();
304 pActiveNav!=fActiveNavigators.end(); pActiveNav++)
305 {
306 if (*pActiveNav == aNavigator) { return id; }
307 id++;
308 }
309
310 fActiveNavigators.push_back(aNavigator);
311 return id;
312}
@ JustWarning
int G4int
Definition: G4Types.hh:66
const G4String & GetName() const

Referenced by G4CoupledTransportation::G4CoupledTransportation(), G4SafetyHelper::InitialiseNavigator(), G4ImportanceProcess::StartTracking(), G4WeightCutOffProcess::StartTracking(), G4WeightWindowProcess::StartTracking(), G4FastSimulationManagerProcess::StartTracking(), G4ParallelWorldProcess::StartTracking(), G4ParallelWorldScoringProcess::StartTracking(), and G4CoupledTransportation::StartTracking().

◆ DeActivateNavigator()

void G4TransportationManager::DeActivateNavigator ( G4Navigator aNavigator)

Definition at line 321 of file G4TransportationManager.cc.

322{
323 std::vector<G4Navigator*>::iterator pNav =
324 std::find(fNavigators.begin(), fNavigators.end(), aNavigator);
325 if (pNav != fNavigators.end())
326 {
327 (*pNav)->Activate(false);
328 }
329 else
330 {
331 G4String message
332 = "Navigator for volume -" + aNavigator->GetWorldVolume()->GetName()
333 + "- not found in memory!";
334 G4Exception("G4TransportationManager::DeActivateNavigator()",
335 "GeomNav1002", JustWarning, message);
336 }
337
338 std::vector<G4Navigator*>::iterator pActiveNav =
339 std::find(fActiveNavigators.begin(), fActiveNavigators.end(), aNavigator);
340 if (pActiveNav != fActiveNavigators.end())
341 {
342 fActiveNavigators.erase(pActiveNav);
343 }
344}

Referenced by G4FastSimulationManagerProcess::EndTracking().

◆ DeRegisterNavigator()

void G4TransportationManager::DeRegisterNavigator ( G4Navigator aNavigator)

Definition at line 247 of file G4TransportationManager.cc.

248{
249 if (aNavigator == fNavigators[0])
250 {
251 G4Exception("G4TransportationManager::DeRegisterNavigator()",
252 "GeomNav0003", FatalException,
253 "The navigator for tracking CANNOT be deregistered!");
254 }
255 std::vector<G4Navigator*>::iterator pNav =
256 std::find(fNavigators.begin(), fNavigators.end(), aNavigator);
257 if (pNav != fNavigators.end())
258 {
259 // Deregister associated world volume
260 //
261 DeRegisterWorld((*pNav)->GetWorldVolume());
262
263 // Deregister the navigator
264 //
265 fNavigators.erase(pNav);
266 }
267 else
268 {
269 G4String message
270 = "Navigator for volume -" + aNavigator->GetWorldVolume()->GetName()
271 + "- not found in memory!";
272 G4Exception("G4TransportationManager::DeRegisterNavigator()",
273 "GeomNav1002", JustWarning, message);
274 }
275}

◆ GetActiveNavigatorsIterator()

◆ GetFieldManager()

◆ GetNavigator() [1/2]

G4Navigator * G4TransportationManager::GetNavigator ( const G4String worldName)

Definition at line 171 of file G4TransportationManager.cc.

172{
173 // If already existing, return the stored pointer to the navigator
174 //
175 std::vector<G4Navigator*>::iterator pNav;
176 for (pNav=fNavigators.begin(); pNav!=fNavigators.end(); pNav++)
177 {
178 if ((*pNav)->GetWorldVolume()->GetName() == worldName) { return *pNav; }
179 }
180
181 // Check if world of that name already exists,
182 // create a navigator and register it
183 //
184 G4Navigator* aNavigator = 0;
185 G4VPhysicalVolume* aWorld = IsWorldExisting(worldName);
186 if(aWorld)
187 {
188 aNavigator = new G4Navigator();
189 aNavigator->SetWorldVolume(aWorld);
190 fNavigators.push_back(aNavigator);
191 }
192 else
193 {
194 G4String message
195 = "World volume with name -" + worldName
196 + "- does not exist. Create it first by GetParallelWorld() method!";
197 G4Exception("G4TransportationManager::GetNavigator(name)",
198 "GeomNav0002", FatalException, message);
199 }
200
201 return aNavigator;
202}
void SetWorldVolume(G4VPhysicalVolume *pWorld)
G4VPhysicalVolume * IsWorldExisting(const G4String &worldName)

Referenced by G4ImportanceProcess::SetParallelWorld(), G4WeightCutOffProcess::SetParallelWorld(), G4WeightWindowProcess::SetParallelWorld(), G4ParallelWorldProcess::SetParallelWorld(), G4ParallelWorldScoringProcess::SetParallelWorld(), and G4FastSimulationManagerProcess::StartTracking().

◆ GetNavigator() [2/2]

G4Navigator * G4TransportationManager::GetNavigator ( G4VPhysicalVolume aWorld)

Definition at line 211 of file G4TransportationManager.cc.

212{
213 std::vector<G4Navigator*>::iterator pNav;
214 for (pNav=fNavigators.begin(); pNav!=fNavigators.end(); pNav++)
215 {
216 if ((*pNav)->GetWorldVolume() == aWorld) { return *pNav; }
217 }
218 G4Navigator* aNavigator = 0;
219 std::vector<G4VPhysicalVolume*>::iterator pWorld =
220 std::find(fWorlds.begin(), fWorlds.end(), aWorld);
221 if (pWorld != fWorlds.end())
222 {
223 aNavigator = new G4Navigator();
224 aNavigator->SetWorldVolume(aWorld);
225 fNavigators.push_back(aNavigator);
226 }
227 else
228 {
229 G4String message
230 = "World volume with name -" + aWorld->GetName()
231 + "- does not exist. Create it first by GetParallelWorld() method!";
232 G4Exception("G4TransportationManager::GetNavigator(pointer)",
233 "GeomNav0002", FatalException, message);
234 }
235
236 return aNavigator;
237}

◆ GetNavigatorForTracking()

◆ GetNoActiveNavigators()

size_t G4TransportationManager::GetNoActiveNavigators ( ) const
inline

◆ GetNoWorlds()

size_t G4TransportationManager::GetNoWorlds ( ) const
inline

◆ GetParallelWorld()

G4VPhysicalVolume * G4TransportationManager::GetParallelWorld ( const G4String worldName)

Definition at line 147 of file G4TransportationManager.cc.

148{
149 G4VPhysicalVolume* wPV = IsWorldExisting(worldName);
150 if (!wPV)
151 {
153 G4LogicalVolume* wLV = wPV->GetLogicalVolume();
154 wLV = new G4LogicalVolume(wLV->GetSolid(), 0,
155 worldName);
156 wPV = new G4PVPlacement (wPV->GetRotation(),
157 wPV->GetTranslation(),
158 wLV, worldName, 0, false, 0);
159 RegisterWorld(wPV);
160 }
161 return wPV;
162}
G4VSolid * GetSolid() const
G4Navigator * GetNavigatorForTracking() const
const G4RotationMatrix * GetRotation() const
G4LogicalVolume * GetLogicalVolume() const
const G4ThreeVector & GetTranslation() const

Referenced by G4RunManager::ConstructScoringWorlds(), G4VUserParallelWorld::GetWorld(), G4ImportanceProcess::SetParallelWorld(), G4WeightCutOffProcess::SetParallelWorld(), G4WeightWindowProcess::SetParallelWorld(), G4ParallelWorldProcess::SetParallelWorld(), and G4ParallelWorldScoringProcess::SetParallelWorld().

◆ GetPropagatorInField()

◆ GetSafetyHelper()

◆ GetTransportationManager()

G4TransportationManager * G4TransportationManager::GetTransportationManager ( )
static

Definition at line 95 of file G4TransportationManager.cc.

96{
97 static G4TransportationManager theInstance;
98 if (!fTransportationManager)
99 fTransportationManager = &theInstance;
100
101 return fTransportationManager;
102}

Referenced by G4Scene::AddWorldIfEmpty(), G4RayTrajectory::AppendStep(), G4ErrorSurfaceTrajState::BuildErrorMatrix(), G4VPrimaryGenerator::CheckVertexInsideWorld(), G4RunManager::ConstructScoringWorlds(), G4TheRayTracer::CreateBitMap(), G4DecayWithSpin::DecayIt(), G4RunManagerKernel::DefineWorldVolume(), G4ITTransportation::DoesGlobalFieldExist(), G4TrajectoryDrawByOriginVolume::Draw(), G4DrawVoxels::DrawVoxels(), G4ASCIITreeSceneHandler::EndModeling(), G4CoupledTransportation::EndTracking(), G4TrajectoryOriginVolumeFilter::Evaluate(), G4CoupledTransportation::G4CoupledTransportation(), G4ErrorFreeTrajState::G4ErrorFreeTrajState(), G4FastSimulationManagerProcess::G4FastSimulationManagerProcess(), G4ImportanceProcess::G4ImportanceProcess(), G4ITTransportation::G4ITTransportation(), G4MultiNavigator::G4MultiNavigator(), G4ParallelWorldProcess::G4ParallelWorldProcess(), G4ParallelWorldScoringProcess::G4ParallelWorldScoringProcess(), G4PathFinder::G4PathFinder(), G4SPSPosDistribution::G4SPSPosDistribution(), G4SteppingManager::G4SteppingManager(), G4SynchrotronRadiation::G4SynchrotronRadiation(), G4SynchrotronRadiationInMat::G4SynchrotronRadiationInMat(), G4Transportation::G4Transportation(), G4VEnergyLossProcess::G4VEnergyLossProcess(), G4WeightCutOffProcess::G4WeightCutOffProcess(), G4WeightWindowProcess::G4WeightWindowProcess(), G4VisManager::GeometryHasChanged(), G4VMscModel::GetParticleChangeForMSC(), G4QSynchRad::GetRadius(), G4VUserParallelWorld::GetWorld(), G4ErrorPropagatorManager::InitFieldForBackwards(), G4SafetyHelper::InitialiseNavigator(), G4ErrorRunManagerHelper::InitializeGeometry(), G4FastSimulationManager::ListTitle(), GFlashHitMaker::make(), G4OpBoundaryProcess::PostStepDoIt(), G4VTransitionRadiation::PostStepDoIt(), G4ErrorMagFieldLimitProcess::PostStepGetPhysicalInteractionLength(), G4VMultipleScattering::PreparePhysicsTable(), G4ErrorFreeTrajState::PropagateError(), G4VisCommandSceneAddTrajectories::SetNewValue(), G4VisCommandSceneAddVolume::SetNewValue(), G4GlobalFastSimulationManager::ShowSetup(), G4FastSimulationManagerProcess::StartTracking(), G4CoupledTransportation::StartTracking(), and G4PhysicalVolumeModel::Validate().

◆ GetWorldsIterator()

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

◆ InactivateAll()

void G4TransportationManager::InactivateAll ( )

Definition at line 352 of file G4TransportationManager.cc.

353{
354 std::vector<G4Navigator*>::iterator pNav;
355 for (pNav=fActiveNavigators.begin(); pNav!=fActiveNavigators.end(); pNav++)
356 {
357 (*pNav)->Activate(false);
358 }
359 fActiveNavigators.clear();
360
361 // Restore status for the navigator for tracking
362 //
363 fNavigators[0]->Activate(true);
364 fActiveNavigators.push_back(fNavigators[0]);
365}

Referenced by G4CoupledTransportation::EndTracking().

◆ IsWorldExisting()

G4VPhysicalVolume * G4TransportationManager::IsWorldExisting ( const G4String worldName)

Definition at line 374 of file G4TransportationManager.cc.

375{
376 std::vector<G4VPhysicalVolume*>::iterator pWorld = fWorlds.begin();
377 if (*pWorld==0) { *pWorld=fNavigators[0]->GetWorldVolume(); }
378
379 for (pWorld=fWorlds.begin(); pWorld!=fWorlds.end(); pWorld++)
380 {
381 if ((*pWorld)->GetName() == name ) { return *pWorld; }
382 }
383 return 0;
384}

Referenced by G4RunManager::ConstructScoringWorlds(), GetNavigator(), GetParallelWorld(), and G4FastSimulationManagerProcess::SetWorldVolume().

◆ SetFieldManager()

void G4TransportationManager::SetFieldManager ( G4FieldManager newFieldManager)

Definition at line 109 of file G4TransportationManager.cc.

110{
111 fFieldManager = newFieldManager;
112
113 // Message the PropagatorInField,
114 // which also maintains this information (to be reviewed)
115 //
116 if( fPropagatorInField )
117 {
118 fPropagatorInField -> SetDetectorFieldManager( newFieldManager );
119 }
120}

◆ SetNavigatorForTracking()

void G4TransportationManager::SetNavigatorForTracking ( G4Navigator newNavigator)
inline

◆ SetPropagatorInField()

void G4TransportationManager::SetPropagatorInField ( G4PropagatorInField newFieldPropagator)
inline

◆ SetWorldForTracking()

void G4TransportationManager::SetWorldForTracking ( G4VPhysicalVolume theWorld)
inline

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