105 #ifdef G4DEBUG_NAVIGATION 
  108     G4cout << 
" G4MultiNavigator::ComputeStep : entered " << 
G4endl;
 
  109     G4cout << 
"   Input position= " << pGlobalPoint
 
  110            << 
"   direction= "      << pDirection         << 
G4endl;
 
  111     G4cout << 
"   Requested step= " << proposedStepLength << 
G4endl;
 
  115   std::vector<G4Navigator*>::iterator pNavigatorIter;
 
  126      step= (*pNavigatorIter)->ComputeStep( initialPosition, 
 
  130      if( safety < minSafety ){ minSafety = safety; } 
 
  131      if( step < minStep )    { minStep= step; } 
 
  137 #ifdef G4DEBUG_NAVIGATION 
  140        G4cout << 
"G4MultiNavigator::ComputeStep : Navigator [" 
  141               << num << 
"] -- step size " << step
 
  142               << 
" safety= " << safety << 
G4endl;
 
  162 #ifdef G4DEBUG_NAVIGATION 
  168     G4cout << 
"G4MultiNavigator::ComputeStep : " 
  169            << 
" initialPosition = " << initialPosition 
 
  170            << 
" and endPosition = " << endPosition << 
G4endl;
 
  171     G4cout.precision( oldPrec );
 
  175   pNewSafety = minSafety; 
 
  179 #ifdef G4DEBUG_NAVIGATION 
  182     G4cout << 
" G4MultiNavigator::ComputeStep : exits returning " 
  200      std::ostringstream message;
 
  201      message << 
"Bad Navigator Id!" << 
G4endl 
  202              << 
"        Navigator Id = " << navigatorId 
 
  204      G4Exception(
"G4MultiNavigator::ObtainFinalStep()", 
"GeomNav0002",
 
  214 #ifdef G4DEBUG_NAVIGATION 
  217      G4cout << 
" G4MultiNavigator::ComputeStep returns " 
  219             << 
" for Navigator " << navigatorId
 
  220             << 
" Limited step = " << limitedStep 
 
  221             << 
" Safety(mm) = " << pNewSafety / 
mm << 
G4endl; 
 
  233 #ifdef G4DEBUG_NAVIGATION 
  236     G4cout << 
" Entered G4MultiNavigator::PrepareNewTrack() " << 
G4endl;
 
  257 #ifdef G4DEBUG_NAVIGATION 
  260     G4cout << 
" Entered G4MultiNavigator::PrepareNavigators() " << 
G4endl;
 
  266   std::vector<G4Navigator*>::iterator pNavigatorIter; 
 
  271     std::ostringstream message;
 
  272     message << 
"Too many active Navigators / worlds !" << 
G4endl 
  273             << 
"        Active Navigators (worlds): " 
  275             << 
"        which is more than the number allowed: " 
  277     G4Exception(
"G4MultiNavigator::PrepareNavigators()", 
"GeomNav0002",  
 
  302 #ifdef G4DEBUG_NAVIGATION 
  305        G4cout << 
" G4MultiNavigator::PrepareNavigators() changed world volume "  
  306               << 
" for mass geometry to " << massWorld->
GetName() << 
G4endl; 
 
  319                                             const G4bool pRelativeSearch,
 
  320                                             const G4bool ignoreDirection )
 
  325   G4bool relative = pRelativeSearch; 
 
  326   std::vector<G4Navigator*>::iterator pNavIter
 
  329   if( pDirection ) { direction = *pDirection; }
 
  331 #ifdef G4DEBUG_NAVIGATION 
  334     G4cout << 
" Entered G4MultiNavigator::LocateGlobalPointAndSetup() " 
  336     G4cout << 
"   Locating at position: " << position
 
  337            << 
", with direction: " << direction << G4endl
 
  338            << 
"   Relative: " << relative 
 
  339            << 
", ignore direction: " << ignoreDirection << 
G4endl;
 
  349         (*pNavIter)->SetGeometricallyLimitedStep(); 
 
  353        = (*pNavIter)->LocateGlobalPointAndSetup( position, &direction,
 
  354                                                  relative, ignoreDirection );   
 
  365 #ifdef G4DEBUG_NAVIGATION 
  368        G4cout << 
" Located in world: " << num << 
", at: " << position << 
G4endl 
  370               << 
", found in volume: " << pLocated << 
G4endl; 
 
  379          G4cout <<  
"Null'   Id: Not-Set "; 
 
  389   return volMassLocated;
 
  399   std::vector<G4Navigator*>::iterator pNavIter
 
  402 #ifdef G4DEBUG_NAVIGATION 
  405     G4cout << 
" Entered G4MultiNavigator::ReLocate() " << 
G4endl 
  406            << 
"  Re-locating at position: " << position  << 
G4endl; 
 
  414      (*pNavIter)->LocateGlobalPointWithinVolume( position ); 
 
  437     std::vector<G4Navigator*>::iterator pNavigatorIter;
 
  442        safety = (*pNavigatorIter)->ComputeSafety( position, maxDistance, state);
 
  443        if( safety < minSafety ) { minSafety = safety; } 
 
  449 #ifdef G4DEBUG_NAVIGATION 
  452       G4cout << 
" G4MultiNavigator::ComputeSafety - returns: "  
  453              << minSafety << 
", at location: " << position << 
G4endl;
 
  464   G4Exception( 
"G4MultiNavigator::CreateTouchableHistoryHandle()", 
 
  466                "Getting a touchable from G4MultiNavigator is not defined."); 
 
  472   if( locatedVolume == 0 )
 
  489   const G4int IdTransport= 0;  
 
  493 #ifdef G4DEBUG_NAVIGATION 
  496     G4cout << 
" Entered G4MultiNavigator::WhichLimited() " << 
G4endl;
 
  504   if( transportLimited )
 
  529   if( (last > -1) && (noLimited == 1 ) )
 
  546   static const G4String StrDoNot(
"DoNot"), StrUnique(
"Unique"),
 
  547                   StrUndefined(
"Undefined"),
 
  548                   StrSharedTransport(
"SharedTransport"),
 
  549                   StrSharedOther(
"SharedOther");
 
  550   G4cout << 
"### G4MultiNavigator::PrintLimited() reports: " << 
G4endl;
 
  554 #ifdef G4DEBUG_NAVIGATION 
  557     G4cout << std::setw(5) << 
" NavId"  << 
" " 
  558            << std::setw(12) << 
" step-size " << 
" " 
  559            << std::setw(12) << 
" raw-size "  << 
" " 
  560            << std::setw(12) << 
" pre-safety " << 
" "  
  561            << std::setw(15) << 
" Limited / flag"  << 
" " 
  562            << std::setw(15) << 
"  World "  << 
" " 
  577     G4cout << std::setw(5) << num  << 
" " 
  578            << std::setw(12) << stepLen << 
" " 
  579            << std::setw(12) << rawStep << 
" " 
  581            << std::setw(5) << (
fLimitTruth[num] ? 
"YES" : 
" NO") << 
" ";
 
  585       case kDoNot          : limitedStr= StrDoNot; 
break;
 
  586       case kUnique         : limitedStr = StrUnique; 
break; 
 
  589       default              : limitedStr = StrUndefined; 
break;
 
  591     G4cout << 
" " << std::setw(15) << limitedStr << 
" ";  
 
  592     G4cout.precision(oldPrec); 
 
  604     G4cout << 
" " << WorldName ; 
 
  616    G4Exception(
"G4MultiNavigator::ResetState()", 
"GeomNav0001",  
 
  618                "Cannot reset state for navigators of G4MultiNavigator.");
 
  620    std::vector<G4Navigator*>::iterator pNavigatorIter;
 
  634                "Cannot setup hierarchy for navigators of G4MultiNavigator."); 
 
  648                    "Mass world pointer has been changed." ); 
 
  671       G4Exception(
"G4MultiNavigator::ResetHierarchyAndLocate()",
 
  673                   "Cannot reset hierarchy before navigators are initialised.");
 
  676    std::vector<G4Navigator*>::iterator pNavIter= 
 
  681       G4bool relativeSearch, ignoreDirection; 
 
  685                                                relativeSearch=
false,
 
  686                                                ignoreDirection=
false);
 
  700   G4int  firstNavigatorId= -1;
 
  701   G4bool        oneObtained= 
false;
 
  707     *argpObtained= isObtained; 
 
  713       std::vector<G4Navigator*>::iterator pNavIter= 
 
  725             if( !isObtained && (newNormal.mag2() != 0.0) )
 
  727               normalGlobalCrd= newNormal; 
 
  728               isObtained =     oneObtained;
 
  729               firstNavigatorId= num; 
 
  732               G4double dotNewPrevious= newNormal.dot( normalGlobalCrd );
 
  733               G4double productMagSq= normalGlobalCrd.mag2() * newNormal.mag2(); 
 
  734               if( productMagSq > 0.0 ) 
 
  736                 G4double productMag= std::sqrt( productMagSq ); 
 
  737                 dotNewPrevious /= productMag; 
 
  740                   *argpObtained= 
false; 
 
  744                     std::ostringstream message;
 
  745                     message << 
"Clash of Normal from different Navigators!" << 
G4endl 
  746                             << 
"        Previous Navigator Id = " << firstNavigatorId << 
G4endl 
  747                             << 
"        Current  Navigator Id = " << num << 
G4endl;
 
  748                     message << 
"  Dot product of 2 normals = " << dotNewPrevious << 
G4endl;
 
  749                     message << 
"        Normal (previous) = " << normalGlobalCrd << 
G4endl;
 
  750                     message << 
"        Normal (current)  = " << newNormal       << 
G4endl;
 
  751                     G4Exception(
"G4MultiNavigator::GetGlobalExitNormal()", 
"GeomNav0002",
 
  768         std::ostringstream message;
 
  770                 << 
" candidate Navigators limiting the step!" << 
G4endl;
 
  771         G4Exception(
"G4MultiNavigator::GetGlobalExitNormal()", 
"GeomNav0002",
 
  778   *argpObtained= isObtained;
 
  779   return normalGlobalCrd;
 
  796     *argpObtained= isObtained;
 
  799     G4int noWarningsStart= 10, noModuloWarnings=100; 
 
  801     if( (numberWarnings < noWarningsStart ) || (numberWarnings%noModuloWarnings==0) ) 
 
  803     std::ostringstream message;
 
  804     message << 
"Cannot obtain normal in local coordinates of two or more coordinate systems." << 
G4endl;
 
  805     G4Exception(
"G4MultiNavigator::GetGlobalExitNormal()", 
"GeomNav0002",
 
  814         std::ostringstream message;
 
  815         message << 
"Cannot obtain normal in local coordinates of two or more coordinate systems." << 
G4endl;
 
  816         G4Exception(
"G4MultiNavigator::GetGlobalExitNormal()", 
"GeomNav0002",
 
  821   *argpObtained= isObtained;
 
  822   return normalGlobalCrd; 
 
virtual G4ThreeVector GetGlobalExitNormal(const G4ThreeVector &CurrentE_Point, G4bool *obtained)
 
G4double ComputeSafety(const G4ThreeVector &globalpoint, const G4double pProposedMaxLength=DBL_MAX, const G4bool keepState=false)
 
static const G4double kInfinity
 
G4bool fLimitTruth[fMaxNav]
 
G4VPhysicalVolume * fLocatedVolume[fMaxNav]
 
CLHEP::Hep3Vector G4ThreeVector
 
G4double ComputeStep(const G4ThreeVector &pGlobalPoint, const G4ThreeVector &pDirection, const G4double pCurrentProposedStepLength, G4double &pNewSafety)
 
void PrepareNewTrack(const G4ThreeVector position, const G4ThreeVector direction)
 
G4double fMinSafety_atSafLocation
 
G4Navigator * GetNavigatorForTracking() const 
 
G4TransportationManager * pTransportManager
 
G4Navigator * fpNavigator[fMaxNav]
 
G4VPhysicalVolume * fLastMassWorld
 
G4VPhysicalVolume * LocateGlobalPointAndSetup(const G4ThreeVector &point, const G4ThreeVector *direction=0, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true)
 
static const double perThousand
 
G4int fNoActiveNavigators
 
G4ReferenceCountedHandle< G4TouchableHistory > G4TouchableHistoryHandle
 
G4ThreeVector fPreStepLocation
 
virtual G4VPhysicalVolume * ResetHierarchyAndLocate(const G4ThreeVector &point, const G4ThreeVector &direction, const G4TouchableHistory &h)
 
G4bool fWasLimitedByGeometry
 
G4TouchableHistoryHandle CreateTouchableHistoryHandle() const 
 
G4GLOB_DLL std::ostream G4cout
 
const G4String & GetName() const 
 
G4double fNewSafety[fMaxNav]
 
virtual G4ThreeVector GetLocalExitNormal(G4bool *valid)
 
virtual G4ThreeVector GetLocalExitNormal(G4bool *obtained)
 
G4VPhysicalVolume * ResetHierarchyAndLocate(const G4ThreeVector &point, const G4ThreeVector &direction, const G4TouchableHistory &h)
 
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
 
static G4TransportationManager * GetTransportationManager()
 
G4TouchableHistory * CreateTouchableHistory() const 
 
G4ThreeVector fSafetyLocation
 
virtual G4ThreeVector GetGlobalExitNormal(const G4ThreeVector &point, G4bool *valid)
 
std::vector< G4Navigator * >::iterator GetActiveNavigatorsIterator()
 
virtual G4int GetCopyNo() const =0
 
void SetWorldVolume(G4VPhysicalVolume *pWorld)
 
G4double ObtainFinalStep(G4int navigatorId, G4double &pNewSafety, G4double &minStepLast, ELimited &limitedStep)
 
ELimited fLimitedStep[fMaxNav]
 
void LocateGlobalPointWithinVolume(const G4ThreeVector &position)
 
G4double fCurrentStepSize[fMaxNav]
 
virtual G4ThreeVector GetLocalExitNormalAndCheck(const G4ThreeVector &CurrentE_Point, G4bool *obtained)
 
void UpdateYourself(G4VPhysicalVolume *pPhysVol, const G4NavigationHistory *history=0)
 
static char * endPosition
 
const G4NavigationHistory * GetHistory() const 
 
static const G4int fMaxNav
 
G4VPhysicalVolume * GetWorldVolume() const 
 
G4double fMinSafety_PreStepPt
 
G4ThreeVector fLastLocatedPosition