Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4ITNavigator2 Class Reference

#include <G4ITNavigator2.hh>

Collaboration diagram for G4ITNavigator2:

Classes

struct  G4NavigatorState
 
struct  G4SaveNavigatorState
 

Public Member Functions

 G4ITNavigator2 ()
 
virtual ~G4ITNavigator2 ()
 
G4ITNavigatorState_Lock2GetNavigatorState ()
 
void SetNavigatorState (G4ITNavigatorState_Lock2 *)
 
void NewNavigatorState ()
 
void NewNavigatorState (const G4TouchableHistory &h)
 
void ResetNavigatorState ()
 
G4VPhysicalVolumeNewNavigatorStateAndLocate (const G4ThreeVector &p, const G4ThreeVector &direction)
 
void CheckNavigatorState () const
 
std::shared_ptr
< G4ITNavigatorState_Lock2
GetSnapshotOfState ()
 
void ResetFromSnapshot (std::shared_ptr< G4ITNavigatorState_Lock2 >)
 
virtual G4double ComputeStep (const G4ThreeVector &pGlobalPoint, const G4ThreeVector &pDirection, const G4double pCurrentProposedStepLength, G4double &pNewSafety)
 
G4double CheckNextStep (const G4ThreeVector &pGlobalPoint, const G4ThreeVector &pDirection, const G4double pCurrentProposedStepLength, G4double &pNewSafety)
 
virtual G4VPhysicalVolumeResetHierarchyAndLocate (const G4ThreeVector &point, const G4ThreeVector &direction, const G4TouchableHistory &h)
 
virtual G4VPhysicalVolumeLocateGlobalPointAndSetup (const G4ThreeVector &point, const G4ThreeVector *direction=0, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true)
 
EInside InsideCurrentVolume (const G4ThreeVector &globalPoint) const
 
void GetRandomInCurrentVolume (G4ThreeVector &rndmPoint) const
 
virtual void LocateGlobalPointWithinVolume (const G4ThreeVector &position)
 
void LocateGlobalPointAndUpdateTouchableHandle (const G4ThreeVector &position, const G4ThreeVector &direction, G4TouchableHandle &oldTouchableToUpdate, const G4bool RelativeSearch=true)
 
void LocateGlobalPointAndUpdateTouchable (const G4ThreeVector &position, const G4ThreeVector &direction, G4VTouchable *touchableToUpdate, const G4bool RelativeSearch=true)
 
void LocateGlobalPointAndUpdateTouchable (const G4ThreeVector &position, G4VTouchable *touchableToUpdate, const G4bool RelativeSearch=true)
 
void SetGeometricallyLimitedStep ()
 
virtual G4double ComputeSafety (const G4ThreeVector &globalpoint, const G4double pProposedMaxLength=DBL_MAX, const G4bool keepState=true)
 
virtual G4bool RecheckDistanceToCurrentBoundary (const G4ThreeVector &pGlobalPoint, const G4ThreeVector &pDirection, const G4double CurrentProposedStepLength, G4double *prDistance, G4double *prNewSafety=0) const
 
G4VPhysicalVolumeGetWorldVolume () const
 
void SetWorldVolume (G4VPhysicalVolume *pWorld)
 
G4GRSVolumeCreateGRSVolume () const
 
G4GRSSolidCreateGRSSolid () const
 
G4TouchableHistoryCreateTouchableHistory () const
 
G4TouchableHistoryCreateTouchableHistory (const G4NavigationHistory *) const
 
virtual G4TouchableHistoryHandle CreateTouchableHistoryHandle () const
 
virtual G4ThreeVector GetLocalExitNormal (G4bool *valid)
 
virtual G4ThreeVector GetLocalExitNormalAndCheck (const G4ThreeVector &point, G4bool *valid)
 
virtual G4ThreeVector GetGlobalExitNormal (const G4ThreeVector &point, G4bool *valid)
 
G4int GetVerboseLevel () const
 
void SetVerboseLevel (G4int level)
 
G4bool IsActive () const
 
void Activate (G4bool flag)
 
G4bool EnteredDaughterVolume () const
 
G4bool ExitedMotherVolume () const
 
void CheckMode (G4bool mode)
 
G4bool IsCheckModeActive () const
 
void SetPushVerbosity (G4bool mode)
 
void PrintState () const
 
const G4AffineTransformGetGlobalToLocalTransform () const
 
const G4AffineTransform GetLocalToGlobalTransform () const
 
G4AffineTransform GetMotherToDaughterTransform (G4VPhysicalVolume *dVolume, G4int dReplicaNo, EVolume dVolumeType)
 
void ResetStackAndState ()
 
G4int SeverityOfZeroStepping (G4int *noZeroSteps) const
 
G4ThreeVector GetCurrentLocalCoordinate () const
 
G4ThreeVector NetTranslation () const
 
G4RotationMatrix NetRotation () const
 
void EnableBestSafety (G4bool value=false)
 

Public Attributes

G4NavigatorStatefpNavigatorState
 
G4VPhysicalVolumefTopPhysical
 
G4bool fCheck
 
G4bool fWarnPush
 
G4NormalNavigation fnormalNav
 
G4VoxelNavigation fvoxelNav
 
G4ParameterisedNavigation fparamNav
 
G4ReplicaNavigation freplicaNav
 
G4RegularNavigation fregularNav
 
G4VoxelSafetyfpVoxelSafety
 

Static Public Attributes

static const G4int fMaxNav = 8
 

Protected Member Functions

G4ThreeVector ComputeLocalPoint (const G4ThreeVector &rGlobPoint) const
 
G4ThreeVector ComputeLocalAxis (const G4ThreeVector &pVec) const
 
virtual void ResetState ()
 
EVolume VolumeType (const G4VPhysicalVolume *pVol) const
 
EVolume CharacteriseDaughters (const G4LogicalVolume *pLog) const
 
G4int GetDaughtersRegularStructureId (const G4LogicalVolume *pLog) const
 
virtual void SetupHierarchy ()
 

Protected Attributes

G4double kCarTolerance
 
G4int fVerbose
 

Friends

std::ostream & operator<< (std::ostream &os, const G4ITNavigator2 &n)
 

Detailed Description

Definition at line 102 of file G4ITNavigator2.hh.

Constructor & Destructor Documentation

G4ITNavigator2::G4ITNavigator2 ( )

Definition at line 100 of file G4ITNavigator2.cc.

101  : fVerbose(0),
102  fTopPhysical(0), fCheck(false),
103  fWarnPush(true)
104 {
105  fActive= false;
106  fActionThreshold_NoZeroSteps = 1000;
107  fAbandonThreshold_NoZeroSteps = 2500;
110 
111  fpNavigatorState = 0;
112 // fSaveState = 0;
114 
115  // this->SetVerboseLevel(3);
116  // this->CheckMode(true);
117 }
G4VoxelSafety * fpVoxelSafety
G4double GetSurfaceTolerance() const
G4VPhysicalVolume * fTopPhysical
G4NavigatorState * fpNavigatorState
void SetNormalNavigation(G4NormalNavigation *fnormnav)
G4RegularNavigation fregularNav
G4NormalNavigation fnormalNav
G4double kCarTolerance
static G4GeometryTolerance * GetInstance()

Here is the call graph for this function:

G4ITNavigator2::~G4ITNavigator2 ( )
virtual

Definition at line 123 of file G4ITNavigator2.cc.

124 { delete fpVoxelSafety; }
G4VoxelSafety * fpVoxelSafety

Member Function Documentation

void G4ITNavigator2::Activate ( G4bool  flag)
inline
EVolume G4ITNavigator2::CharacteriseDaughters ( const G4LogicalVolume pLog) const
inlineprotected

Here is the caller graph for this function:

void G4ITNavigator2::CheckMode ( G4bool  mode)
inline
void G4ITNavigator2::CheckNavigatorState ( ) const

Definition at line 694 of file G4ITNavigator2.cc.

695 {
696  if(fpNavigatorState == 0)
697  {
698  G4ExceptionDescription exceptionDescription;
699  exceptionDescription << "The navigator state is NULL. ";
700  exceptionDescription << "Either NewNavigatorStateAndLocate was not called ";
701  exceptionDescription << "or the provided navigator state was already NULL.";
702 
703  G4Exception("G4ITNavigator::CheckNavigatorStateIsValid",
704  "NavigatorStateNotValid",FatalException,exceptionDescription);
705  return;
706  }
707 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
G4NavigatorState * fpNavigatorState
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Here is the call graph for this function:

G4double G4ITNavigator2::CheckNextStep ( const G4ThreeVector pGlobalPoint,
const G4ThreeVector pDirection,
const G4double  pCurrentProposedStepLength,
G4double pNewSafety 
)

Definition at line 1357 of file G4ITNavigator2.cc.

1361 {
1363  G4double step;
1364 
1365  // Save the state, for this parasitic call
1366  //
1367  //SetSavedState();
1368 // G4SaveNavigatorState savedState(fpNavigatorState);
1369  G4NavigatorState savedState(*fpNavigatorState);
1370 
1371  step = ComputeStep ( pGlobalpoint,
1372  pDirection,
1373  pCurrentProposedStepLength,
1374  pNewSafety );
1375 
1376  // If a parasitic call, then attempt to restore the key parts of the state
1377  //
1378  *fpNavigatorState = savedState;
1379  //RestoreSavedState();
1380  // NOTE: the state of the current subnavigator is NOT restored.
1381  // ***> TODO: restore subnavigator state
1382  // if( last_located) Need Position of last location
1383  // if( last_computed step) Need Endposition of last step
1384 
1385 
1386  return step;
1387 }
virtual G4double ComputeStep(const G4ThreeVector &pGlobalPoint, const G4ThreeVector &pDirection, const G4double pCurrentProposedStepLength, G4double &pNewSafety)
G4NavigatorState * fpNavigatorState
#define CheckNavigatorStateIsValid()
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

G4ThreeVector G4ITNavigator2::ComputeLocalAxis ( const G4ThreeVector pVec) const
inlineprotected

Here is the caller graph for this function:

G4ThreeVector G4ITNavigator2::ComputeLocalPoint ( const G4ThreeVector rGlobPoint) const
inlineprotected

Here is the caller graph for this function:

G4double G4ITNavigator2::ComputeSafety ( const G4ThreeVector globalpoint,
const G4double  pProposedMaxLength = DBL_MAX,
const G4bool  keepState = true 
)
virtual

Definition at line 1892 of file G4ITNavigator2.cc.

1895 {
1897  G4double newSafety = 0.0;
1898 
1899 #ifdef G4DEBUG_NAVIGATION
1900  G4int oldcoutPrec = G4cout.precision(8);
1901  if( fVerbose > 0 )
1902  {
1903  G4cout << "*** G4ITNavigator2::ComputeSafety: ***" << G4endl
1904  << " Called at point: " << pGlobalpoint << G4endl;
1905 
1906  G4VPhysicalVolume *motherPhysical = fHistory.GetTopVolume();
1907  G4cout << " Volume = " << motherPhysical->GetName()
1908  << " - Maximum length = " << pMaxLength << G4endl;
1909  if( fVerbose >= 4 )
1910  {
1911  G4cout << " ----- Upon entering Compute Safety:" << G4endl;
1912  PrintState();
1913  }
1914  }
1915 #endif
1916 
1917  G4SaveNavigatorState* savedState(0);
1918 
1919  G4double distEndpointSq = (pGlobalpoint-fStepEndPoint).mag2();
1920  G4bool stayedOnEndpoint = distEndpointSq < kCarTolerance*kCarTolerance;
1921  G4bool endpointOnSurface = fEnteredDaughter || fExitedMother;
1922 
1923  if( endpointOnSurface && stayedOnEndpoint )
1924  {
1925 #ifdef G4DEBUG_NAVIGATION
1926  if( fVerbose >= 2 )
1927  {
1928  G4cout << " G4Navigator::ComputeSafety() finds that point - "
1929  << pGlobalpoint << " - is on surface " << G4endl;
1930  if( fEnteredDaughter ) { G4cout << " entered new daughter volume"; }
1931  if( fExitedMother ) { G4cout << " and exited previous volume."; }
1932  G4cout << G4endl;
1933  G4cout << " EndPoint was = " << fStepEndPoint << G4endl;
1934  }
1935 #endif
1936  newSafety = 0.0;
1937  // return newSafety;
1938  }
1939  else // if( !(endpointOnSurface && stayedOnEndpoint) )
1940  {
1941 
1942  if (keepState)
1943  {
1944 // SetSavedState();
1945  savedState = new G4SaveNavigatorState(fpNavigatorState);
1946  }
1947 
1948  // Pseudo-relocate to this point (updates voxel information only)
1949  //
1950  LocateGlobalPointWithinVolume( pGlobalpoint );
1951  // --->> DANGER: Side effects on sub-navigator voxel information <<---
1952  // Could be replaced again by 'granular' calls to sub-navigator
1953  // locates (similar side-effects, but faster.
1954  // Solutions:
1955  // 1) Re-locate (to where?)
1956  // 2) Insure that the methods using (G4ComputeStep?)
1957  // does a relocation (if information is disturbed only ?)
1958 
1959 #ifdef G4DEBUG_NAVIGATION
1960  if( fVerbose >= 2 )
1961  {
1962  G4cout << " G4ITNavigator2::ComputeSafety() relocates-in-volume to point: "
1963  << pGlobalpoint << G4endl;
1964  }
1965 #endif
1966  G4VPhysicalVolume *motherPhysical = fHistory.GetTopVolume();
1967  G4LogicalVolume *motherLogical = motherPhysical->GetLogicalVolume();
1968  G4SmartVoxelHeader* pVoxelHeader = motherLogical->GetVoxelHeader();
1969  G4ThreeVector localPoint = ComputeLocalPoint(pGlobalpoint);
1970 
1971  if ( fHistory.GetTopVolumeType()!=kReplica )
1972  {
1973  switch(CharacteriseDaughters(motherLogical))
1974  {
1975  case kNormal:
1976  if ( pVoxelHeader )
1977  {
1978 #ifdef G4NEW_SAFETY
1979  G4double safetyTwo = fpVoxelSafety->ComputeSafety(localPoint,
1980  *motherPhysical, pMaxLength);
1981  newSafety= safetyTwo; // Faster and best available
1982 #else
1983  G4double safetyOldVoxel;
1984  LocateGlobalPointWithinVolume(pGlobalpoint);
1985  safetyOldVoxel =
1986  fvoxelNav.ComputeSafety(localPoint,fHistory,pMaxLength);
1987  newSafety= safetyOldVoxel;
1988 #endif
1989  }
1990  else
1991  {
1992  newSafety=fnormalNav.ComputeSafety(localPoint,fHistory,pMaxLength);
1993  }
1994  break;
1995  case kParameterised:
1996  if( GetDaughtersRegularStructureId(motherLogical) != 1 )
1997  {
1998  newSafety=fparamNav.ComputeSafety(localPoint,fHistory,pMaxLength);
1999  }
2000  else // Regular structure
2001  {
2002  newSafety=fregularNav.ComputeSafety(localPoint,fHistory,pMaxLength);
2003  }
2004  break;
2005  case kReplica:
2006  G4Exception("G4ITNavigator2::ComputeSafety()", "GeomNav0001",
2007  FatalException, "Not applicable for replicated volumes.");
2008  break;
2009  }
2010  }
2011  else
2012  {
2013  newSafety = freplicaNav.ComputeSafety(pGlobalpoint, localPoint,
2014  fHistory, pMaxLength);
2015  }
2016 
2017  if (keepState)
2018  {
2019  *fpNavigatorState = *savedState;
2020  delete savedState;
2021  // RestoreSavedState();
2022  // This now overwrites the values of the Safety 'sphere' (correction)
2023  }
2024 
2025  // Remember last safety origin & value
2026  //
2027  // We overwrite the Safety 'sphere' - keeping old behaviour
2028  fPreviousSftOrigin = pGlobalpoint;
2029  fPreviousSafety = newSafety;
2030  }
2031 
2032 #ifdef G4DEBUG_NAVIGATION
2033  if( fVerbose > 1 )
2034  {
2035  G4cout << " ---- Exiting ComputeSafety " << G4endl;
2036  if( fVerbose > 2 ) { PrintState(); }
2037  G4cout << " Returned value of Safety = " << newSafety << G4endl;
2038  }
2039  G4cout.precision(oldcoutPrec);
2040 #endif
2041 
2042  return newSafety;
2043 }
G4SmartVoxelHeader * GetVoxelHeader() const
G4VoxelSafety * fpVoxelSafety
G4double ComputeSafety(const G4ThreeVector &localPoint, const G4VPhysicalVolume &currentPhysical, G4double maxLength=DBL_MAX)
G4NavigatorState * fpNavigatorState
int G4int
Definition: G4Types.hh:78
G4double ComputeSafety(const G4ThreeVector &globalpoint, const G4NavigationHistory &history, const G4double pMaxLength=DBL_MAX)
G4double ComputeSafety(const G4ThreeVector &localPoint, const G4NavigationHistory &history, const G4double pProposedMaxLength=DBL_MAX)
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
#define fEnteredDaughter
virtual void LocateGlobalPointWithinVolume(const G4ThreeVector &position)
bool G4bool
Definition: G4Types.hh:79
virtual G4double ComputeSafety(const G4ThreeVector &globalpoint, const G4NavigationHistory &history, const G4double pMaxLength=DBL_MAX)
G4RegularNavigation fregularNav
G4NormalNavigation fnormalNav
G4ReplicaNavigation freplicaNav
G4double kCarTolerance
#define CheckNavigatorStateIsValid()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define fStepEndPoint
G4ParameterisedNavigation fparamNav
#define fHistory
void PrintState() const
G4LogicalVolume * GetLogicalVolume() const
G4ThreeVector ComputeLocalPoint(const G4ThreeVector &rGlobPoint) const
G4VoxelNavigation fvoxelNav
#define fPreviousSftOrigin
#define fPreviousSafety
G4int GetDaughtersRegularStructureId(const G4LogicalVolume *pLog) const
#define fExitedMother
G4double ComputeSafety(const G4ThreeVector &localPoint, const G4NavigationHistory &history, const G4double pProposedMaxLength=DBL_MAX)
#define G4endl
Definition: G4ios.hh:61
G4double ComputeSafety(const G4ThreeVector &globalPoint, const G4ThreeVector &localPoint, G4NavigationHistory &history, const G4double pProposedMaxLength=DBL_MAX)
double G4double
Definition: G4Types.hh:76
EVolume CharacteriseDaughters(const G4LogicalVolume *pLog) const

Here is the call graph for this function:

G4double G4ITNavigator2::ComputeStep ( const G4ThreeVector pGlobalPoint,
const G4ThreeVector pDirection,
const G4double  pCurrentProposedStepLength,
G4double pNewSafety 
)
virtual

Definition at line 910 of file G4ITNavigator2.cc.

914 {
916  G4ThreeVector localDirection = ComputeLocalAxis(pDirection);
917  G4double Step = kInfinity;
918  G4VPhysicalVolume *motherPhysical = fHistory.GetTopVolume();
919  G4LogicalVolume *motherLogical = motherPhysical->GetLogicalVolume();
920 
921  // All state relating to exiting normals must be reset
922  //
924  // Reset value - to erase its memory
926  // Reset - used for local exit normal
927  fGrandMotherExitNormal= G4ThreeVector( 0., 0., 0.);
928  fCalculatedExitNormal = false;
929  // Reset for new step
930 
931  static G4ThreadLocal G4int sNavCScalls=0;
932  sNavCScalls++;
933 
935 
936 #ifdef G4VERBOSE
937  if( fVerbose > 0 )
938  {
939  G4cout << "*** G4ITNavigator2::ComputeStep: ***" << G4endl;
940  G4cout << " Volume = " << motherPhysical->GetName()
941  << " - Proposed step length = " << pCurrentProposedStepLength
942  << G4endl;
943 #ifdef G4DEBUG_NAVIGATION
944  if( fVerbose >= 2 )
945  {
946  G4cout << " Called with the arguments: " << G4endl
947  << " Globalpoint = " << std::setw(25) << pGlobalpoint << G4endl
948  << " Direction = " << std::setw(25) << pDirection << G4endl;
949  if( fVerbose >= 4 )
950  {
951  G4cout << " ---- Upon entering : State" << G4endl;
952  PrintState();
953  }
954  }
955 #endif
956  }
957 #endif
958 
959  G4ThreeVector newLocalPoint = ComputeLocalPoint(pGlobalpoint);
960  if( newLocalPoint != fLastLocatedPointLocal )
961  {
962  // Check whether the relocation is within safety
963  //
964  G4ThreeVector oldLocalPoint = fLastLocatedPointLocal;
965  G4double moveLenSq = (newLocalPoint-oldLocalPoint).mag2();
966 
967  if ( moveLenSq >= kCarTolerance*kCarTolerance )
968  {
969 #ifdef G4VERBOSE
970  ComputeStepLog(pGlobalpoint, moveLenSq);
971 #endif
972  // Relocate the point within the same volume
973  //
974  LocateGlobalPointWithinVolume( pGlobalpoint );
975  fLastTriedStepComputation= true; // Ensure that this is set again !!
976  }
977  }
978  if ( fHistory.GetTopVolumeType()!=kReplica )
979  {
980  switch( CharacteriseDaughters(motherLogical) )
981  {
982  case kNormal:
983  if ( motherLogical->GetVoxelHeader() )
984  {
985  LocateGlobalPointWithinVolume(pGlobalpoint);
987  localDirection,
988  pCurrentProposedStepLength,
989  pNewSafety,
990  fHistory,
992  fExitNormal,
993  fExiting,
994  fEntering,
997 
998  }
999  else
1000  {
1001  if( motherPhysical->GetRegularStructureId() == 0 )
1002  {
1004  localDirection,
1005  pCurrentProposedStepLength,
1006  pNewSafety,
1007  fHistory,
1009  fExitNormal,
1010  fExiting,
1011  fEntering,
1014  }
1015  else // Regular (non-voxelised) structure
1016  {
1017  LocateGlobalPointAndSetup( pGlobalpoint, &pDirection, true, true );
1018  fLastTriedStepComputation= true; // Ensure that this is set again !!
1019  //
1020  // if physical process limits the step, the voxel will not be the
1021  // one given by ComputeStepSkippingEqualMaterials() and the local
1022  // point will be wrongly calculated.
1023 
1024  // There is a problem: when msc limits the step and the point is
1025  // assigned wrongly to phantom in previous step (while it is out
1026  // of the container volume). Then LocateGlobalPointAndSetup() has
1027  // reset the history topvolume to world.
1028  //
1029  if(fHistory.GetTopVolume()->GetRegularStructureId() == 0 )
1030  {
1031  G4Exception("G4ITNavigator2::ComputeStep()",
1032  "GeomNav1001", JustWarning,
1033  "Point is relocated in voxels, while it should be outside!");
1035  localDirection,
1036  pCurrentProposedStepLength,
1037  pNewSafety,
1038  fHistory,
1040  fExitNormal,
1041  fExiting,
1042  fEntering,
1045  }
1046  else
1047  {
1048  Step = fregularNav.
1049  ComputeStepSkippingEqualMaterials(fLastLocatedPointLocal,
1050  localDirection,
1051  pCurrentProposedStepLength,
1052  pNewSafety,
1053  fHistory,
1055  fExitNormal,
1056  fExiting,
1057  fEntering,
1060  motherPhysical);
1061  }
1062  }
1063  }
1064  break;
1065  case kParameterised:
1066  if( GetDaughtersRegularStructureId(motherLogical) != 1 )
1067  {
1069  localDirection,
1070  pCurrentProposedStepLength,
1071  pNewSafety,
1072  fHistory,
1074  fExitNormal,
1075  fExiting,
1076  fEntering,
1079  }
1080  else // Regular structure
1081  {
1083  localDirection,
1084  pCurrentProposedStepLength,
1085  pNewSafety,
1086  fHistory,
1088  fExitNormal,
1089  fExiting,
1090  fEntering,
1093  }
1094  break;
1095  case kReplica:
1096  G4Exception("G4ITNavigator2::ComputeStep()", "GeomNav0001",
1097  FatalException, "Not applicable for replicated volumes.");
1098  break;
1099  }
1100  }
1101  else
1102  {
1103  // In the case of a replica, it must handle the exiting
1104  // edge/corner problem by itself
1105  //
1106  G4bool exitingReplica = fExitedMother;
1107  G4bool calculatedExitNormal;
1108  Step = freplicaNav.ComputeStep(pGlobalpoint,
1109  pDirection,
1111  localDirection,
1112  pCurrentProposedStepLength,
1113  pNewSafety,
1114  fHistory,
1116  calculatedExitNormal,
1117  fExitNormal,
1118  exitingReplica,
1119  fEntering,
1122  fExiting= exitingReplica;
1123  fCalculatedExitNormal= calculatedExitNormal;
1124  }
1125 
1126 
1127 // G4cout << " !!!! Step = " << Step << G4endl;
1128 
1129  // Remember last safety origin & value.
1130  //
1131  fPreviousSftOrigin = pGlobalpoint;
1132  fPreviousSafety = pNewSafety;
1133 
1134  // Count zero steps - one can occur due to changing momentum at a boundary
1135  // - one, two (or a few) can occur at common edges between
1136  // volumes
1137  // - more than two is likely a problem in the geometry
1138  // description or the Navigation
1139 
1140  // Rule of thumb: likely at an Edge if two consecutive steps are zero,
1141  // because at least two candidate volumes must have been
1142  // checked
1143  //
1144  fLocatedOnEdge = fLastStepWasZero && (Step==0.0);
1145  fLastStepWasZero = (Step==0.0);
1146  if (fPushed) { fPushed = fLastStepWasZero; }
1147 
1148  // Handle large number of consecutive zero steps
1149  //
1150  if ( fLastStepWasZero )
1151  {
1152  fNumberZeroSteps++;
1153 #ifdef G4DEBUG_NAVIGATION
1154  if( fNumberZeroSteps > 1 )
1155  {
1156  G4cout << "G4ITNavigator2::ComputeStep(): another zero step, # "
1157  << fNumberZeroSteps
1158  << " at " << pGlobalpoint
1159  << " in volume " << motherPhysical->GetName()
1160  << " nav-comp-step calls # " << sNavCScalls
1161  << G4endl;
1162  }
1163 #endif
1164  if( fNumberZeroSteps > fActionThreshold_NoZeroSteps-1 )
1165  {
1166  // Act to recover this stuck track. Pushing it along direction
1167  //
1168  Step += 100*kCarTolerance;
1169 #ifdef G4VERBOSE
1170  if ((!fPushed) && (fWarnPush))
1171  {
1172  std::ostringstream message;
1173  message << "Track stuck or not moving." << G4endl
1174  << " Track stuck, not moving for "
1175  << fNumberZeroSteps << " steps" << G4endl
1176  << " in volume -" << motherPhysical->GetName()
1177  << "- at point " << pGlobalpoint << G4endl
1178  << " direction: " << pDirection << "." << G4endl
1179  << " Potential geometry or navigation problem !"
1180  << G4endl
1181  << " Trying pushing it of " << Step << " mm ...";
1182  G4Exception("G4ITNavigator2::ComputeStep()", "GeomNav1002",
1183  JustWarning, message, "Potential overlap in geometry!");
1184  }
1185 #endif
1186  fPushed = true;
1187  }
1188  if( fNumberZeroSteps > fAbandonThreshold_NoZeroSteps-1 )
1189  {
1190  // Must kill this stuck track
1191  //
1192  std::ostringstream message;
1193  message << "Stuck Track: potential geometry or navigation problem."
1194  << G4endl
1195  << " Track stuck, not moving for "
1196  << fNumberZeroSteps << " steps" << G4endl
1197  << " in volume -" << motherPhysical->GetName()
1198  << "- at point " << pGlobalpoint << G4endl
1199  << " direction: " << pDirection << ".";
1200  motherPhysical->CheckOverlaps(5000, false);
1201  G4Exception("G4ITNavigator2::ComputeStep()", "GeomNav0003",
1202  EventMustBeAborted, message);
1203  }
1204  }
1205  else
1206  {
1207  if (!fPushed) fNumberZeroSteps = 0;
1208  }
1209 
1210  fEnteredDaughter = fEntering; // I expect to enter a volume in this Step
1212 
1213  fStepEndPoint = pGlobalpoint
1214  + std::min(Step,pCurrentProposedStepLength) * pDirection;
1215  fLastStepEndPointLocal = fLastLocatedPointLocal + Step * localDirection;
1216 
1217  if( fExiting )
1218  {
1219 #ifdef G4DEBUG_NAVIGATION
1220  if( fVerbose > 2 )
1221  {
1222  G4cout << " At G4Nav CompStep End - if(exiting) - fExiting= " << fExiting
1223  << " fValidExitNormal = " << fValidExitNormal << G4endl;
1224  G4cout << " fExitNormal= " << fExitNormal << G4endl;
1225  }
1226 #endif
1227 
1229  {
1230  if ( fHistory.GetTopVolumeType()!=kReplica )
1231  {
1232  // Convention: fExitNormal is in the 'grand-mother' coordinate system
1233  //
1235  fCalculatedExitNormal= true;
1236  }
1237  else
1238  {
1240  }
1241  }
1242  else
1243  {
1244  // We must calculate the normal anyway (in order to have it if requested)
1245  //
1246  G4ThreeVector finalLocalPoint =
1247  fLastLocatedPointLocal + localDirection*Step;
1248 
1249  if ( fHistory.GetTopVolumeType()!=kReplica )
1250  {
1251  // Find normal in the 'mother' coordinate system
1252  //
1253  G4ThreeVector exitNormalMotherFrame=
1254  motherLogical->GetSolid()->SurfaceNormal(finalLocalPoint);
1255 
1256  // Transform it to the 'grand-mother' coordinate system
1257  //
1258  const G4RotationMatrix* mRot = motherPhysical->GetRotation();
1259  if( mRot )
1260  {
1262  fGrandMotherExitNormal = (*mRot).inverse() * exitNormalMotherFrame;
1263  }
1264  else
1265  {
1266  fGrandMotherExitNormal = exitNormalMotherFrame;
1267  }
1268 
1269  // Do not set fValidExitNormal -- this signifies
1270  // that the solid is convex!
1271  //
1272  fCalculatedExitNormal= true;
1273  }
1274  else
1275  {
1276  fCalculatedExitNormal = false;
1277  //
1278  // Nothing can be done at this stage currently - to solve this
1279  // Replica Navigation must have calculated the normal for this case
1280  // already.
1281  // Cases: mother is not convex, and exit is at previous replica level
1282 
1283 #ifdef G4DEBUG_NAVIGATION
1285 
1286  desc << "Problem in ComputeStep: Replica Navigation did not provide"
1287  << " valid exit Normal. " << G4endl;
1288  desc << " Do not know how calculate it in this case." << G4endl;
1289  desc << " Location = " << finalLocalPoint << G4endl;
1290  desc << " Volume name = " << motherPhysical->GetName()
1291  << " copy/replica No = " << motherPhysical->GetCopyNo() << G4endl;
1292  G4Exception("G4ITNavigator2::ComputeStep()", "GeomNav0003",
1293  JustWarning, desc, "Normal not available for exiting.");
1294 #endif
1295  }
1296  }
1297 
1298  // Now transform it to the global reference frame !!
1299  //
1301  {
1302  G4int depth= fHistory.GetDepth();
1303  if( depth > 0 )
1304  {
1305  G4AffineTransform GrandMotherToGlobalTransf =
1306  fHistory.GetTransform(depth-1).Inverse();
1308  GrandMotherToGlobalTransf.TransformAxis( fGrandMotherExitNormal );
1309  }
1310  else
1311  {
1313  }
1314  }
1315  else
1316  {
1317  fExitNormalGlobalFrame= G4ThreeVector( 0., 0., 0.);
1318  }
1319  }
1320 
1321  if( (Step == pCurrentProposedStepLength) && (!fExiting) && (!fEntering) )
1322  {
1323  // This if Step is not really limited by the geometry.
1324  // The Navigator is obliged to return "infinity"
1325  //
1326  Step = kInfinity;
1327  }
1328 
1329 #ifdef G4VERBOSE
1330  if( fVerbose > 1 )
1331  {
1332  if( fVerbose >= 4 )
1333  {
1334  G4cout << " ----- Upon exiting :" << G4endl;
1335  PrintState();
1336  }
1337  G4cout << " Returned step= " << Step;
1338  if( fVerbose > 5 ) G4cout << G4endl;
1339  if( Step == kInfinity )
1340  {
1341  G4cout << " Requested step= " << pCurrentProposedStepLength ;
1342  if( fVerbose > 5) G4cout << G4endl;
1343  }
1344  G4cout << " Safety = " << pNewSafety << G4endl;
1345  }
1346 #endif
1347 
1348  return Step;
1349 }
#define fBlockedPhysicalVolume
G4SmartVoxelHeader * GetVoxelHeader() const
#define fValidExitNormal
#define fLastStepEndPointLocal
G4double ComputeStep(const G4ThreeVector &globalPoint, const G4ThreeVector &globalDirection, const G4double currentProposedStepLength, G4double &newSafety, G4NavigationHistory &history, G4bool &validExitNormal, G4ThreeVector &exitNormal, G4bool &exiting, G4bool &entering, G4VPhysicalVolume *(*pBlockedPhysical), G4int &blockedReplicaNo)
static const G4double kInfinity
Definition: geomdefs.hh:42
#define fExiting
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
CLHEP::Hep3Vector G4ThreeVector
#define fLocatedOnEdge
G4VSolid * GetSolid() const
#define fLastTriedStepComputation
const G4RotationMatrix * GetRotation() const
G4double ComputeStep(const G4ThreeVector &globalPoint, const G4ThreeVector &globalDirection, const G4ThreeVector &localPoint, const G4ThreeVector &localDirection, const G4double currentProposedStepLength, G4double &newSafety, G4NavigationHistory &history, G4bool &validExitNormal, G4bool &calculatedExitNormal, G4ThreeVector &exitNormal, G4bool &exiting, G4bool &entering, G4VPhysicalVolume *(*pBlockedPhysical), G4int &blockedReplicaNo)
#define G4ThreadLocal
Definition: tls.hh:89
#define fExitNormalGlobalFrame
int G4int
Definition: G4Types.hh:78
#define fExitNormal
#define fPushed
#define fLastStepWasZero
G4ThreeVector ComputeLocalAxis(const G4ThreeVector &pVec) const
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
#define fEnteredDaughter
G4double ComputeStep(const G4ThreeVector &globalPoint, const G4ThreeVector &globalDirection, const G4double currentProposedStepLength, G4double &newSafety, G4NavigationHistory &history, G4bool &validExitNormal, G4ThreeVector &exitNormal, G4bool &exiting, G4bool &entering, G4VPhysicalVolume *(*pBlockedPhysical), G4int &blockedReplicaNo)
virtual void LocateGlobalPointWithinVolume(const G4ThreeVector &position)
#define fEntering
bool G4bool
Definition: G4Types.hh:79
virtual G4int GetRegularStructureId() const =0
virtual G4VPhysicalVolume * LocateGlobalPointAndSetup(const G4ThreeVector &point, const G4ThreeVector *direction=0, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true)
virtual G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const =0
#define fChangedGrandMotherRefFrame
G4RegularNavigation fregularNav
G4NormalNavigation fnormalNav
#define fCalculatedExitNormal
G4ReplicaNavigation freplicaNav
G4double kCarTolerance
#define CheckNavigatorStateIsValid()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define fStepEndPoint
G4ParameterisedNavigation fparamNav
#define fHistory
#define fGrandMotherExitNormal
#define fBlockedReplicaNo
void PrintState() const
G4double ComputeStep(const G4ThreeVector &localPoint, const G4ThreeVector &localDirection, const G4double currentProposedStepLength, G4double &newSafety, G4NavigationHistory &history, G4bool &validExitNormal, G4ThreeVector &exitNormal, G4bool &exiting, G4bool &entering, G4VPhysicalVolume *(*pBlockedPhysical), G4int &blockedReplicaNo)
G4LogicalVolume * GetLogicalVolume() const
G4ThreeVector ComputeLocalPoint(const G4ThreeVector &rGlobPoint) const
G4VoxelNavigation fvoxelNav
#define fPreviousSftOrigin
#define fPreviousSafety
G4ThreeVector TransformAxis(const G4ThreeVector &axis) const
virtual G4int GetCopyNo() const =0
G4int GetDaughtersRegularStructureId(const G4LogicalVolume *pLog) const
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
#define fExitedMother
#define G4endl
Definition: G4ios.hh:61
#define fLastLocatedPointLocal
double G4double
Definition: G4Types.hh:76
virtual G4double ComputeStep(const G4ThreeVector &globalPoint, const G4ThreeVector &globalDirection, const G4double currentProposedStepLength, G4double &newSafety, G4NavigationHistory &history, G4bool &validExitNormal, G4ThreeVector &exitNormal, G4bool &exiting, G4bool &entering, G4VPhysicalVolume *(*pBlockedPhysical), G4int &blockedReplicaNo)
virtual G4bool CheckOverlaps(G4int res=1000, G4double tol=0., G4bool verbose=true, G4int errMax=1)
#define fNumberZeroSteps
EVolume CharacteriseDaughters(const G4LogicalVolume *pLog) const

Here is the call graph for this function:

Here is the caller graph for this function:

G4GRSSolid* G4ITNavigator2::CreateGRSSolid ( ) const
inline
G4GRSVolume* G4ITNavigator2::CreateGRSVolume ( ) const
inline
G4TouchableHistory* G4ITNavigator2::CreateTouchableHistory ( ) const
inline

Here is the caller graph for this function:

G4TouchableHistory* G4ITNavigator2::CreateTouchableHistory ( const G4NavigationHistory ) const
inline
G4TouchableHistoryHandle G4ITNavigator2::CreateTouchableHistoryHandle ( ) const
virtual

Definition at line 2229 of file G4ITNavigator2.cc.

2230 {
2233 }
G4TouchableHistory * CreateTouchableHistory() const
G4ReferenceCountedHandle< G4TouchableHistory > G4TouchableHistoryHandle
#define CheckNavigatorStateIsValid()

Here is the call graph for this function:

void G4ITNavigator2::EnableBestSafety ( G4bool  value = false)
inline
G4bool G4ITNavigator2::EnteredDaughterVolume ( ) const
inline

Here is the caller graph for this function:

G4bool G4ITNavigator2::ExitedMotherVolume ( ) const
inline
G4ThreeVector G4ITNavigator2::GetCurrentLocalCoordinate ( ) const
inline
G4int G4ITNavigator2::GetDaughtersRegularStructureId ( const G4LogicalVolume pLog) const
inlineprotected

Here is the caller graph for this function:

G4ThreeVector G4ITNavigator2::GetGlobalExitNormal ( const G4ThreeVector point,
G4bool valid 
)
virtual

Definition at line 1739 of file G4ITNavigator2.cc.

1741 {
1743  G4bool validNormal;
1744  G4ThreeVector localNormal, globalNormal;
1745  G4bool usingStored;
1746 
1747  usingStored=
1749  ( ( fLastTriedStepComputation && fExiting) // Just calculated it
1750  || // No locate in between
1752  && (IntersectPointGlobal-fStepEndPoint).mag2()
1753  < (10.0*kCarTolerance*kCarTolerance)
1754  ) // Calculated it 'just' before & then called locate
1755  // but it did not move position
1756  );
1757 
1758  if( usingStored )
1759  {
1760  // This was computed in ComputeStep -- and only on arrival at boundary
1761  //
1762  globalNormal = fExitNormalGlobalFrame;
1763  G4double normMag2 = globalNormal.mag2();
1764  if( std::fabs ( normMag2 - 1.0 ) < perMillion ) // Value is good
1765  {
1766  *pNormalCalculated = true; // ComputeStep always computes it if Exiting
1767  // (fExiting==true)
1768  }
1769  else
1770  {
1771  G4ExceptionDescription message;
1772 
1773  message << " ERROR> Expected normal-global-frame to valid (unit vector) "
1774  << " - but |normal| = " << std::sqrt(normMag2)
1775  << " - and |normal|^ = " << normMag2
1776  << " which differs from 1.0 by " << normMag2 - 1.0 << G4endl
1777  << " n = " << fExitNormalGlobalFrame << G4endl;
1778  message << "============================================================"
1779  << G4endl;
1780  G4int oldVerbose = fVerbose;
1781  fVerbose=4;
1782  message << " State of Navigator: " << G4endl;
1783  message << *this << G4endl;
1784  fVerbose = oldVerbose;
1785  message << "============================================================"
1786  << G4endl;
1787 
1788  G4Exception("G4ITNavigator2::GetGlobalExitNormal()",
1789  "GeomNav0003",JustWarning, message,
1790  "Value obtained from stored global-normal is not a unit vector.");
1791 
1792  // (Re)Compute it now -- as either it was not computed, or it is wrong.
1793  //
1794  localNormal = GetLocalExitNormalAndCheck(IntersectPointGlobal,
1795  &validNormal);
1796  *pNormalCalculated = fCalculatedExitNormal;
1797 
1798  G4AffineTransform localToGlobal = GetLocalToGlobalTransform();
1799  globalNormal = localToGlobal.TransformAxis( localNormal );
1800  }
1801  }
1802  else
1803  {
1804  localNormal = GetLocalExitNormalAndCheck(IntersectPointGlobal,&validNormal);
1805  *pNormalCalculated = fCalculatedExitNormal;
1806 
1807 #ifdef G4DEBUG_NAVIGATION
1808  usingStored= false;
1809 
1810  if( (!validNormal) && !fCalculatedExitNormal)
1811  {
1813  edN << " Calculated = " << fCalculatedExitNormal << G4endl;
1814  edN << " Entering= " << fEntering << G4endl;
1815  G4int oldVerbose= this->GetVerboseLevel();
1816  this->SetVerboseLevel(4);
1817  edN << " State of Navigator: " << G4endl;
1818  edN << *this << G4endl;
1819  this->SetVerboseLevel( oldVerbose );
1820 
1821  G4Exception("G4ITNavigator2::GetGlobalExitNormal()",
1822  "GeomNav0003", JustWarning, edN,
1823  "LocalExitNormalAndCheck() did not calculate Normal.");
1824  }
1825 #endif
1826 
1827  G4double localMag2= localNormal.mag2();
1828  if( validNormal && (std::fabs(localMag2-1.0)) > CLHEP::perMillion )
1829  {
1831 
1832  edN << "G4ITNavigator2::GetGlobalExitNormal: "
1833  << " Using Local Normal - from call to GetLocalExitNormalAndCheck. "
1834  << G4endl
1835  << " Local Exit Normal : " << " || = " << std::sqrt(localMag2)
1836  << " vec = " << localNormal << G4endl
1837  << " Global Exit Normal : " << " || = " << globalNormal.mag()
1838  << " vec = " << globalNormal << G4endl;
1839  edN << " Calculated It = " << fCalculatedExitNormal << G4endl;
1840 
1841  G4Exception("G4ITNavigator2::GetGlobalExitNormal()",
1842  "GeomNav0003",JustWarning, edN,
1843  "Value obtained from new local *solid* is incorrect.");
1844  localNormal = localNormal.unit(); // Should we correct it ??
1845  }
1846  G4AffineTransform localToGlobal = GetLocalToGlobalTransform();
1847  globalNormal = localToGlobal.TransformAxis( localNormal );
1848  }
1849 
1850 #ifdef G4DEBUG_NAVIGATION
1851  if( usingStored )
1852  {
1853  G4ThreeVector globalNormAgn;
1854 
1855  localNormal= GetLocalExitNormalAndCheck(IntersectPointGlobal, &validNormal);
1856 
1857  G4AffineTransform localToGlobal = GetLocalToGlobalTransform();
1858  globalNormAgn = localToGlobal.TransformAxis( localNormal );
1859 
1860  // Check the value computed against fExitNormalGlobalFrame
1861  G4ThreeVector diffNorm = globalNormAgn - fExitNormalGlobalFrame;
1862  if( diffNorm.mag2() > perMillion*CLHEP::perMillion)
1863  {
1864  G4ExceptionDescription edDfn;
1865  edDfn << "Found difference in normals in case of exiting mother "
1866  << "- when Get is called after ComputingStep " << G4endl;
1867  edDfn << " Magnitude of diff = " << diffNorm.mag() << G4endl;
1868  edDfn << " Normal stored (Global) = " << fExitNormalGlobalFrame
1869  << G4endl;
1870  edDfn << " Global Computed from Local = " << globalNormAgn << G4endl;
1871  G4Exception("G4ITNavigator::GetGlobalExitNormal()", "GeomNav0003",
1872  JustWarning, edDfn);
1873  }
1874  }
1875 #endif
1876 
1877  return globalNormal;
1878 }
static constexpr double perMillion
Definition: G4SIunits.hh:334
#define fExiting
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
#define fLastTriedStepComputation
#define fExitNormalGlobalFrame
int G4int
Definition: G4Types.hh:78
#define fEntering
bool G4bool
Definition: G4Types.hh:79
#define fCalculatedExitNormal
G4double kCarTolerance
static constexpr double perMillion
#define CheckNavigatorStateIsValid()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define fStepEndPoint
Hep3Vector unit() const
G4ThreeVector TransformAxis(const G4ThreeVector &axis) const
double mag2() const
G4int GetVerboseLevel() const
#define G4endl
Definition: G4ios.hh:61
virtual G4ThreeVector GetLocalExitNormalAndCheck(const G4ThreeVector &point, G4bool *valid)
double G4double
Definition: G4Types.hh:76
void SetVerboseLevel(G4int level)
double mag() const
const G4AffineTransform GetLocalToGlobalTransform() const

Here is the call graph for this function:

const G4AffineTransform& G4ITNavigator2::GetGlobalToLocalTransform ( ) const
inline

Here is the caller graph for this function:

G4ThreeVector G4ITNavigator2::GetLocalExitNormal ( G4bool valid)
virtual

Definition at line 1494 of file G4ITNavigator2.cc.

1495 {
1497  G4ThreeVector ExitNormal(0.,0.,0.);
1498  G4VSolid *currentSolid=0;
1499  G4LogicalVolume *candidateLogical;
1501  {
1502  // use fLastLocatedPointLocal and next candidate volume
1503  //
1504  G4ThreeVector nextSolidExitNormal(0.,0.,0.);
1505 
1506  if( fEntering && (fBlockedPhysicalVolume!=0) )
1507  {
1508  candidateLogical= fBlockedPhysicalVolume->GetLogicalVolume();
1509  if( candidateLogical )
1510  {
1511  // fLastStepEndPointLocal is in the coordinates of the mother
1512  // we need it in the daughter's coordinate system.
1513 
1514  // The following code should also work in case of Replica
1515  {
1516  // First transform fLastLocatedPointLocal to the new daughter
1517  // coordinates
1518  //
1519  G4AffineTransform MotherToDaughterTransform=
1523  G4ThreeVector daughterPointOwnLocal=
1524  MotherToDaughterTransform.TransformPoint( fLastStepEndPointLocal );
1525 
1526  // OK if it is a parameterised volume
1527  //
1528  EInside inSideIt;
1529  G4bool onSurface;
1530  G4double safety= -1.0;
1531  currentSolid= candidateLogical->GetSolid();
1532  inSideIt = currentSolid->Inside(daughterPointOwnLocal);
1533  onSurface = (inSideIt == kSurface);
1534  if( ! onSurface )
1535  {
1536  if( inSideIt == kOutside )
1537  {
1538  safety = (currentSolid->DistanceToIn(daughterPointOwnLocal));
1539  onSurface = safety < 100.0 * kCarTolerance;
1540  }
1541  else if (inSideIt == kInside )
1542  {
1543  safety = (currentSolid->DistanceToOut(daughterPointOwnLocal));
1544  onSurface = safety < 100.0 * kCarTolerance;
1545  }
1546  }
1547 
1548  if( onSurface )
1549  {
1550  nextSolidExitNormal =
1551  currentSolid->SurfaceNormal(daughterPointOwnLocal);
1552 
1553  // Entering the solid ==> opposite
1554  //
1555  ExitNormal = -nextSolidExitNormal;
1556  fCalculatedExitNormal= true;
1557  }
1558  else
1559  {
1560 #ifdef G4VERBOSE
1561  if(( fVerbose == 1 ) && ( fCheck ))
1562  {
1563  std::ostringstream message;
1564  message << "Point not on surface ! " << G4endl
1565  << " Point = "
1566  << daughterPointOwnLocal << G4endl
1567  << " Physical volume = "
1568  << fBlockedPhysicalVolume->GetName() << G4endl
1569  << " Logical volume = "
1570  << candidateLogical->GetName() << G4endl
1571  << " Solid = " << currentSolid->GetName()
1572  << " Type = "
1573  << currentSolid->GetEntityType() << G4endl
1574  << *currentSolid << G4endl;
1575  if( inSideIt == kOutside )
1576  {
1577  message << "Point is Outside. " << G4endl
1578  << " Safety (from outside) = " << safety << G4endl;
1579  }
1580  else // if( inSideIt == kInside )
1581  {
1582  message << "Point is Inside. " << G4endl
1583  << " Safety (from inside) = " << safety << G4endl;
1584  }
1585  G4Exception("G4ITNavigator2::GetLocalExitNormal()", "GeomNav1001",
1586  JustWarning, message);
1587  }
1588 #endif
1589  }
1590  *valid = onSurface; // was =true;
1591  }
1592  }
1593  }
1594  else if ( fExiting )
1595  {
1596  ExitNormal = fGrandMotherExitNormal;
1597  *valid = true;
1598  fCalculatedExitNormal= true; // Should be true already
1599  }
1600  else // i.e. ( fBlockedPhysicalVolume == 0 )
1601  {
1602  *valid = false;
1603  G4Exception("G4ITNavigator2::GetLocalExitNormal()",
1604  "GeomNav0003", JustWarning,
1605  "Incorrect call to GetLocalSurfaceNormal." );
1606  }
1607  }
1608  else // ( ! fLastTriedStepComputation ) ie. last call was to Locate
1609  {
1610  if ( EnteredDaughterVolume() )
1611  {
1612  G4VSolid* daughterSolid =fHistory.GetTopVolume()->GetLogicalVolume()
1613  ->GetSolid();
1614  ExitNormal= -(daughterSolid->SurfaceNormal(fLastLocatedPointLocal));
1615  if( std::fabs(ExitNormal.mag2()-1.0 ) > CLHEP::perMillion )
1616  {
1618  desc << " Parameters of solid: " << *daughterSolid
1619  << " Point for surface = " << fLastLocatedPointLocal << std::endl;
1620  G4Exception("G4ITNavigator2::GetLocalExitNormal()",
1621  "GeomNav0003", FatalException, desc,
1622  "Surface Normal returned by Solid is not a Unit Vector." );
1623  }
1624  fCalculatedExitNormal= true;
1625  *valid = true;
1626  }
1627  else
1628  {
1629  if( fExitedMother )
1630  {
1631  ExitNormal = fGrandMotherExitNormal;
1632  *valid = true;
1633  fCalculatedExitNormal= true;
1634  }
1635  else // We are not at a boundary. ExitNormal remains (0,0,0)
1636  {
1637  *valid = false;
1638  fCalculatedExitNormal= false;
1639  G4ExceptionDescription message;
1640  message << "Function called when *NOT* at a Boundary." << G4endl;
1641  G4Exception("G4ITNavigator2::GetLocalExitNormal()",
1642  "GeomNav0003", JustWarning, message);
1643  }
1644  }
1645  }
1646  return ExitNormal;
1647 }
G4String GetName() const
#define fBlockedPhysicalVolume
#define fLastStepEndPointLocal
#define fExiting
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
G4VSolid * GetSolid() const
#define fLastTriedStepComputation
virtual G4GeometryType GetEntityType() const =0
virtual EInside Inside(const G4ThreeVector &p) const =0
#define fEntering
bool G4bool
Definition: G4Types.hh:79
virtual G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const =0
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const =0
#define fCalculatedExitNormal
EVolume VolumeType(const G4VPhysicalVolume *pVol) const
G4double kCarTolerance
static constexpr double perMillion
#define CheckNavigatorStateIsValid()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define fHistory
#define fGrandMotherExitNormal
#define fBlockedReplicaNo
G4ThreeVector TransformPoint(const G4ThreeVector &vec) const
EInside
Definition: geomdefs.hh:58
#define fExitedMother
G4bool EnteredDaughterVolume() const
#define G4endl
Definition: G4ios.hh:61
const G4String & GetName() const
#define fLastLocatedPointLocal
double G4double
Definition: G4Types.hh:76
virtual G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=0, G4ThreeVector *n=0) const =0
G4AffineTransform GetMotherToDaughterTransform(G4VPhysicalVolume *dVolume, G4int dReplicaNo, EVolume dVolumeType)

Here is the call graph for this function:

Here is the caller graph for this function:

G4ThreeVector G4ITNavigator2::GetLocalExitNormalAndCheck ( const G4ThreeVector point,
G4bool valid 
)
virtual

Definition at line 1703 of file G4ITNavigator2.cc.

1710 {
1712 #ifdef G4DEBUG_NAVIGATION
1713  // Check Current point against expected 'local' value
1714  //
1716  {
1717  G4ThreeVector ExpectedBoundaryPointLocal;
1718 
1719  const G4AffineTransform& GlobalToLocal= GetGlobalToLocalTransform();
1720  ExpectedBoundaryPointLocal =
1721  GlobalToLocal.TransformPoint( ExpectedBoundaryPointGlobal );
1722 
1723  // Add here: Comparison against expected position,
1724  // i.e. the endpoint of ComputeStep
1725  }
1726 #endif
1727 
1728  return GetLocalExitNormal( pValid);
1729 }
#define fLastTriedStepComputation
#define CheckNavigatorStateIsValid()
G4ThreeVector TransformPoint(const G4ThreeVector &vec) const
virtual G4ThreeVector GetLocalExitNormal(G4bool *valid)
const G4AffineTransform & GetGlobalToLocalTransform() const

Here is the call graph for this function:

Here is the caller graph for this function:

const G4AffineTransform G4ITNavigator2::GetLocalToGlobalTransform ( ) const
inline

Here is the caller graph for this function:

G4AffineTransform G4ITNavigator2::GetMotherToDaughterTransform ( G4VPhysicalVolume dVolume,
G4int  dReplicaNo,
EVolume  dVolumeType 
)

Definition at line 1656 of file G4ITNavigator2.cc.

1659 {
1661  switch (enteringVolumeType)
1662  {
1663  case kNormal: // Nothing is needed to prepare the transformation
1664  break; // It is stored already in the physical volume (placement)
1665  case kReplica: // Sets the transform in the Replica - tbc
1666  G4Exception("G4ITNavigator2::GetMotherToDaughterTransform()",
1667  "GeomNav0001", FatalException,
1668  "Method NOT Implemented yet for replica volumes.");
1669  break;
1670  case kParameterised:
1671  if( pEnteringPhysVol->GetRegularStructureId() == 0 )
1672  {
1673  G4VPVParameterisation *pParam =
1674  pEnteringPhysVol->GetParameterisation();
1675  G4VSolid* pSolid =
1676  pParam->ComputeSolid(enteringReplicaNo, pEnteringPhysVol);
1677  pSolid->ComputeDimensions(pParam, enteringReplicaNo, pEnteringPhysVol);
1678 
1679  // Sets the transform in the Parameterisation
1680  //
1681  pParam->ComputeTransformation(enteringReplicaNo, pEnteringPhysVol);
1682 
1683  // Set the correct solid and material in Logical Volume
1684  //
1685  G4LogicalVolume* pLogical = pEnteringPhysVol->GetLogicalVolume();
1686  pLogical->SetSolid( pSolid );
1687  }
1688  break;
1689  }
1690  return G4AffineTransform(pEnteringPhysVol->GetRotation(),
1691  pEnteringPhysVol->GetTranslation()).Invert();
1692 }
virtual void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
Definition: G4VSolid.cc:138
virtual G4VSolid * ComputeSolid(const G4int, G4VPhysicalVolume *)
void SetSolid(G4VSolid *pSolid)
#define CheckNavigatorStateIsValid()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
virtual void ComputeTransformation(const G4int, G4VPhysicalVolume *) const =0

Here is the call graph for this function:

Here is the caller graph for this function:

G4ITNavigatorState_Lock2 * G4ITNavigator2::GetNavigatorState ( )

Definition at line 709 of file G4ITNavigator2.cc.

710 {
711  return fpNavigatorState;
712 }
G4NavigatorState * fpNavigatorState
void G4ITNavigator2::GetRandomInCurrentVolume ( G4ThreeVector rndmPoint) const

Definition at line 2497 of file G4ITNavigator2.cc.

2498 {
2499  const G4AffineTransform& local2Global = GetLocalToGlobalTransform();
2500  G4VSolid* solid = fHistory.GetTopVolume()->GetLogicalVolume()->GetSolid();
2501 
2502  G4VoxelLimits voxelLimits; // Defaults to "infinite" limits.
2503  G4double vmin, vmax;
2504  G4AffineTransform dummy;
2505  std::vector<std::vector<double> > fExtend;
2506 
2507  solid->CalculateExtent(kXAxis,voxelLimits,dummy,vmin,vmax);
2508  fExtend[kXAxis][BoundingBox::kMin] = vmin;
2509  fExtend[kXAxis][BoundingBox::kMax] = vmax;
2510 
2511  solid->CalculateExtent(kYAxis,voxelLimits,dummy,vmin,vmax);
2512  fExtend[kYAxis][BoundingBox::kMin] = vmin;
2513  fExtend[kYAxis][BoundingBox::kMax] = vmax;
2514 
2515  solid->CalculateExtent(kZAxis,voxelLimits,dummy,vmin,vmax);
2516  fExtend[kZAxis][BoundingBox::kMin] = vmin;
2517  fExtend[kZAxis][BoundingBox::kMax] = vmax;
2518 
2519  G4ThreeVector rndmPos;
2520 
2521  while(1)
2522  {
2523  for(size_t i = 0 ; i < 3 ; ++i)
2524  {
2525  double min = fExtend[i][BoundingBox::kMin];
2526  double max = fExtend[i][BoundingBox::kMax];
2527  rndmPos[i] = G4UniformRand()*(max-min)+min;
2528  }
2529 
2530  if(solid->Inside(rndmPos) == kInside) break;
2531  }
2532 
2533  _rndmPoint = local2Global.TransformPoint(rndmPos);
2534 }
virtual G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const =0
#define G4UniformRand()
Definition: Randomize.hh:97
virtual EInside Inside(const G4ThreeVector &p) const =0
#define fHistory
G4ThreeVector TransformPoint(const G4ThreeVector &vec) const
T max(const T t1, const T t2)
brief Return the largest of the two arguments
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
double G4double
Definition: G4Types.hh:76
const G4AffineTransform GetLocalToGlobalTransform() const

Here is the call graph for this function:

std::shared_ptr<G4ITNavigatorState_Lock2> G4ITNavigator2::GetSnapshotOfState ( )
inline
G4int G4ITNavigator2::GetVerboseLevel ( ) const
inline

Here is the caller graph for this function:

G4VPhysicalVolume* G4ITNavigator2::GetWorldVolume ( ) const
inline
EInside G4ITNavigator2::InsideCurrentVolume ( const G4ThreeVector globalPoint) const

Definition at line 2485 of file G4ITNavigator2.cc.

2486 {
2487  const G4AffineTransform& transform = GetGlobalToLocalTransform();
2488  G4ThreeVector localPoint(transform.TransformPoint(globalPoint));
2489 
2490  G4VSolid* solid = fHistory.GetTopVolume()->GetLogicalVolume()->GetSolid();
2491 
2492  return solid->Inside(localPoint);
2493 }
#define fHistory
G4ThreeVector TransformPoint(const G4ThreeVector &vec) const
const G4AffineTransform & GetGlobalToLocalTransform() const

Here is the call graph for this function:

G4bool G4ITNavigator2::IsActive ( ) const
inline
G4bool G4ITNavigator2::IsCheckModeActive ( ) const
inline
G4VPhysicalVolume * G4ITNavigator2::LocateGlobalPointAndSetup ( const G4ThreeVector point,
const G4ThreeVector direction = 0,
const G4bool  pRelativeSearch = true,
const G4bool  ignoreDirection = true 
)
virtual

Definition at line 159 of file G4ITNavigator2.cc.

163 {
165  G4bool notKnownContained=true, noResult;
166  G4VPhysicalVolume *targetPhysical;
167  G4LogicalVolume *targetLogical;
168  G4VSolid *targetSolid=0;
169  G4ThreeVector localPoint, globalDirection;
170  EInside insideCode;
171 
172  G4bool considerDirection = (!ignoreDirection) || fLocatedOnEdge;
173 
175  fChangedGrandMotherRefFrame= false; // For local exit normal
176 
177  if( considerDirection && pGlobalDirection != 0 )
178  {
179  globalDirection=*pGlobalDirection;
180  }
181 
182 
183 #ifdef G4VERBOSE
184  if( fVerbose > 2 )
185  {
186  static int nCalls = 0;
187  G4int oldcoutPrec = G4cout.precision(8);
188  G4cout << "*** G4ITNavigator2::LocateGlobalPointAndSetup: ***" << G4endl;
189  G4cout << " Called with arguments: " << G4endl
190  << " Globalpoint = " << globalPoint << G4endl
191  << " RelativeSearch = " << relativeSearch << G4endl;
192  if( fVerbose == 4 )
193  {
194  G4cout << " ----- Upon entering:" << G4endl;
195  PrintState();
196  }
197  G4cout.precision(oldcoutPrec);
198  nCalls++;
199 // if(nCalls == 2) abort();
200  }
201 #endif
202 
203  G4int noLevelsExited=0 ;
204  G4int noLevelsEntered= 0;
205 
206  if ( !relativeSearch )
207  {
209  }
210  else
211  {
212  if ( fWasLimitedByGeometry )
213  {
214  fWasLimitedByGeometry = false;
215  fEnteredDaughter = fEntering; // Remember
216  fExitedMother = fExiting; // Remember
217  if ( fExiting )
218  {
219  noLevelsExited++; // count this first level entered too
220 
221  if ( fHistory.GetDepth() )
222  {
223  fBlockedPhysicalVolume = fHistory.GetTopVolume();
224  fBlockedReplicaNo = fHistory.GetTopReplicaNo();
225  fHistory.BackLevel();
226  }
227  else
228  {
229  fLastLocatedPointLocal = localPoint;
230  fLocatedOutsideWorld = true;
231  fBlockedPhysicalVolume = 0; // to be sure
232  fBlockedReplicaNo = -1;
233  fEntering = false; // No longer
234  fEnteredDaughter = false;
235  fExitedMother = true; // ??
236 
237  return 0; // Have exited world volume
238  }
239  // A fix for the case where a volume is "entered" at an edge
240  // and a coincident surface exists outside it.
241  // - This stops it from exiting further volumes and cycling
242  // - However ReplicaNavigator treats this case itself
243  //
244  // assert( fBlockedPhysicalVolume!=0 );
245 
246  // Expect to be on edge => on surface
247  //
249  {
250  fExiting= false;
251  // Consider effect on Exit Normal !?
252  }
253  }
254  else
255  if ( fEntering )
256  {
257  // assert( fBlockedPhysicalVolume!=0 );
258 
259  noLevelsEntered++; // count the first level entered too
260 
262  {
263  case kNormal:
265  fBlockedPhysicalVolume->GetCopyNo());
266  break;
267  case kReplica:
273  break;
274  case kParameterised:
275  if( fBlockedPhysicalVolume->GetRegularStructureId() == 0 )
276  {
277  G4VSolid *pSolid;
278  G4VPVParameterisation *pParam;
279  G4TouchableHistory parentTouchable( fHistory );
280  pParam = fBlockedPhysicalVolume->GetParameterisation();
281  pSolid = pParam->ComputeSolid(fBlockedReplicaNo,
283  pSolid->ComputeDimensions(pParam, fBlockedReplicaNo,
290  //
291  // Set the correct solid and material in Logical Volume
292  //
293  G4LogicalVolume *pLogical;
294  pLogical = fBlockedPhysicalVolume->GetLogicalVolume();
295  pLogical->SetSolid( pSolid );
296  pLogical->UpdateMaterial(pParam ->
297  ComputeMaterial(fBlockedReplicaNo,
299  &parentTouchable));
300  }
301  break;
302  }
303  fEntering = false;
305  localPoint = fHistory.GetTopTransform().TransformPoint(globalPoint);
306  notKnownContained = false;
307  }
308  }
309  else
310  {
312  fEntering = false;
313  fEnteredDaughter = false; // Full Step was not taken, did not enter
314  fExiting = false;
315  fExitedMother = false; // Full Step was not taken, did not exit
316  }
317  }
318  //
319  // Search from top of history up through geometry until
320  // containing volume found:
321  // If on
322  // o OUTSIDE - Back up level, not/no longer exiting volumes
323  // o SURFACE and EXITING - Back up level, setting new blocking no.s
324  // else
325  // o containing volume found
326  //
327 
328  while (notKnownContained)
329  {
330  if ( fHistory.GetTopVolumeType()!=kReplica )
331  {
332  targetSolid = fHistory.GetTopVolume()->GetLogicalVolume()->GetSolid();
333  localPoint = fHistory.GetTopTransform().TransformPoint(globalPoint);
334  insideCode = targetSolid->Inside(localPoint);
335 #ifdef G4VERBOSE
336  if(( fVerbose == 1 ) && ( fCheck ))
337  {
338  G4String solidResponse = "-kInside-";
339  if (insideCode == kOutside)
340  solidResponse = "-kOutside-";
341  else if (insideCode == kSurface)
342  solidResponse = "-kSurface-";
343  G4cout << "*** G4ITNavigator2::LocateGlobalPointAndSetup(): ***" << G4endl
344  << " Invoked Inside() for solid: " << targetSolid->GetName()
345  << ". Solid replied: " << solidResponse << G4endl
346  << " For local point p: " << localPoint << G4endl;
347  }
348 #endif
349  }
350  else
351  {
352  insideCode = freplicaNav.BackLocate(fHistory, globalPoint, localPoint,
353  fExiting, notKnownContained);
354  // !CARE! if notKnownContained returns false then the point is within
355  // the containing placement volume of the replica(s). If insidecode
356  // will result in the history being backed up one level, then the
357  // local point returned is the point in the system of this new level
358  }
359 
360 
361  if ( insideCode==kOutside )
362  {
363  noLevelsExited++;
364  if ( fHistory.GetDepth() )
365  {
366  fBlockedPhysicalVolume = fHistory.GetTopVolume();
367  fBlockedReplicaNo = fHistory.GetTopReplicaNo();
368  fHistory.BackLevel();
369  fExiting = false;
370 
371  if( noLevelsExited > 1 )
372  {
373  // The first transformation was done by the sub-navigator
374  //
375  const G4RotationMatrix* mRot = fBlockedPhysicalVolume->GetRotation();
376  if( mRot )
377  {
378  fGrandMotherExitNormal *= (*mRot).inverse();
380  }
381  }
382  }
383  else
384  {
385  fLastLocatedPointLocal = localPoint;
386  fLocatedOutsideWorld = true;
387  // No extra transformation for ExitNormal - is in frame of Top Volume
388  return 0; // Have exited world volume
389  }
390  }
391  else
392  if ( insideCode==kSurface )
393  {
394  G4bool isExiting = fExiting;
395  if( (!fExiting)&&considerDirection )
396  {
397  // Figure out whether we are exiting this level's volume
398  // by using the direction
399  //
400  G4bool directionExiting = false;
401  G4ThreeVector localDirection =
402  fHistory.GetTopTransform().TransformAxis(globalDirection);
403 
404  // Make sure localPoint in correct reference frame
405  // ( Was it already correct ? How ? )
406  //
407  localPoint= fHistory.GetTopTransform().TransformPoint(globalPoint);
408  if ( fHistory.GetTopVolumeType()!=kReplica )
409  {
410  G4ThreeVector normal = targetSolid->SurfaceNormal(localPoint);
411  directionExiting = normal.dot(localDirection) > 0.0;
412  isExiting = isExiting || directionExiting;
413  }
414  }
415  if( isExiting )
416  {
417  noLevelsExited++;
418  if ( fHistory.GetDepth() )
419  {
420  fBlockedPhysicalVolume = fHistory.GetTopVolume();
421  fBlockedReplicaNo = fHistory.GetTopReplicaNo();
422  fHistory.BackLevel();
423  //
424  // Still on surface but exited volume not necessarily convex
425  //
426  fValidExitNormal = false;
427 
428  if( noLevelsExited > 1 )
429  {
430  // The first transformation was done by the sub-navigator
431  //
432  const G4RotationMatrix* mRot =
433  fBlockedPhysicalVolume->GetRotation();
434  if( mRot )
435  {
436  fGrandMotherExitNormal *= (*mRot).inverse();
438  }
439  }
440  }
441  else
442  {
443  fLastLocatedPointLocal = localPoint;
444  fLocatedOutsideWorld = true;
445  // No extra transformation for ExitNormal, is in frame of Top Vol
446  return 0; // Have exited world volume
447  }
448  }
449  else
450  {
451  notKnownContained=false;
452  }
453  }
454  else
455  {
456  notKnownContained=false;
457  }
458  } // END while (notKnownContained)
459  //
460  // Search downwards until deepest containing volume found,
461  // blocking fBlockedPhysicalVolume/BlockedReplicaNum
462  //
463  // 3 Cases:
464  //
465  // o Parameterised daughters
466  // =>Must be one G4PVParameterised daughter & voxels
467  // o Positioned daughters & voxels
468  // o Positioned daughters & no voxels
469 
470  noResult = true; // noResult should be renamed to
471  // something like enteredLevel, as that is its meaning.
472  do
473  {
474  // Determine `type' of current mother volume
475  //
476  targetPhysical = fHistory.GetTopVolume();
477  if (!targetPhysical) { break; }
478  targetLogical = targetPhysical->GetLogicalVolume();
479  switch( CharacteriseDaughters(targetLogical) )
480  {
481  case kNormal:
482  if ( targetLogical->GetVoxelHeader() ) // use optimised navigation
483  {
484  noResult = fvoxelNav.LevelLocate(fHistory,
487  globalPoint,
488  pGlobalDirection,
489  considerDirection,
490  localPoint);
491  }
492  else // do not use optimised navigation
493  {
494  noResult = fnormalNav.LevelLocate(fHistory,
497  globalPoint,
498  pGlobalDirection,
499  considerDirection,
500  localPoint);
501  }
502  break;
503  case kReplica:
504  noResult = freplicaNav.LevelLocate(fHistory,
507  globalPoint,
508  pGlobalDirection,
509  considerDirection,
510  localPoint);
511  break;
512  case kParameterised:
513  if( GetDaughtersRegularStructureId(targetLogical) != 1 )
514  {
515  noResult = fparamNav.LevelLocate(fHistory,
518  globalPoint,
519  pGlobalDirection,
520  considerDirection,
521  localPoint);
522  }
523  else // Regular structure
524  {
525  noResult = fregularNav.LevelLocate(fHistory,
528  globalPoint,
529  pGlobalDirection,
530  considerDirection,
531  localPoint);
532  }
533  break;
534  }
535 
536  // LevelLocate returns true if it finds a daughter volume
537  // in which globalPoint is inside (or on the surface).
538 
539  if ( noResult )
540  {
541  noLevelsEntered++;
542 
543  // Entering a daughter after ascending
544  //
545  // The blocked volume is no longer valid - it was for another level
546  //
548  fBlockedReplicaNo = -1;
549 
550  // fEntering should be false -- else blockedVolume is assumed good.
551  // fEnteredDaughter is used for ExitNormal
552  //
553  fEntering = false;
554  fEnteredDaughter = true;
555 
556  if( fExitedMother )
557  {
558  G4VPhysicalVolume* enteredPhysical = fHistory.GetTopVolume();
559  const G4RotationMatrix* mRot = enteredPhysical->GetRotation();
560  if( mRot )
561  {
562  // Go deeper, i.e. move 'down' in the hierarchy
563  // Apply direct rotation, not inverse
564  //
565  fGrandMotherExitNormal *= (*mRot);
567  }
568  }
569 
570 #ifdef G4DEBUG_NAVIGATION
571  if( fVerbose > 2 )
572  {
573  G4VPhysicalVolume* enteredPhysical = fHistory.GetTopVolume();
574  G4cout << "*** G4ITNavigator2::LocateGlobalPointAndSetup() ***" << G4endl;
575  G4cout << " Entering volume: " << enteredPhysical->GetName()
576  << G4endl;
577  }
578 #endif
579  }
580  } while (noResult);
581 
582  fLastLocatedPointLocal = localPoint;
583 
584 #ifdef G4VERBOSE
585  if( fVerbose >= 4 )
586  {
587  G4int oldcoutPrec = G4cout.precision(8);
588  G4String curPhysVol_Name("None");
589  if (targetPhysical) { curPhysVol_Name = targetPhysical->GetName(); }
590  G4cout << " Return value = new volume = " << curPhysVol_Name << G4endl;
591  G4cout << " ----- Upon exiting:" << G4endl;
592  PrintState();
593  if( fVerbose >= 5 )
594  {
595  G4cout << "Upon exiting LocateGlobalPointAndSetup():" << G4endl;
596  G4cout << " History = " << G4endl << fHistory << G4endl << G4endl;
597  }
598  G4cout.precision(oldcoutPrec);
599  }
600 #endif
601 
602  fLocatedOutsideWorld= false;
603 
604  return targetPhysical;
605 }
G4String GetName() const
#define fBlockedPhysicalVolume
G4SmartVoxelHeader * GetVoxelHeader() const
#define fValidExitNormal
virtual G4bool LevelLocate(G4NavigationHistory &history, const G4VPhysicalVolume *blockedVol, const G4int blockedNum, const G4ThreeVector &globalPoint, const G4ThreeVector *globalDirection, const G4bool pLocatedOnEdge, G4ThreeVector &localPoint)
#define fExiting
void UpdateMaterial(G4Material *pMaterial)
#define fLocatedOnEdge
double dot(const Hep3Vector &) const
virtual void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
Definition: G4VSolid.cc:138
virtual G4VSolid * ComputeSolid(const G4int, G4VPhysicalVolume *)
void ResetStackAndState()
#define fLastTriedStepComputation
void SetSolid(G4VSolid *pSolid)
const G4RotationMatrix * GetRotation() const
#define fWasLimitedByGeometry
G4bool LevelLocate(G4NavigationHistory &history, const G4VPhysicalVolume *blockedVol, const G4int blockedNum, const G4ThreeVector &globalPoint, const G4ThreeVector *globalDirection, const G4bool pLocatedOnEdge, G4ThreeVector &localPoint)
void ComputeTransformation(const G4int replicaNo, G4VPhysicalVolume *pVol, G4ThreeVector &point) const
int G4int
Definition: G4Types.hh:78
static double normal(HepRandomEngine *eptr)
Definition: RandPoisson.cc:77
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
virtual EInside Inside(const G4ThreeVector &p) const =0
#define fEnteredDaughter
#define fEntering
bool G4bool
Definition: G4Types.hh:79
virtual G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const =0
#define fChangedGrandMotherRefFrame
G4RegularNavigation fregularNav
G4NormalNavigation fnormalNav
G4bool LevelLocate(G4NavigationHistory &history, const G4VPhysicalVolume *blockedVol, const G4int blockedNum, const G4ThreeVector &globalPoint, const G4ThreeVector *globalDirection, const G4bool pLocatedOnEdge, G4ThreeVector &localPoint)
EVolume VolumeType(const G4VPhysicalVolume *pVol) const
G4ReplicaNavigation freplicaNav
#define CheckNavigatorStateIsValid()
G4ParameterisedNavigation fparamNav
#define fHistory
#define fGrandMotherExitNormal
#define fBlockedReplicaNo
void PrintState() const
G4LogicalVolume * GetLogicalVolume() const
G4VoxelNavigation fvoxelNav
EInside
Definition: geomdefs.hh:58
virtual void ComputeTransformation(const G4int, G4VPhysicalVolume *) const =0
G4int GetDaughtersRegularStructureId(const G4LogicalVolume *pLog) const
#define fExitedMother
#define G4endl
Definition: G4ios.hh:61
#define fLocatedOutsideWorld
G4bool LevelLocate(G4NavigationHistory &history, const G4VPhysicalVolume *blockedVol, const G4int blockedNum, const G4ThreeVector &globalPoint, const G4ThreeVector *globalDirection, const G4bool pLocatedOnEdge, G4ThreeVector &localPoint)
#define fLastLocatedPointLocal
G4bool LevelLocate(G4NavigationHistory &history, const G4VPhysicalVolume *blockedVol, const G4int blockedNum, const G4ThreeVector &globalPoint, const G4ThreeVector *globalDirection, const G4bool pLocatedOnEdge, G4ThreeVector &localPoint)
EInside BackLocate(G4NavigationHistory &history, const G4ThreeVector &globalPoint, G4ThreeVector &localPoint, const G4bool &exiting, G4bool &notKnownInside) const
EVolume CharacteriseDaughters(const G4LogicalVolume *pLog) const

Here is the call graph for this function:

Here is the caller graph for this function:

void G4ITNavigator2::LocateGlobalPointAndUpdateTouchable ( const G4ThreeVector position,
const G4ThreeVector direction,
G4VTouchable touchableToUpdate,
const G4bool  RelativeSearch = true 
)
inline
void G4ITNavigator2::LocateGlobalPointAndUpdateTouchable ( const G4ThreeVector position,
G4VTouchable touchableToUpdate,
const G4bool  RelativeSearch = true 
)
inline
void G4ITNavigator2::LocateGlobalPointAndUpdateTouchableHandle ( const G4ThreeVector position,
const G4ThreeVector direction,
G4TouchableHandle oldTouchableToUpdate,
const G4bool  RelativeSearch = true 
)
inline
void G4ITNavigator2::LocateGlobalPointWithinVolume ( const G4ThreeVector position)
virtual

Definition at line 621 of file G4ITNavigator2.cc.

622 {
624 
625 #ifdef G4DEBUG_NAVIGATION
626  // Check: Either step was not limited by a boundary
627  // or else the full step is no longer being taken
628  assert( !fWasLimitedByGeometry );
629 #endif
630 
633  fChangedGrandMotherRefFrame= false; // Frame for Exit Normal
634 
635 #ifdef G4DEBUG_NAVIGATION
636  if( fVerbose > 2 )
637  {
638  G4cout << "Entering LocateGlobalWithinVolume(): History = " << G4endl;
639  G4cout << fHistory << G4endl;
640  }
641 #endif
642 
643  // For the case of Voxel (or Parameterised) volume the respective
644  // Navigator must be messaged to update its voxel information etc
645 
646  // Update the state of the Sub Navigators
647  // - in particular any voxel information they store/cache
648  //
649  G4VPhysicalVolume* motherPhysical = fHistory.GetTopVolume();
650  G4LogicalVolume* motherLogical = motherPhysical->GetLogicalVolume();
651  G4SmartVoxelHeader* pVoxelHeader = motherLogical->GetVoxelHeader();
652 
653  if ( fHistory.GetTopVolumeType()!=kReplica )
654  {
655  switch( CharacteriseDaughters(motherLogical) )
656  {
657  case kNormal:
658  if ( pVoxelHeader )
659  {
661  }
662  break;
663  case kParameterised:
664  if( GetDaughtersRegularStructureId(motherLogical) != 1 )
665  {
666  // Resets state & returns voxel node
667  //
669  }
670  break;
671  case kReplica:
672  G4Exception("G4ITNavigator2::LocateGlobalPointWithinVolume()",
673  "GeomNav0001", FatalException,
674  "Not applicable for replicated volumes.");
675  break;
676  }
677  }
678 
679  // Reset the state variables
680  // - which would have been affected
681  // by the 'equivalent' call to LocateGlobalPointAndSetup
682  // - who's values have been invalidated by the 'move'.
683  //
685  fBlockedReplicaNo = -1;
686  fEntering = false;
687  fEnteredDaughter = false; // Boundary not encountered, did not enter
688  fExiting = false;
689  fExitedMother = false; // Boundary not encountered, did not exit
690 }
#define fBlockedPhysicalVolume
G4SmartVoxelHeader * GetVoxelHeader() const
#define fExiting
#define fLastTriedStepComputation
G4SmartVoxelNode * ParamVoxelLocate(G4SmartVoxelHeader *pHead, const G4ThreeVector &localPoint)
#define fWasLimitedByGeometry
G4GLOB_DLL std::ostream G4cout
#define fEnteredDaughter
#define fEntering
#define fChangedGrandMotherRefFrame
#define CheckNavigatorStateIsValid()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4ParameterisedNavigation fparamNav
#define fHistory
#define fBlockedReplicaNo
G4LogicalVolume * GetLogicalVolume() const
G4ThreeVector ComputeLocalPoint(const G4ThreeVector &rGlobPoint) const
G4VoxelNavigation fvoxelNav
G4int GetDaughtersRegularStructureId(const G4LogicalVolume *pLog) const
G4SmartVoxelNode * VoxelLocate(G4SmartVoxelHeader *pHead, const G4ThreeVector &localPoint)
#define fExitedMother
#define G4endl
Definition: G4ios.hh:61
#define fLastLocatedPointLocal
EVolume CharacteriseDaughters(const G4LogicalVolume *pLog) const

Here is the call graph for this function:

Here is the caller graph for this function:

G4RotationMatrix G4ITNavigator2::NetRotation ( ) const
inline
G4ThreeVector G4ITNavigator2::NetTranslation ( ) const
inline
void G4ITNavigator2::NewNavigatorState ( )

Definition at line 727 of file G4ITNavigator2.cc.

728 {
729  fpNavigatorState = new G4NavigatorState();
730  if(fTopPhysical == 0)
731  {
732  G4ExceptionDescription exceptionDescription;
733  exceptionDescription << "No World Volume";
734 
735  G4Exception("G4ITNavigator::NewNavigatorState",
736  "NoWorldVolume",FatalException,exceptionDescription);
737  return;
738  }
739 
740  fHistory.SetFirstEntry(fTopPhysical );
741  SetupHierarchy();
742 }
virtual void SetupHierarchy()
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
G4VPhysicalVolume * fTopPhysical
G4NavigatorState * fpNavigatorState
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define fHistory

Here is the call graph for this function:

void G4ITNavigator2::NewNavigatorState ( const G4TouchableHistory h)

Definition at line 744 of file G4ITNavigator2.cc.

745 {
746  fpNavigatorState = new G4NavigatorState();
747  if(fTopPhysical == 0)
748  {
749  G4ExceptionDescription exceptionDescription;
750  exceptionDescription << "No World Volume";
751 
752  G4Exception("G4ITNavigator::NewNavigatorState",
753  "NoWorldVolume",FatalException,exceptionDescription);
754  return;
755  }
756 
757  fHistory = *h.GetHistory();
758  fLastTriedStepComputation= false; // Redundant, but best
759  SetupHierarchy();
760 }
virtual void SetupHierarchy()
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
G4VPhysicalVolume * fTopPhysical
#define fLastTriedStepComputation
G4NavigatorState * fpNavigatorState
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define fHistory
const G4NavigationHistory * GetHistory() const

Here is the call graph for this function:

G4VPhysicalVolume * G4ITNavigator2::NewNavigatorStateAndLocate ( const G4ThreeVector p,
const G4ThreeVector direction 
)

Definition at line 762 of file G4ITNavigator2.cc.

764 {
765  fpNavigatorState = new G4NavigatorState();
766 
767  if(fTopPhysical == 0)
768  {
769  G4ExceptionDescription exceptionDescription;
770  exceptionDescription << "No World Volume";
771 
772  G4Exception("G4ITNavigator::NewNavigatorStateAndLocate",
773  "NoWorldVolume",FatalException,exceptionDescription);
774  return 0;
775  }
776 
777  fHistory.SetFirstEntry(fTopPhysical );
778  SetupHierarchy();
779  return LocateGlobalPointAndSetup(p, &direction, false, false);
780 }
virtual void SetupHierarchy()
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
G4VPhysicalVolume * fTopPhysical
G4NavigatorState * fpNavigatorState
virtual G4VPhysicalVolume * LocateGlobalPointAndSetup(const G4ThreeVector &point, const G4ThreeVector *direction=0, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define fHistory

Here is the call graph for this function:

void G4ITNavigator2::PrintState ( ) const

Definition at line 2239 of file G4ITNavigator2.cc.

2240 {
2242  G4int oldcoutPrec = G4cout.precision(4);
2243  if( fVerbose >= 4 )
2244  {
2245  G4cout << "The current state of G4Navigator is: " << G4endl;
2246  G4cout << " ValidExitNormal= " << fValidExitNormal // << G4endl
2247  << " ExitNormal = " << fExitNormal // << G4endl
2248  << " Exiting = " << fExiting // << G4endl
2249  << " Entering = " << fEntering // << G4endl
2250  << " BlockedPhysicalVolume= " ;
2251  if (fBlockedPhysicalVolume==0)
2252  G4cout << "None";
2253  else
2254  G4cout << fBlockedPhysicalVolume->GetName();
2255  G4cout << G4endl
2256  << " BlockedReplicaNo = " << fBlockedReplicaNo // << G4endl
2257  << " LastStepWasZero = " << fLastStepWasZero // << G4endl
2258  << G4endl;
2259  }
2260  if( ( 1 < fVerbose) && (fVerbose < 4) )
2261  {
2262  G4cout << G4endl; // Make sure to line up
2263  G4cout << std::setw(30) << " ExitNormal " << " "
2264  << std::setw( 5) << " Valid " << " "
2265  << std::setw( 9) << " Exiting " << " "
2266  << std::setw( 9) << " Entering" << " "
2267  << std::setw(15) << " Blocked:Volume " << " "
2268  << std::setw( 9) << " ReplicaNo" << " "
2269  << std::setw( 8) << " LastStepZero " << " "
2270  << G4endl;
2271  G4cout << "( " << std::setw(7) << fExitNormal.x()
2272  << ", " << std::setw(7) << fExitNormal.y()
2273  << ", " << std::setw(7) << fExitNormal.z() << " ) "
2274  << std::setw( 5) << fValidExitNormal << " "
2275  << std::setw( 9) << fExiting << " "
2276  << std::setw( 9) << fEntering << " ";
2277  if ( fBlockedPhysicalVolume==0 )
2278  {
2279  G4cout << std::setw(15) << "None";
2280  }
2281  else
2282  {
2283  G4cout << std::setw(15)<< fBlockedPhysicalVolume->GetName();
2284  }
2285  G4cout << std::setw( 9) << fBlockedReplicaNo << " "
2286  << std::setw( 8) << fLastStepWasZero << " "
2287  << G4endl;
2288  }
2289  if( fVerbose > 2 )
2290  {
2291  G4cout.precision(8);
2292  G4cout << " Current Localpoint = " << fLastLocatedPointLocal << G4endl;
2293  G4cout << " PreviousSftOrigin = " << fPreviousSftOrigin << G4endl;
2294  G4cout << " PreviousSafety = " << fPreviousSafety << G4endl;
2295  }
2296  G4cout.precision(oldcoutPrec);
2297 }
#define fBlockedPhysicalVolume
#define fValidExitNormal
#define fExiting
int G4int
Definition: G4Types.hh:78
#define fExitNormal
#define fLastStepWasZero
G4GLOB_DLL std::ostream G4cout
#define fEntering
#define CheckNavigatorStateIsValid()
#define fBlockedReplicaNo
#define fPreviousSftOrigin
#define fPreviousSafety
#define G4endl
Definition: G4ios.hh:61
#define fLastLocatedPointLocal

Here is the caller graph for this function:

G4bool G4ITNavigator2::RecheckDistanceToCurrentBoundary ( const G4ThreeVector pGlobalPoint,
const G4ThreeVector pDirection,
const G4double  CurrentProposedStepLength,
G4double prDistance,
G4double prNewSafety = 0 
) const
virtual

Definition at line 2063 of file G4ITNavigator2.cc.

2069 {
2070  G4ThreeVector localPosition = ComputeLocalPoint(aDisplacedGlobalPoint);
2071  G4ThreeVector localDirection = ComputeLocalAxis(aNewDirection);
2072  // G4double Step = kInfinity;
2073 
2074  G4bool validExitNormal;
2075  G4ThreeVector exitNormal;
2076  // Check against mother solid
2077  G4VPhysicalVolume *motherPhysical = fHistory.GetTopVolume();
2078  G4LogicalVolume *motherLogical = motherPhysical->GetLogicalVolume();
2079 
2080 #ifdef CHECK_ORDER_OF_METHODS
2082  {
2083  G4Exception("G4Navigator::RecheckDistanceToCurrentBoundary()",
2084  "GeomNav0001", FatalException,
2085  "Method must be called after ComputeStep(), before call to LocateMethod.");
2086  }
2087 #endif
2088 
2089  EInside locatedDaug; // = kUndefined;
2090  G4double daughterStep= DBL_MAX;
2091  G4double daughterSafety= DBL_MAX;
2092 
2093  if( fEnteredDaughter )
2094  {
2095  if( motherLogical->CharacteriseDaughters() ==kReplica ) { return false; }
2096 
2097  // Track arrived at boundary of a daughter volume at
2098  // the last call of ComputeStep().
2099  // In case the proposed displaced point is inside this daughter,
2100  // it must backtrack at least to the entry point.
2101  // NOTE: No check is made against other daughter volumes. It is
2102  // assumed that the proposed displacement is small enough that
2103  // this is not needed.
2104 
2105  // Must check boundary of current daughter
2106  //
2107  G4VPhysicalVolume *candPhysical= fBlockedPhysicalVolume;
2108  G4LogicalVolume *candLogical= candPhysical->GetLogicalVolume();
2109  G4VSolid *candSolid= candLogical->GetSolid();
2110 
2111  G4AffineTransform nextLevelTrf(candPhysical->GetRotation(),
2112  candPhysical->GetTranslation());
2113 
2114  G4ThreeVector dgPosition= nextLevelTrf.TransformPoint(localPosition);
2115  G4ThreeVector dgDirection= nextLevelTrf.TransformAxis(localDirection);
2116  locatedDaug = candSolid->Inside(dgPosition);
2117 
2118  if( locatedDaug == kInside )
2119  {
2120  // Reverse direction - and find first exit. ( Is it valid?)
2121  // Must backtrack
2122  G4double distanceBackOut =
2123  candSolid->DistanceToOut(dgPosition,
2124  - dgDirection, // Reverse direction
2125  true, &validExitNormal, &exitNormal);
2126  daughterStep= - distanceBackOut;
2127  // No check is made whether the particle could have arrived at
2128  // at this location without encountering another volume or
2129  // a different psurface of the current volume
2130  if( prNewSafety )
2131  {
2132  daughterSafety= candSolid->DistanceToOut(dgPosition);
2133  }
2134  }
2135  else
2136  {
2137  if( locatedDaug == kOutside )
2138  {
2139  // See whether it still intersects it
2140  //
2141  daughterStep= candSolid->DistanceToIn(dgPosition,
2142  dgDirection);
2143  if( prNewSafety )
2144  {
2145  daughterSafety= candSolid->DistanceToIn(dgPosition);
2146  }
2147  }
2148  else
2149  {
2150  // The point remains on the surface of candidate solid
2151  //
2152  daughterStep= 0.0;
2153  daughterSafety= 0.0;
2154  }
2155  }
2156 
2157  // If trial point is in daughter (or on its surface) we have the
2158  // answer, the rest is not relevant
2159  //
2160  if( locatedDaug != kOutside )
2161  {
2162  *prDistance= daughterStep;
2163  if( prNewSafety ) { *prNewSafety= daughterSafety; }
2164  return true;
2165  }
2166  // If ever extended, so that some type of mother cut daughter,
2167  // this would change
2168  }
2169 
2170  G4VSolid *motherSolid= motherLogical->GetSolid();
2171 
2172  G4double motherStep= DBL_MAX, motherSafety= DBL_MAX;
2173 
2174  // Check distance to boundary of mother
2175  //
2176  if ( fHistory.GetTopVolumeType()!=kReplica )
2177  {
2178  EInside locatedMoth = motherSolid->Inside(localPosition);
2179 
2180  if( locatedMoth == kInside )
2181  {
2182  motherSafety= motherSolid->DistanceToOut(localPosition);
2183  if( ProposedMove >= motherSafety )
2184  {
2185  motherStep= motherSolid->DistanceToOut(localPosition,
2186  localDirection,
2187  true, &validExitNormal, &exitNormal);
2188  }
2189  else
2190  {
2191  motherStep= ProposedMove;
2192  }
2193  }
2194  else if( locatedMoth == kOutside)
2195  {
2196  motherSafety= motherSolid->DistanceToIn(localPosition);
2197  if( ProposedMove >= motherSafety )
2198  {
2199  motherStep= - motherSolid->DistanceToIn(localPosition,
2200  -localDirection);
2201  }
2202  }
2203  else
2204  {
2205  motherSafety= 0.0;
2206  *prDistance= 0.0; // On surface - no move // motherStep;
2207  if( prNewSafety ) { *prNewSafety= motherSafety; }
2208  return false;
2209  }
2210  }
2211  else
2212  {
2213  return false;
2214  }
2215 
2216  *prDistance= std::min( motherStep, daughterStep );
2217  if( prNewSafety )
2218  {
2219  *prNewSafety= std::min( motherSafety, daughterSafety );
2220  }
2221  return true;
2222 }
#define fBlockedPhysicalVolume
G4VSolid * GetSolid() const
#define fLastTriedStepComputation
const G4RotationMatrix * GetRotation() const
G4ThreeVector ComputeLocalAxis(const G4ThreeVector &pVec) const
virtual EInside Inside(const G4ThreeVector &p) const =0
#define fEnteredDaughter
bool G4bool
Definition: G4Types.hh:79
EVolume CharacteriseDaughters() const
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const =0
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
const G4ThreeVector & GetTranslation() const
#define fHistory
G4LogicalVolume * GetLogicalVolume() const
G4ThreeVector ComputeLocalPoint(const G4ThreeVector &rGlobPoint) const
EInside
Definition: geomdefs.hh:58
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
double G4double
Definition: G4Types.hh:76
virtual G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=0, G4ThreeVector *n=0) const =0
#define DBL_MAX
Definition: templates.hh:83

Here is the call graph for this function:

void G4ITNavigator2::ResetFromSnapshot ( std::shared_ptr< G4ITNavigatorState_Lock2 )
inline
G4VPhysicalVolume * G4ITNavigator2::ResetHierarchyAndLocate ( const G4ThreeVector point,
const G4ThreeVector direction,
const G4TouchableHistory h 
)
virtual

Definition at line 131 of file G4ITNavigator2.cc.

134 {
135 // ResetState();
136  fHistory = *h.GetHistory();
137  SetupHierarchy();
138  fLastTriedStepComputation= false; // Redundant, but best
139  return LocateGlobalPointAndSetup(p, &direction, true, false);
140 }
virtual void SetupHierarchy()
const char * p
Definition: xmltok.h:285
#define fLastTriedStepComputation
virtual G4VPhysicalVolume * LocateGlobalPointAndSetup(const G4ThreeVector &point, const G4ThreeVector *direction=0, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true)
#define fHistory
const G4NavigationHistory * GetHistory() const

Here is the call graph for this function:

void G4ITNavigator2::ResetNavigatorState ( )

Definition at line 722 of file G4ITNavigator2.cc.

723 {
724  fpNavigatorState = 0;
725 }
G4NavigatorState * fpNavigatorState
void G4ITNavigator2::ResetStackAndState ( )
inline

Here is the caller graph for this function:

void G4ITNavigator2::ResetState ( )
protectedvirtual

Definition at line 1395 of file G4ITNavigator2.cc.

1396 {
1397  fWasLimitedByGeometry = false;
1398  fEntering = false;
1399  fExiting = false;
1400  fLocatedOnEdge = false;
1401  fLastStepWasZero = false;
1402  fEnteredDaughter = false;
1403  fExitedMother = false;
1404  fPushed = false;
1405 
1406  fValidExitNormal = false;
1408  fCalculatedExitNormal = false;
1409 
1410  fExitNormal = G4ThreeVector(0,0,0);
1413 
1415  fPreviousSafety = 0.0;
1416 
1417  fNumberZeroSteps = 0;
1418 
1420  fBlockedReplicaNo = -1;
1421 
1423  fLocatedOutsideWorld = false;
1424 }
#define fBlockedPhysicalVolume
#define fValidExitNormal
static const G4double kInfinity
Definition: geomdefs.hh:42
#define fExiting
CLHEP::Hep3Vector G4ThreeVector
#define fLocatedOnEdge
#define fWasLimitedByGeometry
#define fExitNormalGlobalFrame
#define fExitNormal
#define fPushed
#define fLastStepWasZero
#define fEnteredDaughter
#define fEntering
#define fChangedGrandMotherRefFrame
#define fCalculatedExitNormal
#define fGrandMotherExitNormal
#define fBlockedReplicaNo
#define fPreviousSftOrigin
#define fPreviousSafety
#define fExitedMother
#define fLocatedOutsideWorld
#define fLastLocatedPointLocal
#define fNumberZeroSteps
void G4ITNavigator2::SetGeometricallyLimitedStep ( )
inline
void G4ITNavigator2::SetNavigatorState ( G4ITNavigatorState_Lock2 navState)

Definition at line 714 of file G4ITNavigator2.cc.

715 {
716  fpNavigatorState = (G4NavigatorState*) navState;
717  if(fpNavigatorState) SetupHierarchy(); // ?
718 // fpSaveState = (G4SaveNavigatorState*) navState;
719 // if(navState) RestoreSavedState();
720 }
virtual void SetupHierarchy()
G4NavigatorState * fpNavigatorState

Here is the call graph for this function:

void G4ITNavigator2::SetPushVerbosity ( G4bool  mode)
inline
void G4ITNavigator2::SetupHierarchy ( )
protectedvirtual

Definition at line 1434 of file G4ITNavigator2.cc.

1435 {
1436  G4int i;
1437  const G4int cdepth = fHistory.GetDepth();
1438  G4VPhysicalVolume *current;
1439  G4VSolid *pSolid;
1440  G4VPVParameterisation *pParam;
1441 
1442  for ( i=1; i<=cdepth; i++ )
1443  {
1444  current = fHistory.GetVolume(i);
1445  switch ( fHistory.GetVolumeType(i) )
1446  {
1447  case kNormal:
1448  break;
1449  case kReplica:
1450  freplicaNav.ComputeTransformation(fHistory.GetReplicaNo(i), current);
1451  break;
1452  case kParameterised:
1453  G4int replicaNo;
1454  pParam = current->GetParameterisation();
1455  replicaNo = fHistory.GetReplicaNo(i);
1456  pSolid = pParam->ComputeSolid(replicaNo, current);
1457 
1458  // Set up dimensions & transform in solid/physical volume
1459  //
1460  pSolid->ComputeDimensions(pParam, replicaNo, current);
1461  pParam->ComputeTransformation(replicaNo, current);
1462 
1463  G4TouchableHistory *pTouchable= 0;
1464  if( pParam->IsNested() )
1465  {
1466  pTouchable= new G4TouchableHistory( fHistory );
1467  pTouchable->MoveUpHistory(); // Move up to the parent level
1468  // Adequate only if Nested at the Branch level (last)
1469  // To extend to other cases:
1470  // pTouchable->MoveUpHistory(cdepth-i-1);
1471  // Move to the parent level of *Current* level
1472  // Could replace this line and constructor with a revised
1473  // c-tor for History(levels to drop)
1474  }
1475  // Set up the correct solid and material in Logical Volume
1476  //
1477  G4LogicalVolume *pLogical = current->GetLogicalVolume();
1478  pLogical->SetSolid( pSolid );
1479  pLogical->UpdateMaterial( pParam ->
1480  ComputeMaterial(replicaNo, current, pTouchable) );
1481  delete pTouchable;
1482  break;
1483  }
1484  }
1485 }
virtual G4bool IsNested() const
void UpdateMaterial(G4Material *pMaterial)
virtual void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
Definition: G4VSolid.cc:138
virtual G4VSolid * ComputeSolid(const G4int, G4VPhysicalVolume *)
void SetSolid(G4VSolid *pSolid)
void ComputeTransformation(const G4int replicaNo, G4VPhysicalVolume *pVol, G4ThreeVector &point) const
int G4int
Definition: G4Types.hh:78
virtual G4VPVParameterisation * GetParameterisation() const =0
G4ReplicaNavigation freplicaNav
#define fHistory
G4LogicalVolume * GetLogicalVolume() const
virtual void ComputeTransformation(const G4int, G4VPhysicalVolume *) const =0
G4int MoveUpHistory(G4int num_levels=1)

Here is the call graph for this function:

Here is the caller graph for this function:

void G4ITNavigator2::SetVerboseLevel ( G4int  level)
inline

Here is the caller graph for this function:

void G4ITNavigator2::SetWorldVolume ( G4VPhysicalVolume pWorld)
inline
G4int G4ITNavigator2::SeverityOfZeroStepping ( G4int noZeroSteps) const
inline
EVolume G4ITNavigator2::VolumeType ( const G4VPhysicalVolume pVol) const
inlineprotected

Here is the caller graph for this function:

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const G4ITNavigator2 n 
)
friend

Definition at line 2407 of file G4ITNavigator2.cc.

2408 {
2409  // Old version did only the following:
2410  // os << "Current History: " << G4endl << n.fHistory;
2411  // Old behaviour is recovered for fVerbose = 0
2412 
2413  // Adapted from G4ITNavigator2::PrintState() const
2414 
2415  G4int oldcoutPrec = os.precision(4);
2416  if( n.fVerbose >= 4 )
2417  {
2418  os << "The current state of G4ITNavigator2 is: " << G4endl;
2419  os << " ValidExitNormal= " << n.fValidExitNormal << G4endl
2420  << " ExitNormal = " << n.fExitNormal << G4endl
2421  << " Exiting = " << n.fExiting << G4endl
2422  << " Entering = " << n.fEntering << G4endl
2423  << " BlockedPhysicalVolume= " ;
2424 
2425  if (n.fBlockedPhysicalVolume==0)
2426  {
2427  os << "None";
2428  }
2429  else
2430  {
2431  os << n.fBlockedPhysicalVolume->GetName();
2432  }
2433 
2434  os << G4endl
2435  << " BlockedReplicaNo = " << n.fBlockedReplicaNo << G4endl
2436  << " LastStepWasZero = " << n.fLastStepWasZero << G4endl
2437  << G4endl;
2438  }
2439  if( ( 1 < n.fVerbose) && (n.fVerbose < 4) )
2440  {
2441  os << G4endl; // Make sure to line up
2442  os << std::setw(30) << " ExitNormal " << " "
2443  << std::setw( 5) << " Valid " << " "
2444  << std::setw( 9) << " Exiting " << " "
2445  << std::setw( 9) << " Entering" << " "
2446  << std::setw(15) << " Blocked:Volume " << " "
2447  << std::setw( 9) << " ReplicaNo" << " "
2448  << std::setw( 8) << " LastStepZero " << " "
2449  << G4endl;
2450  os << "( " << std::setw(7) << n.fExitNormal.x()
2451  << ", " << std::setw(7) << n.fExitNormal.y()
2452  << ", " << std::setw(7) << n.fExitNormal.z() << " ) "
2453  << std::setw( 5) << n.fValidExitNormal << " "
2454  << std::setw( 9) << n.fExiting << " "
2455  << std::setw( 9) << n.fEntering << " ";
2456 
2457  if ( n.fBlockedPhysicalVolume==0 )
2458  { os << std::setw(15) << "None"; }
2459  else
2460  { os << std::setw(15)<< n.fBlockedPhysicalVolume->GetName(); }
2461 
2462  os << std::setw( 9) << n.fBlockedReplicaNo << " "
2463  << std::setw( 8) << n.fLastStepWasZero << " "
2464  << G4endl;
2465  }
2466  if( n.fVerbose > 2 )
2467  {
2468  os.precision(8);
2469  os << " Current Localpoint = " << n.fLastLocatedPointLocal << G4endl;
2470  os << " PreviousSftOrigin = " << n.fPreviousSftOrigin << G4endl;
2471  os << " PreviousSafety = " << n.fPreviousSafety << G4endl;
2472  }
2473  if( n.fVerbose > 3 || n.fVerbose == 0 )
2474  {
2475  os << "Current History: " << G4endl << n.fHistory;
2476  }
2477 
2478  os.precision(oldcoutPrec);
2479  return os;
2480 }
int G4int
Definition: G4Types.hh:78
#define G4endl
Definition: G4ios.hh:61

Member Data Documentation

G4bool G4ITNavigator2::fCheck

Definition at line 586 of file G4ITNavigator2.hh.

const G4int G4ITNavigator2::fMaxNav = 8
static

Definition at line 105 of file G4ITNavigator2.hh.

G4NormalNavigation G4ITNavigator2::fnormalNav

Definition at line 594 of file G4ITNavigator2.hh.

G4ParameterisedNavigation G4ITNavigator2::fparamNav

Definition at line 596 of file G4ITNavigator2.hh.

G4NavigatorState* G4ITNavigator2::fpNavigatorState

Definition at line 542 of file G4ITNavigator2.hh.

G4VoxelSafety* G4ITNavigator2::fpVoxelSafety

Definition at line 599 of file G4ITNavigator2.hh.

G4RegularNavigation G4ITNavigator2::fregularNav

Definition at line 598 of file G4ITNavigator2.hh.

G4ReplicaNavigation G4ITNavigator2::freplicaNav

Definition at line 597 of file G4ITNavigator2.hh.

G4VPhysicalVolume* G4ITNavigator2::fTopPhysical

Definition at line 580 of file G4ITNavigator2.hh.

G4int G4ITNavigator2::fVerbose
protected

Definition at line 412 of file G4ITNavigator2.hh.

G4VoxelNavigation G4ITNavigator2::fvoxelNav

Definition at line 595 of file G4ITNavigator2.hh.

G4bool G4ITNavigator2::fWarnPush

Definition at line 589 of file G4ITNavigator2.hh.

G4double G4ITNavigator2::kCarTolerance
protected

Definition at line 409 of file G4ITNavigator2.hh.


The documentation for this class was generated from the following files: