545 std::vector<G4ITNavigator*>::iterator pNavIter=
548 #ifdef G4DEBUG_PATHFINDER
573 G4double distCheckEnd_sq= ( moveLenEndPosSq - endPointSafety_Est1
574 *endPointSafety_Est1 );
578 G4bool longMoveEnd = distCheckEnd_sq > 0.0;
579 G4bool longMoveSaf = distCheckSaf_sq > 0.0;
583 if( (!
fNewTrack) && ( longMoveEnd && longMoveSaf ) )
591 const G4double cErrorTolerance=1e-12;
594 G4double distCheckRevisedEnd= moveLenEndPosSq-revisedSafety*revisedSafety;
596 G4bool longMoveRevisedEnd= ( distCheckRevisedEnd > 0. ) ;
599 G4double moveLenEndPosition= std::sqrt( moveLenEndPosSq );
600 moveMinusSafety = moveLenEndPosition - revisedSafety;
602 if ( longMoveRevisedEnd && (moveMinusSafety > 0.0 )
603 && ( revisedSafety > 0.0 ) )
608 if( fVerboseLevel > 0 )
610 G4cout <<
" G4PF:Relocate> Ratio to revised safety is "
611 << std::fabs(moveMinusSafety)/revisedSafety <<
G4endl;
614 G4double absMoveMinusSafety= std::fabs(moveMinusSafety);
615 G4bool smallRatio= absMoveMinusSafety < kRadTolerance * revisedSafety ;
618 std::fabs(position.
y())),
619 std::fabs(position.
z()) );
620 G4bool smallValue= absMoveMinusSafety < cErrorTolerance * maxCoordPos;
621 if( ! (smallRatio || smallValue) )
623 G4cout <<
" G4PF:Relocate> Ratio to revised safety is "
624 << std::fabs(moveMinusSafety)/revisedSafety <<
G4endl;
625 G4cout <<
" Difference of move and safety is not very small."
630 moveMinusSafety = 0.0;
631 longMoveRevisedEnd =
false;
633 G4cout <<
" Difference of move & safety is very small in magnitude, "
634 << absMoveMinusSafety <<
G4endl;
637 G4cout <<
" ratio to safety " << revisedSafety
638 <<
" is " << absMoveMinusSafety / revisedSafety
639 <<
"smaller than " << kRadTolerance <<
" of safety ";
643 G4cout <<
" as fraction " << absMoveMinusSafety / maxCoordPos
644 <<
" of position vector max-coord " << maxCoordPos
645 <<
" smaller than " << cErrorTolerance ;
647 G4cout <<
" -- reset moveMinusSafety to "
648 << moveMinusSafety <<
G4endl;
652 if ( longMoveEnd && longMoveSaf
653 && longMoveRevisedEnd && (moveMinusSafety>0.0) )
656 std::ostringstream message;
657 message <<
"ReLocation is further than end-safety value." <<
G4endl
658 <<
" Moved from last endpoint by " << moveLenEndPosition
659 <<
" compared to end safety (from preStep point) = "
660 << endPointSafety_Est1 <<
G4endl
667 <<
" --> last EndStep Location was " << lastEndPosition
669 <<
" safety value = " << endPointSafety_Est1
670 <<
" raw-value = " << endPointSafety_raw <<
G4endl
671 <<
" --> Calling again at this endpoint, we get "
672 << revisedSafety <<
" as safety value." <<
G4endl
673 <<
" --> last position for safety " << fSafetyLocation
677 <<
" move from safety location = "
678 << std::sqrt(moveLenSafSq) <<
G4endl
679 <<
" again= " << moveVecSafety.
mag() <<
G4endl
680 <<
" safety - Move-from-end= "
681 << revisedSafety - moveLenEndPosition
682 <<
" (negative is Bad.)" <<
G4endl
683 <<
" Debug: distCheckRevisedEnd = "
684 << distCheckRevisedEnd;
685 ReportMove( lastEndPosition, position,
"Position" );
686 G4Exception(
"G4ITPathFinder::ReLocate",
"GeomNav0003",
688 G4cout.precision(oldPrec);
692 if( fVerboseLevel > 2 )
695 G4cout <<
" G4ITPathFinder::ReLocate : entered " <<
G4endl;
697 G4cout <<
" *Re*Locating at position " << position <<
G4endl;
700 if ( (fVerboseLevel > -1) || ( moveLenEndPosSq > 0.0) )
702 G4cout <<
" lastEndPosition = " << lastEndPosition
703 <<
" moveVec from step-end = " << moveVecEndPos
708 #endif // G4DEBUG_PATHFINDER
710 for (
G4int num=0; num< fNoActiveNavigators ; ++pNavIter,++num )
714 (*pNavIter)->LocateGlobalPointWithinVolume( position );
726 #ifdef G4DEBUG_PATHFINDER
727 if( fVerboseLevel > 2 )
729 G4cout <<
" G4ITPathFinder::ReLocate : exiting "
#define fPreSafetyMinValue
G4GLOB_DLL std::ostream G4cout
G4double GetRadialTolerance() const
void ReportMove(const G4ThreeVector &OldV, const G4ThreeVector &NewV, const G4String &Quantity) const
#define fLastLocatedPosition
G4double ComputeSafety(const G4ThreeVector &globalPoint)
#define fMinSafety_atSafLocation
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
std::vector< G4ITNavigator * >::iterator GetActiveNavigatorsIterator()
#define fMinSafety_PreStepPt
T max(const T t1, const T t2)
brief Return the largest of the two arguments
#define fPreSafetyLocation
static G4GeometryTolerance * GetInstance()