53   : fWasLimitedByGeometry(false), fVerbose(0),
 
   54     fTopPhysical(0), fCheck(false), fPushed(false), fWarnPush(true)
 
   57   fLastTriedStepComputation= 
false;
 
   66   fActionThreshold_NoZeroSteps  = 10; 
 
   67   fAbandonThreshold_NoZeroSteps = 25; 
 
   95   fLastTriedStepComputation= 
false;  
 
  118                                         const G4bool relativeSearch,
 
  119                                         const G4bool ignoreDirection )
 
  121   G4bool notKnownContained=
true, noResult;
 
  128   G4bool considerDirection = (!ignoreDirection) || fLocatedOnEdge;
 
  130   fLastTriedStepComputation=   
false;   
 
  131   fChangedGrandMotherRefFrame= 
false;  
 
  133   if( considerDirection && pGlobalDirection != 0 )
 
  135     globalDirection=*pGlobalDirection;
 
  143     G4cout << 
"*** G4Navigator::LocateGlobalPointAndSetup: ***" << 
G4endl; 
 
  144     G4cout << 
"    Called with arguments: " << G4endl
 
  145            << 
"    Globalpoint = " << globalPoint << G4endl
 
  146            << 
"    RelativeSearch = " << relativeSearch  << 
G4endl;
 
  152     G4cout.precision(oldcoutPrec);
 
  156   if ( !relativeSearch )
 
  177           fLastLocatedPointLocal = localPoint;
 
  178           fLocatedOutsideWorld = 
true;
 
  202                                                 fBlockedPhysicalVolume);
 
  205               fBlockedPhysicalVolume->
SetCopyNo(fBlockedReplicaNo);
 
  215                                               fBlockedPhysicalVolume);
 
  217                                           fBlockedPhysicalVolume);
 
  219                                               fBlockedPhysicalVolume);
 
  222                 fBlockedPhysicalVolume->
SetCopyNo(fBlockedReplicaNo);
 
  230                   ComputeMaterial(fBlockedReplicaNo,
 
  231                                   fBlockedPhysicalVolume, 
 
  237           fBlockedPhysicalVolume = 0;
 
  239           notKnownContained = 
false;
 
  244       fBlockedPhysicalVolume = 0;
 
  260   G4int noLevelsExited=0 ;
 
  262   while (notKnownContained)
 
  268       insideCode = targetSolid->
Inside(localPoint);
 
  272          G4String solidResponse = 
"-kInside-";
 
  274            solidResponse = 
"-kOutside-";
 
  276            solidResponse = 
"-kSurface-";
 
  277          G4cout << 
"*** G4Navigator::LocateGlobalPointAndSetup(): ***" << 
G4endl 
  278                 << 
"    Invoked Inside() for solid: " << targetSolid->
GetName()
 
  279                 << 
". Solid replied: " << solidResponse << 
G4endl 
  280                 << 
"    For local point p: " << localPoint << 
G4endl;
 
  287                                           fExiting, notKnownContained);
 
  305         if( noLevelsExited > 1 )
 
  312             fGrandMotherExitNormal *= (*mRot).inverse();
 
  313             fChangedGrandMotherRefFrame= 
true;
 
  319         fLastLocatedPointLocal = localPoint;
 
  320         fLocatedOutsideWorld = 
true;
 
  328         G4bool isExiting = fExiting;
 
  329         if( (!fExiting)&&considerDirection )
 
  334           G4bool directionExiting = 
false;
 
  345             directionExiting = normal.
dot(localDirection) > 0.0;
 
  346             isExiting = isExiting || directionExiting;
 
  360             fValidExitNormal = 
false;
 
  362             if( noLevelsExited > 1 )
 
  369                 fGrandMotherExitNormal *= (*mRot).inverse();
 
  370                 fChangedGrandMotherRefFrame= 
true;
 
  376             fLastLocatedPointLocal = localPoint;
 
  377             fLocatedOutsideWorld = 
true;
 
  384           notKnownContained=
false;
 
  389         notKnownContained=
false;
 
  410     if (!targetPhysical) { 
break; }
 
  418                                            fBlockedPhysicalVolume,
 
  428                                             fBlockedPhysicalVolume,
 
  438                                            fBlockedPhysicalVolume,
 
  449                                            fBlockedPhysicalVolume,
 
  459                                              fBlockedPhysicalVolume,
 
  478       fBlockedPhysicalVolume = 0;
 
  479       fBlockedReplicaNo = -1;
 
  493           fGrandMotherExitNormal *= (*mRot).inverse();
 
  497 #ifdef G4DEBUG_NAVIGATION 
  501          G4cout << 
"*** G4Navigator::LocateGlobalPointAndSetup() ***" << 
G4endl;
 
  509   fLastLocatedPointLocal = localPoint;
 
  516     if (targetPhysical)  { curPhysVol_Name = targetPhysical->
GetName(); }
 
  517     G4cout << 
"    Return value = new volume = " << curPhysVol_Name << 
G4endl;
 
  522       G4cout << 
"Upon exiting LocateGlobalPointAndSetup():" << 
G4endl;
 
  525     G4cout.precision(oldcoutPrec);
 
  529   fLocatedOutsideWorld= 
false;
 
  531   return targetPhysical;
 
  551    fLastTriedStepComputation= 
false;
 
  552    fChangedGrandMotherRefFrame= 
false;  
 
  554 #ifdef G4DEBUG_NAVIGATION 
  557      G4cout << 
"Entering LocateGlobalWithinVolume(): History = " << 
G4endl;
 
  579            fvoxelNav.
VoxelLocate( pVoxelHeader, fLastLocatedPointLocal );
 
  591          G4Exception(
"G4Navigator::LocateGlobalPointWithinVolume()",
 
  593                      "Not applicable for replicated volumes.");
 
  603    fBlockedPhysicalVolume = 0; 
 
  604    fBlockedReplicaNo = -1;
 
  621   fSaveState.sExitNormal = fExitNormal;
 
  622   fSaveState.sValidExitNormal = fValidExitNormal;
 
  623   fSaveState.sExiting = fExiting;
 
  624   fSaveState.sEntering = fEntering;
 
  626   fSaveState.spBlockedPhysicalVolume = fBlockedPhysicalVolume;
 
  627   fSaveState.sBlockedReplicaNo = fBlockedReplicaNo, 
 
  629   fSaveState.sLastStepWasZero = fLastStepWasZero;
 
  631   fSaveState.sLocatedOutsideWorld = fLocatedOutsideWorld;
 
  632   fSaveState.sLastLocatedPointLocal= fLastLocatedPointLocal;
 
  638   fSaveState.sPreviousSftOrigin= fPreviousSftOrigin;
 
  639   fSaveState.sPreviousSafety= fPreviousSafety;
 
  650   fExitNormal = fSaveState.sExitNormal;
 
  651   fValidExitNormal = fSaveState.sValidExitNormal;
 
  652   fExiting = fSaveState.sExiting;
 
  653   fEntering = fSaveState.sEntering;
 
  655   fBlockedPhysicalVolume = fSaveState.spBlockedPhysicalVolume;
 
  656   fBlockedReplicaNo = fSaveState.sBlockedReplicaNo, 
 
  658   fLastStepWasZero = fSaveState.sLastStepWasZero;
 
  660   fLocatedOutsideWorld = fSaveState.sLocatedOutsideWorld;
 
  661   fLastLocatedPointLocal= fSaveState.sLastLocatedPointLocal;
 
  664   fSaveState.sPreviousSftOrigin= fPreviousSftOrigin;
 
  665   fSaveState.sPreviousSafety= fPreviousSafety;
 
  701                                    const G4double pCurrentProposedStepLength,
 
  713   fChangedGrandMotherRefFrame= 
false;
 
  716   fCalculatedExitNormal  = 
false;
 
  719   static G4int sNavCScalls=0;
 
  722   fLastTriedStepComputation= 
true; 
 
  727     G4cout << 
"*** G4Navigator::ComputeStep: ***" << 
G4endl; 
 
  729            << 
" - Proposed step length = " << pCurrentProposedStepLength
 
  731 #ifdef G4DEBUG_NAVIGATION 
  734       G4cout << 
"  Called with the arguments: " << G4endl
 
  735              << 
"  Globalpoint = " << std::setw(25) << pGlobalpoint << G4endl
 
  736              << 
"  Direction   = " << std::setw(25) << pDirection << 
G4endl;
 
  748   if( newLocalPoint != fLastLocatedPointLocal )
 
  753     G4double moveLenSq = (newLocalPoint-oldLocalPoint).mag2();
 
  758       ComputeStepLog(pGlobalpoint, moveLenSq);
 
  763       fLastTriedStepComputation= 
true;     
 
  773           Step = fvoxelNav.
ComputeStep(fLastLocatedPointLocal,
 
  775                                        pCurrentProposedStepLength,
 
  782                                        &fBlockedPhysicalVolume,
 
  790             Step = fnormalNav.
ComputeStep(fLastLocatedPointLocal,
 
  792                                           pCurrentProposedStepLength,
 
  799                                           &fBlockedPhysicalVolume,
 
  805             fLastTriedStepComputation= 
true; 
 
  820                 "Point is relocated in voxels, while it should be outside!");
 
  821               Step = fnormalNav.
ComputeStep(fLastLocatedPointLocal,
 
  823                                             pCurrentProposedStepLength,
 
  830                                             &fBlockedPhysicalVolume,
 
  836                    ComputeStepSkippingEqualMaterials(fLastLocatedPointLocal,
 
  838                                                      pCurrentProposedStepLength,
 
  845                                                      &fBlockedPhysicalVolume,
 
  855           Step = fparamNav.
ComputeStep(fLastLocatedPointLocal,
 
  857                                        pCurrentProposedStepLength,
 
  864                                        &fBlockedPhysicalVolume,
 
  869           Step = fregularNav.
ComputeStep(fLastLocatedPointLocal,
 
  871                                          pCurrentProposedStepLength,
 
  878                                          &fBlockedPhysicalVolume,
 
  883         G4Exception(
"G4Navigator::ComputeStep()", 
"GeomNav0001",
 
  894     G4bool calculatedExitNormal;
 
  897                                    fLastLocatedPointLocal,
 
  899                                    pCurrentProposedStepLength,
 
  903                                    calculatedExitNormal,
 
  907                                    &fBlockedPhysicalVolume,
 
  909     fExiting= exitingReplica;                          
 
  910     fCalculatedExitNormal= calculatedExitNormal;
 
  915   fPreviousSftOrigin = pGlobalpoint;
 
  916   fPreviousSafety = pNewSafety; 
 
  928   fLocatedOnEdge   = fLastStepWasZero && (Step==0.0);
 
  929   fLastStepWasZero = (Step==0.0);
 
  930   if (fPushed)  { fPushed = fLastStepWasZero; }
 
  934   if ( fLastStepWasZero )
 
  937 #ifdef G4DEBUG_NAVIGATION 
  938     if( fNumberZeroSteps > 1 )
 
  940        G4cout << 
"G4Navigator::ComputeStep(): another zero step, # " 
  942               << 
" at " << pGlobalpoint
 
  943               << 
" in volume " << motherPhysical->
GetName()
 
  944               << 
" nav-comp-step calls # " << sNavCScalls
 
  948     if( fNumberZeroSteps > fActionThreshold_NoZeroSteps-1 )
 
  954        if ((!fPushed) && (fWarnPush))
 
  956          std::ostringstream message;
 
  957          message << 
"Track stuck or not moving." << 
G4endl 
  958                  << 
"          Track stuck, not moving for "  
  959                  << fNumberZeroSteps << 
" steps" << 
G4endl 
  960                  << 
"          in volume -" << motherPhysical->
GetName()
 
  961                  << 
"- at point " << pGlobalpoint << 
G4endl 
  962                  << 
"          direction: " << pDirection << 
"." << 
G4endl 
  963                  << 
"          Potential geometry or navigation problem !" 
  965                  << 
"          Trying pushing it of " << Step << 
" mm ...";
 
  966          G4Exception(
"G4Navigator::ComputeStep()", 
"GeomNav1002",
 
  967                      JustWarning, message, 
"Potential overlap in geometry!");
 
  972     if( fNumberZeroSteps > fAbandonThreshold_NoZeroSteps-1 )
 
  976       std::ostringstream message;
 
  977       message << 
"Stuck Track: potential geometry or navigation problem." 
  979               << 
"        Track stuck, not moving for "  
  980               << fNumberZeroSteps << 
" steps" << 
G4endl 
  981               << 
"        in volume -" << motherPhysical->
GetName()
 
  982               << 
"- at point " << pGlobalpoint << 
G4endl 
  983               << 
"        direction: " << pDirection << 
".";
 
  985       G4Exception(
"G4Navigator::ComputeStep()", 
"GeomNav0003",
 
  991     if (!fPushed)  fNumberZeroSteps = 0;
 
 1002 #ifdef G4DEBUG_NAVIGATION 
 1005       G4cout << 
" At G4Nav CompStep End - if(exiting) - fExiting= " << fExiting 
 
 1006              << 
" fValidExitNormal = " << fValidExitNormal  << 
G4endl;
 
 1011     if(fValidExitNormal || fCalculatedExitNormal)
 
 1017         fGrandMotherExitNormal= fExitNormal;
 
 1018         fCalculatedExitNormal= 
true;
 
 1022         fGrandMotherExitNormal = fExitNormal;
 
 1030             fLastLocatedPointLocal + localDirection*Step;
 
 1044           fChangedGrandMotherRefFrame= 
true;           
 
 1045           fGrandMotherExitNormal = (*mRot).inverse() * exitNormalMotherFrame;
 
 1049           fGrandMotherExitNormal = exitNormalMotherFrame;
 
 1055         fCalculatedExitNormal= 
true;
 
 1059         fCalculatedExitNormal = 
false;
 
 1066 #ifdef G4DEBUG_NAVIGATION 
 1069         desc << 
"Problem in ComputeStep:  Replica Navigation did not provide" 
 1070              << 
" valid exit Normal. " << 
G4endl;
 
 1071         desc << 
" Do not know how calculate it in this case." << 
G4endl;
 
 1072         desc << 
"  Location    = " << finalLocalPoint << 
G4endl;
 
 1073         desc << 
"  Volume name = " << motherPhysical->
GetName()
 
 1075         G4Exception(
"G4Navigator::ComputeStep()", 
"GeomNav0003",
 
 1076                     JustWarning, desc, 
"Normal not available for exiting.");
 
 1083     if( fValidExitNormal || fCalculatedExitNormal )
 
 1090         fExitNormalGlobalFrame =
 
 1091           GrandMotherToGlobalTransf.
TransformAxis( fGrandMotherExitNormal );
 
 1095         fExitNormalGlobalFrame= fGrandMotherExitNormal;
 
 1105   if( (Step == pCurrentProposedStepLength) && (!fExiting) && (!fEntering) )
 
 1121     G4cout << 
"  Returned step= " << Step;
 
 1123     if( Step == kInfinity )
 
 1125        G4cout << 
" Requested step= " << pCurrentProposedStepLength ;
 
 1143                                      const G4double pCurrentProposedStepLength,
 
 1154                        pCurrentProposedStepLength, 
 
 1175   fLocatedOnEdge         = 
false;
 
 1176   fLastStepWasZero       = 
false;
 
 1181   fValidExitNormal       = 
false;
 
 1182   fChangedGrandMotherRefFrame= 
false;
 
 1183   fCalculatedExitNormal  = 
false;
 
 1190   fPreviousSafety        = 0.0; 
 
 1192   fNumberZeroSteps       = 0;
 
 1194   fBlockedPhysicalVolume = 0;
 
 1195   fBlockedReplicaNo      = -1;
 
 1197   fLastLocatedPointLocal = 
G4ThreeVector( kInfinity, -kInfinity, 0.0 ); 
 
 1198   fLocatedOutsideWorld   = 
false;
 
 1217   for ( i=1; i<=cdepth; i++ )
 
 1246           ComputeMaterial(replicaNo, current, &touchable) );
 
 1264   if ( fLastTriedStepComputation ) 
 
 1270     if( fEntering && (fBlockedPhysicalVolume!=0) ) 
 
 1273       if( candidateLogical ) 
 
 1295           currentSolid= candidateLogical->
GetSolid(); 
 
 1296           inSideIt  =  currentSolid->
Inside(daughterPointOwnLocal); 
 
 1297           onSurface =  (inSideIt == 
kSurface); 
 
 1302               safety = (currentSolid->
DistanceToIn(daughterPointOwnLocal)); 
 
 1305             else if (inSideIt == 
kInside )
 
 1307               safety = (currentSolid->
DistanceToOut(daughterPointOwnLocal)); 
 
 1314             nextSolidExitNormal =
 
 1319             ExitNormal = -nextSolidExitNormal;
 
 1320             fCalculatedExitNormal= 
true;
 
 1325             if(( 
fVerbose == 1 ) && ( fCheck ))
 
 1327               std::ostringstream message;
 
 1328               message << 
"Point not on surface ! " << 
G4endl 
 1330                       << daughterPointOwnLocal << 
G4endl  
 1331                       << 
"  Physical volume = " 
 1333                       << 
"  Logical volume  = " 
 1335                       << 
"  Solid           = " << currentSolid->
GetName() 
 
 1338                       << *currentSolid << 
G4endl;
 
 1341                 message << 
"Point is Outside. " << G4endl
 
 1342                         << 
"  Safety (from outside) = " << safety << 
G4endl;
 
 1346                 message << 
"Point is Inside. " << G4endl
 
 1347                         << 
"  Safety (from inside) = " << safety << 
G4endl;              
 
 1349               G4Exception(
"G4Navigator::GetLocalExitNormal()", 
"GeomNav1001",
 
 1358     else if ( fExiting ) 
 
 1360       ExitNormal = fGrandMotherExitNormal;
 
 1362       fCalculatedExitNormal= 
true;  
 
 1369                   "Incorrect call to GetLocalSurfaceNormal." );
 
 1378       ExitNormal= -(daughterSolid->
SurfaceNormal(fLastLocatedPointLocal));
 
 1379       if( std::fabs(ExitNormal.
mag2()-1.0 ) > CLHEP::perMillion )
 
 1382         desc << 
" Parameters of solid: " << *daughterSolid
 
 1383              << 
" Point for surface = " << fLastLocatedPointLocal << std::endl;
 
 1386                     "Surface Normal returned by Solid is not a Unit Vector." );
 
 1388       fCalculatedExitNormal= 
true;
 
 1395         ExitNormal = fGrandMotherExitNormal;
 
 1397         fCalculatedExitNormal= 
true;
 
 1402         fCalculatedExitNormal= 
false; 
 
 1404         message << 
"Function called when *NOT* at a Boundary." << 
G4endl;
 
 1421                                            G4int   enteringReplicaNo,
 
 1424   switch (enteringVolumeType)
 
 1429       G4Exception(
"G4Navigator::GetMotherToDaughterTransform()",
 
 1431                   "Method NOT Implemented yet for replica volumes.");
 
 1439           pParam->
ComputeSolid(enteringReplicaNo, pEnteringPhysVol);
 
 1474 #ifdef G4DEBUG_NAVIGATION 
 1477   if ( fLastTriedStepComputation ) 
 
 1479     G4ThreeVector ExpectedBoundaryPointLocal;
 
 1482     ExpectedBoundaryPointLocal =
 
 1502                                        G4bool*        pNormalCalculated)
 
 1507   if( fLastTriedStepComputation && fExiting )  
 
 1511     globalNormal = fExitNormalGlobalFrame; 
 
 1512     *pNormalCalculated = 
true; 
 
 1518     *pNormalCalculated = fCalculatedExitNormal;
 
 1520 #ifdef G4DEBUG_NAVIGATION 
 1521     if( (!validNormal) && !fCalculatedExitNormal)
 
 1524       edN << 
"  Calculated = " << fCalculatedExitNormal << 
G4endl;
 
 1525       edN << 
"   Entering= "  << fEntering << 
G4endl;
 
 1528       edN << 
"   State of Navigator: " << 
G4endl;
 
 1534                   "LocalExitNormalAndCheck() did not calculate Normal.");
 
 1539      if( validNormal && (std::fabs(localMag2-1.0)) > CLHEP::perMillion )
 
 1543        edN << 
"G4Navigator::GetGlobalExitNormal: " 
 1544            << 
"  Using Local Normal - from call to GetLocalExitNormalAndCheck. " 
 1546            << 
"  Local  Exit Normal = " << localNormal  << 
" || = " 
 1547            << std::sqrt(localMag2) << 
G4endl 
 1548            << 
"  Global Exit Normal = " << globalNormal << 
" || = " 
 1550        edN << 
"  Calculated It      = " << fCalculatedExitNormal << 
G4endl;
 
 1554                    "Value obtained from new local *solid* is incorrect.");
 
 1555        localNormal = localNormal.
unit(); 
 
 1561 #ifdef G4DEBUG_NAVIGATION 
 1563   if( fLastTriedStepComputation && fExiting)
 
 1566     *pNormalCalculated = fCalculatedExitNormal;
 
 1572     G4ThreeVector diffNorm = globalNormal - fExitNormalGlobalFrame;
 
 1576       edDfn << 
"Found difference in normals in case of exiting mother " 
 1577             << 
"- when Get is called after ComputingStep " << 
G4endl;
 
 1578       edDfn << 
"  Magnitude of diff =      " << diffNorm.
mag() << 
G4endl;
 
 1579       edDfn << 
"  Normal stored (Global)     = " << fExitNormalGlobalFrame
 
 1581       edDfn << 
"  Global Computed from Local = " << globalNormal << 
G4endl;
 
 1582       G4Exception(
"G4Navigator::GetGlobalExitNormal()", 
"GeomNav0003",
 
 1588   return globalNormal;
 
 1609 #ifdef G4DEBUG_NAVIGATION 
 1613     G4cout << 
"*** G4Navigator::ComputeSafety: ***" << 
G4endl 
 1614            << 
"    Called at point: " << pGlobalpoint << 
G4endl;
 
 1618            << 
" - Maximum length = " << pMaxLength << 
G4endl; 
 
 1621        G4cout << 
"    ----- Upon entering Compute Safety:" << 
G4endl;
 
 1633   if( !(endpointOnSurface && stayedOnEndpoint) )
 
 1646 #ifdef G4DEBUG_NAVIGATION 
 1649       G4cout << 
"  G4Navigator::ComputeSafety() relocates-in-volume to point: " 
 1650              << pGlobalpoint << 
G4endl;
 
 1668                                            *motherPhysical, pMaxLength);
 
 1669 #ifdef G4DEBUG_NAVIGATION 
 1673             G4double diffSafety= (safetyTwo - safetyNormal);
 
 1674             if( std::fabs(diffSafety) > CLHEP::perMillion
 
 1675                                       * std::fabs(safetyNormal) )
 
 1678               exd << 
" ERROR in G4Navigator::ComputeStep " << 
G4endl;
 
 1679               exd << 
"  Error>  DIFFERENCE in Safety from G4VoxelSafety " 
 1680                   << 
" - compared to value from Normal.  Diff = " << diffSafety << 
G4endl;
 
 1681               exd << 
"  New Voxel Safety= " << safetyTwo
 
 1682                   << 
"  Value from Normal= " << safetyNormal << 
G4endl;
 
 1683               exd << 
"  Location:  Local coordinates = " << localPoint
 
 1684                   << 
"  mother Volume= " << *motherPhysical->
GetName()
 
 1686               exd << 
"          : Global coordinates = " << pGlobalpoint
 
 1695             G4double diffBetterToApprox= safetyTwo - safetyOldVoxel;
 
 1696             if( diffBetterToApprox < 0.0 )
 
 1699               exd << 
"SMALLER Safety from call G4VoxelSafety compared to value " 
 1700                   << 
" from Normal.  Diff = " << diffSafety << 
G4endl;
 
 1701               exd << 
" New Voxel Safety= " << safetyTwo
 
 1702                   << 
"  Old value from Normal= " << newSafety << 
G4endl;
 
 1703               exd << 
"  Location:  Local coordinates = " << localPoint
 
 1704                   << 
"  mother Volume= " << *motherPhysical->
GetName()
 
 1706               exd << 
"          : Global coordinates = " << pGlobalpoint
 
 1714             newSafety= safetyTwo;   
 
 1719             newSafety= safetyOldVoxel;
 
 1738           G4Exception(
"G4Navigator::ComputeSafety()", 
"GeomNav0001",
 
 1745       newSafety = freplicaNav.
ComputeSafety(pGlobalpoint, localPoint,
 
 1751 #ifdef G4DEBUG_NAVIGATION 
 1754       G4cout << 
"    G4Navigator::ComputeSafety() finds that point - "  
 1755              << pGlobalpoint << 
" - is on surface " << 
G4endl; 
 
 1767   fPreviousSftOrigin = pGlobalpoint;
 
 1768   fPreviousSafety = newSafety; 
 
 1772 #ifdef G4DEBUG_NAVIGATION 
 1777     G4cout << 
"    Returned value of Safety = " << newSafety << 
G4endl;
 
 1779   G4cout.precision(oldcoutPrec);
 
 1803     G4cout << 
"The current state of G4Navigator is: " << 
G4endl;
 
 1804     G4cout << 
"  ValidExitNormal= " << fValidExitNormal << G4endl
 
 1805            << 
"  ExitNormal     = " << fExitNormal      << G4endl
 
 1806            << 
"  Exiting        = " << fExiting         << G4endl
 
 1807            << 
"  Entering       = " << fEntering        << G4endl
 
 1808            << 
"  BlockedPhysicalVolume= " ;
 
 1809     if (fBlockedPhysicalVolume==0)
 
 1814            << 
"  BlockedReplicaNo     = " <<  fBlockedReplicaNo       << G4endl
 
 1815            << 
"  LastStepWasZero      = " <<   fLastStepWasZero       << G4endl
 
 1821     G4cout << std::setw(30) << 
" ExitNormal "  << 
" " 
 1822            << std::setw( 5) << 
" Valid "       << 
" "      
 1823            << std::setw( 9) << 
" Exiting "     << 
" "       
 1824            << std::setw( 9) << 
" Entering"     << 
" "  
 1825            << std::setw(15) << 
" Blocked:Volume "  << 
" "    
 1826            << std::setw( 9) << 
" ReplicaNo"        << 
" "   
 1827            << std::setw( 8) << 
" LastStepZero  "   << 
" "    
 1829     G4cout << 
"( " << std::setw(7) << fExitNormal.
x() 
 
 1830            << 
", " << std::setw(7) << fExitNormal.
y()
 
 1831            << 
", " << std::setw(7) << fExitNormal.
z() << 
" ) " 
 1832            << std::setw( 5)  << fValidExitNormal  << 
" "    
 1833            << std::setw( 9)  << fExiting          << 
" " 
 1834            << std::setw( 9)  << fEntering         << 
" ";
 
 1835     if ( fBlockedPhysicalVolume==0 )
 
 1836       G4cout << std::setw(15) << 
"None";
 
 1838       G4cout << std::setw(15)<< fBlockedPhysicalVolume->
GetName();
 
 1839       G4cout << std::setw( 9)  << fBlockedReplicaNo  << 
" " 
 1840              << std::setw( 8)  << fLastStepWasZero   << 
" " 
 1846     G4cout << 
" Current Localpoint = " << fLastLocatedPointLocal << 
G4endl;
 
 1847     G4cout << 
" PreviousSftOrigin  = " << fPreviousSftOrigin << 
G4endl;
 
 1848     G4cout << 
" PreviousSafety     = " << fPreviousSafety << 
G4endl; 
 
 1850   G4cout.precision(oldcoutPrec);
 
 1857 void G4Navigator::ComputeStepLog(
const G4ThreeVector& pGlobalpoint,
 
 1867                                       TransformPoint(fLastLocatedPointLocal); 
 
 1869   G4double shiftOriginSafSq = (fPreviousSftOrigin-pGlobalpoint).mag2();
 
 1877   if( shiftOriginSafSq >= 
sqr(fPreviousSafety) )
 
 1879     G4double shiftOrigin = std::sqrt(shiftOriginSafSq);
 
 1880     G4double diffShiftSaf = shiftOrigin - fPreviousSafety;
 
 1882     if( diffShiftSaf > fAccuracyForWarning )
 
 1886       std::ostringstream message, suggestion;
 
 1887       message << 
"Accuracy error or slightly inaccurate position shift." 
 1889               << 
"     The Step's starting point has moved "  
 1890               << std::sqrt(moveLenSq)/
mm << 
" mm " << 
G4endl 
 1891               << 
"     since the last call to a Locate method." << 
G4endl 
 1892               << 
"     This has resulted in moving "  
 1893               << shiftOrigin/
mm << 
" mm "  
 1894               << 
" from the last point at which the safety "  
 1895               << 
"     was calculated " << 
G4endl 
 1896               << 
"     which is more than the computed safety= "  
 1897               << fPreviousSafety/
mm << 
" mm  at that point." << 
G4endl 
 1898               << 
"     This difference is "  
 1899               << diffShiftSaf/
mm << 
" mm." << 
G4endl 
 1900               << 
"     The tolerated accuracy is " 
 1901               << fAccuracyForException/
mm << 
" mm.";
 
 1904       static G4int warnNow = 0;
 
 1905       if( ((++warnNow % 100) == 1) )
 
 1908                << 
"  This problem can be due to either " << 
G4endl 
 1909                << 
"    - a process that has proposed a displacement" 
 1910                << 
" larger than the current safety , or" << 
G4endl 
 1911                << 
"    - inaccuracy in the computation of the safety";
 
 1912         suggestion << 
"We suggest that you " << G4endl
 
 1913                    << 
"   - find i) what particle is being tracked, and " 
 1914                    << 
" ii) through what part of your geometry " << G4endl
 
 1915                    << 
"      for example by re-running this event with " 
 1917                    << 
"         /tracking/verbose 1 "  << G4endl
 
 1918                    << 
"    - check which processes you declare for" 
 1919                    << 
" this particle (and look at non-standard ones)" 
 1921                    << 
"   - in case, create a detailed logfile" 
 1922                    << 
" of this event using:" << G4endl
 
 1923                    << 
"         /tracking/verbose 6 ";
 
 1927                   message, 
G4String(suggestion.str()));
 
 1928       G4cout.precision(oldcoutPrec);
 
 1929       G4cerr.precision(oldcerrPrec);
 
 1931 #ifdef G4DEBUG_NAVIGATION 
 1934       G4cerr << 
"WARNING - G4Navigator::ComputeStep()" << 
G4endl 
 1935              << 
"          The Step's starting point has moved " 
 1936              << std::sqrt(moveLenSq) << 
"," << 
G4endl 
 1937              << 
"          which has taken it to the limit of" 
 1938              << 
" the current safety. " << 
G4endl;
 
 1942   G4double safetyPlus = fPreviousSafety + fAccuracyForException;
 
 1943   if ( shiftOriginSafSq > 
sqr(safetyPlus) )
 
 1945     std::ostringstream message;
 
 1946     message << 
"May lead to a crash or unreliable results." << 
G4endl 
 1947             << 
"        Position has shifted considerably without" 
 1948             << 
" notifying the navigator !" << 
G4endl 
 1949             << 
"        Tolerated safety: " << safetyPlus << 
G4endl 
 1950             << 
"        Computed shift  : " << shiftOriginSafSq;
 
 1951     G4Exception(
"G4Navigator::ComputeStep()", 
"GeomNav1002",
 
 1968   G4int oldcoutPrec = os.precision(4);
 
 1971     os << 
"The current state of G4Navigator is: " << 
G4endl;
 
 1972     os << 
"  ValidExitNormal= " << n.fValidExitNormal << G4endl
 
 1973     << 
"  ExitNormal     = " << n.fExitNormal      << G4endl
 
 1974     << 
"  Exiting        = " << n.fExiting         << G4endl
 
 1975     << 
"  Entering       = " << n.fEntering        << G4endl
 
 1976     << 
"  BlockedPhysicalVolume= " ;
 
 1977     if (n.fBlockedPhysicalVolume==0)
 
 1980       os << n.fBlockedPhysicalVolume->
GetName();
 
 1982     << 
"  BlockedReplicaNo     = " <<  n.fBlockedReplicaNo       << G4endl
 
 1983     << 
"  LastStepWasZero      = " <<   n.fLastStepWasZero       << G4endl
 
 1989     os << std::setw(30) << 
" ExitNormal "  << 
" " 
 1990     << std::setw( 5) << 
" Valid "       << 
" " 
 1991     << std::setw( 9) << 
" Exiting "     << 
" " 
 1992     << std::setw( 9) << 
" Entering"     << 
" " 
 1993     << std::setw(15) << 
" Blocked:Volume "  << 
" " 
 1994     << std::setw( 9) << 
" ReplicaNo"        << 
" " 
 1995     << std::setw( 8) << 
" LastStepZero  "   << 
" " 
 1997     os << 
"( " << std::setw(7) << n.fExitNormal.
x()
 
 1998     << 
", " << std::setw(7) << n.fExitNormal.
y()
 
 1999     << 
", " << std::setw(7) << n.fExitNormal.
z() << 
" ) " 
 2000     << std::setw( 5)  << n.fValidExitNormal  << 
" " 
 2001     << std::setw( 9)  << n.fExiting          << 
" " 
 2002     << std::setw( 9)  << n.fEntering         << 
" ";
 
 2003     if ( n.fBlockedPhysicalVolume==0 )
 
 2004       { os << std::setw(15) << 
"None"; }
 
 2006       { os << std::setw(15)<< n.fBlockedPhysicalVolume->
GetName(); }
 
 2007     os << std::setw( 9)  << n.fBlockedReplicaNo  << 
" " 
 2008     << std::setw( 8)  << n.fLastStepWasZero   << 
" " 
 2014     os << 
" Current Localpoint = " << n.fLastLocatedPointLocal << 
G4endl;
 
 2015     os << 
" PreviousSftOrigin  = " << n.fPreviousSftOrigin << 
G4endl;
 
 2016     os << 
" PreviousSafety     = " << n.fPreviousSafety << 
G4endl;
 
 2023   os.precision(oldcoutPrec);