Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4MultiNavigator Class Reference

#include <G4MultiNavigator.hh>

Inheritance diagram for G4MultiNavigator:
Collaboration diagram for G4MultiNavigator:

Public Member Functions

 G4MultiNavigator ()
 
 ~G4MultiNavigator ()
 
G4double ComputeStep (const G4ThreeVector &pGlobalPoint, const G4ThreeVector &pDirection, const G4double pCurrentProposedStepLength, G4double &pNewSafety)
 
G4double ObtainFinalStep (G4int navigatorId, G4double &pNewSafety, G4double &minStepLast, ELimited &limitedStep)
 
void PrepareNavigators ()
 
void PrepareNewTrack (const G4ThreeVector position, const G4ThreeVector direction)
 
G4VPhysicalVolumeResetHierarchyAndLocate (const G4ThreeVector &point, const G4ThreeVector &direction, const G4TouchableHistory &h)
 
G4VPhysicalVolumeLocateGlobalPointAndSetup (const G4ThreeVector &point, const G4ThreeVector *direction=0, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true)
 
void LocateGlobalPointWithinVolume (const G4ThreeVector &position)
 
G4double ComputeSafety (const G4ThreeVector &globalpoint, const G4double pProposedMaxLength=DBL_MAX, const G4bool keepState=false)
 
G4TouchableHistoryHandle CreateTouchableHistoryHandle () const
 
virtual G4ThreeVector GetLocalExitNormal (G4bool *obtained)
 
virtual G4ThreeVector GetLocalExitNormalAndCheck (const G4ThreeVector &CurrentE_Point, G4bool *obtained)
 
virtual G4ThreeVector GetGlobalExitNormal (const G4ThreeVector &CurrentE_Point, G4bool *obtained)
 
G4NavigatorGetNavigator (G4int n) const
 
- Public Member Functions inherited from G4Navigator
 G4Navigator ()
 
virtual ~G4Navigator ()
 
G4double CheckNextStep (const G4ThreeVector &pGlobalPoint, const G4ThreeVector &pDirection, const G4double pCurrentProposedStepLength, G4double &pNewSafety)
 
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 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
 
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)
 

Protected Member Functions

void ResetState ()
 
void SetupHierarchy ()
 
void WhichLimited ()
 
void PrintLimited ()
 
void CheckMassWorld ()
 
- Protected Member Functions inherited from G4Navigator
void SetSavedState ()
 
void RestoreSavedState ()
 
G4ThreeVector ComputeLocalPoint (const G4ThreeVector &rGlobPoint) const
 
G4ThreeVector ComputeLocalAxis (const G4ThreeVector &pVec) const
 
EVolume VolumeType (const G4VPhysicalVolume *pVol) const
 
EVolume CharacteriseDaughters (const G4LogicalVolume *pLog) const
 
G4int GetDaughtersRegularStructureId (const G4LogicalVolume *pLog) const
 

Friends

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

Additional Inherited Members

- Protected Attributes inherited from G4Navigator
G4double kCarTolerance
 
G4double fMinStep
 
G4double fSqTol
 
G4NavigationHistory fHistory
 
G4bool fEnteredDaughter
 
G4bool fExitedMother
 
G4bool fWasLimitedByGeometry
 
G4ThreeVector fStepEndPoint
 
G4ThreeVector fLastStepEndPointLocal
 
G4int fVerbose
 

Detailed Description

Definition at line 59 of file G4MultiNavigator.hh.

Constructor & Destructor Documentation

G4MultiNavigator::G4MultiNavigator ( )

Definition at line 50 of file G4MultiNavigator.cc.

51  : G4Navigator(), fLastMassWorld(0)
52 {
53  fNoActiveNavigators= 0;
54  G4ThreeVector Big3Vector( kInfinity, kInfinity, kInfinity );
55  fLastLocatedPosition = Big3Vector;
56  fSafetyLocation = Big3Vector;
57  fPreStepLocation = Big3Vector;
58 
59  fMinSafety_PreStepPt= -1.0;
60  fMinSafety_atSafLocation= -1.0;
61  fMinSafety= -kInfinity;
62  fTrueMinStep= fMinStep= -kInfinity;
63 
64  for(G4int num=0; num< fMaxNav; ++num )
65  {
66  fpNavigator[num] = 0;
67  fLimitTruth[num] = false;
68  fLimitedStep[num] = kUndefLimited;
69  fCurrentStepSize[num] = fNewSafety[num] = -1.0;
70  fLocatedVolume[num] = 0;
71  }
72 
74 
75  G4Navigator* massNav= pTransportManager->GetNavigatorForTracking();
76  if( massNav )
77  {
78  G4VPhysicalVolume* pWorld= massNav->GetWorldVolume();
79  if( pWorld )
80  {
81  SetWorldVolume( pWorld );
82  fLastMassWorld = pWorld;
83  }
84  }
85 
86  fNoLimitingStep= -1;
87  fIdNavLimiting= -1;
88 }
static const G4double kInfinity
Definition: geomdefs.hh:42
G4Navigator * GetNavigatorForTracking() const
int G4int
Definition: G4Types.hh:78
static G4TransportationManager * GetTransportationManager()
void SetWorldVolume(G4VPhysicalVolume *pWorld)
G4VPhysicalVolume * GetWorldVolume() const

Here is the call graph for this function:

G4MultiNavigator::~G4MultiNavigator ( )

Definition at line 90 of file G4MultiNavigator.cc.

91 {
92 }

Member Function Documentation

void G4MultiNavigator::CheckMassWorld ( )
protected

Definition at line 640 of file G4MultiNavigator.cc.

641 {
642  G4VPhysicalVolume* navTrackWorld=
643  pTransportManager->GetNavigatorForTracking()->GetWorldVolume();
644 
645  if( navTrackWorld != fLastMassWorld )
646  {
647  G4Exception( "G4MultiNavigator::CheckMassWorld()",
648  "GeomNav0003", FatalException,
649  "Mass world pointer has been changed." );
650  }
651 }
G4Navigator * GetNavigatorForTracking() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4VPhysicalVolume * GetWorldVolume() const

Here is the call graph for this function:

G4double G4MultiNavigator::ComputeSafety ( const G4ThreeVector globalpoint,
const G4double  pProposedMaxLength = DBL_MAX,
const G4bool  keepState = false 
)
virtual

Reimplemented from G4Navigator.

Definition at line 429 of file G4MultiNavigator.cc.

432 {
433  // Recompute safety for the relevant point
434 
435  G4double minSafety = kInfinity, safety = kInfinity;
436 
437  std::vector<G4Navigator*>::iterator pNavigatorIter;
438  pNavigatorIter= pTransportManager-> GetActiveNavigatorsIterator();
439 
440  for( G4int num=0; num< fNoActiveNavigators; ++pNavigatorIter,++num )
441  {
442  safety = (*pNavigatorIter)->ComputeSafety( position, maxDistance, state);
443  if( safety < minSafety ) { minSafety = safety; }
444  }
445 
446  fSafetyLocation = position;
447  fMinSafety_atSafLocation = minSafety;
448 
449 #ifdef G4DEBUG_NAVIGATION
450  if( fVerbose > 1 )
451  {
452  G4cout << " G4MultiNavigator::ComputeSafety - returns: "
453  << minSafety << ", at location: " << position << G4endl;
454  }
455 #endif
456  return minSafety;
457 }
static const G4double kInfinity
Definition: geomdefs.hh:42
G4int fVerbose
Definition: G4Navigator.hh:392
int G4int
Definition: G4Types.hh:78
#define position
Definition: xmlparse.cc:622
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
G4double G4MultiNavigator::ComputeStep ( const G4ThreeVector pGlobalPoint,
const G4ThreeVector pDirection,
const G4double  pCurrentProposedStepLength,
G4double pNewSafety 
)
virtual

Reimplemented from G4Navigator.

Definition at line 94 of file G4MultiNavigator.cc.

98 {
99  G4double safety= 0.0, step=0.0;
100  G4double minSafety= kInfinity, minStep= kInfinity;
101 
102  fNoLimitingStep= -1;
103  fIdNavLimiting= -1; // Reset for new step
104 
105 #ifdef G4DEBUG_NAVIGATION
106  if( fVerbose > 2 )
107  {
108  G4cout << " G4MultiNavigator::ComputeStep : entered " << G4endl;
109  G4cout << " Input position= " << pGlobalPoint
110  << " direction= " << pDirection << G4endl;
111  G4cout << " Requested step= " << proposedStepLength << G4endl;
112  }
113 #endif
114 
115  std::vector<G4Navigator*>::iterator pNavigatorIter;
116 
117  pNavigatorIter= pTransportManager-> GetActiveNavigatorsIterator();
118 
119  G4ThreeVector initialPosition = pGlobalPoint;
120  G4ThreeVector initialDirection= pDirection;
121 
122  for( G4int num=0; num< fNoActiveNavigators; ++pNavigatorIter,++num )
123  {
124  safety= kInfinity;
125 
126  step= (*pNavigatorIter)->ComputeStep( initialPosition,
127  initialDirection,
128  proposedStepLength,
129  safety );
130  if( safety < minSafety ){ minSafety = safety; }
131  if( step < minStep ) { minStep= step; }
132 
133  fCurrentStepSize[num] = step;
134  fNewSafety[num]= safety;
135  // This is currently the safety from the last sub-step
136 
137 #ifdef G4DEBUG_NAVIGATION
138  if( fVerbose > 2 )
139  {
140  G4cout << "G4MultiNavigator::ComputeStep : Navigator ["
141  << num << "] -- step size " << step
142  << " safety= " << safety << G4endl;
143  }
144 #endif
145  }
146 
147  // Save safety value, related position
148  //
149  fPreStepLocation = initialPosition;
150  fMinSafety_PreStepPt = minSafety;
151  fMinStep = minStep;
152 
153  if( fMinStep == kInfinity )
154  {
155  fTrueMinStep = proposedStepLength; // Use this below for endpoint !!
156  }
157  else
158  {
159  fTrueMinStep = minStep;
160  }
161 
162 #ifdef G4DEBUG_NAVIGATION
163  if( fVerbose > 1 )
164  {
165  G4ThreeVector endPosition = initialPosition+fTrueMinStep*initialDirection;
166 
167  G4int oldPrec = G4cout.precision(8);
168  G4cout << "G4MultiNavigator::ComputeStep : "
169  << " initialPosition = " << initialPosition
170  << " and endPosition = " << endPosition << G4endl;
171  G4cout.precision( oldPrec );
172  }
173 #endif
174 
175  pNewSafety = minSafety;
176 
177  this->WhichLimited();
178 
179 #ifdef G4DEBUG_NAVIGATION
180  if( fVerbose > 2 )
181  {
182  G4cout << " G4MultiNavigator::ComputeStep : exits returning "
183  << minStep << G4endl;
184  }
185 #endif
186 
187  return minStep; // must return kInfinity if do not limit step
188 }
static const G4double kInfinity
Definition: geomdefs.hh:42
G4int fVerbose
Definition: G4Navigator.hh:392
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

G4TouchableHistoryHandle G4MultiNavigator::CreateTouchableHistoryHandle ( ) const
virtual

Reimplemented from G4Navigator.

Definition at line 462 of file G4MultiNavigator.cc.

463 {
464  G4Exception( "G4MultiNavigator::CreateTouchableHistoryHandle()",
465  "GeomNav0001", FatalException,
466  "Getting a touchable from G4MultiNavigator is not defined.");
467 
468  G4TouchableHistory* touchHist;
469  touchHist= fpNavigator[0] -> CreateTouchableHistory();
470 
471  G4VPhysicalVolume* locatedVolume= fLocatedVolume[0];
472  if( locatedVolume == 0 )
473  {
474  // Workaround to ensure that the touchable is fixed !! // TODO: fix
475  //
476  touchHist->UpdateYourself( locatedVolume, touchHist->GetHistory() );
477  }
478 
479  return G4TouchableHistoryHandle(touchHist);
480 }
G4ReferenceCountedHandle< G4TouchableHistory > G4TouchableHistoryHandle
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4TouchableHistory * CreateTouchableHistory() const
void UpdateYourself(G4VPhysicalVolume *pPhysVol, const G4NavigationHistory *history=0)
const G4NavigationHistory * GetHistory() const

Here is the call graph for this function:

G4ThreeVector G4MultiNavigator::GetGlobalExitNormal ( const G4ThreeVector CurrentE_Point,
G4bool obtained 
)
virtual

Reimplemented from G4Navigator.

Definition at line 695 of file G4MultiNavigator.cc.

697 {
698  G4ThreeVector normalGlobalCrd(0.0, 0.0, 0.0);
699  G4bool isObtained= false;
700  // These default values will be used if fNoLimitingStep== 0
701  G4int firstNavigatorId= -1;
702  G4bool oneObtained= false;
703 
704  if( fNoLimitingStep==1 )
705  {
706  // Only message the Navigator which limited the step!
707  normalGlobalCrd= fpNavigator[ fIdNavLimiting ]->GetGlobalExitNormal( argPoint, &isObtained);
708  *argpObtained= isObtained;
709  }
710  else
711  {
712  if( fNoLimitingStep > 1 )
713  {
714  std::vector<G4Navigator*>::iterator pNavIter=
715  pTransportManager->GetActiveNavigatorsIterator();
716 
717  for ( G4int num=0; num< fNoActiveNavigators ; ++pNavIter,++num )
718  {
719  G4ThreeVector oneNormal;
720  if( fLimitTruth[ num ] ) // Did this geometry limit the step ?
721  {
722  G4ThreeVector newNormal= (*pNavIter)-> GetGlobalExitNormal( argPoint, &oneObtained );
723  if( oneObtained )
724  {
725  // Keep first one - only if it is valid (ie not null)
726  if( !isObtained && (newNormal.mag2() != 0.0) )
727  {
728  normalGlobalCrd= newNormal;
729  isObtained = oneObtained;
730  firstNavigatorId= num;
731  }else{
732  // Check for clash
733  G4double dotNewPrevious= newNormal.dot( normalGlobalCrd );
734  G4double productMagSq= normalGlobalCrd.mag2() * newNormal.mag2();
735  if( productMagSq > 0.0 )
736  {
737  G4double productMag= std::sqrt( productMagSq );
738  dotNewPrevious /= productMag; // Normalise
739  if( dotNewPrevious < (1 - perThousand) )
740  {
741  *argpObtained= false;
742 
743  if( fVerbose > 2 ) // dotNewPrevious <= 0.0 )
744  {
745  std::ostringstream message;
746  message << "Clash of Normal from different Navigators!" << G4endl
747  << " Previous Navigator Id = " << firstNavigatorId << G4endl
748  << " Current Navigator Id = " << num << G4endl;
749  message << " Dot product of 2 normals = " << dotNewPrevious << G4endl;
750  message << " Normal (previous) = " << normalGlobalCrd << G4endl;
751  message << " Normal (current) = " << newNormal << G4endl;
752  G4Exception("G4MultiNavigator::GetGlobalExitNormal()", "GeomNav0002",
753  JustWarning, message);
754  }
755  }
756  else
757  {
758  // Close agreement - Do not change
759  }
760  }
761  }
762  }
763  }
764  } // end for over the Navigators
765 
766  // Report if no Normal was obtained
767  if( !oneObtained )
768  {
769  std::ostringstream message;
770  message << "No Normal obtained despite having " << fNoLimitingStep
771  << " candidate Navigators limiting the step!" << G4endl;
772  G4Exception("G4MultiNavigator::GetGlobalExitNormal()", "GeomNav0002",
773  JustWarning, message);
774  }
775 
776  } // end if ( fNoLimiting > 1 )
777  } // end else
778 
779  *argpObtained= isObtained;
780  return normalGlobalCrd;
781 }
virtual G4ThreeVector GetGlobalExitNormal(const G4ThreeVector &CurrentE_Point, G4bool *obtained)
double dot(const Hep3Vector &) const
G4int fVerbose
Definition: G4Navigator.hh:392
int G4int
Definition: G4Types.hh:78
bool G4bool
Definition: G4Types.hh:79
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
virtual G4ThreeVector GetGlobalExitNormal(const G4ThreeVector &point, G4bool *valid)
std::vector< G4Navigator * >::iterator GetActiveNavigatorsIterator()
double mag2() const
#define G4endl
Definition: G4ios.hh:61
static constexpr double perThousand
Definition: G4SIunits.hh:333
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

G4ThreeVector G4MultiNavigator::GetLocalExitNormal ( G4bool obtained)
virtual

Reimplemented from G4Navigator.

Definition at line 786 of file G4MultiNavigator.cc.

787 {
788  // If it is the mass navigator, then expect
789  G4ThreeVector normalGlobalCrd(0.0, 0.0, 0.0);
790  G4bool isObtained= false;
791  // These default values will be used if fNoLimitingStep== 0
792 
793  if( fNoLimitingStep==1 )
794  {
795  // Only message the Navigator which limited the step!
796  normalGlobalCrd= fpNavigator[ fIdNavLimiting ]->GetLocalExitNormal( &isObtained);
797  *argpObtained= isObtained;
798 
799  static G4ThreadLocal G4int numberWarnings= 0;
800  G4int noWarningsStart= 10, noModuloWarnings=100;
801  numberWarnings++;
802  if( (numberWarnings < noWarningsStart ) || (numberWarnings%noModuloWarnings==0) )
803  {
804  std::ostringstream message;
805  message << "Cannot obtain normal in local coordinates of two or more coordinate systems." << G4endl;
806  G4Exception("G4MultiNavigator::GetGlobalExitNormal()", "GeomNav0002",
807  JustWarning, message);
808  }
809  }
810  else
811  {
812  if( fNoLimitingStep > 1 )
813  {
814  // Does not make sense - cannot obtain *local* normal in several coordinate systems
815  std::ostringstream message;
816  message << "Cannot obtain normal in local coordinates of two or more coordinate systems." << G4endl;
817  G4Exception("G4MultiNavigator::GetGlobalExitNormal()", "GeomNav0002",
818  FatalException, message);
819  }
820  }
821 
822  *argpObtained= isObtained;
823  return normalGlobalCrd;
824 }
#define G4ThreadLocal
Definition: tls.hh:89
int G4int
Definition: G4Types.hh:78
virtual G4ThreeVector GetLocalExitNormal(G4bool *valid)
bool G4bool
Definition: G4Types.hh:79
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

G4ThreeVector G4MultiNavigator::GetLocalExitNormalAndCheck ( const G4ThreeVector CurrentE_Point,
G4bool obtained 
)
virtual

Reimplemented from G4Navigator.

Definition at line 830 of file G4MultiNavigator.cc.

832 {
833  return G4MultiNavigator::GetLocalExitNormal( obtained);
834 }
virtual G4ThreeVector GetLocalExitNormal(G4bool *obtained)

Here is the call graph for this function:

G4Navigator* G4MultiNavigator::GetNavigator ( G4int  n) const
inline

Definition at line 141 of file G4MultiNavigator.hh.

142  {
143  if( (n>fNoActiveNavigators)||(n<0)){ n=0; }
144  return fpNavigator[n];
145  }
const G4int n
G4VPhysicalVolume * G4MultiNavigator::LocateGlobalPointAndSetup ( const G4ThreeVector point,
const G4ThreeVector direction = 0,
const G4bool  pRelativeSearch = true,
const G4bool  ignoreDirection = true 
)
virtual

Reimplemented from G4Navigator.

Definition at line 317 of file G4MultiNavigator.cc.

321 {
322  // Locate the point in each geometry
323 
324  G4ThreeVector direction(0.0, 0.0, 0.0);
325  G4bool relative = pRelativeSearch;
326  std::vector<G4Navigator*>::iterator pNavIter
327  = pTransportManager->GetActiveNavigatorsIterator();
328 
329  if( pDirection ) { direction = *pDirection; }
330 
331 #ifdef G4DEBUG_NAVIGATION
332  if( fVerbose > 2 )
333  {
334  G4cout << " Entered G4MultiNavigator::LocateGlobalPointAndSetup() "
335  << G4endl;
336  G4cout << " Locating at position: " << position
337  << ", with direction: " << direction << G4endl
338  << " Relative: " << relative
339  << ", ignore direction: " << ignoreDirection << G4endl;
340  G4cout << " Number of active navigators: " << fNoActiveNavigators
341  << G4endl;
342  }
343 #endif
344 
345  for ( G4int num=0; num< fNoActiveNavigators ; ++pNavIter,++num )
346  {
347  if( fWasLimitedByGeometry && fLimitTruth[num] )
348  {
349  (*pNavIter)->SetGeometricallyLimitedStep();
350  }
351 
352  G4VPhysicalVolume *pLocated
353  = (*pNavIter)->LocateGlobalPointAndSetup( position, &direction,
354  relative, ignoreDirection );
355  // Set the state related to the location
356  //
357  fLocatedVolume[num] = pLocated;
358 
359  // Clear state related to the step
360  //
361  fLimitedStep[num] = kDoNot;
362  fCurrentStepSize[num] = 0.0;
363  fLimitTruth[ num ] = false; // Always clear on locating (see Navigator)
364 
365 #ifdef G4DEBUG_NAVIGATION
366  if( fVerbose > 2 )
367  {
368  G4cout << " Located in world: " << num << ", at: " << position << G4endl
369  << " Used geomLimStp: " << fLimitTruth[num]
370  << ", found in volume: " << pLocated << G4endl;
371  G4cout << " Name = '" ;
372  if( pLocated )
373  {
374  G4cout << pLocated->GetName() << "'";
375  G4cout << " - CopyNo= " << pLocated->GetCopyNo();
376  }
377  else
378  {
379  G4cout << "Null' Id: Not-Set ";
380  }
381  G4cout << G4endl;
382  }
383 #endif
384  }
385 
386  fWasLimitedByGeometry = false; // Clear on locating
387  G4VPhysicalVolume* volMassLocated= fLocatedVolume[0];
388 
389  return volMassLocated;
390 }
G4int fVerbose
Definition: G4Navigator.hh:392
int G4int
Definition: G4Types.hh:78
G4bool fWasLimitedByGeometry
Definition: G4Navigator.hh:382
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
bool G4bool
Definition: G4Types.hh:79
std::vector< G4Navigator * >::iterator GetActiveNavigatorsIterator()
virtual G4int GetCopyNo() const =0
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

void G4MultiNavigator::LocateGlobalPointWithinVolume ( const G4ThreeVector position)
virtual

Reimplemented from G4Navigator.

Definition at line 395 of file G4MultiNavigator.cc.

396 {
397  // Relocate the point in each geometry
398 
399  std::vector<G4Navigator*>::iterator pNavIter
400  = pTransportManager->GetActiveNavigatorsIterator();
401 
402 #ifdef G4DEBUG_NAVIGATION
403  if( fVerbose > 2 )
404  {
405  G4cout << " Entered G4MultiNavigator::ReLocate() " << G4endl
406  << " Re-locating at position: " << position << G4endl;
407  }
408 #endif
409 
410  for ( G4int num=0; num< fNoActiveNavigators ; ++pNavIter,++num )
411  {
412  // ... none limited the step
413 
414  (*pNavIter)->LocateGlobalPointWithinVolume( position );
415 
416  // Clear state related to the step
417  //
418  fLimitedStep[num] = kDoNot;
419  fCurrentStepSize[num] = 0.0;
420 
421  fLimitTruth[ num ] = false; // Always clear on locating (see Navigator)
422  }
423  fWasLimitedByGeometry = false; // Clear on locating
424  fLastLocatedPosition = position;
425 }
G4int fVerbose
Definition: G4Navigator.hh:392
int G4int
Definition: G4Types.hh:78
G4bool fWasLimitedByGeometry
Definition: G4Navigator.hh:382
#define position
Definition: xmlparse.cc:622
G4GLOB_DLL std::ostream G4cout
std::vector< G4Navigator * >::iterator GetActiveNavigatorsIterator()
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

G4double G4MultiNavigator::ObtainFinalStep ( G4int  navigatorId,
G4double pNewSafety,
G4double minStepLast,
ELimited limitedStep 
)

Definition at line 193 of file G4MultiNavigator.cc.

197 {
198  if( navigatorId > fNoActiveNavigators )
199  {
200  std::ostringstream message;
201  message << "Bad Navigator Id!" << G4endl
202  << " Navigator Id = " << navigatorId
203  << " No Active = " << fNoActiveNavigators << ".";
204  G4Exception("G4MultiNavigator::ObtainFinalStep()", "GeomNav0002",
205  FatalException, message);
206  }
207 
208  // Prepare the information to return
209  //
210  pNewSafety = fNewSafety[ navigatorId ];
211  limitedStep = fLimitedStep[ navigatorId ];
212  minStep= fMinStep;
213 
214 #ifdef G4DEBUG_NAVIGATION
215  if( fVerbose > 1 )
216  {
217  G4cout << " G4MultiNavigator::ComputeStep returns "
218  << fCurrentStepSize[ navigatorId ]
219  << " for Navigator " << navigatorId
220  << " Limited step = " << limitedStep
221  << " Safety(mm) = " << pNewSafety / mm << G4endl;
222  }
223 #endif
224 
225  return fCurrentStepSize[ navigatorId ];
226 }
static constexpr double mm
Definition: G4SIunits.hh:115
G4int fVerbose
Definition: G4Navigator.hh:392
G4GLOB_DLL std::ostream G4cout
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

void G4MultiNavigator::PrepareNavigators ( )

Definition at line 251 of file G4MultiNavigator.cc.

252 {
253  // Key purposes:
254  // - Check and cache set of active navigators
255  // - Reset state for new track
256 
257 #ifdef G4DEBUG_NAVIGATION
258  if( fVerbose > 1 )
259  {
260  G4cout << " Entered G4MultiNavigator::PrepareNavigators() " << G4endl;
261  }
262 #endif
263 
264  // Message the transportation-manager to find active navigators
265 
266  std::vector<G4Navigator*>::iterator pNavigatorIter;
267  fNoActiveNavigators= pTransportManager-> GetNoActiveNavigators();
268 
269  if( fNoActiveNavigators > fMaxNav )
270  {
271  std::ostringstream message;
272  message << "Too many active Navigators / worlds !" << G4endl
273  << " Active Navigators (worlds): "
274  << fNoActiveNavigators << G4endl
275  << " which is more than the number allowed: "
276  << fMaxNav << " !";
277  G4Exception("G4MultiNavigator::PrepareNavigators()", "GeomNav0002",
278  FatalException, message);
279  }
280 
281  pNavigatorIter= pTransportManager-> GetActiveNavigatorsIterator();
282  for( G4int num=0; num< fNoActiveNavigators; ++pNavigatorIter,++num )
283  {
284  fpNavigator[num] = *pNavigatorIter;
285  fLimitTruth[num] = false;
286  fLimitedStep[num] = kDoNot;
287  fCurrentStepSize[num] = 0.0;
288  fLocatedVolume[num] = 0;
289  }
290  fWasLimitedByGeometry = false;
291 
292  // Check the world volume of the mass navigator
293  // in case a call to SetWorldVolume() changed it
294 
295  G4VPhysicalVolume* massWorld = GetWorldVolume();
296 
297  if( (massWorld != fLastMassWorld) && (massWorld!=0) )
298  {
299  // Pass along change to Mass Navigator
300  fpNavigator[0] -> SetWorldVolume( massWorld );
301 
302 #ifdef G4DEBUG_NAVIGATION
303  if( fVerbose > 0 )
304  {
305  G4cout << " G4MultiNavigator::PrepareNavigators() changed world volume "
306  << " for mass geometry to " << massWorld->GetName() << G4endl;
307  }
308 #endif
309 
310  fLastMassWorld = massWorld;
311  }
312 }
G4int fVerbose
Definition: G4Navigator.hh:392
int G4int
Definition: G4Types.hh:78
G4bool fWasLimitedByGeometry
Definition: G4Navigator.hh:382
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
void SetWorldVolume(G4VPhysicalVolume *pWorld)
#define G4endl
Definition: G4ios.hh:61
G4VPhysicalVolume * GetWorldVolume() const

Here is the call graph for this function:

Here is the caller graph for this function:

void G4MultiNavigator::PrepareNewTrack ( const G4ThreeVector  position,
const G4ThreeVector  direction 
)

Definition at line 230 of file G4MultiNavigator.cc.

232 {
233 #ifdef G4DEBUG_NAVIGATION
234  if( fVerbose > 1 )
235  {
236  G4cout << " Entered G4MultiNavigator::PrepareNewTrack() " << G4endl;
237  }
238 #endif
239 
241 
242  LocateGlobalPointAndSetup( position, &direction, false, false );
243  //
244  // The first location for each Navigator must be non-relative
245  // or else call ResetStackAndState() for each Navigator
246  // Use direction to get correct side of boundary (ignore dir= false)
247 }
G4int fVerbose
Definition: G4Navigator.hh:392
G4VPhysicalVolume * LocateGlobalPointAndSetup(const G4ThreeVector &point, const G4ThreeVector *direction=0, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true)
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

void G4MultiNavigator::PrintLimited ( )
protected

Definition at line 543 of file G4MultiNavigator.cc.

544 {
545  // Report results -- for checking
546 
547  static const G4String StrDoNot("DoNot"), StrUnique("Unique"),
548  StrUndefined("Undefined"),
549  StrSharedTransport("SharedTransport"),
550  StrSharedOther("SharedOther");
551  G4cout << "### G4MultiNavigator::PrintLimited() reports: " << G4endl;
552  G4cout << " Minimum step (true): " << fTrueMinStep
553  << ", reported min: " << fMinStep << G4endl;
554 
555 #ifdef G4DEBUG_NAVIGATION
556  if(fVerbose>=2)
557  {
558  G4cout << std::setw(5) << " NavId" << " "
559  << std::setw(12) << " step-size " << " "
560  << std::setw(12) << " raw-size " << " "
561  << std::setw(12) << " pre-safety " << " "
562  << std::setw(15) << " Limited / flag" << " "
563  << std::setw(15) << " World " << " "
564  << G4endl;
565  }
566 #endif
567 
568  for ( G4int num= 0; num < fNoActiveNavigators; num++ )
569  {
570  G4double rawStep = fCurrentStepSize[num];
571  G4double stepLen = fCurrentStepSize[num];
572  if( stepLen > fTrueMinStep )
573  {
574  stepLen = fTrueMinStep; // did not limit (went as far as asked)
575  }
576  G4int oldPrec= G4cout.precision(9);
577 
578  G4cout << std::setw(5) << num << " "
579  << std::setw(12) << stepLen << " "
580  << std::setw(12) << rawStep << " "
581  << std::setw(12) << fNewSafety[num] << " "
582  << std::setw(5) << (fLimitTruth[num] ? "YES" : " NO") << " ";
583  G4String limitedStr;
584  switch ( fLimitedStep[num] )
585  {
586  case kDoNot : limitedStr= StrDoNot; break;
587  case kUnique : limitedStr = StrUnique; break;
588  case kSharedTransport: limitedStr= StrSharedTransport; break;
589  case kSharedOther : limitedStr = StrSharedOther; break;
590  default : limitedStr = StrUndefined; break;
591  }
592  G4cout << " " << std::setw(15) << limitedStr << " ";
593  G4cout.precision(oldPrec);
594 
595  G4Navigator *pNav= fpNavigator[ num ];
596  G4String WorldName( "Not-Set" );
597  if (pNav)
598  {
599  G4VPhysicalVolume *pWorld= pNav->GetWorldVolume();
600  if( pWorld )
601  {
602  WorldName = pWorld->GetName();
603  }
604  }
605  G4cout << " " << WorldName ;
606  G4cout << G4endl;
607  }
608 }
G4int fVerbose
Definition: G4Navigator.hh:392
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
G4VPhysicalVolume * GetWorldVolume() const

Here is the call graph for this function:

G4VPhysicalVolume * G4MultiNavigator::ResetHierarchyAndLocate ( const G4ThreeVector point,
const G4ThreeVector direction,
const G4TouchableHistory h 
)
virtual

Reimplemented from G4Navigator.

Definition at line 656 of file G4MultiNavigator.cc.

659 {
660  // Reset geometry for all -- and use the touchable for the mass history
661 
662  G4VPhysicalVolume* massVolume=0;
663  G4Navigator* pMassNavigator= fpNavigator[0];
664 
665  if( pMassNavigator )
666  {
667  massVolume= pMassNavigator->ResetHierarchyAndLocate( point, direction,
668  MassHistory);
669  }
670  else
671  {
672  G4Exception("G4MultiNavigator::ResetHierarchyAndLocate()",
673  "GeomNav0002", FatalException,
674  "Cannot reset hierarchy before navigators are initialised.");
675  }
676 
677  std::vector<G4Navigator*>::iterator pNavIter=
678  pTransportManager->GetActiveNavigatorsIterator();
679 
680  for ( G4int num=0; num< fNoActiveNavigators ; ++pNavIter,++num )
681  {
682  G4bool relativeSearch, ignoreDirection;
683 
684  (*pNavIter)-> LocateGlobalPointAndSetup( point,
685  &direction,
686  relativeSearch=false,
687  ignoreDirection=false);
688  }
689  return massVolume;
690 }
G4VPhysicalVolume * LocateGlobalPointAndSetup(const G4ThreeVector &point, const G4ThreeVector *direction=0, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true)
int G4int
Definition: G4Types.hh:78
virtual G4VPhysicalVolume * ResetHierarchyAndLocate(const G4ThreeVector &point, const G4ThreeVector &direction, const G4TouchableHistory &h)
Definition: G4Navigator.cc:95
bool G4bool
Definition: G4Types.hh:79
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
std::vector< G4Navigator * >::iterator GetActiveNavigatorsIterator()

Here is the call graph for this function:

void G4MultiNavigator::ResetState ( )
protectedvirtual

Reimplemented from G4Navigator.

Definition at line 613 of file G4MultiNavigator.cc.

614 {
615  fWasLimitedByGeometry= false;
616 
617  G4Exception("G4MultiNavigator::ResetState()", "GeomNav0001",
619  "Cannot reset state for navigators of G4MultiNavigator.");
620 
621  std::vector<G4Navigator*>::iterator pNavigatorIter;
622  pNavigatorIter= pTransportManager-> GetActiveNavigatorsIterator();
623  for( G4int num=0; num< fNoActiveNavigators; ++pNavigatorIter,++num )
624  {
625  // (*pNavigatorIter)->ResetState(); // KEEP THIS comment !!!
626  }
627 }
int G4int
Definition: G4Types.hh:78
G4bool fWasLimitedByGeometry
Definition: G4Navigator.hh:382
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:

void G4MultiNavigator::SetupHierarchy ( )
protectedvirtual

Reimplemented from G4Navigator.

Definition at line 631 of file G4MultiNavigator.cc.

632 {
633  G4Exception( "G4MultiNavigator::SetupHierarchy()",
634  "GeomNav0001", FatalException,
635  "Cannot setup hierarchy for navigators of G4MultiNavigator.");
636 }
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:

void G4MultiNavigator::WhichLimited ( )
protected

Definition at line 484 of file G4MultiNavigator.cc.

485 {
486  // Flag which processes limited the step
487 
488  G4int last=-1;
489  const G4int IdTransport= 0; // Id of Mass Navigator !!
490  G4int noLimited=0;
491  ELimited shared= kSharedOther;
492 
493 #ifdef G4DEBUG_NAVIGATION
494  if( fVerbose > 2 )
495  {
496  G4cout << " Entered G4MultiNavigator::WhichLimited() " << G4endl;
497  }
498 #endif
499 
500  // Assume that [IdTransport] is Mass / Transport
501  //
502  G4bool transportLimited = (fCurrentStepSize[IdTransport] == fMinStep)
503  && ( fMinStep!= kInfinity);
504  if( transportLimited )
505  {
506  shared= kSharedTransport;
507  }
508 
509  for ( G4int num= 0; num < fNoActiveNavigators; num++ )
510  {
511  G4bool limitedStep;
512 
513  G4double step= fCurrentStepSize[num];
514 
515  limitedStep = ( step == fMinStep ) && ( step != kInfinity);
516 
517  fLimitTruth[ num ] = limitedStep;
518  if( limitedStep )
519  {
520  noLimited++;
521  fLimitedStep[num] = shared;
522  last= num;
523  }
524  else
525  {
526  fLimitedStep[num] = kDoNot;
527  }
528  }
529  if( (last > -1) && (noLimited == 1 ) )
530  {
531  fLimitedStep[ last ] = kUnique;
532  fIdNavLimiting = last;
533  }
534 
535  fNoLimitingStep= noLimited;
536 
537  return;
538 }
static const G4double kInfinity
Definition: geomdefs.hh:42
ELimited
G4int fVerbose
Definition: G4Navigator.hh:392
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76

Here is the caller graph for this function:

Friends And Related Function Documentation

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

Definition at line 2250 of file G4Navigator.cc.

2251 {
2252  // Old version did only the following:
2253  // os << "Current History: " << G4endl << n.fHistory;
2254  // Old behaviour is recovered for fVerbose = 0
2255 
2256  // Adapted from G4Navigator::PrintState() const
2257 
2258  G4int oldcoutPrec = os.precision(4);
2259  if( n.fVerbose >= 4 )
2260  {
2261  os << "The current state of G4Navigator is: " << G4endl;
2262  os << " ValidExitNormal= " << n.fValidExitNormal << G4endl
2263  << " ExitNormal = " << n.fExitNormal << G4endl
2264  << " Exiting = " << n.fExiting << G4endl
2265  << " Entering = " << n.fEntering << G4endl
2266  << " BlockedPhysicalVolume= " ;
2267  if (n.fBlockedPhysicalVolume==0)
2268  os << "None";
2269  else
2270  os << n.fBlockedPhysicalVolume->GetName();
2271  os << G4endl
2272  << " BlockedReplicaNo = " << n.fBlockedReplicaNo << G4endl
2273  << " LastStepWasZero = " << n.fLastStepWasZero << G4endl
2274  << G4endl;
2275  }
2276  if( ( 1 < n.fVerbose) && (n.fVerbose < 4) )
2277  {
2278  os << G4endl; // Make sure to line up
2279  os << std::setw(30) << " ExitNormal " << " "
2280  << std::setw( 5) << " Valid " << " "
2281  << std::setw( 9) << " Exiting " << " "
2282  << std::setw( 9) << " Entering" << " "
2283  << std::setw(15) << " Blocked:Volume " << " "
2284  << std::setw( 9) << " ReplicaNo" << " "
2285  << std::setw( 8) << " LastStepZero " << " "
2286  << G4endl;
2287  os << "( " << std::setw(7) << n.fExitNormal.x()
2288  << ", " << std::setw(7) << n.fExitNormal.y()
2289  << ", " << std::setw(7) << n.fExitNormal.z() << " ) "
2290  << std::setw( 5) << n.fValidExitNormal << " "
2291  << std::setw( 9) << n.fExiting << " "
2292  << std::setw( 9) << n.fEntering << " ";
2293  if ( n.fBlockedPhysicalVolume==0 )
2294  { os << std::setw(15) << "None"; }
2295  else
2296  { os << std::setw(15)<< n.fBlockedPhysicalVolume->GetName(); }
2297  os << std::setw( 9) << n.fBlockedReplicaNo << " "
2298  << std::setw( 8) << n.fLastStepWasZero << " "
2299  << G4endl;
2300  }
2301  if( n.fVerbose > 2 )
2302  {
2303  os.precision(8);
2304  os << " Current Localpoint = " << n.fLastLocatedPointLocal << G4endl;
2305  os << " PreviousSftOrigin = " << n.fPreviousSftOrigin << G4endl;
2306  os << " PreviousSafety = " << n.fPreviousSafety << G4endl;
2307  }
2308  if( n.fVerbose > 3 || n.fVerbose == 0 )
2309  {
2310  os << "Current History: " << G4endl << n.fHistory;
2311  }
2312 
2313  os.precision(oldcoutPrec);
2314  return os;
2315 }
double x() const
G4int fVerbose
Definition: G4Navigator.hh:392
int G4int
Definition: G4Types.hh:78
double z() const
const G4String & GetName() const
G4NavigationHistory fHistory
Definition: G4Navigator.hh:368
double y() const
#define G4endl
Definition: G4ios.hh:61

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