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

#include <G4MultiNavigator.hh>

+ Inheritance diagram for G4MultiNavigator:

Public Member Functions

 G4MultiNavigator ()
 
 ~G4MultiNavigator ()
 
G4double ComputeStep (const G4ThreeVector &pGlobalPoint, const G4ThreeVector &pDirection, const G4double pCurrentProposedStepLength, G4double &pNewSafety)
 
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)
 
G4VPhysicalVolumeLocateGlobalPointAndSetup (const G4ThreeVector &point, const G4ThreeVector *direction=0, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true)
 
void LocateGlobalPointWithinVolume (const G4ThreeVector &position)
 
G4double ComputeSafety (const G4ThreeVector &globalpoint, const G4double pProposedMaxLength=DBL_MAX, const G4bool keepState=false)
 
G4TouchableHistoryHandle CreateTouchableHistoryHandle () const
 
virtual G4ThreeVector GetLocalExitNormal (G4bool *obtained)
 
virtual G4ThreeVector GetLocalExitNormalAndCheck (const G4ThreeVector &CurrentE_Point, G4bool *obtained)
 
virtual G4ThreeVector GetGlobalExitNormal (const G4ThreeVector &CurrentE_Point, G4bool *obtained)
 
G4NavigatorGetNavigator (G4int n) const
 
- Public Member Functions inherited from G4Navigator
 G4Navigator ()
 
virtual ~G4Navigator ()
 
virtual G4double ComputeStep (const G4ThreeVector &pGlobalPoint, const G4ThreeVector &pDirection, const G4double pCurrentProposedStepLength, G4double &pNewSafety)
 
G4double CheckNextStep (const G4ThreeVector &pGlobalPoint, const G4ThreeVector &pDirection, const G4double pCurrentProposedStepLength, G4double &pNewSafety)
 
virtual G4VPhysicalVolumeResetHierarchyAndLocate (const G4ThreeVector &point, const G4ThreeVector &direction, const G4TouchableHistory &h)
 
virtual G4VPhysicalVolumeLocateGlobalPointAndSetup (const G4ThreeVector &point, const G4ThreeVector *direction=0, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true)
 
virtual void LocateGlobalPointWithinVolume (const G4ThreeVector &position)
 
void LocateGlobalPointAndUpdateTouchableHandle (const G4ThreeVector &position, const G4ThreeVector &direction, G4TouchableHandle &oldTouchableToUpdate, const G4bool RelativeSearch=true)
 
void LocateGlobalPointAndUpdateTouchable (const G4ThreeVector &position, const G4ThreeVector &direction, G4VTouchable *touchableToUpdate, const G4bool RelativeSearch=true)
 
void LocateGlobalPointAndUpdateTouchable (const G4ThreeVector &position, G4VTouchable *touchableToUpdate, const G4bool RelativeSearch=true)
 
void SetGeometricallyLimitedStep ()
 
virtual G4double ComputeSafety (const G4ThreeVector &globalpoint, const G4double pProposedMaxLength=DBL_MAX, const G4bool keepState=true)
 
G4VPhysicalVolumeGetWorldVolume () const
 
void SetWorldVolume (G4VPhysicalVolume *pWorld)
 
G4GRSVolumeCreateGRSVolume () const
 
G4GRSSolidCreateGRSSolid () const
 
G4TouchableHistoryCreateTouchableHistory () const
 
G4TouchableHistoryCreateTouchableHistory (const G4NavigationHistory *) const
 
virtual G4TouchableHistoryHandle CreateTouchableHistoryHandle () const
 
virtual G4ThreeVector GetLocalExitNormal (G4bool *valid)
 
virtual G4ThreeVector GetLocalExitNormalAndCheck (const G4ThreeVector &point, G4bool *valid)
 
virtual G4ThreeVector GetGlobalExitNormal (const G4ThreeVector &point, G4bool *valid)
 
G4int GetVerboseLevel () const
 
void SetVerboseLevel (G4int level)
 
G4bool IsActive () const
 
void Activate (G4bool flag)
 
G4bool EnteredDaughterVolume () const
 
G4bool ExitedMotherVolume () const
 
void CheckMode (G4bool mode)
 
G4bool IsCheckModeActive () const
 
void SetPushVerbosity (G4bool mode)
 
void PrintState () const
 
const G4AffineTransformGetGlobalToLocalTransform () const
 
const G4AffineTransform GetLocalToGlobalTransform () const
 
G4AffineTransform GetMotherToDaughterTransform (G4VPhysicalVolume *dVolume, G4int dReplicaNo, EVolume dVolumeType)
 
void ResetStackAndState ()
 
G4int SeverityOfZeroStepping (G4int *noZeroSteps) const
 
G4ThreeVector GetCurrentLocalCoordinate () const
 
G4ThreeVector NetTranslation () const
 
G4RotationMatrix NetRotation () const
 
void EnableBestSafety (G4bool value=false)
 

Protected Member Functions

void ResetState ()
 
void SetupHierarchy ()
 
void WhichLimited ()
 
void PrintLimited ()
 
void CheckMassWorld ()
 
- Protected Member Functions inherited from G4Navigator
void SetSavedState ()
 
void RestoreSavedState ()
 
virtual void ResetState ()
 
G4ThreeVector ComputeLocalPoint (const G4ThreeVector &rGlobPoint) const
 
G4ThreeVector ComputeLocalAxis (const G4ThreeVector &pVec) const
 
EVolume VolumeType (const G4VPhysicalVolume *pVol) const
 
EVolume CharacteriseDaughters (const G4LogicalVolume *pLog) const
 
G4int GetDaughtersRegularStructureId (const G4LogicalVolume *pLog) const
 
virtual void SetupHierarchy ()
 

Friends

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

Additional Inherited Members

- Protected Attributes inherited from G4Navigator
G4double kCarTolerance
 
G4NavigationHistory fHistory
 
G4bool fEnteredDaughter
 
G4bool fExitedMother
 
G4bool fWasLimitedByGeometry
 
G4ThreeVector fStepEndPoint
 
G4ThreeVector fLastStepEndPointLocal
 
G4int fVerbose
 

Detailed Description

Definition at line 59 of file G4MultiNavigator.hh.

Constructor & Destructor Documentation

◆ G4MultiNavigator()

G4MultiNavigator::G4MultiNavigator ( )

Definition at line 50 of file G4MultiNavigator.cc.

51 : G4Navigator(), fLastMassWorld(0)
52{
53 fNoActiveNavigators= 0;
54 G4ThreeVector Big3Vector( kInfinity, kInfinity, kInfinity );
55 fLastLocatedPosition = Big3Vector;
56 fSafetyLocation = Big3Vector;
57 fPreStepLocation = Big3Vector;
58
59 fMinSafety_PreStepPt= -1.0;
60 fMinSafety_atSafLocation= -1.0;
61 fMinSafety= -kInfinity;
62 fTrueMinStep= fMinStep= -kInfinity;
63
64 for(register int num=0; num< fMaxNav; ++num )
65 {
66 fpNavigator[num] = 0;
67 fLimitTruth[num] = false;
68 fLimitedStep[num] = kUndefLimited;
69 fCurrentStepSize[num] = fNewSafety[num] = -1.0;
70 fLocatedVolume[num] = 0;
71 }
72
74
75 G4Navigator* massNav= pTransportManager->GetNavigatorForTracking();
76 if( massNav )
77 {
78 G4VPhysicalVolume* pWorld= massNav->GetWorldVolume();
79 if( pWorld )
80 {
81 SetWorldVolume( pWorld );
82 fLastMassWorld = pWorld;
83 }
84 }
85
86 fNoLimitingStep= -1;
87 fIdNavLimiting= -1;
88}
@ kUndefLimited
void SetWorldVolume(G4VPhysicalVolume *pWorld)
G4VPhysicalVolume * GetWorldVolume() const
static G4TransportationManager * GetTransportationManager()
G4Navigator * GetNavigatorForTracking() const

◆ ~G4MultiNavigator()

G4MultiNavigator::~G4MultiNavigator ( )

Definition at line 90 of file G4MultiNavigator.cc.

91{
92}

Member Function Documentation

◆ CheckMassWorld()

void G4MultiNavigator::CheckMassWorld ( )
protected

Definition at line 639 of file G4MultiNavigator.cc.

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

◆ ComputeSafety()

G4double G4MultiNavigator::ComputeSafety ( const G4ThreeVector globalpoint,
const G4double  pProposedMaxLength = DBL_MAX,
const G4bool  keepState = false 
)
virtual

Reimplemented from G4Navigator.

Definition at line 429 of file G4MultiNavigator.cc.

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

◆ ComputeStep()

G4double G4MultiNavigator::ComputeStep ( const G4ThreeVector pGlobalPoint,
const G4ThreeVector pDirection,
const G4double  pCurrentProposedStepLength,
G4double pNewSafety 
)
virtual

Reimplemented from G4Navigator.

Definition at line 94 of file G4MultiNavigator.cc.

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

◆ CreateTouchableHistoryHandle()

G4TouchableHistoryHandle G4MultiNavigator::CreateTouchableHistoryHandle ( ) const
virtual

Reimplemented from G4Navigator.

Definition at line 462 of file G4MultiNavigator.cc.

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

◆ GetGlobalExitNormal()

G4ThreeVector G4MultiNavigator::GetGlobalExitNormal ( const G4ThreeVector CurrentE_Point,
G4bool obtained 
)
virtual

Reimplemented from G4Navigator.

Definition at line 694 of file G4MultiNavigator.cc.

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

Referenced by GetGlobalExitNormal().

◆ GetLocalExitNormal()

G4ThreeVector G4MultiNavigator::GetLocalExitNormal ( G4bool obtained)
virtual

Reimplemented from G4Navigator.

Definition at line 785 of file G4MultiNavigator.cc.

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

Referenced by GetLocalExitNormalAndCheck().

◆ GetLocalExitNormalAndCheck()

G4ThreeVector G4MultiNavigator::GetLocalExitNormalAndCheck ( const G4ThreeVector CurrentE_Point,
G4bool obtained 
)
virtual

Reimplemented from G4Navigator.

Definition at line 829 of file G4MultiNavigator.cc.

831{
832 return G4MultiNavigator::GetLocalExitNormal( obtained);
833}
virtual G4ThreeVector GetLocalExitNormal(G4bool *obtained)

◆ GetNavigator()

G4Navigator * G4MultiNavigator::GetNavigator ( G4int  n) const
inline

Definition at line 141 of file G4MultiNavigator.hh.

142 {
143 if( (n>fNoActiveNavigators)||(n<0)){ n=0; }
144 return fpNavigator[n];
145 }

◆ LocateGlobalPointAndSetup()

G4VPhysicalVolume * G4MultiNavigator::LocateGlobalPointAndSetup ( const G4ThreeVector point,
const G4ThreeVector direction = 0,
const G4bool  pRelativeSearch = true,
const G4bool  ignoreDirection = true 
)
virtual

Reimplemented from G4Navigator.

Definition at line 317 of file G4MultiNavigator.cc.

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

Referenced by PrepareNewTrack(), and ResetHierarchyAndLocate().

◆ LocateGlobalPointWithinVolume()

void G4MultiNavigator::LocateGlobalPointWithinVolume ( const G4ThreeVector position)
virtual

Reimplemented from G4Navigator.

Definition at line 395 of file G4MultiNavigator.cc.

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

◆ ObtainFinalStep()

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

Definition at line 193 of file G4MultiNavigator.cc.

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

Referenced by G4PathFinder::DoNextCurvedStep().

◆ PrepareNavigators()

void G4MultiNavigator::PrepareNavigators ( )

Definition at line 251 of file G4MultiNavigator.cc.

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

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

◆ PrepareNewTrack()

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

Definition at line 230 of file G4MultiNavigator.cc.

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

◆ PrintLimited()

void G4MultiNavigator::PrintLimited ( )
protected

Definition at line 542 of file G4MultiNavigator.cc.

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

◆ ResetHierarchyAndLocate()

G4VPhysicalVolume * G4MultiNavigator::ResetHierarchyAndLocate ( const G4ThreeVector point,
const G4ThreeVector direction,
const G4TouchableHistory h 
)
virtual

Reimplemented from G4Navigator.

Definition at line 655 of file G4MultiNavigator.cc.

658{
659 // Reset geometry for all -- and use the touchable for the mass history
660
661 G4VPhysicalVolume* massVolume=0;
662 G4Navigator* pMassNavigator= fpNavigator[0];
663
664 if( pMassNavigator )
665 {
666 massVolume= pMassNavigator->ResetHierarchyAndLocate( point, direction,
667 MassHistory);
668 }
669 else
670 {
671 G4Exception("G4MultiNavigator::ResetHierarchyAndLocate()",
672 "GeomNav0002", FatalException,
673 "Cannot reset hierarchy before navigators are initialised.");
674 }
675
676 std::vector<G4Navigator*>::iterator pNavIter=
677 pTransportManager->GetActiveNavigatorsIterator();
678
679 for ( register int num=0; num< fNoActiveNavigators ; ++pNavIter,++num )
680 {
681 G4bool relativeSearch, ignoreDirection;
682
683 (*pNavIter)-> LocateGlobalPointAndSetup( point,
684 &direction,
685 relativeSearch=false,
686 ignoreDirection=false);
687 }
688 return massVolume;
689}
virtual G4VPhysicalVolume * ResetHierarchyAndLocate(const G4ThreeVector &point, const G4ThreeVector &direction, const G4TouchableHistory &h)
Definition: G4Navigator.cc:88

◆ ResetState()

void G4MultiNavigator::ResetState ( )
protectedvirtual

Reimplemented from G4Navigator.

Definition at line 612 of file G4MultiNavigator.cc.

613{
614 fWasLimitedByGeometry= false;
615
616 G4Exception("G4MultiNavigator::ResetState()", "GeomNav0001",
618 "Cannot reset state for navigators of G4MultiNavigator.");
619
620 std::vector<G4Navigator*>::iterator pNavigatorIter;
621 pNavigatorIter= pTransportManager-> GetActiveNavigatorsIterator();
622 for( register int num=0; num< fNoActiveNavigators; ++pNavigatorIter,++num )
623 {
624 // (*pNavigatorIter)->ResetState(); // KEEP THIS comment !!!
625 }
626}

◆ SetupHierarchy()

void G4MultiNavigator::SetupHierarchy ( )
protectedvirtual

Reimplemented from G4Navigator.

Definition at line 630 of file G4MultiNavigator.cc.

631{
632 G4Exception( "G4MultiNavigator::SetupHierarchy()",
633 "GeomNav0001", FatalException,
634 "Cannot setup hierarchy for navigators of G4MultiNavigator.");
635}

◆ WhichLimited()

void G4MultiNavigator::WhichLimited ( )
protected

Definition at line 484 of file G4MultiNavigator.cc.

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

Referenced by ComputeStep().

Friends And Related Function Documentation

◆ operator<<

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

Definition at line 1960 of file G4Navigator.cc.

1961{
1962 // Old version did only the following:
1963 // os << "Current History: " << G4endl << n.fHistory;
1964 // Old behaviour is recovered for fVerbose = 0
1965
1966 // Adapted from G4Navigator::PrintState() const
1967
1968 G4int oldcoutPrec = os.precision(4);
1969 if( n.fVerbose >= 4 )
1970 {
1971 os << "The current state of G4Navigator is: " << G4endl;
1972 os << " ValidExitNormal= " << n.fValidExitNormal << G4endl
1973 << " ExitNormal = " << n.fExitNormal << G4endl
1974 << " Exiting = " << n.fExiting << G4endl
1975 << " Entering = " << n.fEntering << G4endl
1976 << " BlockedPhysicalVolume= " ;
1977 if (n.fBlockedPhysicalVolume==0)
1978 os << "None";
1979 else
1980 os << n.fBlockedPhysicalVolume->GetName();
1981 os << G4endl
1982 << " BlockedReplicaNo = " << n.fBlockedReplicaNo << G4endl
1983 << " LastStepWasZero = " << n.fLastStepWasZero << G4endl
1984 << G4endl;
1985 }
1986 if( ( 1 < n.fVerbose) && (n.fVerbose < 4) )
1987 {
1988 os << G4endl; // Make sure to line up
1989 os << std::setw(30) << " ExitNormal " << " "
1990 << std::setw( 5) << " Valid " << " "
1991 << std::setw( 9) << " Exiting " << " "
1992 << std::setw( 9) << " Entering" << " "
1993 << std::setw(15) << " Blocked:Volume " << " "
1994 << std::setw( 9) << " ReplicaNo" << " "
1995 << std::setw( 8) << " LastStepZero " << " "
1996 << G4endl;
1997 os << "( " << std::setw(7) << n.fExitNormal.x()
1998 << ", " << std::setw(7) << n.fExitNormal.y()
1999 << ", " << std::setw(7) << n.fExitNormal.z() << " ) "
2000 << std::setw( 5) << n.fValidExitNormal << " "
2001 << std::setw( 9) << n.fExiting << " "
2002 << std::setw( 9) << n.fEntering << " ";
2003 if ( n.fBlockedPhysicalVolume==0 )
2004 { os << std::setw(15) << "None"; }
2005 else
2006 { os << std::setw(15)<< n.fBlockedPhysicalVolume->GetName(); }
2007 os << std::setw( 9) << n.fBlockedReplicaNo << " "
2008 << std::setw( 8) << n.fLastStepWasZero << " "
2009 << G4endl;
2010 }
2011 if( n.fVerbose > 2 )
2012 {
2013 os.precision(8);
2014 os << " Current Localpoint = " << n.fLastLocatedPointLocal << G4endl;
2015 os << " PreviousSftOrigin = " << n.fPreviousSftOrigin << G4endl;
2016 os << " PreviousSafety = " << n.fPreviousSafety << G4endl;
2017 }
2018 if( n.fVerbose > 3 || n.fVerbose == 0 )
2019 {
2020 os << "Current History: " << G4endl << n.fHistory;
2021 }
2022
2023 os.precision(oldcoutPrec);
2024 return os;
2025}

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