Geant4-11
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
G4ErrorPropagationNavigator Class Reference

#include <G4ErrorPropagationNavigator.hh>

Inheritance diagram for G4ErrorPropagationNavigator:
G4Navigator

Public Member Functions

void Activate (G4bool flag)
 
void CheckMode (G4bool mode)
 
G4double CheckNextStep (const G4ThreeVector &pGlobalPoint, const G4ThreeVector &pDirection, const G4double pCurrentProposedStepLength, G4double &pNewSafety)
 
G4NavigatorClone () const
 
G4double ComputeSafety (const G4ThreeVector &globalpoint, const G4double pProposedMaxLength=DBL_MAX, const G4bool keepState=true)
 
G4double ComputeStep (const G4ThreeVector &pGlobalPoint, const G4ThreeVector &pDirection, const G4double pCurrentProposedStepLength, G4double &pNewSafety)
 
G4GRSSolidCreateGRSSolid () const
 
G4GRSVolumeCreateGRSVolume () const
 
G4TouchableHistoryCreateTouchableHistory () const
 
G4TouchableHistoryCreateTouchableHistory (const G4NavigationHistory *) const
 
virtual G4TouchableHistoryHandle CreateTouchableHistoryHandle () const
 
void EnableBestSafety (G4bool value=false)
 
G4bool EnteredDaughterVolume () const
 
G4bool ExitedMotherVolume () const
 
 G4ErrorPropagationNavigator ()
 
G4ThreeVector GetCurrentLocalCoordinate () const
 
G4VExternalNavigationGetExternalNavigation () const
 
G4ThreeVector GetGlobalExitNormal (const G4ThreeVector &point, G4bool *valid)
 
const G4AffineTransformGetGlobalToLocalTransform () const
 
G4ThreeVector GetLastStepEndPoint () const
 
virtual G4ThreeVector GetLocalExitNormal (G4bool *valid)
 
virtual G4ThreeVector GetLocalExitNormalAndCheck (const G4ThreeVector &point, G4bool *valid)
 
const G4AffineTransform GetLocalToGlobalTransform () const
 
G4AffineTransform GetMotherToDaughterTransform (G4VPhysicalVolume *dVolume, G4int dReplicaNo, EVolume dVolumeType)
 
G4int GetVerboseLevel () const
 
G4VPhysicalVolumeGetWorldVolume () const
 
void InformLastStep (G4double lastStep, G4bool entersDaughtVol, G4bool exitsMotherVol)
 
G4bool IsActive () const
 
G4bool IsCheckModeActive () const
 
virtual G4VPhysicalVolumeLocateGlobalPointAndSetup (const G4ThreeVector &point, const G4ThreeVector *direction=nullptr, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=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 LocateGlobalPointAndUpdateTouchableHandle (const G4ThreeVector &position, const G4ThreeVector &direction, G4TouchableHandle &oldTouchableToUpdate, const G4bool RelativeSearch=true)
 
virtual void LocateGlobalPointWithinVolume (const G4ThreeVector &position)
 
G4RotationMatrix NetRotation () const
 
G4ThreeVector NetTranslation () const
 
void PrintState () const
 
virtual G4VPhysicalVolumeResetHierarchyAndLocate (const G4ThreeVector &point, const G4ThreeVector &direction, const G4TouchableHistory &h)
 
void ResetStackAndState ()
 
void SetExternalNavigation (G4VExternalNavigation *externalNav)
 
void SetGeometricallyLimitedStep ()
 
void SetPushVerbosity (G4bool mode)
 
void SetVerboseLevel (G4int level)
 
void SetVoxelNavigation (G4VoxelNavigation *voxelNav)
 
void SetWorldVolume (G4VPhysicalVolume *pWorld)
 
G4int SeverityOfZeroStepping (G4int *noZeroSteps) const
 
G4double TargetSafetyFromPoint (const G4ThreeVector &pGlobalpoint)
 
 ~G4ErrorPropagationNavigator ()
 

Protected Member Functions

EVolume CharacteriseDaughters (const G4LogicalVolume *pLog) const
 
G4bool CheckOverlapsIterative (G4VPhysicalVolume *vol)
 
G4ThreeVector ComputeLocalAxis (const G4ThreeVector &pVec) const
 
G4ThreeVector ComputeLocalPoint (const G4ThreeVector &rGlobPoint) const
 
G4int GetDaughtersRegularStructureId (const G4LogicalVolume *pLv) const
 
virtual void ResetState ()
 
void RestoreSavedState ()
 
void SetSavedState ()
 
virtual void SetupHierarchy ()
 
EVolume VolumeType (const G4VPhysicalVolume *pVol) const
 

Protected Attributes

G4bool fEnteredDaughter
 
G4bool fExitedMother
 
G4NavigationHistory fHistory
 
G4ThreeVector fLastStepEndPointLocal
 
G4double fMinStep
 
G4double fSqTol
 
G4ThreeVector fStepEndPoint
 
G4int fVerbose = 0
 
G4bool fWasLimitedByGeometry = false
 
G4double kCarTolerance
 

Private Member Functions

void ComputeStepLog (const G4ThreeVector &pGlobalpoint, G4double moveLenSq) const
 
G4VoxelNavigationGetVoxelNavigator ()
 

Private Attributes

G4int fAbandonThreshold_NoZeroSteps = 25
 
G4int fActionThreshold_NoZeroSteps = 10
 
G4bool fActive = false
 
G4VPhysicalVolumefBlockedPhysicalVolume
 
G4int fBlockedReplicaNo
 
G4bool fCalculatedExitNormal
 
G4bool fChangedGrandMotherRefFrame
 
G4bool fCheck = false
 
G4bool fEntering
 
G4bool fExiting
 
G4ThreeVector fExitNormal
 
G4ThreeVector fExitNormalGlobalFrame
 
G4ThreeVector fGrandMotherExitNormal
 
G4ThreeVector fLastLocatedPointLocal
 
G4VPhysicalVolumefLastMotherPhys = nullptr
 
G4bool fLastStepWasZero
 
G4bool fLastTriedStepComputation = false
 
G4bool fLocatedOnEdge
 
G4bool fLocatedOutsideWorld
 
G4NormalNavigation fnormalNav
 
G4int fNumberZeroSteps
 
G4ParameterisedNavigation fparamNav
 
G4VExternalNavigationfpExternalNav = nullptr
 
G4double fPreviousSafety
 
G4ThreeVector fPreviousSftOrigin
 
G4bool fPushed = false
 
G4VoxelNavigationfpvoxelNav
 
G4VoxelSafetyfpVoxelSafety
 
G4RegularNavigation fregularNav
 
G4ReplicaNavigation freplicaNav
 
struct G4Navigator::G4SaveNavigatorState fSaveState
 
G4VPhysicalVolumefTopPhysical = nullptr
 
G4bool fValidExitNormal
 
G4bool fWarnPush = true
 

Detailed Description

Definition at line 44 of file G4ErrorPropagationNavigator.hh.

Constructor & Destructor Documentation

◆ G4ErrorPropagationNavigator()

G4ErrorPropagationNavigator::G4ErrorPropagationNavigator ( )

Definition at line 44 of file G4ErrorPropagationNavigator.cc.

45 : G4Navigator()
46{
47}

◆ ~G4ErrorPropagationNavigator()

G4ErrorPropagationNavigator::~G4ErrorPropagationNavigator ( )

Definition at line 51 of file G4ErrorPropagationNavigator.cc.

52{
53}

Member Function Documentation

◆ Activate()

void G4Navigator::Activate ( G4bool  flag)
inlineinherited

◆ CharacteriseDaughters()

EVolume G4Navigator::CharacteriseDaughters ( const G4LogicalVolume pLog) const
inlineprotectedinherited

◆ CheckMode()

void G4Navigator::CheckMode ( G4bool  mode)
inlineinherited

◆ CheckNextStep()

G4double G4Navigator::CheckNextStep ( const G4ThreeVector pGlobalPoint,
const G4ThreeVector pDirection,
const G4double  pCurrentProposedStepLength,
G4double pNewSafety 
)
inherited

Definition at line 1255 of file G4Navigator.cc.

1259{
1260 G4double step;
1261
1262 // Save the state, for this parasitic call
1263 //
1264 SetSavedState();
1265
1266 step = ComputeStep ( pGlobalpoint,
1267 pDirection,
1268 pCurrentProposedStepLength,
1269 pNewSafety );
1270
1271 // It is a parasitic call, so attempt to restore the key parts of the state
1272 //
1274 // NOTE: the state of the current subnavigator is NOT restored.
1275 // ***> TODO: restore subnavigator state
1276 // if( last_located) Need Position of last location
1277 // if( last_computed step) Need Endposition of last step
1278
1279 return step;
1280}
double G4double
Definition: G4Types.hh:83
void RestoreSavedState()
Definition: G4Navigator.cc:716
void SetSavedState()
Definition: G4Navigator.cc:682
virtual G4double ComputeStep(const G4ThreeVector &pGlobalPoint, const G4ThreeVector &pDirection, const G4double pCurrentProposedStepLength, G4double &pNewSafety)
Definition: G4Navigator.cc:770

References G4Navigator::ComputeStep(), G4Navigator::RestoreSavedState(), and G4Navigator::SetSavedState().

Referenced by G4SafetyHelper::CheckNextStep().

◆ CheckOverlapsIterative()

G4bool G4Navigator::CheckOverlapsIterative ( G4VPhysicalVolume vol)
protectedinherited

Definition at line 2130 of file G4Navigator.cc.

2131{
2132 // Check and report overlaps
2133 //
2134 G4bool foundOverlap = false;
2135 G4int nPoints = 300000, ntrials = 9, numOverlaps = 5;
2136 G4double trialLength = 1.0 * CLHEP::centimeter;
2137 while ( ntrials-- > 0 && !foundOverlap )
2138 {
2139 if ( fVerbose > 1 )
2140 {
2141 G4cout << " ** Running overlap checks in volume "
2142 << vol->GetName()
2143 << " with length = " << trialLength << G4endl;
2144 }
2145 foundOverlap = vol->CheckOverlaps(nPoints, trialLength,
2146 fVerbose, numOverlaps);
2147 trialLength *= 0.1;
2148 if ( trialLength <= 1.0e-5 ) { numOverlaps= 1;}
2149 }
2150 return foundOverlap;
2151}
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
G4int fVerbose
Definition: G4Navigator.hh:395
virtual G4bool CheckOverlaps(G4int res=1000, G4double tol=0., G4bool verbose=true, G4int errMax=1)
const G4String & GetName() const
static constexpr double centimeter
Definition: SystemOfUnits.h:67

References CLHEP::centimeter, G4VPhysicalVolume::CheckOverlaps(), G4Navigator::fVerbose, G4cout, G4endl, and G4VPhysicalVolume::GetName().

Referenced by G4Navigator::ComputeStep().

◆ Clone()

G4Navigator * G4Navigator::Clone ( ) const
inlineinherited

◆ ComputeLocalAxis()

G4ThreeVector G4Navigator::ComputeLocalAxis ( const G4ThreeVector pVec) const
inlineprotectedinherited

◆ ComputeLocalPoint()

G4ThreeVector G4Navigator::ComputeLocalPoint ( const G4ThreeVector rGlobPoint) const
inlineprotectedinherited

◆ ComputeSafety()

G4double G4ErrorPropagationNavigator::ComputeSafety ( const G4ThreeVector globalpoint,
const G4double  pProposedMaxLength = DBL_MAX,
const G4bool  keepState = true 
)
virtual

Reimplemented from G4Navigator.

Definition at line 153 of file G4ErrorPropagationNavigator.cc.

157{
158 G4double safetyGeom = G4Navigator::ComputeSafety(pGlobalPoint,
159 pMaxLength, keepState);
160
161 G4double safetyTarget = TargetSafetyFromPoint( pGlobalPoint );
162
163 return std::min(safetyGeom, safetyTarget);
164}
G4double TargetSafetyFromPoint(const G4ThreeVector &pGlobalpoint)
virtual G4double ComputeSafety(const G4ThreeVector &globalpoint, const G4double pProposedMaxLength=DBL_MAX, const G4bool keepState=true)
T min(const T t1, const T t2)
brief Return the smallest of the two arguments

References G4Navigator::ComputeSafety(), G4INCL::Math::min(), and TargetSafetyFromPoint().

◆ ComputeStep()

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

Reimplemented from G4Navigator.

Definition at line 57 of file G4ErrorPropagationNavigator.cc.

62{
63 G4double safetyGeom = DBL_MAX;
64
65 G4double Step = G4Navigator::ComputeStep(pGlobalPoint, pDirection,
66 pCurrentProposedStepLength,
67 safetyGeom);
68
71
72 if ( g4edata != nullptr )
73 {
74 const G4ErrorTarget* target = g4edata->GetTarget();
75 if( target != nullptr )
76 {
77 G4double StepPlane=target->GetDistanceFromPoint(pGlobalPoint,pDirection);
78
79 if( StepPlane < 0. ) // Negative means target is crossed,
80 { // will not be found
81 StepPlane = DBL_MAX;
82 }
83#ifdef G4VERBOSE
85 {
86 G4cout << "G4ErrorPropagationNavigator::ComputeStep()" << G4endl
87 << " Target step: " << StepPlane
88 << ", Transportation step: " << Step << G4endl;
89 target->Dump( "G4ErrorPropagationNavigator::ComputeStep Target " );
90 }
91#endif
92
93 if( StepPlane < Step )
94 {
95#ifdef G4VERBOSE
97 {
98 G4cout << "G4ErrorPropagationNavigator::ComputeStep()" << G4endl
99 << " TargetCloserThanBoundary: " << StepPlane << " < "
100 << Step << G4endl;
101 }
102#endif
103 Step = StepPlane;
105 }
106 else
107 {
109 }
110 }
111 }
112 G4double safetyTarget = TargetSafetyFromPoint(pGlobalPoint);
113
114 // Avoid call to G4Navigator::ComputeSafety - which could have side effects
115 //
116 pNewSafety = std::min(safetyGeom, safetyTarget);
117
118#ifdef G4VERBOSE
120 {
121 G4cout << "G4ErrorPropagationNavigator::ComputeStep()" << G4endl
122 << " Step: " << Step << ", ComputeSafety: " << pNewSafety
123 << G4endl;
124 }
125#endif
126
127 return Step;
128}
@ G4ErrorState_TargetCloserThanBoundary
@ G4ErrorState_Propagating
static G4ErrorPropagatorData * GetErrorPropagatorData()
const G4ErrorTarget * GetTarget(G4bool mustExist=false) const
void SetState(G4ErrorState sta)
virtual void Dump(const G4String &msg) const =0
virtual G4double GetDistanceFromPoint(const G4ThreeVector &, const G4ThreeVector &) const
#define DBL_MAX
Definition: templates.hh:62

References G4Navigator::ComputeStep(), DBL_MAX, G4ErrorTarget::Dump(), G4cout, G4endl, G4ErrorState_Propagating, G4ErrorState_TargetCloserThanBoundary, G4ErrorTarget::GetDistanceFromPoint(), G4ErrorPropagatorData::GetErrorPropagatorData(), G4ErrorPropagatorData::GetTarget(), G4INCL::Math::min(), G4ErrorPropagatorData::SetState(), TargetSafetyFromPoint(), and G4ErrorPropagatorData::verbose().

◆ ComputeStepLog()

void G4Navigator::ComputeStepLog ( const G4ThreeVector pGlobalpoint,
G4double  moveLenSq 
) const
privateinherited

Definition at line 2027 of file G4Navigator.cc.

2029{
2030 // The following checks only make sense if the move is larger
2031 // than the tolerance.
2032
2033 const G4double fAccuracyForWarning = kCarTolerance,
2034 fAccuracyForException = 1000*kCarTolerance;
2035
2036 G4ThreeVector OriginalGlobalpoint = fHistory.GetTopTransform().
2037 InverseTransformPoint(fLastLocatedPointLocal);
2038
2039 G4double shiftOriginSafSq = (fPreviousSftOrigin-pGlobalpoint).mag2();
2040
2041 // Check that the starting point of this step is
2042 // within the isotropic safety sphere of the last point
2043 // to a accuracy/precision given by fAccuracyForWarning.
2044 // If so give warning.
2045 // If it fails by more than fAccuracyForException exit with error.
2046 //
2047 if( shiftOriginSafSq >= sqr(fPreviousSafety) )
2048 {
2049 G4double shiftOrigin = std::sqrt(shiftOriginSafSq);
2050 G4double diffShiftSaf = shiftOrigin - fPreviousSafety;
2051
2052 if( diffShiftSaf > fAccuracyForWarning )
2053 {
2054 G4int oldcoutPrec = G4cout.precision(8);
2055 G4int oldcerrPrec = G4cerr.precision(10);
2056 std::ostringstream message, suggestion;
2057 message << "Accuracy error or slightly inaccurate position shift."
2058 << G4endl
2059 << " The Step's starting point has moved "
2060 << std::sqrt(moveLenSq)/mm << " mm " << G4endl
2061 << " since the last call to a Locate method." << G4endl
2062 << " This has resulted in moving "
2063 << shiftOrigin/mm << " mm "
2064 << " from the last point at which the safety "
2065 << " was calculated " << G4endl
2066 << " which is more than the computed safety= "
2067 << fPreviousSafety/mm << " mm at that point." << G4endl
2068 << " This difference is "
2069 << diffShiftSaf/mm << " mm." << G4endl
2070 << " The tolerated accuracy is "
2071 << fAccuracyForException/mm << " mm.";
2072
2073 suggestion << " ";
2074 static G4ThreadLocal G4int warnNow = 0;
2075 if( ((++warnNow % 100) == 1) )
2076 {
2077 message << G4endl
2078 << " This problem can be due to either " << G4endl
2079 << " - a process that has proposed a displacement"
2080 << " larger than the current safety , or" << G4endl
2081 << " - inaccuracy in the computation of the safety";
2082 suggestion << "We suggest that you " << G4endl
2083 << " - find i) what particle is being tracked, and "
2084 << " ii) through what part of your geometry " << G4endl
2085 << " for example by re-running this event with "
2086 << G4endl
2087 << " /tracking/verbose 1 " << G4endl
2088 << " - check which processes you declare for"
2089 << " this particle (and look at non-standard ones)"
2090 << G4endl
2091 << " - in case, create a detailed logfile"
2092 << " of this event using:" << G4endl
2093 << " /tracking/verbose 6 ";
2094 }
2095 G4Exception("G4Navigator::ComputeStep()",
2096 "GeomNav1002", JustWarning,
2097 message, G4String(suggestion.str()));
2098 G4cout.precision(oldcoutPrec);
2099 G4cerr.precision(oldcerrPrec);
2100 }
2101#ifdef G4DEBUG_NAVIGATION
2102 else
2103 {
2104 G4cerr << "WARNING - G4Navigator::ComputeStep()" << G4endl
2105 << " The Step's starting point has moved "
2106 << std::sqrt(moveLenSq) << "," << G4endl
2107 << " which has taken it to the limit of"
2108 << " the current safety. " << G4endl;
2109 }
2110#endif
2111 }
2112 G4double safetyPlus = fPreviousSafety + fAccuracyForException;
2113 if ( shiftOriginSafSq > sqr(safetyPlus) )
2114 {
2115 std::ostringstream message;
2116 message << "May lead to a crash or unreliable results." << G4endl
2117 << " Position has shifted considerably without"
2118 << " notifying the navigator !" << G4endl
2119 << " Tolerated safety: " << safetyPlus << G4endl
2120 << " Computed shift : " << shiftOriginSafSq;
2121 G4Exception("G4Navigator::ComputeStep()", "GeomNav1002",
2122 JustWarning, message);
2123 }
2124}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
static constexpr double mm
Definition: G4SIunits.hh:95
G4GLOB_DLL std::ostream G4cerr
const G4AffineTransform & GetTopTransform() const
G4double fPreviousSafety
Definition: G4Navigator.hh:429
G4double kCarTolerance
Definition: G4Navigator.hh:377
G4ThreeVector fLastLocatedPointLocal
Definition: G4Navigator.hh:413
G4NavigationHistory fHistory
Definition: G4Navigator.hh:384
G4ThreeVector fPreviousSftOrigin
Definition: G4Navigator.hh:428
T sqr(const T &x)
Definition: templates.hh:128
#define G4ThreadLocal
Definition: tls.hh:77

References G4Navigator::fHistory, G4Navigator::fLastLocatedPointLocal, G4Navigator::fPreviousSafety, G4Navigator::fPreviousSftOrigin, G4cerr, G4cout, G4endl, G4Exception(), G4ThreadLocal, G4NavigationHistory::GetTopTransform(), JustWarning, G4Navigator::kCarTolerance, mm, and sqr().

Referenced by G4Navigator::ComputeStep().

◆ CreateGRSSolid()

G4GRSSolid * G4Navigator::CreateGRSSolid ( ) const
inlineinherited

◆ CreateGRSVolume()

G4GRSVolume * G4Navigator::CreateGRSVolume ( ) const
inlineinherited

◆ CreateTouchableHistory() [1/2]

G4TouchableHistory * G4Navigator::CreateTouchableHistory ( ) const
inlineinherited

◆ CreateTouchableHistory() [2/2]

G4TouchableHistory * G4Navigator::CreateTouchableHistory ( const G4NavigationHistory ) const
inlineinherited

◆ CreateTouchableHistoryHandle()

G4TouchableHistoryHandle G4Navigator::CreateTouchableHistoryHandle ( ) const
virtualinherited

Reimplemented in G4MultiNavigator.

Definition at line 1955 of file G4Navigator.cc.

1956{
1958}
G4ReferenceCountedHandle< G4TouchableHistory > G4TouchableHistoryHandle
G4TouchableHistory * CreateTouchableHistory() const

References G4Navigator::CreateTouchableHistory().

Referenced by G4FastTrack::FRecordsAffineTransformation(), and G4VIntersectionLocator::LocateGlobalPointWithinVolumeAndCheck().

◆ EnableBestSafety()

void G4Navigator::EnableBestSafety ( G4bool  value = false)
inlineinherited

◆ EnteredDaughterVolume()

G4bool G4Navigator::EnteredDaughterVolume ( ) const
inlineinherited

◆ ExitedMotherVolume()

G4bool G4Navigator::ExitedMotherVolume ( ) const
inlineinherited

◆ GetCurrentLocalCoordinate()

G4ThreeVector G4Navigator::GetCurrentLocalCoordinate ( ) const
inlineinherited

◆ GetDaughtersRegularStructureId()

G4int G4Navigator::GetDaughtersRegularStructureId ( const G4LogicalVolume pLv) const
inlineprotectedinherited

◆ GetExternalNavigation()

G4VExternalNavigation * G4Navigator::GetExternalNavigation ( ) const
inlineinherited

◆ GetGlobalExitNormal()

G4ThreeVector G4ErrorPropagationNavigator::GetGlobalExitNormal ( const G4ThreeVector point,
G4bool valid 
)
virtual

Reimplemented from G4Navigator.

Definition at line 168 of file G4ErrorPropagationNavigator.cc.

170{
171 G4ErrorPropagatorData* g4edata
173 const G4ErrorTarget* target = nullptr;
174
175 G4ThreeVector normal(0.0, 0.0, 0.0);
176 G4double distance= 0;
177
178 // Determine which 'geometry' limited the step
179 if ( g4edata != nullptr )
180 {
181 target = g4edata->GetTarget();
182 if( target != nullptr )
183 {
184 distance = target->GetDistanceFromPoint(point);
185 }
186 }
187
188 if( distance > kCarTolerance || (target == nullptr) )
189 // Not reached the target or if a target does not exist,
190 // this seems the best we can do
191 {
193 }
194 else
195 {
196 switch( target->GetType() )
197 {
199 // The volume is in the 'real' mass geometry
201 break;
203 normal = G4ThreeVector( 0.0, 0.0, 0.0);
204 *valid = false;
205 G4Exception("G4ErrorPropagationNavigator::GetGlobalExitNormal",
206 "Geometry1003",
207 JustWarning, "Unexpected value of Target type");
208 break;
211 const G4ErrorSurfaceTarget* surfaceTarget=
212 static_cast<const G4ErrorSurfaceTarget*>(target);
213 normal = surfaceTarget->GetTangentPlane(point).normal().unit();
214 *valid = true;
215 break;
216
217// default:
218// normal= G4ThreeVector( 0.0, 0.0, 0.0 );
219// *valid = false;
220// G4Exception("G4ErrorPropagationNavigator::GetGlobalExitNormal",
221// "Geometry:003",
222// FatalException, "Impossible value of Target type");
223// break;
224 }
225 }
226 return normal;
227}
@ G4ErrorTarget_PlaneSurface
@ G4ErrorTarget_CylindricalSurface
@ G4ErrorTarget_GeomVolume
@ G4ErrorTarget_TrkL
CLHEP::Hep3Vector G4ThreeVector
virtual G4Plane3D GetTangentPlane(const G4ThreeVector &point) const =0
G4ErrorTargetType GetType() const
virtual G4ThreeVector GetGlobalExitNormal(const G4ThreeVector &point, G4bool *valid)
Normal3D< T > normal() const
Definition: Plane3D.h:97
static double normal(HepRandomEngine *eptr)
Definition: RandPoisson.cc:79

References G4ErrorTarget_CylindricalSurface, G4ErrorTarget_GeomVolume, G4ErrorTarget_PlaneSurface, G4ErrorTarget_TrkL, G4Exception(), G4ErrorTarget::GetDistanceFromPoint(), G4ErrorPropagatorData::GetErrorPropagatorData(), G4Navigator::GetGlobalExitNormal(), G4ErrorSurfaceTarget::GetTangentPlane(), G4ErrorPropagatorData::GetTarget(), G4ErrorTarget::GetType(), JustWarning, G4Navigator::kCarTolerance, HepGeom::Plane3D< T >::normal(), and CLHEP::normal().

◆ GetGlobalToLocalTransform()

const G4AffineTransform & G4Navigator::GetGlobalToLocalTransform ( ) const
inlineinherited

◆ GetLastStepEndPoint()

G4ThreeVector G4Navigator::GetLastStepEndPoint ( ) const
inlineinherited

Definition at line 304 of file G4Navigator.hh.

304{ return fStepEndPoint;}
G4ThreeVector fStepEndPoint
Definition: G4Navigator.hh:388

References G4Navigator::fStepEndPoint.

◆ GetLocalExitNormal()

G4ThreeVector G4Navigator::GetLocalExitNormal ( G4bool valid)
virtualinherited

Reimplemented in G4MultiNavigator.

Definition at line 1389 of file G4Navigator.cc.

1390{
1391 G4ThreeVector ExitNormal(0.,0.,0.);
1392 G4VSolid* currentSolid = nullptr;
1393 G4LogicalVolume* candidateLogical;
1394
1396 {
1397 // use fLastLocatedPointLocal and next candidate volume
1398 //
1399 G4ThreeVector nextSolidExitNormal(0.,0.,0.);
1400
1401 if( fEntering && (fBlockedPhysicalVolume!=0) )
1402 {
1403 candidateLogical = fBlockedPhysicalVolume->GetLogicalVolume();
1404 if( candidateLogical )
1405 {
1406 // fLastStepEndPointLocal is in the coordinates of the mother
1407 // we need it in the daughter's coordinate system.
1408
1409 // The following code should also work in case of Replica
1410 {
1411 // First transform fLastLocatedPointLocal to the new daughter
1412 // coordinates
1413 //
1414 G4AffineTransform MotherToDaughterTransform=
1418 G4ThreeVector daughterPointOwnLocal =
1419 MotherToDaughterTransform.TransformPoint( fLastStepEndPointLocal );
1420
1421 // OK if it is a parameterised volume
1422 //
1423 EInside inSideIt;
1424 G4bool onSurface;
1425 G4double safety = -1.0;
1426 currentSolid = candidateLogical->GetSolid();
1427 inSideIt = currentSolid->Inside(daughterPointOwnLocal);
1428 onSurface = (inSideIt == kSurface);
1429 if( !onSurface )
1430 {
1431 if( inSideIt == kOutside )
1432 {
1433 safety = (currentSolid->DistanceToIn(daughterPointOwnLocal));
1434 onSurface = safety < 100.0 * kCarTolerance;
1435 }
1436 else if (inSideIt == kInside )
1437 {
1438 safety = (currentSolid->DistanceToOut(daughterPointOwnLocal));
1439 onSurface = safety < 100.0 * kCarTolerance;
1440 }
1441 }
1442
1443 if( onSurface )
1444 {
1445 nextSolidExitNormal =
1446 currentSolid->SurfaceNormal(daughterPointOwnLocal);
1447
1448 // Entering the solid ==> opposite
1449 //
1450 // First flip ( ExitNormal = -nextSolidExitNormal; )
1451 // and then rotate the the normal to the frame of the mother (current volume)
1452 ExitNormal = MotherToDaughterTransform
1453 .InverseTransformAxis( -nextSolidExitNormal );
1454 fCalculatedExitNormal = true;
1455 }
1456 else
1457 {
1458#ifdef G4VERBOSE
1459 if(( fVerbose == 1 ) && ( fCheck ))
1460 {
1461 std::ostringstream message;
1462 message << "Point not on surface ! " << G4endl
1463 << " Point = "
1464 << daughterPointOwnLocal << G4endl
1465 << " Physical volume = "
1467 << " Logical volume = "
1468 << candidateLogical->GetName() << G4endl
1469 << " Solid = " << currentSolid->GetName()
1470 << " Type = "
1471 << currentSolid->GetEntityType() << G4endl
1472 << *currentSolid << G4endl;
1473 if( inSideIt == kOutside )
1474 {
1475 message << "Point is Outside. " << G4endl
1476 << " Safety (from outside) = " << safety << G4endl;
1477 }
1478 else // if( inSideIt == kInside )
1479 {
1480 message << "Point is Inside. " << G4endl
1481 << " Safety (from inside) = " << safety << G4endl;
1482 }
1483 G4Exception("G4Navigator::GetLocalExitNormal()", "GeomNav1001",
1484 JustWarning, message);
1485 }
1486#endif
1487 }
1488 *valid = onSurface; // was =true;
1489 }
1490 }
1491 }
1492 else if ( fExiting )
1493 {
1494 ExitNormal = fGrandMotherExitNormal;
1495 *valid = true;
1496 fCalculatedExitNormal = true; // Should be true already
1497 }
1498 else // i.e. ( fBlockedPhysicalVolume == 0 )
1499 {
1500 *valid = false;
1501 G4Exception("G4Navigator::GetLocalExitNormal()",
1502 "GeomNav0003", JustWarning,
1503 "Incorrect call to GetLocalSurfaceNormal." );
1504 }
1505 }
1506 else // ( ! fLastTriedStepComputation ) i.e. last call was to Locate
1507 {
1508 if ( EnteredDaughterVolume() )
1509 {
1510 G4VSolid* daughterSolid = fHistory.GetTopVolume()->GetLogicalVolume()
1511 ->GetSolid();
1512 ExitNormal = -(daughterSolid->SurfaceNormal(fLastLocatedPointLocal));
1513 if( std::fabs(ExitNormal.mag2()-1.0 ) > kToleranceNormalCheck )
1514 {
1516 desc << " Parameters of solid: " << *daughterSolid
1517 << " Point for surface = " << fLastLocatedPointLocal << std::endl;
1518 G4Exception("G4Navigator::GetLocalExitNormal()",
1519 "GeomNav0003", FatalException, desc,
1520 "Surface Normal returned by Solid is not a Unit Vector." );
1521 }
1522 fCalculatedExitNormal = true;
1523 *valid = true;
1524 }
1525 else
1526 {
1527 if( fExitedMother )
1528 {
1529 ExitNormal = fGrandMotherExitNormal;
1530 *valid = true;
1531 fCalculatedExitNormal = true;
1532 }
1533 else // We are not at a boundary. ExitNormal remains (0,0,0)
1534 {
1535 *valid = false;
1536 fCalculatedExitNormal = false;
1537 G4ExceptionDescription message;
1538 message << "Function called when *NOT* at a Boundary." << G4endl;
1539 message << "Exit Normal not calculated." << G4endl;
1540 G4Exception("G4Navigator::GetLocalExitNormal()",
1541 "GeomNav0003", JustWarning, message);
1542 }
1543 }
1544 }
1545 return ExitNormal;
1546}
@ FatalException
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
static const G4double kToleranceNormalCheck
Definition: G4Navigator.cc:47
G4ThreeVector InverseTransformAxis(const G4ThreeVector &axis) const
G4ThreeVector TransformPoint(const G4ThreeVector &vec) const
G4VSolid * GetSolid() const
const G4String & GetName() const
G4VPhysicalVolume * GetTopVolume() const
G4bool fExitedMother
Definition: G4Navigator.hh:404
EVolume VolumeType(const G4VPhysicalVolume *pVol) const
G4bool fCheck
Definition: G4Navigator.hh:537
G4bool fLastTriedStepComputation
Definition: G4Navigator.hh:459
G4bool fExiting
Definition: G4Navigator.hh:465
G4int fBlockedReplicaNo
Definition: G4Navigator.hh:439
G4bool fEntering
Definition: G4Navigator.hh:465
G4ThreeVector fLastStepEndPointLocal
Definition: G4Navigator.hh:391
G4AffineTransform GetMotherToDaughterTransform(G4VPhysicalVolume *dVolume, G4int dReplicaNo, EVolume dVolumeType)
G4bool EnteredDaughterVolume() const
G4VPhysicalVolume * fBlockedPhysicalVolume
Definition: G4Navigator.hh:438
G4bool fCalculatedExitNormal
Definition: G4Navigator.hh:483
G4ThreeVector fGrandMotherExitNormal
Definition: G4Navigator.hh:423
G4LogicalVolume * GetLogicalVolume() const
G4String GetName() const
virtual EInside Inside(const G4ThreeVector &p) const =0
virtual G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const =0
virtual G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const =0
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const =0
virtual G4GeometryType GetEntityType() const =0
EInside
Definition: geomdefs.hh:67
@ kInside
Definition: geomdefs.hh:70
@ kOutside
Definition: geomdefs.hh:68
@ kSurface
Definition: geomdefs.hh:69

References G4VSolid::DistanceToIn(), G4VSolid::DistanceToOut(), G4Navigator::EnteredDaughterVolume(), FatalException, G4Navigator::fBlockedPhysicalVolume, G4Navigator::fBlockedReplicaNo, G4Navigator::fCalculatedExitNormal, G4Navigator::fCheck, G4Navigator::fEntering, G4Navigator::fExitedMother, G4Navigator::fExiting, G4Navigator::fGrandMotherExitNormal, G4Navigator::fHistory, G4Navigator::fLastLocatedPointLocal, G4Navigator::fLastStepEndPointLocal, G4Navigator::fLastTriedStepComputation, G4Navigator::fVerbose, G4endl, G4Exception(), G4VSolid::GetEntityType(), G4VPhysicalVolume::GetLogicalVolume(), G4Navigator::GetMotherToDaughterTransform(), G4LogicalVolume::GetName(), G4VPhysicalVolume::GetName(), G4VSolid::GetName(), G4LogicalVolume::GetSolid(), G4NavigationHistory::GetTopVolume(), G4VSolid::Inside(), G4AffineTransform::InverseTransformAxis(), JustWarning, G4Navigator::kCarTolerance, kInside, kOutside, kSurface, kToleranceNormalCheck, CLHEP::Hep3Vector::mag2(), G4VSolid::SurfaceNormal(), G4AffineTransform::TransformPoint(), and G4Navigator::VolumeType().

Referenced by G4RayTrajectory::AppendStep(), G4MultiNavigator::GetLocalExitNormal(), G4Navigator::GetLocalExitNormalAndCheck(), and G4VTransitionRadiation::PostStepDoIt().

◆ GetLocalExitNormalAndCheck()

G4ThreeVector G4Navigator::GetLocalExitNormalAndCheck ( const G4ThreeVector point,
G4bool valid 
)
virtualinherited

Reimplemented in G4MultiNavigator.

Definition at line 1606 of file G4Navigator.cc.

1613{
1614#ifdef G4DEBUG_NAVIGATION
1615 // Check Current point against expected 'local' value
1616 //
1618 {
1619 G4ThreeVector ExpectedBoundaryPointLocal;
1620
1621 const G4AffineTransform& GlobalToLocal = GetGlobalToLocalTransform();
1622 ExpectedBoundaryPointLocal =
1623 GlobalToLocal.TransformPoint( ExpectedBoundaryPointGlobal );
1624
1625 // Add here: Comparison against expected position,
1626 // i.e. the endpoint of ComputeStep
1627 }
1628#endif
1629
1630 return GetLocalExitNormal( pValid );
1631}
virtual G4ThreeVector GetLocalExitNormal(G4bool *valid)
const G4AffineTransform & GetGlobalToLocalTransform() const

References G4Navigator::fLastTriedStepComputation, G4Navigator::GetGlobalToLocalTransform(), G4Navigator::GetLocalExitNormal(), and G4AffineTransform::TransformPoint().

Referenced by G4Navigator::GetGlobalExitNormal().

◆ GetLocalToGlobalTransform()

const G4AffineTransform G4Navigator::GetLocalToGlobalTransform ( ) const
inlineinherited

◆ GetMotherToDaughterTransform()

G4AffineTransform G4Navigator::GetMotherToDaughterTransform ( G4VPhysicalVolume dVolume,
G4int  dReplicaNo,
EVolume  dVolumeType 
)
inherited

Definition at line 1555 of file G4Navigator.cc.

1558{
1559 switch (enteringVolumeType)
1560 {
1561 case kNormal: // Nothing is needed to prepare the transformation
1562 break; // It is stored already in the physical volume (placement)
1563 case kReplica: // Sets the transform in the Replica - tbc
1564 G4Exception("G4Navigator::GetMotherToDaughterTransform()",
1565 "GeomNav0001", FatalException,
1566 "Method NOT Implemented yet for replica volumes.");
1567 break;
1568 case kParameterised:
1569 if( pEnteringPhysVol->GetRegularStructureId() == 0 )
1570 {
1571 G4VPVParameterisation *pParam =
1572 pEnteringPhysVol->GetParameterisation();
1573 G4VSolid* pSolid =
1574 pParam->ComputeSolid(enteringReplicaNo, pEnteringPhysVol);
1575 pSolid->ComputeDimensions(pParam, enteringReplicaNo, pEnteringPhysVol);
1576
1577 // Sets the transform in the Parameterisation
1578 //
1579 pParam->ComputeTransformation(enteringReplicaNo, pEnteringPhysVol);
1580
1581 // Set the correct solid and material in Logical Volume
1582 //
1583 G4LogicalVolume* pLogical = pEnteringPhysVol->GetLogicalVolume();
1584 pLogical->SetSolid( pSolid );
1585 }
1586 break;
1587 case kExternal:
1588 // Expect that nothing is needed to prepare the transformation.
1589 // It is stored already in the physical volume (placement)
1590 break;
1591 }
1592 return G4AffineTransform(pEnteringPhysVol->GetRotation(),
1593 pEnteringPhysVol->GetTranslation()).Invert();
1594}
G4AffineTransform & Invert()
void SetSolid(G4VSolid *pSolid)
virtual G4VSolid * ComputeSolid(const G4int, G4VPhysicalVolume *)
virtual void ComputeTransformation(const G4int, G4VPhysicalVolume *) const =0
virtual void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
Definition: G4VSolid.cc:137
@ kNormal
Definition: geomdefs.hh:84
@ kParameterised
Definition: geomdefs.hh:86
@ kExternal
Definition: geomdefs.hh:87
@ kReplica
Definition: geomdefs.hh:85

References G4VSolid::ComputeDimensions(), G4VPVParameterisation::ComputeSolid(), G4VPVParameterisation::ComputeTransformation(), FatalException, G4Exception(), G4VPhysicalVolume::GetLogicalVolume(), G4VPhysicalVolume::GetParameterisation(), G4VPhysicalVolume::GetRegularStructureId(), G4VPhysicalVolume::GetRotation(), G4VPhysicalVolume::GetTranslation(), G4AffineTransform::Invert(), kExternal, kNormal, kParameterised, kReplica, and G4LogicalVolume::SetSolid().

Referenced by G4Navigator::GetLocalExitNormal().

◆ GetVerboseLevel()

G4int G4Navigator::GetVerboseLevel ( ) const
inlineinherited

◆ GetVoxelNavigator()

G4VoxelNavigation & G4Navigator::GetVoxelNavigator ( )
inlineprivateinherited

◆ GetWorldVolume()

G4VPhysicalVolume * G4Navigator::GetWorldVolume ( ) const
inlineinherited

◆ InformLastStep()

void G4Navigator::InformLastStep ( G4double  lastStep,
G4bool  entersDaughtVol,
G4bool  exitsMotherVol 
)
inherited

Definition at line 2240 of file G4Navigator.cc.

2241{
2242 G4bool zeroStep = ( lastStep == 0.0 );
2243 fLocatedOnEdge = fLastStepWasZero && zeroStep;
2244 fLastStepWasZero = zeroStep;
2245
2246 fExiting = exitsMotherVol;
2247 fEntering = entersDaughtVol;
2248}
G4bool fLocatedOnEdge
Definition: G4Navigator.hh:477
G4bool fLastStepWasZero
Definition: G4Navigator.hh:475

References G4Navigator::fEntering, G4Navigator::fExiting, G4Navigator::fLastStepWasZero, and G4Navigator::fLocatedOnEdge.

◆ IsActive()

G4bool G4Navigator::IsActive ( ) const
inlineinherited

Referenced by export_G4Navigator().

◆ IsCheckModeActive()

G4bool G4Navigator::IsCheckModeActive ( ) const
inlineinherited

◆ LocateGlobalPointAndSetup()

G4VPhysicalVolume * G4Navigator::LocateGlobalPointAndSetup ( const G4ThreeVector point,
const G4ThreeVector direction = nullptr,
const G4bool  pRelativeSearch = true,
const G4bool  ignoreDirection = true 
)
virtualinherited

Reimplemented in G4MultiNavigator.

Definition at line 132 of file G4Navigator.cc.

136{
137 G4bool notKnownContained = true, noResult;
138 G4VPhysicalVolume *targetPhysical;
139 G4LogicalVolume *targetLogical;
140 G4VSolid *targetSolid = 0;
141 G4ThreeVector localPoint, globalDirection;
142 EInside insideCode;
143
144 G4bool considerDirection = (!ignoreDirection) || fLocatedOnEdge;
145
147 fChangedGrandMotherRefFrame = false; // For local exit normal
148
149 if( considerDirection && pGlobalDirection != nullptr )
150 {
151 globalDirection=*pGlobalDirection;
152 }
153
154#ifdef G4VERBOSE
155 if( fVerbose > 2 )
156 {
157 G4int oldcoutPrec = G4cout.precision(8);
158 G4cout << "*** G4Navigator::LocateGlobalPointAndSetup: ***" << G4endl;
159 G4cout << " Called with arguments: " << G4endl
160 << " Globalpoint = " << globalPoint << G4endl
161 << " RelativeSearch = " << relativeSearch << G4endl;
162 if( fVerbose >= 4 )
163 {
164 G4cout << " ----- Upon entering:" << G4endl;
165 PrintState();
166 }
167 G4cout.precision(oldcoutPrec);
168 }
169#endif
170
171 G4int noLevelsExited = 0;
172 G4int noLevelsEntered = 0;
173
174 if ( !relativeSearch )
175 {
177 }
178 else
179 {
181 {
182 fWasLimitedByGeometry = false;
183 fEnteredDaughter = fEntering; // Remember
184 fExitedMother = fExiting; // Remember
185 if ( fExiting )
186 {
187 ++noLevelsExited; // count this first level entered too
188
189 if ( fHistory.GetDepth() )
190 {
194 }
195 else
196 {
197 fLastLocatedPointLocal = localPoint;
199 fBlockedPhysicalVolume = 0; // to be sure
201 fEntering = false; // No longer
202 fEnteredDaughter = false;
203 fExitedMother = true; // ??
204
205 return nullptr; // Have exited world volume
206 }
207 // A fix for the case where a volume is "entered" at an edge
208 // and a coincident surface exists outside it.
209 // - This stops it from exiting further volumes and cycling
210 // - However ReplicaNavigator treats this case itself
211 //
212 // assert( fBlockedPhysicalVolume!=0 );
213
214 // Expect to be on edge => on surface
215 //
217 {
218 fExiting = false;
219 // Consider effect on Exit Normal !?
220 }
221 }
222 else
223 if ( fEntering )
224 {
225 // assert( fBlockedPhysicalVolume!=0 );
226
227 ++noLevelsEntered; // count the first level entered too
228
230 {
231 case kNormal:
234 break;
235 case kReplica:
241 break;
242 case kParameterised:
244 {
245 G4VSolid *pSolid;
246 G4VPVParameterisation *pParam;
247 G4TouchableHistory parentTouchable( fHistory );
249 pSolid = pParam->ComputeSolid(fBlockedReplicaNo,
251 pSolid->ComputeDimensions(pParam, fBlockedReplicaNo,
258 //
259 // Set the correct solid and material in Logical Volume
260 //
261 G4LogicalVolume *pLogical;
263 pLogical->SetSolid( pSolid );
264 pLogical->UpdateMaterial(pParam ->
265 ComputeMaterial(fBlockedReplicaNo,
267 &parentTouchable));
268 }
269 break;
270 case kExternal:
271 G4Exception("G4Navigator::LocateGlobalPointAndSetup()",
272 "GeomNav0001", FatalException,
273 "Extra levels not applicable for external volumes.");
274 break;
275 }
276 fEntering = false;
277 fBlockedPhysicalVolume = nullptr;
278 localPoint = fHistory.GetTopTransform().TransformPoint(globalPoint);
279 notKnownContained = false;
280 }
281 }
282 else
283 {
284 fBlockedPhysicalVolume = nullptr;
285 fEntering = false;
286 fEnteredDaughter = false; // Full Step was not taken, did not enter
287 fExiting = false;
288 fExitedMother = false; // Full Step was not taken, did not exit
289 }
290 }
291 //
292 // Search from top of history up through geometry until
293 // containing volume found:
294 // If on
295 // o OUTSIDE - Back up level, not/no longer exiting volumes
296 // o SURFACE and EXITING - Back up level, setting new blocking no.s
297 // else
298 // o containing volume found
299 //
300
301 while (notKnownContained) // Loop checking, 07.10.2016, J.Apostolakis
302 {
303 EVolume topVolumeType = fHistory.GetTopVolumeType();
304 if (topVolumeType!=kReplica && topVolumeType!=kExternal)
305 {
306 targetSolid = fHistory.GetTopVolume()->GetLogicalVolume()->GetSolid();
307 localPoint = fHistory.GetTopTransform().TransformPoint(globalPoint);
308 insideCode = targetSolid->Inside(localPoint);
309#ifdef G4VERBOSE
310 if(( fVerbose == 1 ) && ( fCheck ))
311 {
312 G4String solidResponse = "-kInside-";
313 if (insideCode == kOutside)
314 solidResponse = "-kOutside-";
315 else if (insideCode == kSurface)
316 solidResponse = "-kSurface-";
317 G4cout << "*** G4Navigator::LocateGlobalPointAndSetup(): ***" << G4endl
318 << " Invoked Inside() for solid: " << targetSolid->GetName()
319 << ". Solid replied: " << solidResponse << G4endl
320 << " For local point p: " << localPoint << G4endl;
321 }
322#endif
323 }
324 else
325 {
326 if( topVolumeType == kReplica )
327 {
328 insideCode = freplicaNav.BackLocate(fHistory, globalPoint, localPoint,
329 fExiting, notKnownContained);
330 // !CARE! if notKnownContained returns false then the point is within
331 // the containing placement volume of the replica(s). If insidecode
332 // will result in the history being backed up one level, then the
333 // local point returned is the point in the system of this new level
334 }
335 else
336 {
337 targetSolid = fHistory.GetTopVolume()->GetLogicalVolume()->GetSolid();
338 localPoint = fHistory.GetTopTransform().TransformPoint(globalPoint);
339 G4ThreeVector localDirection =
340 fHistory.GetTopTransform().TransformAxis(globalDirection);
341 insideCode = fpExternalNav->Inside(targetSolid, localPoint, localDirection);
342 }
343 }
344
345 if ( insideCode==kOutside )
346 {
347 ++noLevelsExited;
348 if ( fHistory.GetDepth() )
349 {
353 fExiting = false;
354
355 if( noLevelsExited > 1 )
356 {
357 // The first transformation was done by the sub-navigator
358 //
360 if( mRot )
361 {
362 fGrandMotherExitNormal *= (*mRot).inverse();
364 }
365 }
366 }
367 else
368 {
369 fLastLocatedPointLocal = localPoint;
371 // No extra transformation for ExitNormal - is in frame of Top Volume
372 return nullptr; // Have exited world volume
373 }
374 }
375 else
376 if ( insideCode==kSurface )
377 {
378 G4bool isExiting = fExiting;
379 if( (!fExiting) && considerDirection )
380 {
381 // Figure out whether we are exiting this level's volume
382 // by using the direction
383 //
384 G4bool directionExiting = false;
385 G4ThreeVector localDirection =
386 fHistory.GetTopTransform().TransformAxis(globalDirection);
387
388 // Make sure localPoint in correct reference frame
389 // ( Was it already correct ? How ? )
390 //
391 localPoint= fHistory.GetTopTransform().TransformPoint(globalPoint);
393 {
394 G4ThreeVector normal = targetSolid->SurfaceNormal(localPoint);
395 directionExiting = normal.dot(localDirection) > 0.0;
396 isExiting = isExiting || directionExiting;
397 }
398 }
399 if( isExiting )
400 {
401 ++noLevelsExited;
402 if ( fHistory.GetDepth() )
403 {
407 //
408 // Still on surface but exited volume not necessarily convex
409 //
410 fValidExitNormal = false;
411
412 if( noLevelsExited > 1 )
413 {
414 // The first transformation was done by the sub-navigator
415 //
416 const G4RotationMatrix* mRot =
418 if( mRot )
419 {
420 fGrandMotherExitNormal *= (*mRot).inverse();
422 }
423 }
424 }
425 else
426 {
427 fLastLocatedPointLocal = localPoint;
429 // No extra transformation for ExitNormal, is in frame of Top Vol
430 return nullptr; // Have exited world volume
431 }
432 }
433 else
434 {
435 notKnownContained = false;
436 }
437 }
438 else
439 {
440 notKnownContained = false;
441 }
442 } // END while (notKnownContained)
443 //
444 // Search downwards until deepest containing volume found,
445 // blocking fBlockedPhysicalVolume/BlockedReplicaNum
446 //
447 // 3 Cases:
448 //
449 // o Parameterised daughters
450 // =>Must be one G4PVParameterised daughter & voxels
451 // o Positioned daughters & voxels
452 // o Positioned daughters & no voxels
453
454 noResult = true; // noResult should be renamed to
455 // something like enteredLevel, as that is its meaning.
456 do
457 {
458 // Determine `type' of current mother volume
459 //
460 targetPhysical = fHistory.GetTopVolume();
461 if (!targetPhysical) { break; }
462 targetLogical = targetPhysical->GetLogicalVolume();
463 switch( CharacteriseDaughters(targetLogical) )
464 {
465 case kNormal:
466 if ( targetLogical->GetVoxelHeader() ) // use optimised navigation
467 {
471 globalPoint,
472 pGlobalDirection,
473 considerDirection,
474 localPoint);
475 }
476 else // do not use optimised navigation
477 {
481 globalPoint,
482 pGlobalDirection,
483 considerDirection,
484 localPoint);
485 }
486 break;
487 case kReplica:
491 globalPoint,
492 pGlobalDirection,
493 considerDirection,
494 localPoint);
495 break;
496 case kParameterised:
497 if( GetDaughtersRegularStructureId(targetLogical) != 1 )
498 {
499 noResult = fparamNav.LevelLocate(fHistory,
502 globalPoint,
503 pGlobalDirection,
504 considerDirection,
505 localPoint);
506 }
507 else // Regular structure
508 {
512 globalPoint,
513 pGlobalDirection,
514 considerDirection,
515 localPoint);
516 }
517 break;
518 case kExternal:
522 globalPoint,
523 pGlobalDirection,
524 considerDirection,
525 localPoint);
526 break;
527 }
528
529 // LevelLocate returns true if it finds a daughter volume
530 // in which globalPoint is inside (or on the surface).
531
532 if ( noResult )
533 {
534 ++noLevelsEntered;
535
536 // Entering a daughter after ascending
537 //
538 // The blocked volume is no longer valid - it was for another level
539 //
540 fBlockedPhysicalVolume = nullptr;
542
543 // fEntering should be false -- else blockedVolume is assumed good.
544 // fEnteredDaughter is used for ExitNormal
545 //
546 fEntering = false;
547 fEnteredDaughter = true;
548
549 if( fExitedMother )
550 {
551 G4VPhysicalVolume* enteredPhysical = fHistory.GetTopVolume();
552 const G4RotationMatrix* mRot = enteredPhysical->GetRotation();
553 if( mRot )
554 {
555 // Go deeper, i.e. move 'down' in the hierarchy
556 // Apply direct rotation, not inverse
557 //
558 fGrandMotherExitNormal *= (*mRot);
560 }
561 }
562
563#ifdef G4DEBUG_NAVIGATION
564 if( fVerbose > 2 )
565 {
566 G4VPhysicalVolume* enteredPhysical = fHistory.GetTopVolume();
567 G4cout << "*** G4Navigator::LocateGlobalPointAndSetup() ***" << G4endl;
568 G4cout << " Entering volume: " << enteredPhysical->GetName()
569 << G4endl;
570 }
571#endif
572 }
573 } while (noResult); // Loop checking, 07.10.2016, J.Apostolakis
574
575 fLastLocatedPointLocal = localPoint;
576
577#ifdef G4VERBOSE
578 if( fVerbose >= 4 )
579 {
580 G4int oldcoutPrec = G4cout.precision(8);
581 G4String curPhysVol_Name("None");
582 if (targetPhysical) { curPhysVol_Name = targetPhysical->GetName(); }
583 G4cout << " Return value = new volume = " << curPhysVol_Name << G4endl;
584 G4cout << " ----- Upon exiting:" << G4endl;
585 PrintState();
586 if( fVerbose >= 5 )
587 {
588 G4cout << "Upon exiting LocateGlobalPointAndSetup():" << G4endl;
589 G4cout << " History = " << G4endl << fHistory << G4endl << G4endl;
590 }
591 G4cout.precision(oldcoutPrec);
592 }
593#endif
594
595 fLocatedOutsideWorld = false;
596
597 return targetPhysical;
598}
G4ThreeVector TransformAxis(const G4ThreeVector &axis) const
G4SmartVoxelHeader * GetVoxelHeader() const
void UpdateMaterial(G4Material *pMaterial)
EVolume GetTopVolumeType() const
void NewLevel(G4VPhysicalVolume *pNewMother, EVolume vType=kNormal, G4int nReplica=-1)
size_t GetDepth() const
G4int GetTopReplicaNo() const
G4bool fEnteredDaughter
Definition: G4Navigator.hh:398
G4ParameterisedNavigation fparamNav
Definition: G4Navigator.hh:529
G4VExternalNavigation * fpExternalNav
Definition: G4Navigator.hh:532
G4ReplicaNavigation freplicaNav
Definition: G4Navigator.hh:530
G4bool fWasLimitedByGeometry
Definition: G4Navigator.hh:408
G4VoxelNavigation & GetVoxelNavigator()
EVolume CharacteriseDaughters(const G4LogicalVolume *pLog) const
void PrintState() const
G4RegularNavigation fregularNav
Definition: G4Navigator.hh:531
G4NormalNavigation fnormalNav
Definition: G4Navigator.hh:523
void ResetStackAndState()
G4bool fLocatedOutsideWorld
Definition: G4Navigator.hh:479
G4bool fValidExitNormal
Definition: G4Navigator.hh:474
G4int GetDaughtersRegularStructureId(const G4LogicalVolume *pLv) const
G4bool fChangedGrandMotherRefFrame
Definition: G4Navigator.hh:482
G4bool LevelLocate(G4NavigationHistory &history, const G4VPhysicalVolume *blockedVol, const G4int blockedNum, const G4ThreeVector &globalPoint, const G4ThreeVector *globalDirection, const G4bool pLocatedOnEdge, G4ThreeVector &localPoint)
G4bool LevelLocate(G4NavigationHistory &history, const G4VPhysicalVolume *blockedVol, const G4int blockedNum, const G4ThreeVector &globalPoint, const G4ThreeVector *globalDirection, const G4bool pLocatedOnEdge, G4ThreeVector &localPoint)
G4bool LevelLocate(G4NavigationHistory &history, const G4VPhysicalVolume *blockedVol, const G4int blockedNum, const G4ThreeVector &globalPoint, const G4ThreeVector *globalDirection, const G4bool pLocatedOnEdge, G4ThreeVector &localPoint)
void ComputeTransformation(const G4int replicaNo, G4VPhysicalVolume *pVol, G4ThreeVector &point) const
G4bool LevelLocate(G4NavigationHistory &history, const G4VPhysicalVolume *blockedVol, const G4int blockedNum, const G4ThreeVector &globalPoint, const G4ThreeVector *globalDirection, const G4bool pLocatedOnEdge, G4ThreeVector &localPoint)
EInside BackLocate(G4NavigationHistory &history, const G4ThreeVector &globalPoint, G4ThreeVector &localPoint, const G4bool &exiting, G4bool &notKnownInside) const
virtual EInside Inside(const G4VSolid *solid, const G4ThreeVector &position, const G4ThreeVector &direction)
virtual G4bool LevelLocate(G4NavigationHistory &history, const G4VPhysicalVolume *blockedVol, const G4int blockedNum, const G4ThreeVector &globalPoint, const G4ThreeVector *globalDirection, const G4bool pLocatedOnEdge, G4ThreeVector &localPoint)=0
const G4RotationMatrix * GetRotation() const
virtual void SetCopyNo(G4int CopyNo)=0
virtual G4int GetCopyNo() const =0
virtual G4int GetRegularStructureId() const =0
virtual G4VPVParameterisation * GetParameterisation() const =0
virtual G4bool LevelLocate(G4NavigationHistory &history, const G4VPhysicalVolume *blockedVol, const G4int blockedNum, const G4ThreeVector &globalPoint, const G4ThreeVector *globalDirection, const G4bool pLocatedOnEdge, G4ThreeVector &localPoint)
EVolume
Definition: geomdefs.hh:83

References G4NavigationHistory::BackLevel(), G4ReplicaNavigation::BackLocate(), G4Navigator::CharacteriseDaughters(), G4VSolid::ComputeDimensions(), G4VPVParameterisation::ComputeSolid(), G4ReplicaNavigation::ComputeTransformation(), G4VPVParameterisation::ComputeTransformation(), FatalException, G4Navigator::fBlockedPhysicalVolume, G4Navigator::fBlockedReplicaNo, G4Navigator::fChangedGrandMotherRefFrame, G4Navigator::fCheck, G4Navigator::fEnteredDaughter, G4Navigator::fEntering, G4Navigator::fExitedMother, G4Navigator::fExiting, G4Navigator::fGrandMotherExitNormal, G4Navigator::fHistory, G4Navigator::fLastLocatedPointLocal, G4Navigator::fLastTriedStepComputation, G4Navigator::fLocatedOnEdge, G4Navigator::fLocatedOutsideWorld, G4Navigator::fnormalNav, G4Navigator::fparamNav, G4Navigator::fpExternalNav, G4Navigator::fregularNav, G4Navigator::freplicaNav, G4Navigator::fValidExitNormal, G4Navigator::fVerbose, G4Navigator::fWasLimitedByGeometry, G4cout, G4endl, G4Exception(), G4VPhysicalVolume::GetCopyNo(), G4Navigator::GetDaughtersRegularStructureId(), G4NavigationHistory::GetDepth(), G4VPhysicalVolume::GetLogicalVolume(), G4VPhysicalVolume::GetName(), G4VSolid::GetName(), G4VPhysicalVolume::GetParameterisation(), G4VPhysicalVolume::GetRegularStructureId(), G4VPhysicalVolume::GetRotation(), G4LogicalVolume::GetSolid(), G4NavigationHistory::GetTopReplicaNo(), G4NavigationHistory::GetTopTransform(), G4NavigationHistory::GetTopVolume(), G4NavigationHistory::GetTopVolumeType(), G4LogicalVolume::GetVoxelHeader(), G4Navigator::GetVoxelNavigator(), G4VSolid::Inside(), G4VExternalNavigation::Inside(), kExternal, kNormal, kOutside, kParameterised, kReplica, kSurface, G4NormalNavigation::LevelLocate(), G4ParameterisedNavigation::LevelLocate(), G4RegularNavigation::LevelLocate(), G4ReplicaNavigation::LevelLocate(), G4VoxelNavigation::LevelLocate(), G4VExternalNavigation::LevelLocate(), G4NavigationHistory::NewLevel(), CLHEP::normal(), G4Navigator::PrintState(), G4Navigator::ResetStackAndState(), G4VPhysicalVolume::SetCopyNo(), G4LogicalVolume::SetSolid(), G4VSolid::SurfaceNormal(), G4AffineTransform::TransformAxis(), G4AffineTransform::TransformPoint(), G4LogicalVolume::UpdateMaterial(), and G4Navigator::VolumeType().

Referenced by G4AdjointPrimaryGenerator::ComputeAccumulatedDepthVectorAlongBackRay(), G4Navigator::ComputeStep(), G4VIntersectionLocator::GetLocalSurfaceNormal(), G4SPSPosDistribution::IsSourceConfined(), G4SafetyHelper::Locate(), G4VIntersectionLocator::LocateGlobalPointWithinVolumeAndCheck(), G4Navigator::ResetHierarchyAndLocate(), and G4SteppingManager::SetInitialStep().

◆ LocateGlobalPointAndUpdateTouchable() [1/2]

void G4Navigator::LocateGlobalPointAndUpdateTouchable ( const G4ThreeVector position,
const G4ThreeVector direction,
G4VTouchable touchableToUpdate,
const G4bool  RelativeSearch = true 
)
inlineinherited

◆ LocateGlobalPointAndUpdateTouchable() [2/2]

void G4Navigator::LocateGlobalPointAndUpdateTouchable ( const G4ThreeVector position,
G4VTouchable touchableToUpdate,
const G4bool  RelativeSearch = true 
)
inlineinherited

◆ LocateGlobalPointAndUpdateTouchableHandle()

void G4Navigator::LocateGlobalPointAndUpdateTouchableHandle ( const G4ThreeVector position,
const G4ThreeVector direction,
G4TouchableHandle oldTouchableToUpdate,
const G4bool  RelativeSearch = true 
)
inlineinherited

◆ LocateGlobalPointWithinVolume()

void G4Navigator::LocateGlobalPointWithinVolume ( const G4ThreeVector position)
virtualinherited

Reimplemented in G4MultiNavigator.

Definition at line 614 of file G4Navigator.cc.

615{
616#ifdef G4DEBUG_NAVIGATION
617 assert( !fWasLimitedByGeometry );
618 // Check: Either step was not limited by a boundary or
619 // else the full step is no longer being taken
620#endif
621
624 fChangedGrandMotherRefFrame = false; // Frame for Exit Normal
625
626 // For the case of Voxel (or Parameterised) volume the respective
627 // Navigator must be messaged to update its voxel information etc
628
629 // Update the state of the Sub Navigators
630 // - in particular any voxel information they store/cache
631 //
632 G4VPhysicalVolume* motherPhysical = fHistory.GetTopVolume();
633 G4LogicalVolume* motherLogical = motherPhysical->GetLogicalVolume();
634 G4SmartVoxelHeader* pVoxelHeader = motherLogical->GetVoxelHeader();
635
636 switch( CharacteriseDaughters(motherLogical) )
637 {
638 case kNormal:
639 if ( pVoxelHeader )
640 {
642 }
643 break;
644 case kParameterised:
645 if( GetDaughtersRegularStructureId(motherLogical) != 1 )
646 {
647 // Resets state & returns voxel node
648 //
650 }
651 break;
652 case kReplica:
653 // Nothing to do
654 break;
655 case kExternal:
656 fpExternalNav->RelocateWithinVolume( motherPhysical,
658 break;
659 }
660
661 // Reset the state variables
662 // - which would have been affected
663 // by the 'equivalent' call to LocateGlobalPointAndSetup
664 // - who's values have been invalidated by the 'move'.
665 //
666 fBlockedPhysicalVolume = nullptr;
668 fEntering = false;
669 fEnteredDaughter = false; // Boundary not encountered, did not enter
670 fExiting = false;
671 fExitedMother = false; // Boundary not encountered, did not exit
672}
G4ThreeVector ComputeLocalPoint(const G4ThreeVector &rGlobPoint) const
G4SmartVoxelNode * ParamVoxelLocate(G4SmartVoxelHeader *pHead, const G4ThreeVector &localPoint)
virtual void RelocateWithinVolume(G4VPhysicalVolume *motherPhysical, const G4ThreeVector &localPoint)
G4SmartVoxelNode * VoxelLocate(G4SmartVoxelHeader *pHead, const G4ThreeVector &localPoint)

References G4Navigator::CharacteriseDaughters(), G4Navigator::ComputeLocalPoint(), G4Navigator::fBlockedPhysicalVolume, G4Navigator::fBlockedReplicaNo, G4Navigator::fChangedGrandMotherRefFrame, G4Navigator::fEnteredDaughter, G4Navigator::fEntering, G4Navigator::fExitedMother, G4Navigator::fExiting, G4Navigator::fHistory, G4Navigator::fLastLocatedPointLocal, G4Navigator::fLastTriedStepComputation, G4Navigator::fparamNav, G4Navigator::fpExternalNav, G4Navigator::fWasLimitedByGeometry, G4Navigator::GetDaughtersRegularStructureId(), G4VPhysicalVolume::GetLogicalVolume(), G4NavigationHistory::GetTopVolume(), G4LogicalVolume::GetVoxelHeader(), G4Navigator::GetVoxelNavigator(), kExternal, kNormal, kParameterised, kReplica, G4ParameterisedNavigation::ParamVoxelLocate(), G4VExternalNavigation::RelocateWithinVolume(), and G4VoxelNavigation::VoxelLocate().

Referenced by G4VIntersectionLocator::AdjustmentOfFoundIntersection(), G4Navigator::ComputeSafety(), G4Navigator::ComputeStep(), G4PropagatorInField::ComputeStep(), G4BrentLocator::EstimateIntersectionPoint(), G4MultiLevelLocator::EstimateIntersectionPoint(), G4SimpleLocator::EstimateIntersectionPoint(), G4VIntersectionLocator::LocateGlobalPointWithinVolumeAndCheck(), G4Transportation::PostStepDoIt(), and G4SafetyHelper::ReLocateWithinVolume().

◆ NetRotation()

G4RotationMatrix G4Navigator::NetRotation ( ) const
inlineinherited

◆ NetTranslation()

G4ThreeVector G4Navigator::NetTranslation ( ) const
inlineinherited

◆ PrintState()

void G4Navigator::PrintState ( ) const
inherited

Definition at line 1964 of file G4Navigator.cc.

1965{
1966 G4int oldcoutPrec = G4cout.precision(4);
1967 if( fVerbose >= 4 )
1968 {
1969 G4cout << "The current state of G4Navigator is: " << G4endl;
1970 G4cout << " ValidExitNormal= " << fValidExitNormal // << G4endl
1971 << " ExitNormal = " << fExitNormal // << G4endl
1972 << " Exiting = " << fExiting // << G4endl
1973 << " Entering = " << fEntering // << G4endl
1974 << " BlockedPhysicalVolume= " ;
1976 {
1977 G4cout << "None";
1978 }
1979 else
1980 {
1982 }
1983 G4cout << G4endl
1984 << " BlockedReplicaNo = " << fBlockedReplicaNo // << G4endl
1985 << " LastStepWasZero = " << fLastStepWasZero // << G4endl
1986 << G4endl;
1987 }
1988 if( ( 1 < fVerbose) && (fVerbose < 4) )
1989 {
1990 G4cout << G4endl; // Make sure to line up
1991 G4cout << std::setw(30) << " ExitNormal " << " "
1992 << std::setw( 5) << " Valid " << " "
1993 << std::setw( 9) << " Exiting " << " "
1994 << std::setw( 9) << " Entering" << " "
1995 << std::setw(15) << " Blocked:Volume " << " "
1996 << std::setw( 9) << " ReplicaNo" << " "
1997 << std::setw( 8) << " LastStepZero " << " "
1998 << G4endl;
1999 G4cout << "( " << std::setw(7) << fExitNormal.x()
2000 << ", " << std::setw(7) << fExitNormal.y()
2001 << ", " << std::setw(7) << fExitNormal.z() << " ) "
2002 << std::setw( 5) << fValidExitNormal << " "
2003 << std::setw( 9) << fExiting << " "
2004 << std::setw( 9) << fEntering << " ";
2005 if ( fBlockedPhysicalVolume == nullptr )
2006 { G4cout << std::setw(15) << "None"; }
2007 else
2008 { G4cout << std::setw(15)<< fBlockedPhysicalVolume->GetName(); }
2009 G4cout << std::setw( 9) << fBlockedReplicaNo << " "
2010 << std::setw( 8) << fLastStepWasZero << " "
2011 << G4endl;
2012 }
2013 if( fVerbose > 2 )
2014 {
2015 G4cout.precision(8);
2016 G4cout << " Current Localpoint = " << fLastLocatedPointLocal << G4endl;
2017 G4cout << " PreviousSftOrigin = " << fPreviousSftOrigin << G4endl;
2018 G4cout << " PreviousSafety = " << fPreviousSafety << G4endl;
2019 }
2020 G4cout.precision(oldcoutPrec);
2021}
double z() const
double x() const
double y() const
G4ThreeVector fExitNormal
Definition: G4Navigator.hh:417

References G4Navigator::fBlockedPhysicalVolume, G4Navigator::fBlockedReplicaNo, G4Navigator::fEntering, G4Navigator::fExiting, G4Navigator::fExitNormal, G4Navigator::fLastLocatedPointLocal, G4Navigator::fLastStepWasZero, G4Navigator::fPreviousSafety, G4Navigator::fPreviousSftOrigin, G4Navigator::fValidExitNormal, G4Navigator::fVerbose, G4cout, G4endl, G4VPhysicalVolume::GetName(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

Referenced by G4Navigator::ComputeSafety(), G4Navigator::ComputeStep(), export_G4Navigator(), and G4Navigator::LocateGlobalPointAndSetup().

◆ ResetHierarchyAndLocate()

G4VPhysicalVolume * G4Navigator::ResetHierarchyAndLocate ( const G4ThreeVector point,
const G4ThreeVector direction,
const G4TouchableHistory h 
)
virtualinherited

Reimplemented in G4MultiNavigator.

Definition at line 102 of file G4Navigator.cc.

105{
106 ResetState();
107 fHistory = *h.GetHistory();
109 fLastTriedStepComputation = false; // Redundant, but best
110 return LocateGlobalPointAndSetup(p, &direction, true, false);
111}
virtual void SetupHierarchy()
virtual void ResetState()
virtual G4VPhysicalVolume * LocateGlobalPointAndSetup(const G4ThreeVector &point, const G4ThreeVector *direction=nullptr, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true)
Definition: G4Navigator.cc:132
const G4NavigationHistory * GetHistory() const

References G4Navigator::fHistory, G4Navigator::fLastTriedStepComputation, G4TouchableHistory::GetHistory(), G4Navigator::LocateGlobalPointAndSetup(), G4Navigator::ResetState(), and G4Navigator::SetupHierarchy().

Referenced by G4MultiNavigator::ResetHierarchyAndLocate(), and G4SteppingManager::SetInitialStep().

◆ ResetStackAndState()

void G4Navigator::ResetStackAndState ( )
inlineinherited

◆ ResetState()

void G4Navigator::ResetState ( )
protectedvirtualinherited

Reimplemented in G4MultiNavigator.

Definition at line 1288 of file G4Navigator.cc.

1289{
1290 fWasLimitedByGeometry = false;
1291 fEntering = false;
1292 fExiting = false;
1293 fLocatedOnEdge = false;
1294 fLastStepWasZero = false;
1295 fEnteredDaughter = false;
1296 fExitedMother = false;
1297 fPushed = false;
1298
1299 fValidExitNormal = false;
1301 fCalculatedExitNormal = false;
1302
1303 fExitNormal = G4ThreeVector(0,0,0);
1306
1308 fPreviousSafety = 0.0;
1309
1310 fNumberZeroSteps = 0;
1311
1312 fBlockedPhysicalVolume = nullptr;
1313 fBlockedReplicaNo = -1;
1314
1316 fLocatedOutsideWorld = false;
1317
1318 fLastMotherPhys = nullptr;
1319}
G4int fNumberZeroSteps
Definition: G4Navigator.hh:449
G4ThreeVector fExitNormalGlobalFrame
Definition: G4Navigator.hh:425
G4VPhysicalVolume * fLastMotherPhys
Definition: G4Navigator.hh:434
G4bool fPushed
Definition: G4Navigator.hh:539
static const G4double kInfinity
Definition: geomdefs.hh:41

References G4Navigator::fBlockedPhysicalVolume, G4Navigator::fBlockedReplicaNo, G4Navigator::fCalculatedExitNormal, G4Navigator::fChangedGrandMotherRefFrame, G4Navigator::fEnteredDaughter, G4Navigator::fEntering, G4Navigator::fExitedMother, G4Navigator::fExiting, G4Navigator::fExitNormal, G4Navigator::fExitNormalGlobalFrame, G4Navigator::fGrandMotherExitNormal, G4Navigator::fLastLocatedPointLocal, G4Navigator::fLastMotherPhys, G4Navigator::fLastStepWasZero, G4Navigator::fLocatedOnEdge, G4Navigator::fLocatedOutsideWorld, G4Navigator::fNumberZeroSteps, G4Navigator::fPreviousSafety, G4Navigator::fPreviousSftOrigin, G4Navigator::fPushed, G4Navigator::fValidExitNormal, G4Navigator::fWasLimitedByGeometry, and kInfinity.

Referenced by G4Navigator::ResetHierarchyAndLocate().

◆ RestoreSavedState()

void G4Navigator::RestoreSavedState ( )
protectedinherited

Definition at line 716 of file G4Navigator.cc.

717{
722
725
727
733
734 // The 'expected' behaviour is to restore these too (fix 2014.05.26)
737}
struct G4Navigator::G4SaveNavigatorState fSaveState
G4VPhysicalVolume * spBlockedPhysicalVolume
Definition: G4Navigator.hh:500

References G4Navigator::fBlockedPhysicalVolume, G4Navigator::fBlockedReplicaNo, G4Navigator::fEnteredDaughter, G4Navigator::fEntering, G4Navigator::fExitedMother, G4Navigator::fExiting, G4Navigator::fExitNormal, G4Navigator::fLastLocatedPointLocal, G4Navigator::fLastStepWasZero, G4Navigator::fLocatedOutsideWorld, G4Navigator::fPreviousSafety, G4Navigator::fPreviousSftOrigin, G4Navigator::fSaveState, G4Navigator::fValidExitNormal, G4Navigator::fWasLimitedByGeometry, G4Navigator::G4SaveNavigatorState::sBlockedReplicaNo, G4Navigator::G4SaveNavigatorState::sEnteredDaughter, G4Navigator::G4SaveNavigatorState::sEntering, G4Navigator::G4SaveNavigatorState::sExitedMother, G4Navigator::G4SaveNavigatorState::sExiting, G4Navigator::G4SaveNavigatorState::sExitNormal, G4Navigator::G4SaveNavigatorState::sLastLocatedPointLocal, G4Navigator::G4SaveNavigatorState::sLastStepWasZero, G4Navigator::G4SaveNavigatorState::sLocatedOutsideWorld, G4Navigator::G4SaveNavigatorState::spBlockedPhysicalVolume, G4Navigator::G4SaveNavigatorState::sPreviousSafety, G4Navigator::G4SaveNavigatorState::sPreviousSftOrigin, G4Navigator::G4SaveNavigatorState::sValidExitNormal, and G4Navigator::G4SaveNavigatorState::sWasLimitedByGeometry.

Referenced by G4Navigator::CheckNextStep(), and G4Navigator::ComputeSafety().

◆ SetExternalNavigation()

void G4Navigator::SetExternalNavigation ( G4VExternalNavigation externalNav)
inlineinherited

◆ SetGeometricallyLimitedStep()

void G4Navigator::SetGeometricallyLimitedStep ( )
inlineinherited

◆ SetPushVerbosity()

void G4Navigator::SetPushVerbosity ( G4bool  mode)
inlineinherited

◆ SetSavedState()

void G4Navigator::SetSavedState ( )
protectedinherited

Definition at line 682 of file G4Navigator.cc.

683{
684 // Note: the state of dependent objects is not currently saved.
685 // ( This means that the full state is changed by calls between
686 // SetSavedState() and RestoreSavedState();
687
692
695
697
703
704 // Even the safety sphere - if you want to change it do it explicitly!
705 //
708}

References G4Navigator::fBlockedPhysicalVolume, G4Navigator::fBlockedReplicaNo, G4Navigator::fEnteredDaughter, G4Navigator::fEntering, G4Navigator::fExitedMother, G4Navigator::fExiting, G4Navigator::fExitNormal, G4Navigator::fLastLocatedPointLocal, G4Navigator::fLastStepWasZero, G4Navigator::fLocatedOutsideWorld, G4Navigator::fPreviousSafety, G4Navigator::fPreviousSftOrigin, G4Navigator::fSaveState, G4Navigator::fValidExitNormal, G4Navigator::fWasLimitedByGeometry, G4Navigator::G4SaveNavigatorState::sBlockedReplicaNo, G4Navigator::G4SaveNavigatorState::sEnteredDaughter, G4Navigator::G4SaveNavigatorState::sEntering, G4Navigator::G4SaveNavigatorState::sExitedMother, G4Navigator::G4SaveNavigatorState::sExiting, G4Navigator::G4SaveNavigatorState::sExitNormal, G4Navigator::G4SaveNavigatorState::sLastLocatedPointLocal, G4Navigator::G4SaveNavigatorState::sLastStepWasZero, G4Navigator::G4SaveNavigatorState::sLocatedOutsideWorld, G4Navigator::G4SaveNavigatorState::spBlockedPhysicalVolume, G4Navigator::G4SaveNavigatorState::sPreviousSafety, G4Navigator::G4SaveNavigatorState::sPreviousSftOrigin, G4Navigator::G4SaveNavigatorState::sValidExitNormal, and G4Navigator::G4SaveNavigatorState::sWasLimitedByGeometry.

Referenced by G4Navigator::CheckNextStep(), and G4Navigator::ComputeSafety().

◆ SetupHierarchy()

void G4Navigator::SetupHierarchy ( )
protectedvirtualinherited

Reimplemented in G4MultiNavigator.

Definition at line 1329 of file G4Navigator.cc.

1330{
1331 const G4int cdepth = fHistory.GetDepth();
1332 G4VPhysicalVolume* current;
1333 G4VSolid* pSolid;
1334 G4VPVParameterisation* pParam;
1335
1336 for ( auto i=1; i<=cdepth; ++i )
1337 {
1338 current = fHistory.GetVolume(i);
1339 switch ( fHistory.GetVolumeType(i) )
1340 {
1341 case kNormal:
1342 case kExternal:
1343 break;
1344 case kReplica:
1346 break;
1347 case kParameterised:
1348 G4int replicaNo;
1349 pParam = current->GetParameterisation();
1350 replicaNo = fHistory.GetReplicaNo(i);
1351 pSolid = pParam->ComputeSolid(replicaNo, current);
1352
1353 // Set up dimensions & transform in solid/physical volume
1354 //
1355 pSolid->ComputeDimensions(pParam, replicaNo, current);
1356 pParam->ComputeTransformation(replicaNo, current);
1357
1358 G4TouchableHistory* pTouchable = nullptr;
1359 if( pParam->IsNested() )
1360 {
1361 pTouchable= new G4TouchableHistory( fHistory );
1362 pTouchable->MoveUpHistory(); // Move up to the parent level
1363 // Adequate only if Nested at the Branch level (last)
1364 // To extend to other cases:
1365 // pTouchable->MoveUpHistory(cdepth-i-1);
1366 // Move to the parent level of *Current* level
1367 // Could replace this line and constructor with a revised
1368 // c-tor for History(levels to drop)
1369 }
1370 // Set up the correct solid and material in Logical Volume
1371 //
1372 G4LogicalVolume* pLogical = current->GetLogicalVolume();
1373 pLogical->SetSolid( pSolid );
1374 pLogical->UpdateMaterial( pParam ->
1375 ComputeMaterial(replicaNo, current, pTouchable) );
1376 delete pTouchable;
1377 break;
1378 }
1379 }
1380}
G4int GetReplicaNo(G4int n) const
G4VPhysicalVolume * GetVolume(G4int n) const
EVolume GetVolumeType(G4int n) const
G4int MoveUpHistory(G4int num_levels=1)
virtual G4bool IsNested() const

References G4VSolid::ComputeDimensions(), G4VPVParameterisation::ComputeSolid(), G4ReplicaNavigation::ComputeTransformation(), G4VPVParameterisation::ComputeTransformation(), G4Navigator::fHistory, G4Navigator::freplicaNav, G4NavigationHistory::GetDepth(), G4VPhysicalVolume::GetLogicalVolume(), G4VPhysicalVolume::GetParameterisation(), G4NavigationHistory::GetReplicaNo(), G4NavigationHistory::GetVolume(), G4NavigationHistory::GetVolumeType(), G4VPVParameterisation::IsNested(), kExternal, kNormal, kParameterised, kReplica, G4TouchableHistory::MoveUpHistory(), G4LogicalVolume::SetSolid(), and G4LogicalVolume::UpdateMaterial().

Referenced by G4Navigator::ResetHierarchyAndLocate().

◆ SetVerboseLevel()

void G4Navigator::SetVerboseLevel ( G4int  level)
inlineinherited

◆ SetVoxelNavigation()

void G4Navigator::SetVoxelNavigation ( G4VoxelNavigation voxelNav)
inherited

◆ SetWorldVolume()

void G4Navigator::SetWorldVolume ( G4VPhysicalVolume pWorld)
inlineinherited

◆ SeverityOfZeroStepping()

G4int G4Navigator::SeverityOfZeroStepping ( G4int noZeroSteps) const
inlineinherited

◆ TargetSafetyFromPoint()

G4double G4ErrorPropagationNavigator::TargetSafetyFromPoint ( const G4ThreeVector pGlobalpoint)

Definition at line 132 of file G4ErrorPropagationNavigator.cc.

134{
135 G4double safety = DBL_MAX;
136
137 G4ErrorPropagatorData* g4edata
139
140 if ( g4edata != nullptr )
141 {
142 const G4ErrorTarget* target = g4edata->GetTarget();
143 if( target != nullptr )
144 {
145 safety = target->GetDistanceFromPoint(pGlobalpoint);
146 }
147 }
148 return safety;
149}

References DBL_MAX, G4ErrorTarget::GetDistanceFromPoint(), G4ErrorPropagatorData::GetErrorPropagatorData(), and G4ErrorPropagatorData::GetTarget().

Referenced by ComputeSafety(), and ComputeStep().

◆ VolumeType()

EVolume G4Navigator::VolumeType ( const G4VPhysicalVolume pVol) const
inlineprotectedinherited

Field Documentation

◆ fAbandonThreshold_NoZeroSteps

G4int G4Navigator::fAbandonThreshold_NoZeroSteps = 25
privateinherited

Definition at line 453 of file G4Navigator.hh.

Referenced by G4Navigator::ComputeStep(), and G4Navigator::G4Navigator().

◆ fActionThreshold_NoZeroSteps

G4int G4Navigator::fActionThreshold_NoZeroSteps = 10
privateinherited

Definition at line 451 of file G4Navigator.hh.

Referenced by G4Navigator::ComputeStep(), and G4Navigator::G4Navigator().

◆ fActive

G4bool G4Navigator::fActive = false
privateinherited

Definition at line 456 of file G4Navigator.hh.

◆ fBlockedPhysicalVolume

G4VPhysicalVolume* G4Navigator::fBlockedPhysicalVolume
privateinherited

◆ fBlockedReplicaNo

G4int G4Navigator::fBlockedReplicaNo
privateinherited

◆ fCalculatedExitNormal

G4bool G4Navigator::fCalculatedExitNormal
privateinherited

◆ fChangedGrandMotherRefFrame

G4bool G4Navigator::fChangedGrandMotherRefFrame
privateinherited

◆ fCheck

G4bool G4Navigator::fCheck = false
privateinherited

◆ fEnteredDaughter

G4bool G4Navigator::fEnteredDaughter
protectedinherited

◆ fEntering

G4bool G4Navigator::fEntering
privateinherited

◆ fExitedMother

G4bool G4Navigator::fExitedMother
protectedinherited

◆ fExiting

G4bool G4Navigator::fExiting
privateinherited

◆ fExitNormal

G4ThreeVector G4Navigator::fExitNormal
privateinherited

◆ fExitNormalGlobalFrame

G4ThreeVector G4Navigator::fExitNormalGlobalFrame
privateinherited

◆ fGrandMotherExitNormal

G4ThreeVector G4Navigator::fGrandMotherExitNormal
privateinherited

◆ fHistory

G4NavigationHistory G4Navigator::fHistory
protectedinherited

◆ fLastLocatedPointLocal

G4ThreeVector G4Navigator::fLastLocatedPointLocal
privateinherited

◆ fLastMotherPhys

G4VPhysicalVolume* G4Navigator::fLastMotherPhys = nullptr
privateinherited

Definition at line 434 of file G4Navigator.hh.

Referenced by G4Navigator::ComputeStep(), and G4Navigator::ResetState().

◆ fLastStepEndPointLocal

G4ThreeVector G4Navigator::fLastStepEndPointLocal
protectedinherited

◆ fLastStepWasZero

G4bool G4Navigator::fLastStepWasZero
privateinherited

◆ fLastTriedStepComputation

G4bool G4Navigator::fLastTriedStepComputation = false
privateinherited

◆ fLocatedOnEdge

G4bool G4Navigator::fLocatedOnEdge
privateinherited

◆ fLocatedOutsideWorld

G4bool G4Navigator::fLocatedOutsideWorld
privateinherited

◆ fMinStep

G4double G4Navigator::fMinStep
protectedinherited

Definition at line 377 of file G4Navigator.hh.

Referenced by G4Navigator::ComputeStep(), and G4Navigator::G4Navigator().

◆ fnormalNav

G4NormalNavigation G4Navigator::fnormalNav
privateinherited

◆ fNumberZeroSteps

G4int G4Navigator::fNumberZeroSteps
privateinherited

Definition at line 449 of file G4Navigator.hh.

Referenced by G4Navigator::ComputeStep(), and G4Navigator::ResetState().

◆ fparamNav

G4ParameterisedNavigation G4Navigator::fparamNav
privateinherited

◆ fpExternalNav

G4VExternalNavigation* G4Navigator::fpExternalNav = nullptr
privateinherited

◆ fPreviousSafety

G4double G4Navigator::fPreviousSafety
privateinherited

◆ fPreviousSftOrigin

G4ThreeVector G4Navigator::fPreviousSftOrigin
privateinherited

◆ fPushed

G4bool G4Navigator::fPushed = false
privateinherited

Definition at line 539 of file G4Navigator.hh.

Referenced by G4Navigator::ComputeStep(), and G4Navigator::ResetState().

◆ fpvoxelNav

G4VoxelNavigation* G4Navigator::fpvoxelNav
privateinherited

Definition at line 525 of file G4Navigator.hh.

Referenced by G4Navigator::G4Navigator(), and G4Navigator::~G4Navigator().

◆ fpVoxelSafety

G4VoxelSafety* G4Navigator::fpVoxelSafety
privateinherited

◆ fregularNav

G4RegularNavigation G4Navigator::fregularNav
privateinherited

◆ freplicaNav

G4ReplicaNavigation G4Navigator::freplicaNav
privateinherited

◆ fSaveState

struct G4Navigator::G4SaveNavigatorState G4Navigator::fSaveState
privateinherited

◆ fSqTol

G4double G4Navigator::fSqTol
protectedinherited

◆ fStepEndPoint

G4ThreeVector G4Navigator::fStepEndPoint
protectedinherited

◆ fTopPhysical

G4VPhysicalVolume* G4Navigator::fTopPhysical = nullptr
privateinherited

Definition at line 517 of file G4Navigator.hh.

◆ fValidExitNormal

G4bool G4Navigator::fValidExitNormal
privateinherited

◆ fVerbose

G4int G4Navigator::fVerbose = 0
protectedinherited

◆ fWarnPush

G4bool G4Navigator::fWarnPush = true
privateinherited

Definition at line 539 of file G4Navigator.hh.

Referenced by G4Navigator::ComputeStep().

◆ fWasLimitedByGeometry

G4bool G4Navigator::fWasLimitedByGeometry = false
protectedinherited

◆ kCarTolerance

G4double G4Navigator::kCarTolerance
protectedinherited

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