96 G4double ourStep=currentProposedStepLength, ourSafety;
98 G4bool motherValidExitNormal=
false;
103 G4bool initialNode, noStep;
105 G4int curNoVolumes, contentNo;
117 motherSolid = motherLogical->
GetSolid();
124 ourSafety = motherSafety;
129 if( motherSafety < 0.0 )
132 std::ostringstream message;
133 message <<
"Negative Safety In Voxel Navigation !" <<
G4endl
134 <<
" Current solid " << motherSolid->
GetName()
135 <<
" gave negative safety: " << motherSafety <<
G4endl
136 <<
" for the current (local) point " << localPoint;
137 G4Exception(
"G4ParameterisedNavigation::ComputeStep()",
142 std::ostringstream message;
143 message <<
"Point is outside Current Volume !" <<
G4endl
144 <<
" Point " << localPoint
145 <<
" is outside current volume " << motherPhysical->
GetName()
148 G4cout <<
" Estimated isotropic distance to solid (distToIn)= "
150 if( estDistToSolid > 100.0 * motherSolid->
GetTolerance() )
153 G4Exception(
"G4ParameterisedNavigation::ComputeStep()",
155 "Point is far outside Current Volume !");
158 G4Exception(
"G4ParameterisedNavigation::ComputeStep()",
160 "Point is a little outside Current Volume.");
171 &motherValidExitNormal,
174 if( (motherStep >=
kInfinity) || (motherStep < 0.0) )
180 ourStep = motherStep = 0.0;
185 validExitNormal = motherValidExitNormal;
186 exitNormal = motherExitNormal;
188 *pBlockedPhysical= 0;
210 if (exiting && (*pBlockedPhysical==samplePhysical) && validExitNormal)
232 for ( contentNo=curNoVolumes-1; contentNo>=0; contentNo-- )
234 sampleNo = curVoxelNode->
GetVolume(contentNo);
241 sampleSolid = IdentifyAndPlaceSolid( sampleNo, samplePhysical,
247 const G4ThreeVector samplePoint = sampleTf.TransformPoint(localPoint);
249 if ( sampleSafety<ourSafety )
251 ourSafety = sampleSafety;
253 if ( sampleSafety<=ourStep )
255 sampleDirection = sampleTf.TransformAxis(localDirection);
257 sampleSolid->
DistanceToIn(samplePoint, sampleDirection);
258 if ( sampleStep<=ourStep )
260 ourStep = sampleStep;
263 *pBlockedPhysical = samplePhysical;
264 blockedReplicaNo = sampleNo;
273 intersectionPoint= samplePoint + sampleStep * sampleDirection;
278 std::ostringstream message;
279 message <<
"Navigator gets conflicting response from Solid."
281 <<
" Inaccurate solid DistanceToIn"
283 <<
" Solid gave DistanceToIn = "
284 << sampleStep <<
" yet returns " ;
286 message <<
"-kInside-";
288 message <<
"-kOutside-";
290 message <<
"-kSurface-";
291 message <<
" for this point !" <<
G4endl
292 <<
" Point = " << intersectionPoint
295 message <<
" DistanceToIn(p) = "
298 message <<
" DistanceToOut(p) = "
300 G4Exception(
"G4ParameterisedNavigation::ComputeStep()",
302 G4cout.precision(oldcoutPrec);
314 voxelSafety = ComputeVoxelSafety(localPoint,axis);
315 if ( voxelSafety<ourSafety )
317 ourSafety = voxelSafety;
319 if ( currentProposedStepLength<ourSafety )
326 *pBlockedPhysical = 0;
333 if ( motherSafety<=ourStep )
340 &motherValidExitNormal,
344 if( ( motherStep < 0.0 ) || ( motherStep >=
kInfinity) )
349 ourStep = motherStep = 0.0;
355 if( motherValidExitNormal && (
fCheck || (motherStep<=ourStep)) )
358 localPoint, localDirection,
359 motherStep, motherSolid,
360 "From motherSolid::DistanceToOut");
363 if ( motherStep<=ourStep )
365 ourStep = motherStep;
368 if ( validExitNormal )
379 validExitNormal =
false;
387 noStep = LocateNextVoxel(localPoint, localDirection, ourStep, axis);
G4VPhysicalVolume * GetTopVolume() const
static const G4double kInfinity
G4int GetVolume(G4int pVolumeNo) const
G4VSolid * GetSolid() const
G4VPhysicalVolume * GetDaughter(const G4int i) const
G4double GetTolerance() const
const G4RotationMatrix * GetRotation() const
G4int GetNoContained() const
HepRotation inverse() const
void ReportOutsideMother(const G4ThreeVector &localPoint, const G4ThreeVector &localDirection, const G4VPhysicalVolume *motherPV, G4double tDist=30.0 *CLHEP::cm) const
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
virtual EInside Inside(const G4ThreeVector &p) const =0
void BlockVolume(const G4int v)
virtual G4VPVParameterisation * GetParameterisation() const =0
G4bool IsBlocked(const G4int v) const
G4bool CheckAndReportBadNormal(const G4ThreeVector &unitNormal, const G4ThreeVector &localPoint, const G4ThreeVector &localDirection, G4double step, const G4VSolid *solid, const char *msg) const
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const =0
static const double kMinExitingNormalCosine
G4NavigationLogger * fLogger
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
const G4ThreeVector & GetTranslation() const
G4LogicalVolume * GetLogicalVolume() const
virtual void GetReplicationData(EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const =0
G4SmartVoxelNode * fVoxelNode
virtual G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=0, G4ThreeVector *n=0) const =0
void Enlarge(const G4int nv)