58{
60 G4ThreeVector stepEndPoint = fNavigator.GetLastStepEndPoint();
61
63
64 G4double distEndpointSq = (pGlobalpoint-stepEndPoint).mag2();
65 G4bool stayedOnEndpoint = distEndpointSq <
sqr(fkCarTolerance);
66 G4bool endpointOnSurface = fNavigator.EnteredDaughterVolume()
67 || fNavigator.ExitedMotherVolume();
68
69 G4VPhysicalVolume* motherPhysical = fNavHistory.GetTopVolume();
70 if( motherPhysical != physicalVolume )
71 {
72 std::ostringstream msg;
73 msg << " Current (navigation) phys-volume: " << motherPhysical
75 << " Request made for phys-volume: " << physicalVolume
77 G4Exception(
"G4SafetyCalculator::SafetyInCurrentVolume",
"GeomNav0001",
79 "This method must be called only in the Current volume.");
80 }
81
82 if( !(endpointOnSurface && stayedOnEndpoint) )
83 {
85 G4SmartVoxelHeader* pVoxelHeader = motherLogical->
GetVoxelHeader();
86
87
88
90
91
92
94 switch(dtype)
95 {
97 if ( pVoxelHeader )
98 {
99
100 safety = fVoxelSafety.ComputeSafety(localPoint,
101 *motherPhysical, pMaxLength);
102 }
103 else
104 {
105 safety=fnormalNav.ComputeSafety(localPoint,fNavHistory,pMaxLength);
106 }
107 break;
110 {
111 safety=fparamNav.ComputeSafety(localPoint,fNavHistory,pMaxLength);
112 }
113 else
114 {
115 safety=fregularNav.ComputeSafety(localPoint,fNavHistory,pMaxLength);
116 }
117 break;
119 safety = freplicaNav.ComputeSafety(pGlobalpoint, localPoint,
120 fNavHistory, pMaxLength);
121 break;
123 safety = fpExternalNav->ComputeSafety(localPoint, fNavHistory,
124 pMaxLength);
125 break;
126 }
127
128
129
130 fPreviousSftOrigin = pGlobalpoint;
131 fPreviousSafety = safety;
132 }
133
134 return safety;
135}
CLHEP::Hep3Vector G4ThreeVector
void QuickLocateWithinVolume(const G4ThreeVector &pointLocal, G4VPhysicalVolume *motherPhysical)
G4ThreeVector ComputeLocalPoint(const G4ThreeVector &rGlobPoint) const