680{
682 G4bool isObtained =
false;
683
684 G4int firstNavigatorId = -1;
685 G4bool oneObtained =
false;
686
687 if( fNoLimitingStep == 1 )
688 {
689
690 normalGlobalCrd = fpNavigator[ fIdNavLimiting ]
692 *argpObtained = isObtained;
693 }
694 else
695 {
696 if( fNoLimitingStep > 1 )
697 {
699
700 for ( auto num = 0; num < fNoActiveNavigators ; ++pNavIter, ++num )
701 {
703 if( fLimitTruth[ num ] )
704 {
706 (*pNavIter)->GetGlobalExitNormal( argPoint, &oneObtained );
707 if( oneObtained )
708 {
709
710 if( !isObtained && (newNormal.
mag2() != 0.0) )
711 {
712 normalGlobalCrd = newNormal;
713 isObtained = oneObtained;
714 firstNavigatorId = num;
715 }
716 else
717 {
718
719 G4double dotNewPrevious = newNormal.
dot( normalGlobalCrd );
720 G4double productMagSq = normalGlobalCrd.mag2()*newNormal.
mag2();
721 if( productMagSq > 0.0 )
722 {
723 G4double productMag = std::sqrt( productMagSq );
724 dotNewPrevious /= productMag;
725 if( dotNewPrevious < (1 - perThousand) )
726 {
727 *argpObtained = false;
728
730 {
731 std::ostringstream message;
732 message << "Clash of Normal from different Navigators!"
734 << " Previous Navigator Id = "
735 << firstNavigatorId <<
G4endl
736 << " Current Navigator Id = "
738 message << " Dot product of 2 normals = "
739 << dotNewPrevious <<
G4endl;
740 message << " Normal (previous) = "
741 << normalGlobalCrd <<
G4endl;
742 message <<
" Normal (current) = " << newNormal <<
G4endl;
743 G4Exception(
"G4MultiNavigator::GetGlobalExitNormal()",
745 }
746 }
747 else
748 {
749
750 }
751 }
752 }
753 }
754 }
755 }
756
757
758 if( !oneObtained )
759 {
760 std::ostringstream message;
761 message << "No Normal obtained despite having " << fNoLimitingStep
762 <<
" candidate Navigators limiting the step!" <<
G4endl;
763 G4Exception(
"G4MultiNavigator::GetGlobalExitNormal()",
"GeomNav0002",
765 }
766
767 }
768 }
769
770 *argpObtained = isObtained;
771 return normalGlobalCrd;
772}
double dot(const Hep3Vector &) const
virtual G4ThreeVector GetGlobalExitNormal(const G4ThreeVector &point, G4bool *valid)
std::vector< G4Navigator * >::iterator GetActiveNavigatorsIterator()