738 fLastTriedStepComputation=
true;
743 G4cout <<
"*** G4ITNavigator::ComputeStep: ***" <<
G4endl;
745 <<
" - Proposed step length = " << pCurrentProposedStepLength
747 #ifdef G4DEBUG_NAVIGATION
750 G4cout <<
" Called with the arguments: " << G4endl
751 <<
" Globalpoint = " << std::setw(25) << pGlobalpoint << G4endl
752 <<
" Direction = " << std::setw(25) << pDirection <<
G4endl;
761 if( newLocalPoint != fLastLocatedPointLocal )
766 G4double moveLenSq = (newLocalPoint-oldLocalPoint).mag2();
771 ComputeStepLog(pGlobalpoint, moveLenSq);
776 fLastTriedStepComputation=
true;
786 Step = fvoxelNav.
ComputeStep(fLastLocatedPointLocal,
788 pCurrentProposedStepLength,
795 &fBlockedPhysicalVolume,
803 Step = fnormalNav.
ComputeStep(fLastLocatedPointLocal,
805 pCurrentProposedStepLength,
812 &fBlockedPhysicalVolume,
818 fLastTriedStepComputation=
true;
833 "Point is relocated in voxels, while it should be outside!");
834 Step = fnormalNav.
ComputeStep(fLastLocatedPointLocal,
836 pCurrentProposedStepLength,
843 &fBlockedPhysicalVolume,
849 ComputeStepSkippingEqualMaterials(fLastLocatedPointLocal,
851 pCurrentProposedStepLength,
858 &fBlockedPhysicalVolume,
868 Step = fparamNav.
ComputeStep(fLastLocatedPointLocal,
870 pCurrentProposedStepLength,
877 &fBlockedPhysicalVolume,
882 Step = fregularNav.
ComputeStep(fLastLocatedPointLocal,
884 pCurrentProposedStepLength,
891 &fBlockedPhysicalVolume,
896 G4Exception(
"G4ITNavigator::ComputeStep()",
"GeomNav0001",
907 G4bool calculatedExitNormal=
false;
911 fLastLocatedPointLocal,
913 pCurrentProposedStepLength,
917 calculatedExitNormal,
921 &fBlockedPhysicalVolume,
923 fExiting= exitingReplica;
928 fPreviousSftOrigin = pGlobalpoint;
929 fPreviousSafety = pNewSafety;
941 fLocatedOnEdge = fLastStepWasZero && (Step==0.0);
942 fLastStepWasZero = (Step==0.0);
943 if (fPushed) fPushed = fLastStepWasZero;
947 if ( fLastStepWasZero )
950 #ifdef G4DEBUG_NAVIGATION
951 if( fNumberZeroSteps > 1 )
953 G4cout <<
"G4ITNavigator::ComputeStep(): another zero step, # "
955 <<
" at " << pGlobalpoint
956 <<
" in volume " << motherPhysical->
GetName()
957 <<
" nav-comp-step calls # " << sNavCScalls
961 if( fNumberZeroSteps > fActionThreshold_NoZeroSteps-1 )
967 if ((!fPushed) && (fWarnPush))
969 std::ostringstream message;
970 message <<
"Track stuck or not moving." << G4endl
971 <<
" Track stuck, not moving for "
972 << fNumberZeroSteps <<
" steps" << G4endl
973 <<
" in volume -" << motherPhysical->
GetName()
974 <<
"- at point " << pGlobalpoint << G4endl
975 <<
" direction: " << pDirection <<
"." << G4endl
976 <<
" Potential geometry or navigation problem !"
978 <<
" Trying pushing it of " << Step <<
" mm ...";
979 G4Exception(
"G4ITNavigator::ComputeStep()",
"GeomNav1002",
980 JustWarning, message,
"Potential overlap in geometry!");
985 if( fNumberZeroSteps > fAbandonThreshold_NoZeroSteps-1 )
989 std::ostringstream message;
990 message <<
"Stuck Track: potential geometry or navigation problem."
992 <<
" Track stuck, not moving for "
993 << fNumberZeroSteps <<
" steps" << G4endl
994 <<
" in volume -" << motherPhysical->
GetName()
995 <<
"- at point " << pGlobalpoint << G4endl
996 <<
" direction: " << pDirection <<
".";
998 G4Exception(
"G4ITNavigator::ComputeStep()",
"GeomNav0003",
1004 if (!fPushed) fNumberZeroSteps = 0;
1015 #ifdef G4DEBUG_NAVIGATION
1018 G4cout <<
" At G4Nav CompStep End - if(exiting) - fExiting= " << fExiting
1019 <<
" fValidExitNormal = " << fValidExitNormal <<
G4endl;
1024 if(fValidExitNormal)
1028 fGrandMotherExitNormal= fExitNormal;
1035 fLastLocatedPointLocal + localDirection*Step;
1039 fGrandMotherExitNormal =
1045 fGrandMotherExitNormal *= (*mRot).inverse();
1052 if( (Step == pCurrentProposedStepLength) && (!fExiting) && (!fEntering) )
1069 if( Step == kInfinity )
1071 G4cout <<
" Original proposed step = "
1072 << pCurrentProposedStepLength <<
G4endl;
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)
G4int GetDaughtersRegularStructureId(const G4LogicalVolume *pLog) const
virtual G4VPhysicalVolume * LocateGlobalPointAndSetup(const G4ThreeVector &point, const G4ThreeVector *direction=0, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true)
virtual void LocateGlobalPointWithinVolume(const G4ThreeVector &position)
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)
G4ThreeVector fLastStepEndPointLocal
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
virtual G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const =0
G4ThreeVector ComputeLocalAxis(const G4ThreeVector &pVec) const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4NavigationHistory fHistory
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 G4RotationMatrix * GetRotation() const
EVolume CharacteriseDaughters(const G4LogicalVolume *pLog) const
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)
G4ThreeVector ComputeLocalPoint(const G4ThreeVector &rGlobPoint) const
G4VSolid * GetSolid() const
G4ThreeVector fStepEndPoint