715 fChangedGrandMotherRefFrame=
false;
718 fCalculatedExitNormal =
false;
724 fLastTriedStepComputation=
true;
729 G4cout <<
"*** G4Navigator::ComputeStep: ***" <<
G4endl;
731 <<
" - Proposed step length = " << pCurrentProposedStepLength
733 #ifdef G4DEBUG_NAVIGATION
736 G4cout <<
" Called with the arguments: " << G4endl
737 <<
" Globalpoint = " << std::setw(25) << pGlobalpoint << G4endl
738 <<
" Direction = " << std::setw(25) << pDirection <<
G4endl;
750 if( newLocalPoint != fLastLocatedPointLocal )
755 G4double moveLenSq = (newLocalPoint-oldLocalPoint).mag2();
760 ComputeStepLog(pGlobalpoint, moveLenSq);
765 fLastTriedStepComputation=
true;
775 Step = fvoxelNav.
ComputeStep(fLastLocatedPointLocal,
777 pCurrentProposedStepLength,
784 &fBlockedPhysicalVolume,
792 Step = fnormalNav.
ComputeStep(fLastLocatedPointLocal,
794 pCurrentProposedStepLength,
801 &fBlockedPhysicalVolume,
807 fLastTriedStepComputation=
true;
822 "Point is relocated in voxels, while it should be outside!");
823 Step = fnormalNav.
ComputeStep(fLastLocatedPointLocal,
825 pCurrentProposedStepLength,
832 &fBlockedPhysicalVolume,
838 ComputeStepSkippingEqualMaterials(fLastLocatedPointLocal,
840 pCurrentProposedStepLength,
847 &fBlockedPhysicalVolume,
857 Step = fparamNav.
ComputeStep(fLastLocatedPointLocal,
859 pCurrentProposedStepLength,
866 &fBlockedPhysicalVolume,
871 Step = fregularNav.
ComputeStep(fLastLocatedPointLocal,
873 pCurrentProposedStepLength,
880 &fBlockedPhysicalVolume,
885 G4Exception(
"G4Navigator::ComputeStep()",
"GeomNav0001",
896 G4bool calculatedExitNormal;
899 fLastLocatedPointLocal,
901 pCurrentProposedStepLength,
905 calculatedExitNormal,
909 &fBlockedPhysicalVolume,
911 fExiting= exitingReplica;
912 fCalculatedExitNormal= calculatedExitNormal;
917 fPreviousSftOrigin = pGlobalpoint;
918 fPreviousSafety = pNewSafety;
930 fLocatedOnEdge = fLastStepWasZero && (Step==0.0);
931 fLastStepWasZero = (Step==0.0);
932 if (fPushed) { fPushed = fLastStepWasZero; }
936 if ( fLastStepWasZero )
939 #ifdef G4DEBUG_NAVIGATION
940 if( fNumberZeroSteps > 1 )
942 G4cout <<
"G4Navigator::ComputeStep(): another zero step, # "
944 <<
" at " << pGlobalpoint
945 <<
" in volume " << motherPhysical->
GetName()
946 <<
" nav-comp-step calls # " << sNavCScalls
950 if( fNumberZeroSteps > fActionThreshold_NoZeroSteps-1 )
956 if ((!fPushed) && (fWarnPush))
958 std::ostringstream message;
959 message <<
"Track stuck or not moving." << G4endl
960 <<
" Track stuck, not moving for "
961 << fNumberZeroSteps <<
" steps" << G4endl
962 <<
" in volume -" << motherPhysical->
GetName()
963 <<
"- at point " << pGlobalpoint << G4endl
964 <<
" direction: " << pDirection <<
"." << G4endl
965 <<
" Potential geometry or navigation problem !"
967 <<
" Trying pushing it of " << Step <<
" mm ...";
968 G4Exception(
"G4Navigator::ComputeStep()",
"GeomNav1002",
969 JustWarning, message,
"Potential overlap in geometry!");
974 if( fNumberZeroSteps > fAbandonThreshold_NoZeroSteps-1 )
978 std::ostringstream message;
979 message <<
"Stuck Track: potential geometry or navigation problem."
981 <<
" Track stuck, not moving for "
982 << fNumberZeroSteps <<
" steps" << G4endl
983 <<
" in volume -" << motherPhysical->
GetName()
984 <<
"- at point " << pGlobalpoint << G4endl
985 <<
" direction: " << pDirection <<
".";
987 G4Exception(
"G4Navigator::ComputeStep()",
"GeomNav0003",
993 if (!fPushed) fNumberZeroSteps = 0;
1004 #ifdef G4DEBUG_NAVIGATION
1007 G4cout <<
" At G4Nav CompStep End - if(exiting) - fExiting= " << fExiting
1008 <<
" fValidExitNormal = " << fValidExitNormal <<
G4endl;
1013 if(fValidExitNormal || fCalculatedExitNormal)
1019 fGrandMotherExitNormal= fExitNormal;
1020 fCalculatedExitNormal=
true;
1024 fGrandMotherExitNormal = fExitNormal;
1032 fLastLocatedPointLocal + localDirection*Step;
1046 fChangedGrandMotherRefFrame=
true;
1047 fGrandMotherExitNormal = (*mRot).inverse() * exitNormalMotherFrame;
1051 fGrandMotherExitNormal = exitNormalMotherFrame;
1057 fCalculatedExitNormal=
true;
1061 fCalculatedExitNormal =
false;
1068 #ifdef G4DEBUG_NAVIGATION
1071 desc <<
"Problem in ComputeStep: Replica Navigation did not provide"
1072 <<
" valid exit Normal. " <<
G4endl;
1073 desc <<
" Do not know how calculate it in this case." <<
G4endl;
1074 desc <<
" Location = " << finalLocalPoint <<
G4endl;
1075 desc <<
" Volume name = " << motherPhysical->
GetName()
1077 G4Exception(
"G4Navigator::ComputeStep()",
"GeomNav0003",
1078 JustWarning, desc,
"Normal not available for exiting.");
1085 if( fValidExitNormal || fCalculatedExitNormal )
1092 fExitNormalGlobalFrame =
1093 GrandMotherToGlobalTransf.
TransformAxis( fGrandMotherExitNormal );
1097 fExitNormalGlobalFrame= fGrandMotherExitNormal;
1107 if( (Step == pCurrentProposedStepLength) && (!fExiting) && (!fEntering) )
1123 G4cout <<
" Returned step= " << Step;
1125 if( Step == kInfinity )
1127 G4cout <<
" Requested step= " << pCurrentProposedStepLength ;
G4SmartVoxelHeader * GetVoxelHeader() const
G4VPhysicalVolume * GetTopVolume() const
G4double ComputeStep(const G4ThreeVector &globalPoint, const G4ThreeVector &globalDirection, const G4double currentProposedStepLength, G4double &newSafety, G4NavigationHistory &history, G4bool &validExitNormal, G4ThreeVector &exitNormal, G4bool &exiting, G4bool &entering, G4VPhysicalVolume *(*pBlockedPhysical), G4int &blockedReplicaNo)
std::ostringstream G4ExceptionDescription
CLHEP::Hep3Vector G4ThreeVector
G4ThreeVector fLastStepEndPointLocal
G4ThreeVector ComputeLocalAxis(const G4ThreeVector &pVec) const
G4double ComputeStep(const G4ThreeVector &globalPoint, const G4ThreeVector &globalDirection, const G4ThreeVector &localPoint, const G4ThreeVector &localDirection, const G4double currentProposedStepLength, G4double &newSafety, G4NavigationHistory &history, G4bool &validExitNormal, G4bool &calculatedExitNormal, G4ThreeVector &exitNormal, G4bool &exiting, G4bool &entering, G4VPhysicalVolume *(*pBlockedPhysical), G4int &blockedReplicaNo)
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
G4double ComputeStep(const G4ThreeVector &globalPoint, const G4ThreeVector &globalDirection, const G4double currentProposedStepLength, G4double &newSafety, G4NavigationHistory &history, G4bool &validExitNormal, G4ThreeVector &exitNormal, G4bool &exiting, G4bool &entering, G4VPhysicalVolume *(*pBlockedPhysical), G4int &blockedReplicaNo)
EVolume GetTopVolumeType() const
virtual G4int GetRegularStructureId() const =0
G4NavigationHistory fHistory
virtual G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const =0
EVolume CharacteriseDaughters(const G4LogicalVolume *pLog) const
G4ThreeVector ComputeLocalPoint(const G4ThreeVector &rGlobPoint) const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4double ComputeStep(const G4ThreeVector &localPoint, const G4ThreeVector &localDirection, const G4double currentProposedStepLength, G4double &newSafety, G4NavigationHistory &history, G4bool &validExitNormal, G4ThreeVector &exitNormal, G4bool &exiting, G4bool &entering, G4VPhysicalVolume *(*pBlockedPhysical), G4int &blockedReplicaNo)
G4LogicalVolume * GetLogicalVolume() const
const G4AffineTransform & GetTransform(G4int n) const
G4int GetDaughtersRegularStructureId(const G4LogicalVolume *pLog) const
virtual G4int GetCopyNo() const =0
virtual G4VPhysicalVolume * LocateGlobalPointAndSetup(const G4ThreeVector &point, const G4ThreeVector *direction=0, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true)
const G4RotationMatrix * GetRotation() const
G4ThreeVector fStepEndPoint
virtual G4double ComputeStep(const G4ThreeVector &globalPoint, const G4ThreeVector &globalDirection, const G4double currentProposedStepLength, G4double &newSafety, G4NavigationHistory &history, G4bool &validExitNormal, G4ThreeVector &exitNormal, G4bool &exiting, G4bool &entering, G4VPhysicalVolume *(*pBlockedPhysical), G4int &blockedReplicaNo)
virtual G4bool CheckOverlaps(G4int res=1000, G4double tol=0., G4bool verbose=true, G4int errMax=1)
virtual void LocateGlobalPointWithinVolume(const G4ThreeVector &position)
G4VSolid * GetSolid() const