761 fChangedGrandMotherRefFrame=
false;
764 fCalculatedExitNormal =
false;
770 fLastTriedStepComputation=
true;
775 G4cout <<
"*** G4Navigator::ComputeStep: ***" <<
G4endl;
777 <<
" - Proposed step length = " << pCurrentProposedStepLength
779 #ifdef G4DEBUG_NAVIGATION
782 G4cout <<
" Called with the arguments: " << G4endl
783 <<
" Globalpoint = " << std::setw(25) << pGlobalpoint << G4endl
784 <<
" Direction = " << std::setw(25) << pDirection <<
G4endl;
796 if( newLocalPoint != fLastLocatedPointLocal )
801 G4double moveLenSq = (newLocalPoint-oldLocalPoint).mag2();
803 if ( moveLenSq >=
fSqTol )
806 ComputeStepLog(pGlobalpoint, moveLenSq);
811 fLastTriedStepComputation=
true;
821 Step = fvoxelNav.
ComputeStep(fLastLocatedPointLocal,
823 pCurrentProposedStepLength,
830 &fBlockedPhysicalVolume,
838 Step = fnormalNav.
ComputeStep(fLastLocatedPointLocal,
840 pCurrentProposedStepLength,
847 &fBlockedPhysicalVolume,
853 fLastTriedStepComputation=
true;
868 "Point is relocated in voxels, while it should be outside!");
869 Step = fnormalNav.
ComputeStep(fLastLocatedPointLocal,
871 pCurrentProposedStepLength,
878 &fBlockedPhysicalVolume,
884 ComputeStepSkippingEqualMaterials(fLastLocatedPointLocal,
886 pCurrentProposedStepLength,
893 &fBlockedPhysicalVolume,
903 Step = fparamNav.
ComputeStep(fLastLocatedPointLocal,
905 pCurrentProposedStepLength,
912 &fBlockedPhysicalVolume,
917 Step = fregularNav.
ComputeStep(fLastLocatedPointLocal,
919 pCurrentProposedStepLength,
926 &fBlockedPhysicalVolume,
931 G4Exception(
"G4Navigator::ComputeStep()",
"GeomNav0001",
942 G4bool calculatedExitNormal;
945 fLastLocatedPointLocal,
947 pCurrentProposedStepLength,
951 calculatedExitNormal,
955 &fBlockedPhysicalVolume,
957 fExiting= exitingReplica;
958 fCalculatedExitNormal= calculatedExitNormal;
963 fPreviousSftOrigin = pGlobalpoint;
964 fPreviousSafety = pNewSafety;
976 fLocatedOnEdge = fLastStepWasZero && (Step==0.0);
978 if (fPushed) { fPushed = fLastStepWasZero; }
982 if ( fLastStepWasZero )
985 #ifdef G4DEBUG_NAVIGATION
986 if( fNumberZeroSteps > 1 )
988 G4cout <<
"G4Navigator::ComputeStep(): another 'zero' step, # "
990 <<
", at " << pGlobalpoint
991 <<
", in volume " << motherPhysical->
GetName()
992 <<
", nav-comp-step calls # " << sNavCScalls
993 <<
", Step= " << Step
997 if( fNumberZeroSteps > fActionThreshold_NoZeroSteps-1 )
1003 if ((!fPushed) && (fWarnPush))
1005 std::ostringstream message;
1006 message <<
"Track stuck or not moving." << G4endl
1007 <<
" Track stuck, not moving for "
1008 << fNumberZeroSteps <<
" steps" << G4endl
1009 <<
" in volume -" << motherPhysical->
GetName()
1010 <<
"- at point " << pGlobalpoint
1011 <<
" (local point " << newLocalPoint <<
")" << G4endl
1012 <<
" direction: " << pDirection
1013 <<
" (local direction: " << localDirection <<
")." << G4endl
1014 <<
" Potential geometry or navigation problem !"
1016 <<
" Trying pushing it of " << Step <<
" mm ...";
1017 G4Exception(
"G4Navigator::ComputeStep()",
"GeomNav1002",
1018 JustWarning, message,
"Potential overlap in geometry!");
1023 if( fNumberZeroSteps > fAbandonThreshold_NoZeroSteps-1 )
1027 std::ostringstream message;
1028 message <<
"Stuck Track: potential geometry or navigation problem."
1030 <<
" Track stuck, not moving for "
1031 << fNumberZeroSteps <<
" steps" << G4endl
1032 <<
" in volume -" << motherPhysical->
GetName()
1033 <<
"- at point " << pGlobalpoint << G4endl
1034 <<
" direction: " << pDirection <<
".";
1041 G4Exception(
"G4Navigator::ComputeStep()",
"GeomNav0003",
1047 if (!fPushed) fNumberZeroSteps = 0;
1054 +
std::min(Step,pCurrentProposedStepLength) * pDirection;
1059 #ifdef G4DEBUG_NAVIGATION
1062 G4cout <<
" At G4Nav CompStep End - if(exiting) - fExiting= " << fExiting
1063 <<
" fValidExitNormal = " << fValidExitNormal <<
G4endl;
1068 if(fValidExitNormal || fCalculatedExitNormal)
1074 fGrandMotherExitNormal= fExitNormal;
1075 fCalculatedExitNormal=
true;
1079 fGrandMotherExitNormal = fExitNormal;
1087 fLastLocatedPointLocal + localDirection*Step;
1101 fChangedGrandMotherRefFrame=
true;
1102 fGrandMotherExitNormal = (*mRot).inverse() * exitNormalMotherFrame;
1106 fGrandMotherExitNormal = exitNormalMotherFrame;
1112 fCalculatedExitNormal=
true;
1116 fCalculatedExitNormal =
false;
1123 #ifdef G4DEBUG_NAVIGATION
1126 desc <<
"Problem in ComputeStep: Replica Navigation did not provide"
1127 <<
" valid exit Normal. " <<
G4endl;
1128 desc <<
" Do not know how calculate it in this case." <<
G4endl;
1129 desc <<
" Location = " << finalLocalPoint <<
G4endl;
1130 desc <<
" Volume name = " << motherPhysical->
GetName()
1132 G4Exception(
"G4Navigator::ComputeStep()",
"GeomNav0003",
1133 JustWarning, desc,
"Normal not available for exiting.");
1140 if( fValidExitNormal || fCalculatedExitNormal )
1147 fExitNormalGlobalFrame =
1148 GrandMotherToGlobalTransf.
TransformAxis( fGrandMotherExitNormal );
1152 fExitNormalGlobalFrame= fGrandMotherExitNormal;
1161 if( (Step == pCurrentProposedStepLength) && (!fExiting) && (!fEntering) )
1177 G4cout <<
" Returned step= " << Step;
1181 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)
static const G4double kInfinity
std::ostringstream G4ExceptionDescription
CLHEP::Hep3Vector G4ThreeVector
G4ThreeVector fLastStepEndPointLocal
G4ThreeVector ComputeLocalAxis(const G4ThreeVector &pVec) const
G4VSolid * GetSolid() const
const G4RotationMatrix * GetRotation() 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)
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
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)