Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ITMultiNavigator Class Reference

#include <G4ITMultiNavigator.hh>

+ Inheritance diagram for G4ITMultiNavigator:

Public Member Functions

 G4ITMultiNavigator ()
 
 ~G4ITMultiNavigator () override
 
G4double ComputeStep (const G4ThreeVector &pGlobalPoint, const G4ThreeVector &pDirection, const G4double pCurrentProposedStepLength, G4double &pNewSafety) override
 
G4double ObtainFinalStep (G4int navigatorId, G4double &pNewSafety, G4double &minStepLast, ELimited &limitedStep)
 
void PrepareNavigators ()
 
void PrepareNewTrack (const G4ThreeVector position, const G4ThreeVector direction)
 
G4VPhysicalVolumeResetHierarchyAndLocate (const G4ThreeVector &point, const G4ThreeVector &direction, const G4TouchableHistory &h) override
 
G4VPhysicalVolumeLocateGlobalPointAndSetup (const G4ThreeVector &point, const G4ThreeVector *direction=nullptr, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true) override
 
void LocateGlobalPointWithinVolume (const G4ThreeVector &position) override
 
G4double ComputeSafety (const G4ThreeVector &globalpoint, const G4double pProposedMaxLength=DBL_MAX, const G4bool keepState=false) override
 
G4TouchableHandle CreateTouchableHistoryHandle () const override
 
G4ThreeVector GetLocalExitNormal (G4bool *obtained) override
 
G4ThreeVector GetLocalExitNormalAndCheck (const G4ThreeVector &CurrentE_Point, G4bool *obtained) override
 
G4ThreeVector GetGlobalExitNormal (const G4ThreeVector &CurrentE_Point, G4bool *obtained) override
 
G4ITNavigator * GetNavigator (G4int n) const
 
- Public Member Functions inherited from G4TrackStateDependent< G4ITMultiNavigator >
 ~G4TrackStateDependent () override=default
 
virtual void SetTrackState (G4shared_ptr< StateType > state)
 
G4VTrackStateHandle PopTrackState () override
 
G4VTrackStateHandle GetTrackState () const override
 
virtual StateTypeHandle GetConcreteTrackState () const
 
void LoadTrackState (G4TrackStateManager &manager) override
 
void SaveTrackState (G4TrackStateManager &manager) override
 
void NewTrackState () override
 
virtual StateTypeHandle CreateTrackState () const
 
void ResetTrackState () override
 
- Public Member Functions inherited from G4VTrackStateDependent
 G4VTrackStateDependent ()=default
 
virtual ~G4VTrackStateDependent ()=default
 

Protected Member Functions

void ResetState () override
 
void SetupHierarchy () override
 
void WhichLimited ()
 
void PrintLimited ()
 
void CheckMassWorld ()
 
- Protected Member Functions inherited from G4TrackStateDependent< G4ITMultiNavigator >
 G4TrackStateDependent ()
 

Friends

std::ostream & operator<< (std::ostream &os, const G4ITNavigator &n)
 

Additional Inherited Members

- Public Types inherited from G4TrackStateDependent< G4ITMultiNavigator >
using ClassType
 
using StateType
 
using StateTypeHandle
 
- Protected Attributes inherited from G4TrackStateDependent< G4ITMultiNavigator >
StateTypeHandle fpTrackState
 

Detailed Description

Definition at line 142 of file G4ITMultiNavigator.hh.

Constructor & Destructor Documentation

◆ G4ITMultiNavigator()

G4ITMultiNavigator::G4ITMultiNavigator ( )

Definition at line 67 of file G4ITMultiNavigator.cc.

68{
69 fNoActiveNavigators= 0;
70
71 for(auto & num : fpNavigator)
72 {
73 num = nullptr;
74 }
75
77
78 G4ITNavigator* massNav= pTransportManager->GetNavigatorForTracking();
79 if( massNav != nullptr )
80 {
81 G4VPhysicalVolume* pWorld= massNav->GetWorldVolume();
82 if( pWorld != nullptr )
83 {
84 SetWorldVolume( pWorld );
85 fLastMassWorld = pWorld;
86 }
87 }
88}
static G4ITTransportationManager * GetTransportationManager()
G4ITNavigator * GetNavigatorForTracking() const

◆ ~G4ITMultiNavigator()

G4ITMultiNavigator::~G4ITMultiNavigator ( )
overridedefault

Member Function Documentation

◆ CheckMassWorld()

void G4ITMultiNavigator::CheckMassWorld ( )
protected

Definition at line 637 of file G4ITMultiNavigator.cc.

638{
639 G4VPhysicalVolume* navTrackWorld=
640 pTransportManager->GetNavigatorForTracking()->GetWorldVolume();
641
642 if( navTrackWorld != fLastMassWorld )
643 {
644 G4Exception( "G4ITMultiNavigator::CheckMassWorld()",
645 "GeomNav0003", FatalException,
646 "Mass world pointer has been changed." );
647 }
648}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)

◆ ComputeSafety()

G4double G4ITMultiNavigator::ComputeSafety ( const G4ThreeVector & globalpoint,
const G4double pProposedMaxLength = DBL_MAX,
const G4bool keepState = false )
override

Definition at line 428 of file G4ITMultiNavigator.cc.

431{
432 // Recompute safety for the relevant point
433
434 G4double minSafety = kInfinity, safety = kInfinity;
435
436 std::vector<G4ITNavigator*>::iterator pNavigatorIter;
437 pNavigatorIter= pTransportManager-> GetActiveNavigatorsIterator();
438
439 for( G4int num=0; num< fNoActiveNavigators; ++pNavigatorIter,++num )
440 {
441 safety = (*pNavigatorIter)->ComputeSafety( position, maxDistance, state);
442 if( safety < minSafety ) { minSafety = safety; }
443 }
444
446 fMinSafety_atSafLocation = minSafety;
447
448#ifdef G4DEBUG_NAVIGATION
449 if( fVerbose > 1 )
450 {
451 G4cout << " G4ITMultiNavigator::ComputeSafety - returns: "
452 << minSafety << ", at location: " << position << G4endl;
453 }
454#endif
455 return minSafety;
456}
#define fMinSafety_atSafLocation
#define fSafetyLocation
double G4double
Definition G4Types.hh:83
int G4int
Definition G4Types.hh:85
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout

◆ ComputeStep()

G4double G4ITMultiNavigator::ComputeStep ( const G4ThreeVector & pGlobalPoint,
const G4ThreeVector & pDirection,
const G4double pCurrentProposedStepLength,
G4double & pNewSafety )
override

Definition at line 93 of file G4ITMultiNavigator.cc.

97{
98 G4double safety= 0.0, step=0.0;
99 G4double minSafety= kInfinity, minStep= kInfinity;
100
101 fNoLimitingStep= -1;
102 fIdNavLimiting= -1; // Reset for new step
103
104#ifdef G4DEBUG_NAVIGATION
105 if( fVerbose > 2 )
106 {
107 G4cout << " G4ITMultiNavigator::ComputeStep : entered " << G4endl;
108 G4cout << " Input position= " << pGlobalPoint
109 << " direction= " << pDirection << G4endl;
110 G4cout << " Requested step= " << proposedStepLength << G4endl;
111 }
112#endif
113
114 std::vector<G4ITNavigator*>::iterator pNavigatorIter;
115
116 pNavigatorIter= pTransportManager-> GetActiveNavigatorsIterator();
117
118 G4ThreeVector initialPosition = pGlobalPoint;
119 G4ThreeVector initialDirection= pDirection;
120
121 for( G4int num=0; num< fNoActiveNavigators; ++pNavigatorIter,++num )
122 {
123 safety= kInfinity;
124
125 step= (*pNavigatorIter)->ComputeStep( initialPosition,
126 initialDirection,
127 proposedStepLength,
128 safety );
129 if( safety < minSafety ){ minSafety = safety; }
130 if( step < minStep ) { minStep= step; }
131
132 fCurrentStepSize[num] = step;
133 fNewSafety[num]= safety;
134 // This is currently the safety from the last sub-step
135
136#ifdef G4DEBUG_NAVIGATION
137 if( fVerbose > 2 )
138 {
139 G4cout << "G4ITMultiNavigator::ComputeStep : Navigator ["
140 << num << "] -- step size " << step
141 << " safety= " << safety << G4endl;
142 }
143#endif
144 }
145
146 // Save safety value, related position
147 //
148 fPreStepLocation = initialPosition;
149 fMinSafety_PreStepPt = minSafety;
150 fMinStep = minStep;
151
152 if( fMinStep == kInfinity )
153 {
154 fTrueMinStep = proposedStepLength; // Use this below for endpoint !!
155 }
156 else
157 {
158 fTrueMinStep = minStep;
159 }
160
161#ifdef G4DEBUG_NAVIGATION
162 if( fVerbose > 1 )
163 {
164 G4ThreeVector endPosition = initialPosition+fTrueMinStep*initialDirection;
165
166 G4int oldPrec = G4cout.precision(8);
167 G4cout << "G4ITMultiNavigator::ComputeStep : "
168 << " initialPosition = " << initialPosition
169 << " and endPosition = " << endPosition << G4endl;
170 G4cout.precision( oldPrec );
171 }
172#endif
173
174 pNewSafety = minSafety;
175
176 this->WhichLimited();
177
178#ifdef G4DEBUG_NAVIGATION
179 if( fVerbose > 2 )
180 {
181 G4cout << " G4ITMultiNavigator::ComputeStep : exits returning "
182 << minStep << G4endl;
183 }
184#endif
185
186 return minStep; // must return kInfinity if do not limit step
187}
#define fMinStep
#define fTrueMinStep
#define fIdNavLimiting
#define fNoLimitingStep
#define fNewSafety
#define fPreStepLocation
#define fCurrentStepSize
#define fMinSafety_PreStepPt

◆ CreateTouchableHistoryHandle()

G4TouchableHandle G4ITMultiNavigator::CreateTouchableHistoryHandle ( ) const
override

Definition at line 460 of file G4ITMultiNavigator.cc.

461{
462 G4Exception( "G4ITMultiNavigator::CreateTouchableHistoryHandle()",
463 "GeomNav0001", FatalException,
464 "Getting a touchable from G4ITMultiNavigator is not defined.");
465
466 G4TouchableHistory* touchHist;
467 touchHist= fpNavigator[0] -> CreateTouchableHistory();
468
469 G4VPhysicalVolume* locatedVolume= fLocatedVolume[0];
470 if( locatedVolume == nullptr )
471 {
472 // Workaround to ensure that the touchable is fixed !! // TODO: fix
473 //
474 touchHist->UpdateYourself( locatedVolume, touchHist->GetHistory() );
475 }
476
477 return G4TouchableHandle(touchHist);
478}
#define fLocatedVolume
G4ReferenceCountedHandle< G4VTouchable > G4TouchableHandle
virtual const G4NavigationHistory * GetHistory() const
virtual void UpdateYourself(G4VPhysicalVolume *pPhysVol, const G4NavigationHistory *history=nullptr)

◆ GetGlobalExitNormal()

G4ThreeVector G4ITMultiNavigator::GetGlobalExitNormal ( const G4ThreeVector & CurrentE_Point,
G4bool * obtained )
override

Definition at line 692 of file G4ITMultiNavigator.cc.

694{
695 G4ThreeVector normalGlobalCrd(0.0, 0.0, 0.0);
696 G4bool isObtained= false;
697 // These default values will be used if fNoLimitingStep== 0
698 G4int firstNavigatorId= -1;
699 G4bool oneObtained= false;
700
701 if( fNoLimitingStep==1 )
702 {
703 // Only message the Navigator which limited the step!
704 normalGlobalCrd= fpNavigator[ fIdNavLimiting ]->GetGlobalExitNormal( argPoint, &isObtained);
705 *argpObtained= isObtained;
706 }
707 else
708 {
709 if( fNoLimitingStep > 1 )
710 {
711 auto pNavIter=
712 pTransportManager->GetActiveNavigatorsIterator();
713
714 for ( G4int num=0; num< fNoActiveNavigators ; ++pNavIter,++num )
715 {
716 G4ThreeVector oneNormal;
717 if( fLimitTruth[ num ] ) // Did this geometry limit the step ?
718 {
719 G4ThreeVector newNormal= (*pNavIter)-> GetGlobalExitNormal( argPoint, &oneObtained );
720 if( oneObtained )
721 {
722 // Keep first one - only if it is valid (ie not null)
723 if( !isObtained && (newNormal.mag2() != 0.0) )
724 {
725 normalGlobalCrd= newNormal;
726 isObtained = oneObtained;
727 firstNavigatorId= num;
728 }else{
729 // Check for clash
730 G4double dotNewPrevious= newNormal.dot( normalGlobalCrd );
731 G4double productMagSq= normalGlobalCrd.mag2() * newNormal.mag2();
732 if( productMagSq > 0.0 )
733 {
734 G4double productMag= std::sqrt( productMagSq );
735 dotNewPrevious /= productMag; // Normalise
736 if( dotNewPrevious < (1 - perThousand) )
737 {
738 *argpObtained= false;
739
740 if( fVerbose > 2 ) // dotNewPrevious <= 0.0 )
741 {
742 std::ostringstream message;
743 message << "Clash of Normal from different Navigators!" << G4endl
744 << " Previous Navigator Id = " << firstNavigatorId << G4endl
745 << " Current Navigator Id = " << num << G4endl;
746 message << " Dot product of 2 normals = " << dotNewPrevious << G4endl;
747 message << " Normal (previous) = " << normalGlobalCrd << G4endl;
748 message << " Normal (current) = " << newNormal << G4endl;
749 G4Exception("G4ITMultiNavigator::GetGlobalExitNormal()", "GeomNav0002",
750 JustWarning, message);
751 }
752 }
753 else
754 {
755 // Close agreement - Do not change
756 }
757 }
758 }
759 }
760 }
761 } // end for over the Navigators
762
763 // Report if no Normal was obtained
764 if( !oneObtained )
765 {
766 std::ostringstream message;
767 message << "No Normal obtained despite having " << fNoLimitingStep
768 << " candidate Navigators limiting the step!" << G4endl;
769 G4Exception("G4ITMultiNavigator::GetGlobalExitNormal()", "GeomNav0002",
770 JustWarning, message);
771 }
772
773 } // end if ( fNoLimiting > 1 )
774 } // end else
775
776 *argpObtained= isObtained;
777 return normalGlobalCrd;
778}
@ JustWarning
#define fLimitTruth
bool G4bool
Definition G4Types.hh:86
double mag2() const
double dot(const Hep3Vector &) const
G4ThreeVector GetGlobalExitNormal(const G4ThreeVector &CurrentE_Point, G4bool *obtained) override
std::vector< G4ITNavigator * >::iterator GetActiveNavigatorsIterator()

Referenced by GetGlobalExitNormal().

◆ GetLocalExitNormal()

G4ThreeVector G4ITMultiNavigator::GetLocalExitNormal ( G4bool * obtained)
override

Definition at line 783 of file G4ITMultiNavigator.cc.

784{
785 // If it is the mass navigator, then expect
786 G4ThreeVector normalGlobalCrd(0.0, 0.0, 0.0);
787 G4bool isObtained= false;
788 // These default values will be used if fNoLimitingStep== 0
789
790 if( fNoLimitingStep==1 )
791 {
792 // Only message the Navigator which limited the step!
793 normalGlobalCrd= fpNavigator[ fIdNavLimiting ]->GetLocalExitNormal( &isObtained);
794 *argpObtained= isObtained;
795
796 static G4ThreadLocal G4int numberWarnings= 0;
797 G4int noWarningsStart= 10, noModuloWarnings=100;
798 numberWarnings++;
799 if( (numberWarnings < noWarningsStart ) || (numberWarnings%noModuloWarnings==0) )
800 {
801 std::ostringstream message;
802 message << "Cannot obtain normal in local coordinates of two or more coordinate systems." << G4endl;
803 G4Exception("G4ITMultiNavigator::GetGlobalExitNormal()", "GeomNav0002",
804 JustWarning, message);
805 }
806 }
807 else
808 {
809 if( fNoLimitingStep > 1 )
810 {
811 // Does not make sense - cannot obtain *local* normal in several coordinate systems
812 std::ostringstream message;
813 message << "Cannot obtain normal in local coordinates of two or more coordinate systems." << G4endl;
814 G4Exception("G4ITMultiNavigator::GetGlobalExitNormal()", "GeomNav0002",
815 FatalException, message);
816 }
817 }
818
819 *argpObtained= isObtained;
820 return normalGlobalCrd;
821}
#define G4ThreadLocal
Definition tls.hh:77

Referenced by GetLocalExitNormalAndCheck().

◆ GetLocalExitNormalAndCheck()

G4ThreeVector G4ITMultiNavigator::GetLocalExitNormalAndCheck ( const G4ThreeVector & CurrentE_Point,
G4bool * obtained )
override

Definition at line 827 of file G4ITMultiNavigator.cc.

829{
831}
G4ThreeVector GetLocalExitNormal(G4bool *obtained) override

◆ GetNavigator()

G4ITNavigator * G4ITMultiNavigator::GetNavigator ( G4int n) const
inline

Definition at line 228 of file G4ITMultiNavigator.hh.

229 {
230 if( (n>fNoActiveNavigators)||(n<0))
231 { n=0;}
232 return fpNavigator[n];
233 }

◆ LocateGlobalPointAndSetup()

G4VPhysicalVolume * G4ITMultiNavigator::LocateGlobalPointAndSetup ( const G4ThreeVector & point,
const G4ThreeVector * direction = nullptr,
const G4bool pRelativeSearch = true,
const G4bool ignoreDirection = true )
override

Definition at line 316 of file G4ITMultiNavigator.cc.

320{
321 // Locate the point in each geometry
322
323 G4ThreeVector direction(0.0, 0.0, 0.0);
324 G4bool relative = pRelativeSearch;
325 auto pNavIter
326 = pTransportManager->GetActiveNavigatorsIterator();
327
328 if( pDirection != nullptr ) { direction = *pDirection; }
329
330#ifdef G4DEBUG_NAVIGATION
331 if( fVerbose > 2 )
332 {
333 G4cout << " Entered G4ITMultiNavigator::LocateGlobalPointAndSetup() "
334 << G4endl;
335 G4cout << " Locating at position: " << position
336 << ", with direction: " << direction << G4endl
337 << " Relative: " << relative
338 << ", ignore direction: " << ignoreDirection << G4endl;
339 G4cout << " Number of active navigators: " << fNoActiveNavigators
340 << G4endl;
341 }
342#endif
343
344 for ( G4int num=0; num< fNoActiveNavigators ; ++pNavIter,++num )
345 {
347 {
348 (*pNavIter)->SetGeometricallyLimitedStep();
349 }
350
351 G4VPhysicalVolume *pLocated
352 = (*pNavIter)->LocateGlobalPointAndSetup( position, &direction,
353 relative, ignoreDirection );
354 // Set the state related to the location
355 //
356 fLocatedVolume[num] = pLocated;
357
358 // Clear state related to the step
359 //
360 fLimitedStep[num] = kDoNot;
361 fCurrentStepSize[num] = 0.0;
362 fLimitTruth[ num ] = false; // Always clear on locating (see Navigator)
363
364#ifdef G4DEBUG_NAVIGATION
365 if( fVerbose > 2 )
366 {
367 G4cout << " Located in world: " << num << ", at: " << position << G4endl
368 << " Used geomLimStp: " << fLimitTruth[num]
369 << ", found in volume: " << pLocated << G4endl;
370 G4cout << " Name = '" ;
371 if( pLocated )
372 {
373 G4cout << pLocated->GetName() << "'";
374 G4cout << " - CopyNo= " << pLocated->GetCopyNo();
375 }
376 else
377 {
378 G4cout << "Null' Id: Not-Set ";
379 }
380 G4cout << G4endl;
381 }
382#endif
383 }
384
385 fWasLimitedByGeometry = false; // Clear on locating
386 G4VPhysicalVolume* volMassLocated= fLocatedVolume[0];
387
388 return volMassLocated;
389}
#define fWasLimitedByGeometry
#define fLimitedStep
@ kDoNot
virtual G4int GetCopyNo() const =0
const G4String & GetName() const

Referenced by PrepareNewTrack(), and ResetHierarchyAndLocate().

◆ LocateGlobalPointWithinVolume()

void G4ITMultiNavigator::LocateGlobalPointWithinVolume ( const G4ThreeVector & position)
override

Definition at line 394 of file G4ITMultiNavigator.cc.

395{
396 // Relocate the point in each geometry
397
398 auto pNavIter
399 = pTransportManager->GetActiveNavigatorsIterator();
400
401#ifdef G4DEBUG_NAVIGATION
402 if( fVerbose > 2 )
403 {
404 G4cout << " Entered G4ITMultiNavigator::ReLocate() " << G4endl
405 << " Re-locating at position: " << position << G4endl;
406 }
407#endif
408
409 for ( G4int num=0; num< fNoActiveNavigators ; ++pNavIter,++num )
410 {
411 // ... none limited the step
412
413 (*pNavIter)->LocateGlobalPointWithinVolume( position );
414
415 // Clear state related to the step
416 //
417 fLimitedStep[num] = kDoNot;
418 fCurrentStepSize[num] = 0.0;
419
420 fLimitTruth[ num ] = false; // Always clear on locating (see Navigator)
421 }
422 fWasLimitedByGeometry = false; // Clear on locating
424}
#define fLastLocatedPosition

◆ ObtainFinalStep()

G4double G4ITMultiNavigator::ObtainFinalStep ( G4int navigatorId,
G4double & pNewSafety,
G4double & minStepLast,
ELimited & limitedStep )

Definition at line 192 of file G4ITMultiNavigator.cc.

196{
197 if( navigatorId > fNoActiveNavigators )
198 {
199 std::ostringstream message;
200 message << "Bad Navigator Id!" << G4endl
201 << " Navigator Id = " << navigatorId
202 << " No Active = " << fNoActiveNavigators << ".";
203 G4Exception("G4ITMultiNavigator::ObtainFinalStep()", "GeomNav0002",
204 FatalException, message);
205 }
206
207 // Prepare the information to return
208 //
209 pNewSafety = fNewSafety[ navigatorId ];
210 limitedStep = fLimitedStep[ navigatorId ];
211 minStep= fMinStep;
212
213#ifdef G4DEBUG_NAVIGATION
214 if( fVerbose > 1 )
215 {
216 G4cout << " G4ITMultiNavigator::ComputeStep returns "
217 << fCurrentStepSize[ navigatorId ]
218 << " for Navigator " << navigatorId
219 << " Limited step = " << limitedStep
220 << " Safety(mm) = " << pNewSafety / mm << G4endl;
221 }
222#endif
223
224 return fCurrentStepSize[ navigatorId ];
225}

Referenced by G4ITPathFinder::DoNextCurvedStep().

◆ PrepareNavigators()

void G4ITMultiNavigator::PrepareNavigators ( )

Definition at line 250 of file G4ITMultiNavigator.cc.

251{
252 // Key purposes:
253 // - Check and cache set of active navigators
254 // - Reset state for new track
255
256#ifdef G4DEBUG_NAVIGATION
257 if( fVerbose > 1 )
258 {
259 G4cout << " Entered G4ITMultiNavigator::PrepareNavigators() " << G4endl;
260 }
261#endif
262
263 // Message the transportation-manager to find active navigators
264
265 std::vector<G4ITNavigator*>::iterator pNavigatorIter;
266 fNoActiveNavigators = (G4int)pTransportManager-> GetNoActiveNavigators();
267
268 if( fNoActiveNavigators > fMaxNav )
269 {
270 std::ostringstream message;
271 message << "Too many active Navigators / worlds !" << G4endl
272 << " Active Navigators (worlds): "
273 << fNoActiveNavigators << G4endl
274 << " which is more than the number allowed: "
275 << fMaxNav << " !";
276 G4Exception("G4ITMultiNavigator::PrepareNavigators()", "GeomNav0002",
277 FatalException, message);
278 }
279
280 pNavigatorIter= pTransportManager-> GetActiveNavigatorsIterator();
281 for( G4int num=0; num< fNoActiveNavigators; ++pNavigatorIter,++num )
282 {
283 fpNavigator[num] = *pNavigatorIter;
284 fLimitTruth[num] = false;
285 fLimitedStep[num] = kDoNot;
286 fCurrentStepSize[num] = 0.0;
287 fLocatedVolume[num] = nullptr;
288 }
289 fWasLimitedByGeometry = false;
290
291 // Check the world volume of the mass navigator
292 // in case a call to SetWorldVolume() changed it
293
294 G4VPhysicalVolume* massWorld = GetWorldVolume();
295
296 if( (massWorld != fLastMassWorld) && (massWorld!=nullptr) )
297 {
298 // Pass along change to Mass Navigator
299 fpNavigator[0] -> SetWorldVolume( massWorld );
300
301#ifdef G4DEBUG_NAVIGATION
302 if( fVerbose > 0 )
303 {
304 G4cout << " G4ITMultiNavigator::PrepareNavigators() changed world volume "
305 << " for mass geometry to " << massWorld->GetName() << G4endl;
306 }
307#endif
308
309 fLastMassWorld = massWorld;
310 }
311}

Referenced by PrepareNewTrack(), and G4ITPathFinder::PrepareNewTrack().

◆ PrepareNewTrack()

void G4ITMultiNavigator::PrepareNewTrack ( const G4ThreeVector position,
const G4ThreeVector direction )

Definition at line 229 of file G4ITMultiNavigator.cc.

231{
232#ifdef G4DEBUG_NAVIGATION
233 if( fVerbose > 1 )
234 {
235 G4cout << " Entered G4ITMultiNavigator::PrepareNewTrack() " << G4endl;
236 }
237#endif
238
240
241 LocateGlobalPointAndSetup( position, &direction, false, false );
242 //
243 // The first location for each Navigator must be non-relative
244 // or else call ResetStackAndState() for each Navigator
245 // Use direction to get correct side of boundary (ignore dir= false)
246}
G4VPhysicalVolume * LocateGlobalPointAndSetup(const G4ThreeVector &point, const G4ThreeVector *direction=nullptr, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true) override

◆ PrintLimited()

void G4ITMultiNavigator::PrintLimited ( )
protected

Definition at line 540 of file G4ITMultiNavigator.cc.

541{
542 // Report results -- for checking
543
544 static const G4String StrDoNot("DoNot"), StrUnique("Unique"),
545 StrUndefined("Undefined"),
546 StrSharedTransport("SharedTransport"),
547 StrSharedOther("SharedOther");
548 G4cout << "### G4ITMultiNavigator::PrintLimited() reports: " << G4endl;
549 G4cout << " Minimum step (true): " << fTrueMinStep
550 << ", reported min: " << fMinStep << G4endl;
551
552#ifdef G4DEBUG_NAVIGATION
553 if(fVerbose>=2)
554 {
555 G4cout << std::setw(5) << " NavId" << " "
556 << std::setw(12) << " step-size " << " "
557 << std::setw(12) << " raw-size " << " "
558 << std::setw(12) << " pre-safety " << " "
559 << std::setw(15) << " Limited / flag" << " "
560 << std::setw(15) << " World " << " "
561 << G4endl;
562 }
563#endif
564
565 for ( G4int num= 0; num < fNoActiveNavigators; num++ )
566 {
567 G4double rawStep = fCurrentStepSize[num];
568 G4double stepLen = fCurrentStepSize[num];
569 if( stepLen > fTrueMinStep )
570 {
571 stepLen = fTrueMinStep; // did not limit (went as far as asked)
572 }
573 G4long oldPrec= G4cout.precision(9);
574
575 G4cout << std::setw(5) << num << " "
576 << std::setw(12) << stepLen << " "
577 << std::setw(12) << rawStep << " "
578 << std::setw(12) << fNewSafety[num] << " "
579 << std::setw(5) << (fLimitTruth[num] ? "YES" : " NO") << " ";
580 G4String limitedStr;
581 switch ( fLimitedStep[num] )
582 {
583 case kDoNot : limitedStr= StrDoNot; break;
584 case kUnique : limitedStr = StrUnique; break;
585 case kSharedTransport: limitedStr= StrSharedTransport; break;
586 case kSharedOther : limitedStr = StrSharedOther; break;
587 default : limitedStr = StrUndefined; break;
588 }
589 G4cout << " " << std::setw(15) << limitedStr << " ";
590 G4cout.precision(oldPrec);
591
592 G4ITNavigator *pNav= fpNavigator[ num ];
593 G4String WorldName( "Not-Set" );
594 if (pNav != nullptr)
595 {
596 G4VPhysicalVolume *pWorld= pNav->GetWorldVolume();
597 if( pWorld != nullptr )
598 {
599 WorldName = pWorld->GetName();
600 }
601 }
602 G4cout << " " << WorldName ;
603 G4cout << G4endl;
604 }
605}
@ kUnique
@ kSharedOther
@ kSharedTransport
long G4long
Definition G4Types.hh:87

◆ ResetHierarchyAndLocate()

G4VPhysicalVolume * G4ITMultiNavigator::ResetHierarchyAndLocate ( const G4ThreeVector & point,
const G4ThreeVector & direction,
const G4TouchableHistory & h )
override

Definition at line 653 of file G4ITMultiNavigator.cc.

656{
657 // Reset geometry for all -- and use the touchable for the mass history
658
659 G4VPhysicalVolume* massVolume=nullptr;
660 G4ITNavigator* pMassNavigator= fpNavigator[0];
661
662 if( pMassNavigator != nullptr )
663 {
664 massVolume= pMassNavigator->ResetHierarchyAndLocate( point, direction,
665 MassHistory);
666 }
667 else
668 {
669 G4Exception("G4ITMultiNavigator::ResetHierarchyAndLocate()",
670 "GeomNav0002", FatalException,
671 "Cannot reset hierarchy before navigators are initialised.");
672 }
673
674 auto pNavIter=
675 pTransportManager->GetActiveNavigatorsIterator();
676
677 for ( G4int num=0; num< fNoActiveNavigators ; ++pNavIter,++num )
678 {
679 G4bool relativeSearch, ignoreDirection;
680
681 (*pNavIter)-> LocateGlobalPointAndSetup( point,
682 &direction,
683 relativeSearch=false,
684 ignoreDirection=false);
685 }
686 return massVolume;
687}

◆ ResetState()

void G4ITMultiNavigator::ResetState ( )
overrideprotected

Definition at line 610 of file G4ITMultiNavigator.cc.

611{
612 fWasLimitedByGeometry= false;
613
614 G4Exception("G4ITMultiNavigator::ResetState()", "GeomNav0001",
616 "Cannot reset state for navigators of G4ITMultiNavigator.");
617
618 std::vector<G4ITNavigator*>::iterator pNavigatorIter;
619 pNavigatorIter= pTransportManager-> GetActiveNavigatorsIterator();
620 for( G4int num=0; num< fNoActiveNavigators; ++pNavigatorIter,++num )
621 {
622 // (*pNavigatorIter)->ResetState(); // KEEP THIS comment !!!
623 }
624}

◆ SetupHierarchy()

void G4ITMultiNavigator::SetupHierarchy ( )
overrideprotected

Definition at line 628 of file G4ITMultiNavigator.cc.

629{
630 G4Exception( "G4ITMultiNavigator::SetupHierarchy()",
631 "GeomNav0001", FatalException,
632 "Cannot setup hierarchy for navigators of G4ITMultiNavigator.");
633}

◆ WhichLimited()

void G4ITMultiNavigator::WhichLimited ( )
protected

Definition at line 482 of file G4ITMultiNavigator.cc.

483{
484 // Flag which processes limited the step
485
486 G4int last=-1;
487 const G4int IdTransport= 0; // Id of Mass Navigator !!
488 G4int noLimited=0;
489 ELimited shared= kSharedOther;
490
491#ifdef G4DEBUG_NAVIGATION
492 if( fVerbose > 2 )
493 {
494 G4cout << " Entered G4ITMultiNavigator::WhichLimited() " << G4endl;
495 }
496#endif
497
498 // Assume that [IdTransport] is Mass / Transport
499 //
500 G4bool transportLimited = (fCurrentStepSize[IdTransport] == fMinStep)
501 && ( fMinStep!= kInfinity);
502 if( transportLimited )
503 {
504 shared= kSharedTransport;
505 }
506
507 for ( G4int num= 0; num < fNoActiveNavigators; num++ )
508 {
509 G4bool limitedStep;
510
511 G4double step= fCurrentStepSize[num];
512
513 limitedStep = ( step == fMinStep ) && ( step != kInfinity);
514
515 fLimitTruth[ num ] = limitedStep;
516 if( limitedStep )
517 {
518 noLimited++;
519 fLimitedStep[num] = shared;
520 last= num;
521 }
522 else
523 {
524 fLimitedStep[num] = kDoNot;
525 }
526 }
527 if( (last > -1) && (noLimited == 1 ) )
528 {
529 fLimitedStep[ last ] = kUnique;
530 }
531
532 fNoLimitingStep= noLimited;
533
534 return;
535}

Referenced by ComputeStep().

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const G4ITNavigator & n )
friend

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