85                 G4bool&             recalculatedEndPoint,        
 
   91   G4bool found_approximate_intersection = 
false;
 
   92   G4bool there_is_no_intersection       = 
false;
 
   94   G4FieldTrack  CurrentA_PointVelocity = CurveStartPointVelocity; 
 
   95   G4FieldTrack  CurrentB_PointVelocity = CurveEndPointVelocity;
 
   97   G4bool        validNormalAtE = 
false;
 
  100   G4FieldTrack  ApproxIntersecPointV(CurveEndPointVelocity); 
 
  102   G4bool last_AF_intersection = 
false;
 
  103   G4bool final_section = 
true;  
 
  105   recalculatedEndPoint = 
false; 
 
  107   G4bool restoredFullEndpoint = 
false;
 
  109   G4int substep_no = 0;
 
  113   const G4int max_substeps  = 100000000;  
 
  114   const G4int warn_substeps = 1000;       
 
  125   if( (TrialPoint - StartPosition).mag() < tolerance * 
CLHEP::mm ) 
 
  127      G4Exception(
"G4SimpleLocator::EstimateIntersectionPoint()", 
 
  129                  "Intersection point F is exactly at start point A." ); 
 
  143                                                  CurrentB_PointVelocity, 
 
  152        G4Exception(
"G4SimpleLocator::EstimateIntersectionPoint()", 
 
  154                    "Intermediate F point is past end B point!" ); 
 
  163      G4ThreeVector  ChordEF_Vector = CurrentF_Point - CurrentE_Point;
 
  166      G4double       MomDir_dot_Norm= NewMomentumDir.
dot( NormalAtEntry ) ;
 
  173                       NewMomentumDir, NormalAtEntry, validNormalAtE ); 
 
  178      G4bool adequate_angle = ( MomDir_dot_Norm >= 0.0 ) 
 
  179                           || (! validNormalAtE );  
 
  184        found_approximate_intersection = 
true;
 
  188        IntersectedOrRecalculatedFT = ApproxIntersecPointV;
 
  189        IntersectedOrRecalculatedFT.
SetPosition( CurrentE_Point );
 
  198                                    CurrentE_Point, CurrentF_Point, MomentumDir,
 
  199                                    last_AF_intersection, IP, NewSafety,
 
  200                                    fPreviousSafety, fPreviousSftOrigin );
 
  204            IntersectedOrRecalculatedFT = ApproxIntersecPointV;
 
  227        G4bool usedNavigatorAF = 
false; 
 
  236        last_AF_intersection = Intersects_AF;
 
  245          CurrentB_PointVelocity = ApproxIntersecPointV;
 
  246          CurrentE_Point = PointG;
 
  256          validNormalAtE = validNormalLast; 
 
  261          final_section= 
false; 
 
  266            G4cout << 
"G4PiF::LI> Investigating intermediate point" 
  268                   << 
" on way to full s=" 
  283          G4bool usedNavigatorFB=
false; 
 
  289                                                 NewSafety,fPreviousSafety,
 
  292                                                 PointH, &usedNavigatorFB );
 
  307            CurrentA_PointVelocity = ApproxIntersecPointV;
 
  308            CurrentE_Point = PointH;
 
  318            validNormalAtE = validNormalLast;
 
  332              there_is_no_intersection = 
true;   
 
  338              CurrentA_PointVelocity = CurrentB_PointVelocity;  
 
  339              CurrentB_PointVelocity = CurveEndPointVelocity;
 
  340              restoredFullEndpoint = 
true;
 
  362                                      CurrentB_PointVelocity,
 
  366          CurrentB_PointVelocity = newEndPointFT;
 
  370            recalculatedEndPoint = 
true;
 
  371            IntersectedOrRecalculatedFT = newEndPointFT;
 
  375        if( curveDist < 0.0 )
 
  378          printStatus( CurrentA_PointVelocity,  CurrentB_PointVelocity,
 
  379                       -1.0, NewSafety,  substep_no );
 
  380          std::ostringstream message;
 
  381          message << 
"Error in advancing propagation." << 
G4endl 
  382                  << 
"        Point A (start) is " << CurrentA_PointVelocity
 
  384                  << 
"        Point B (end)   is " << CurrentB_PointVelocity
 
  386                  << 
"        Curve distance is " << curveDist << 
G4endl 
  388                  << 
"The final curve point is not further along" 
  389                  << 
" than the original!" << 
G4endl;
 
  391          if( recalculatedEndPoint )
 
  393            message << 
"Recalculation of EndPoint was called with fEpsStep= " 
  396          message.precision(20);
 
  397          message << 
" Point A (Curve start)   is " << CurveStartPointVelocity
 
  399                  << 
" Point B (Curve   end)   is " << CurveEndPointVelocity
 
  401                  << 
" Point A (Current start) is " << CurrentA_PointVelocity
 
  403                  << 
" Point B (Current end)   is " << CurrentB_PointVelocity
 
  405                  << 
" Point E (Trial Point)   is " << CurrentE_Point
 
  407                  << 
" Point F (Intersection)  is " << ApproxIntersecPointV
 
  409                  << 
"        LocateIntersection parameters are : Substep no= " 
  412          G4Exception(
"G4SimpleLocator::EstimateIntersectionPoint()",
 
  416        if(restoredFullEndpoint)
 
  418          final_section = restoredFullEndpoint;
 
  419          restoredFullEndpoint = 
false;
 
  424 #ifdef G4DEBUG_LOCATE_INTERSECTION   
  425      G4int trigger_substepno_print= warn_substeps - 20;
 
  427      if( substep_no >= trigger_substepno_print )
 
  429        G4cout << 
"Difficulty in converging in " 
  430               << 
"G4SimpleLocator::EstimateIntersectionPoint():" 
  432               << 
"    Substep no = " << substep_no << 
G4endl;
 
  433        if( substep_no == trigger_substepno_print )
 
  435          printStatus( CurveStartPointVelocity, CurveEndPointVelocity,
 
  438        G4cout << 
" State of point A: "; 
 
  439        printStatus( CurrentA_PointVelocity, CurrentA_PointVelocity,
 
  440                     -1.0, NewSafety, substep_no-1, 0);
 
  441        G4cout << 
" State of point B: "; 
 
  442        printStatus( CurrentA_PointVelocity, CurrentB_PointVelocity,
 
  443                     -1.0, NewSafety, substep_no);
 
  448   } 
while ( ( ! found_approximate_intersection )
 
  449            && ( ! there_is_no_intersection )     
 
  450            && ( substep_no <= max_substeps) ); 
 
  452   if( substep_no > max_no_seen )
 
  454     max_no_seen = substep_no; 
 
  455 #ifdef G4DEBUG_LOCATE_INTERSECTION   
  456     if( max_no_seen > warn_substeps )
 
  458       trigger_substepno_print = max_no_seen-20; 
 
  463   if(  ( substep_no >= max_substeps)
 
  464       && !there_is_no_intersection
 
  465       && !found_approximate_intersection )
 
  467     G4cout << 
"ERROR - G4SimpleLocator::EstimateIntersectionPoint()" << 
G4endl 
  468            << 
"        Start and Endpoint of Requested Step:" << 
G4endl;
 
  469     printStatus( CurveStartPointVelocity, CurveEndPointVelocity,
 
  472            << 
"        Start and end-point of current Sub-Step:" << 
G4endl;
 
  473     printStatus( CurrentA_PointVelocity, CurrentA_PointVelocity,
 
  474                  -1.0, NewSafety, substep_no-1);
 
  475     printStatus( CurrentA_PointVelocity, CurrentB_PointVelocity,
 
  476                  -1.0, NewSafety, substep_no);
 
  478     std::ostringstream message;
 
  479     message << 
"Convergence is requiring too many substeps: " 
  480             << substep_no << G4endl
 
  481             << 
"          Abandoning effort to intersect." << G4endl
 
  482             << 
"          Found intersection = " 
  483             << found_approximate_intersection << G4endl
 
  484             << 
"          Intersection exists = " 
  485             << !there_is_no_intersection << 
G4endl;
 
  486     message.precision(10); 
 
  489     message << 
"          Undertaken only length: " << done_len
 
  490             << 
" out of " << full_len << 
" required." << G4endl
 
  491             << 
"          Remaining length = " << full_len-done_len; 
 
  493     G4Exception(
"G4SimpleLocator::EstimateIntersectionPoint()",
 
  496   else if( substep_no >= warn_substeps )
 
  498     std::ostringstream message;
 
  499     message.precision(10); 
 
  501     message << 
"Many substeps while trying to locate intersection." << 
G4endl 
  502             << 
"          Undertaken length: "   
  504             << 
" - Needed: "  << substep_no << 
" substeps." << 
G4endl 
  505             << 
"          Warning level = " << warn_substeps
 
  506             << 
" and maximum substeps = " << max_substeps;
 
  507     G4Exception(
"G4SimpleLocator::EstimateIntersectionPoint()",
 
  510   return  !there_is_no_intersection; 
 
G4FieldTrack ReEstimateEndpoint(const G4FieldTrack &CurrentStateA, const G4FieldTrack &EstimtdEndStateB, G4double linearDistSq, G4double curveDist)
 
void SetPosition(G4ThreeVector nPos)
 
G4double GetCurveLength() const 
 
double dot(const Hep3Vector &) const 
 
G4ThreeVector GetSurfaceNormal(const G4ThreeVector &CurrentInt_Point, G4bool &validNormal)
 
G4bool IntersectChord(const G4ThreeVector &StartPointA, const G4ThreeVector &EndPointB, G4double &NewSafety, G4double &PreviousSafety, G4ThreeVector &PreviousSftOrigin, G4double &LinearStepLength, G4ThreeVector &IntersectionPoint, G4bool *calledNavigator=0)
 
G4FieldTrack ApproxCurvePointV(const G4FieldTrack &curveAPointVelocity, const G4FieldTrack &curveBPointVelocity, const G4ThreeVector ¤tEPoint, G4double epsStep)
 
const G4ThreeVector & GetMomentumDir() const 
 
void printStatus(const G4FieldTrack &startFT, const G4FieldTrack ¤tFT, G4double requestStep, G4double safety, G4int stepNum)
 
G4bool EstimateIntersectionPoint(const G4FieldTrack &curveStartPointTangent, const G4FieldTrack &curveEndPointTangent, const G4ThreeVector &trialPoint, G4FieldTrack &intersectPointTangent, G4bool &recalculatedEndPoint, G4double &fPreviousSafety, G4ThreeVector &fPreviousSftOrigin)
 
G4double GetEpsilonStepFor()
 
G4ThreeVector GetPosition() const 
 
G4GLOB_DLL std::ostream G4cout
 
static constexpr double mm
 
void ReportTrialStep(G4int step_no, const G4ThreeVector &ChordAB_v, const G4ThreeVector &ChordEF_v, const G4ThreeVector &NewMomentumDir, const G4ThreeVector &NormalAtEntry, G4bool validNormal)
 
G4Navigator * GetNavigatorFor()
 
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
 
#define fPreviousSftOrigin
 
G4bool GetAdjustementOfFoundIntersection()
 
G4double fiDeltaIntersection
 
G4ChordFinder * GetChordFinderFor()
 
virtual void LocateGlobalPointWithinVolume(const G4ThreeVector &position)
 
G4bool AdjustmentOfFoundIntersection(const G4ThreeVector &A, const G4ThreeVector &CurrentE_Point, const G4ThreeVector &CurrentF_Point, const G4ThreeVector &MomentumDir, const G4bool IntersectAF, G4ThreeVector &IntersectionPoint, G4double &NewSafety, G4double &fPrevSafety, G4ThreeVector &fPrevSftOrigin)
 
G4SimpleLocator(G4Navigator *theNavigator)
 
G4ThreeVector GetMomentumDirection() const