Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/electromagnetic/dna/management/include/G4ITNavigator1.hh

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/electromagnetic/dna/management/include/G4ITNavigator1.hh (Version 11.3.0) and /processes/electromagnetic/dna/management/include/G4ITNavigator1.hh (Version 10.3.p3)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
                                                   >>  26 // $Id: G4ITNavigator1.hh 85244 2014-10-27 08:24:13Z gcosmo $
 26 //                                                 27 //
 27 // Original author: Paul Kent, July 95/96          28 // Original author: Paul Kent, July 95/96
 28 //                                                 29 //
 29 /// \brief { Class description:                    30 /// \brief { Class description:
 30 ///                                                31 ///
 31 /// G4ITNavigator1 is a duplicate version of G     32 /// G4ITNavigator1 is a duplicate version of G4Navigator started from Geant4.9.5
 32 /// initially written by Paul Kent and colleag     33 /// initially written by Paul Kent and colleagues.
 33 /// The only difference resides in the way the     34 /// The only difference resides in the way the information is saved and managed
 34 ///                                                35 ///
 35 /// A class for use by the tracking management     36 /// A class for use by the tracking management, able to obtain/calculate
 36 /// dynamic tracking time information such as      37 /// dynamic tracking time information such as the distance to the next volume,
 37 /// or to find the physical volume containing      38 /// or to find the physical volume containing a given point in the world
 38 /// reference system. The navigator maintains      39 /// reference system. The navigator maintains a transformation history and
 39 /// other information to optimise the tracking     40 /// other information to optimise the tracking time performance.}
 40 //                                                 41 //
 41 // Contact : Mathieu Karamitros (kara (AT) cen     42 // Contact : Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
 42 //                                                 43 //
 43 // WARNING : This class is released as a proto     44 // WARNING : This class is released as a prototype.
 44 // It might strongly evolve or even disapear i     45 // It might strongly evolve or even disapear in the next releases.
 45 //                                                 46 //
 46 // We would be very happy hearing from you, se     47 // We would be very happy hearing from you, send us your feedback! :)
 47 //                                                 48 //
 48 // History:                                        49 // History:
 49 // - Created.                                      50 // - Created.                                  Paul Kent,     Jul 95/96
 50 // - Zero step protections                         51 // - Zero step protections                     J.A. / G.C.,   Nov  2004
 51 // - Added check mode                              52 // - Added check mode                          G. Cosmo,      Mar  2004
 52 // - Made Navigator Abstract                       53 // - Made Navigator Abstract                   G. Cosmo,      Nov  2003
 53 // - G4ITNavigator1 created                        54 // - G4ITNavigator1 created                     M.K.,          Nov  2012
 54 // *******************************************     55 // *********************************************************************
 55                                                    56 
 56 #ifndef G4ITNAVIGATOR_HH                           57 #ifndef G4ITNAVIGATOR_HH
 57 #define G4ITNAVIGATOR_HH                           58 #define G4ITNAVIGATOR_HH
 58                                                    59 
 59 #include "geomdefs.hh"                             60 #include "geomdefs.hh"
 60                                                    61 
 61 #include "G4ThreeVector.hh"                        62 #include "G4ThreeVector.hh"
 62 #include "G4AffineTransform.hh"                    63 #include "G4AffineTransform.hh"
 63 #include "G4RotationMatrix.hh"                     64 #include "G4RotationMatrix.hh"
 64                                                    65 
 65 #include "G4LogicalVolume.hh"             // U     66 #include "G4LogicalVolume.hh"             // Used in inline methods
                                                   >>  67 #include "G4GRSVolume.hh"                 //    "         "
                                                   >>  68 #include "G4GRSSolid.hh"                  //    "         "
 66 #include "G4TouchableHandle.hh"           //       69 #include "G4TouchableHandle.hh"           //    "         "
                                                   >>  70 #include "G4TouchableHistoryHandle.hh"
 67                                                    71 
 68 #include "G4NavigationHistory.hh"                  72 #include "G4NavigationHistory.hh"
 69 #include "G4NormalNavigation.hh"                   73 #include "G4NormalNavigation.hh"
 70 #include "G4VoxelNavigation.hh"                    74 #include "G4VoxelNavigation.hh"
 71 #include "G4ParameterisedNavigation.hh"            75 #include "G4ParameterisedNavigation.hh"
 72 #include "G4ReplicaNavigation.hh"                  76 #include "G4ReplicaNavigation.hh"
 73 #include "G4RegularNavigation.hh"                  77 #include "G4RegularNavigation.hh"
 74                                                    78 
 75 #include <iostream>                                79 #include <iostream>
 76                                                    80 
 77 class G4VPhysicalVolume;                           81 class G4VPhysicalVolume;
 78                                                    82 
 79                                                    83 
 80 struct G4ITNavigatorState_Lock1                    84 struct G4ITNavigatorState_Lock1
 81 {                                                  85 {
 82     virtual ~G4ITNavigatorState_Lock1()= defau <<  86     virtual ~G4ITNavigatorState_Lock1(){;}
 83 protected:                                         87 protected:
 84     G4ITNavigatorState_Lock1(){}               <<  88     G4ITNavigatorState_Lock1(){;}
 85 };                                                 89 };
 86                                                    90 
 87 class G4ITNavigator1                               91 class G4ITNavigator1
 88 {                                                  92 {
 89 public:                                            93 public:
 90   static const G4int fMaxNav = 8;   // rename      94   static const G4int fMaxNav = 8;   // rename to kMaxNoNav ??
 91                                                    95 
 92   public:  // with description                     96   public:  // with description
 93                                                    97 
 94   friend std::ostream& operator << (std::ostre     98   friend std::ostream& operator << (std::ostream &os, const G4ITNavigator1 &n);
 95                                                    99 
 96   G4ITNavigator1();                               100   G4ITNavigator1();
 97     // Constructor - initialisers and setup.      101     // Constructor - initialisers and setup.
 98                                                   102 
 99   virtual ~G4ITNavigator1();                      103   virtual ~G4ITNavigator1();
100     // Destructor. No actions.                    104     // Destructor. No actions.
101                                                   105 
102   G4ITNavigator1(const G4ITNavigator1&) = dele << 
103   G4ITNavigator1& operator=(const G4ITNavigato << 
104                                                << 
105   // !>                                           106   // !>
106     G4ITNavigatorState_Lock1* GetNavigatorStat    107     G4ITNavigatorState_Lock1* GetNavigatorState();
107     void SetNavigatorState(G4ITNavigatorState_    108     void SetNavigatorState(G4ITNavigatorState_Lock1*);
108     void NewNavigatorState();                     109     void NewNavigatorState();
109   // <!                                           110   // <!
110                                                   111 
111   virtual G4double ComputeStep(const G4ThreeVe    112   virtual G4double ComputeStep(const G4ThreeVector &pGlobalPoint,
112                                const G4ThreeVe    113                                const G4ThreeVector &pDirection,
113                                const G4double     114                                const G4double pCurrentProposedStepLength,
114                                      G4double     115                                      G4double  &pNewSafety);
115     // Calculate the distance to the next boun    116     // Calculate the distance to the next boundary intersected
116     // along the specified NORMALISED vector d    117     // along the specified NORMALISED vector direction and
117     // from the specified point in the global     118     // from the specified point in the global coordinate
118     // system. LocateGlobalPointAndSetup or Lo    119     // system. LocateGlobalPointAndSetup or LocateGlobalPointWithinVolume 
119     // must have been called with the same glo    120     // must have been called with the same global point prior to this call.
120     // The isotropic distance to the nearest b    121     // The isotropic distance to the nearest boundary is also
121     // calculated (usually an underestimate).     122     // calculated (usually an underestimate). The current
122     // proposed Step length is used to avoid i    123     // proposed Step length is used to avoid intersection
123     // calculations: if it can be determined t    124     // calculations: if it can be determined that the nearest
124     // boundary is >pCurrentProposedStepLength    125     // boundary is >pCurrentProposedStepLength away, kInfinity
125     // is returned together with the computed     126     // is returned together with the computed isotropic safety
126     // distance. Geometry must be closed.         127     // distance. Geometry must be closed.
127                                                   128 
128   G4double CheckNextStep(const G4ThreeVector &    129   G4double CheckNextStep(const G4ThreeVector &pGlobalPoint,
129                          const G4ThreeVector &    130                          const G4ThreeVector &pDirection,
130                          const G4double pCurre    131                          const G4double pCurrentProposedStepLength,
131                                G4double &pNewS    132                                G4double &pNewSafety); 
132     // Same as above, but do not disturb the s    133     // Same as above, but do not disturb the state of the Navigator.
133                                                   134 
134   virtual                                         135   virtual
135   G4VPhysicalVolume* ResetHierarchyAndLocate(c    136   G4VPhysicalVolume* ResetHierarchyAndLocate(const G4ThreeVector &point,
136                                              c    137                                              const G4ThreeVector &direction,
137                                              c    138                                              const G4TouchableHistory &h);
138                                                   139 
139     // Resets the geometrical hierarchy and se    140     // Resets the geometrical hierarchy and search for the volumes deepest
140     // in the hierarchy containing the point i    141     // in the hierarchy containing the point in the global coordinate space.
141     // The direction is used to check if a vol    142     // The direction is used to check if a volume is entered.
142     // The search begin is the geometrical hie    143     // The search begin is the geometrical hierarchy at the location of the
143     // last located point, or the endpoint of     144     // last located point, or the endpoint of the previous Step if
144     // SetGeometricallyLimitedStep() has been     145     // SetGeometricallyLimitedStep() has been called immediately before.
145     //                                            146     // 
146     // Important Note: In order to call this t    147     // Important Note: In order to call this the geometry MUST be closed.
147                                                   148 
148   virtual                                         149   virtual
149   G4VPhysicalVolume* LocateGlobalPointAndSetup    150   G4VPhysicalVolume* LocateGlobalPointAndSetup(const G4ThreeVector& point,
150                                              c << 151                                              const G4ThreeVector* direction=0,
151                                              c    152                                              const G4bool pRelativeSearch=true,
152                                              c    153                                              const G4bool ignoreDirection=true);
153     // Search the geometrical hierarchy for th    154     // Search the geometrical hierarchy for the volumes deepest in the hierarchy
154     // containing the point in the global coor    155     // containing the point in the global coordinate space. Two main cases are:
155     //  i) If pRelativeSearch=false it makes u    156     //  i) If pRelativeSearch=false it makes use of no previous/state
156     //     information. Returns the physical v    157     //     information. Returns the physical volume containing the point, 
157     //     with all previous mothers correctly    158     //     with all previous mothers correctly set up.
158     // ii) If pRelativeSearch is set to true,     159     // ii) If pRelativeSearch is set to true, the search begin is the
159     //     geometrical hierarchy at the locati    160     //     geometrical hierarchy at the location of the last located point,
160     //     or the endpoint of the previous Ste    161     //     or the endpoint of the previous Step if SetGeometricallyLimitedStep()
161     //     has been called immediately before.    162     //     has been called immediately before.
162     // The direction is used (to check if a vo    163     // The direction is used (to check if a volume is entered) if either
163     //   - the argument ignoreDirection is fal    164     //   - the argument ignoreDirection is false, or
164     //   - the Navigator has determined that i    165     //   - the Navigator has determined that it is on an edge shared by two or
165     //     more volumes.  (This is state infor    166     //     more volumes.  (This is state information.)
166     //                                            167     // 
167     // Important Note: In order to call this t    168     // Important Note: In order to call this the geometry MUST be closed.
168                                                   169 
169   virtual                                         170   virtual
170   void LocateGlobalPointWithinVolume(const G4T    171   void LocateGlobalPointWithinVolume(const G4ThreeVector& position);
171     // Notify the Navigator that a track has m    172     // Notify the Navigator that a track has moved to the new Global point
172     // 'position', that is known to be within     173     // 'position', that is known to be within the current safety.
173     // No check is performed to ensure that it    174     // No check is performed to ensure that it is within  the volume. 
174     // This method can be called instead of Lo    175     // This method can be called instead of LocateGlobalPointAndSetup ONLY if
175     // the caller is certain that the new glob    176     // the caller is certain that the new global point (position) is inside the
176     // same volume as the previous position.      177     // same volume as the previous position.  Usually this can be guaranteed
177     // only if the point is within safety.        178     // only if the point is within safety.
178                                                   179 
179   inline void LocateGlobalPointAndUpdateToucha    180   inline void LocateGlobalPointAndUpdateTouchableHandle(
180                 const G4ThreeVector&       pos    181                 const G4ThreeVector&       position,
181                 const G4ThreeVector&       dir    182                 const G4ThreeVector&       direction,
182                       G4TouchableHandle&   old    183                       G4TouchableHandle&   oldTouchableToUpdate,
183                 const G4bool               Rel    184                 const G4bool               RelativeSearch = true);
184     // First, search the geometrical hierarchy    185     // First, search the geometrical hierarchy like the above method
185     // LocateGlobalPointAndSetup(). Then use t    186     // LocateGlobalPointAndSetup(). Then use the volume found and its
186     // navigation history to update the toucha    187     // navigation history to update the touchable.
187                                                   188 
188   inline void LocateGlobalPointAndUpdateToucha    189   inline void LocateGlobalPointAndUpdateTouchable(
189                 const G4ThreeVector&       pos    190                 const G4ThreeVector&       position,
190                 const G4ThreeVector&       dir    191                 const G4ThreeVector&       direction,
191                       G4VTouchable*        tou    192                       G4VTouchable*        touchableToUpdate,
192                 const G4bool               Rel    193                 const G4bool               RelativeSearch = true);
193     // First, search the geometrical hierarchy    194     // First, search the geometrical hierarchy like the above method
194     // LocateGlobalPointAndSetup(). Then use t    195     // LocateGlobalPointAndSetup(). Then use the volume found and its
195     // navigation history to update the toucha    196     // navigation history to update the touchable.
196                                                   197 
197   inline void LocateGlobalPointAndUpdateToucha    198   inline void LocateGlobalPointAndUpdateTouchable(
198                 const G4ThreeVector&       pos    199                 const G4ThreeVector&       position,
199                       G4VTouchable*        tou    200                       G4VTouchable*        touchableToUpdate,
200                 const G4bool               Rel    201                 const G4bool               RelativeSearch = true);
201     // Same as the method above but missing di    202     // Same as the method above but missing direction.
202                                                   203 
203   inline void SetGeometricallyLimitedStep();      204   inline void SetGeometricallyLimitedStep();
204     // Inform the navigator that the previous     205     // Inform the navigator that the previous Step calculated
205     // by the geometry was taken in its entire    206     // by the geometry was taken in its entirety.
206                                                   207 
207   virtual G4double ComputeSafety(const G4Three    208   virtual G4double ComputeSafety(const G4ThreeVector &globalpoint,
208                                  const G4doubl    209                                  const G4double pProposedMaxLength = DBL_MAX,
209                                  const G4bool     210                                  const G4bool keepState = true);
210     // Calculate the isotropic distance to the    211     // Calculate the isotropic distance to the nearest boundary from the
211     // specified point in the global coordinat    212     // specified point in the global coordinate system. 
212     // The globalpoint utilised must be within    213     // The globalpoint utilised must be within the current volume.
213     // The value returned is usually an undere    214     // The value returned is usually an underestimate.  
214     // The proposed maximum length is used to     215     // The proposed maximum length is used to avoid volume safety
215     //  calculations.  The geometry must be cl    216     //  calculations.  The geometry must be closed.
216     // To ensure minimum side effects from the    217     // To ensure minimum side effects from the call, keepState
217     //  must be true.                             218     //  must be true.
218                                                   219   
219   inline G4VPhysicalVolume* GetWorldVolume() c    220   inline G4VPhysicalVolume* GetWorldVolume() const;
220     // Return the current  world (`topmost') v    221     // Return the current  world (`topmost') volume.
221                                                   222 
222   inline void SetWorldVolume(G4VPhysicalVolume    223   inline void SetWorldVolume(G4VPhysicalVolume* pWorld);
223     // Set the world (`topmost') volume. This     224     // Set the world (`topmost') volume. This must be positioned at
224     // origin (0,0,0) and unrotated.              225     // origin (0,0,0) and unrotated.
225                                                   226 
                                                   >> 227   inline G4GRSVolume* CreateGRSVolume() const;
                                                   >> 228   inline G4GRSSolid* CreateGRSSolid() const; 
226   inline G4TouchableHistory* CreateTouchableHi    229   inline G4TouchableHistory* CreateTouchableHistory() const;
227   inline G4TouchableHistory* CreateTouchableHi    230   inline G4TouchableHistory* CreateTouchableHistory(const G4NavigationHistory*) const;
228     // `Touchable' creation methods: caller ha    231     // `Touchable' creation methods: caller has deletion responsibility.
229                                                   232 
230   virtual G4TouchableHandle CreateTouchableHis << 233   virtual G4TouchableHistoryHandle CreateTouchableHistoryHandle() const;
231     // Returns a reference counted handle to a    234     // Returns a reference counted handle to a touchable history.
232                                                   235 
233   virtual G4ThreeVector GetLocalExitNormal(G4b    236   virtual G4ThreeVector GetLocalExitNormal(G4bool* valid);
234   virtual G4ThreeVector GetLocalExitNormalAndC    237   virtual G4ThreeVector GetLocalExitNormalAndCheck(const G4ThreeVector& point,
235                                                   238                                                          G4bool* valid);
236   virtual G4ThreeVector GetGlobalExitNormal(co    239   virtual G4ThreeVector GetGlobalExitNormal(const G4ThreeVector& point,
237                                                   240                                                   G4bool* valid);
238     // Return Exit Surface Normal and validity    241     // Return Exit Surface Normal and validity too.
239     // Can only be called if the Navigator's l    242     // Can only be called if the Navigator's last Step has crossed a
240     // volume geometrical boundary.               243     // volume geometrical boundary.
241     // It returns the Normal to the surface po    244     // It returns the Normal to the surface pointing out of the volume that
242     // was left behind and/or into the volume     245     // was left behind and/or into the volume that was entered.
243     // Convention:                                246     // Convention:
244     //   The *local* normal is in the coordina    247     //   The *local* normal is in the coordinate system of the *final* volume.
245     // Restriction:                               248     // Restriction:
246     //   Normals are not available for replica    249     //   Normals are not available for replica volumes (returns valid= false)
247     // These methods takes full care about how    250     // These methods takes full care about how to calculate this normal,
248     // but if the surfaces are not convex it w    251     // but if the surfaces are not convex it will return valid=false.
249                                                   252 
250   inline G4int GetVerboseLevel() const;           253   inline G4int GetVerboseLevel() const;
251   inline void  SetVerboseLevel(G4int level);      254   inline void  SetVerboseLevel(G4int level);
252     // Get/Set Verbose(ness) level.               255     // Get/Set Verbose(ness) level.
253     // [if level>0 && G4VERBOSE, printout can     256     // [if level>0 && G4VERBOSE, printout can occur]
254                                                   257 
255   inline G4bool IsActive() const;                 258   inline G4bool IsActive() const;
256     // Verify if the navigator is active.         259     // Verify if the navigator is active.
257   inline void  Activate(G4bool flag);             260   inline void  Activate(G4bool flag);
258     // Activate/inactivate the navigator.         261     // Activate/inactivate the navigator.
259                                                   262 
260   inline G4bool EnteredDaughterVolume() const;    263   inline G4bool EnteredDaughterVolume() const;
261     // The purpose of this function is to info    264     // The purpose of this function is to inform the caller if the track is
262     // entering a daughter volume while exitin    265     // entering a daughter volume while exiting from the current volume.
263     // This method returns                        266     // This method returns 
264     // - True only in case 1) above, that is w    267     // - True only in case 1) above, that is when the Step has caused
265     //   the track to arrive at a boundary of     268     //   the track to arrive at a boundary of a daughter.
266     // - False in cases 2), 3) and 4), i.e. in    269     // - False in cases 2), 3) and 4), i.e. in all other cases.
267     // This function is not guaranteed to work    270     // This function is not guaranteed to work if SetGeometricallyLimitedStep()
268     // was not called when it should have been    271     // was not called when it should have been called.
269   inline G4bool ExitedMotherVolume() const;       272   inline G4bool ExitedMotherVolume() const;
270     // Verify if the step has exited the mothe    273     // Verify if the step has exited the mother volume.
271                                                   274 
272   inline void   CheckMode(G4bool mode);           275   inline void   CheckMode(G4bool mode);
273     // Run navigation in "check-mode", therefo    276     // Run navigation in "check-mode", therefore using additional
274     // verifications and more strict correctne    277     // verifications and more strict correctness conditions.
275     // Is effective only with G4VERBOSE set.      278     // Is effective only with G4VERBOSE set.
276   inline G4bool IsCheckModeActive() const;        279   inline G4bool IsCheckModeActive() const;
277   inline void   SetPushVerbosity(G4bool mode);    280   inline void   SetPushVerbosity(G4bool mode);
278     // Set/unset verbosity for pushed tracks (    281     // Set/unset verbosity for pushed tracks (default is true).
279                                                   282 
280   void PrintState() const;                        283   void PrintState() const;
281     // Print the internal state of the Navigat    284     // Print the internal state of the Navigator (for debugging).
282     // The level of detail is according to the    285     // The level of detail is according to the verbosity.
283                                                   286 
284   inline const G4AffineTransform& GetGlobalToL    287   inline const G4AffineTransform& GetGlobalToLocalTransform() const;
285   inline const G4AffineTransform  GetLocalToGl    288   inline const G4AffineTransform  GetLocalToGlobalTransform() const;
286     // Obtain the transformations Global/Local    289     // Obtain the transformations Global/Local (and inverse).
287     // Clients of these methods must copy the     290     // Clients of these methods must copy the data if they need to keep it.
288                                                   291 
289   G4AffineTransform GetMotherToDaughterTransfo    292   G4AffineTransform GetMotherToDaughterTransform(G4VPhysicalVolume* dVolume, 
290                                                   293                                                  G4int dReplicaNo,
291                                                   294                                                  EVolume dVolumeType );
292     // Obtain mother to daughter transformatio    295     // Obtain mother to daughter transformation
293                                                   296 
294   inline void ResetStackAndState();               297   inline void ResetStackAndState();
295     // Reset stack and minimum or navigator st    298     // Reset stack and minimum or navigator state machine necessary for reset
296     // as needed by LocalGlobalPointAndSetup.     299     // as needed by LocalGlobalPointAndSetup.
297     // [Does not perform clears, resizes, or r    300     // [Does not perform clears, resizes, or reset fLastLocatedPointLocal]
298                                                   301 
299   inline G4int SeverityOfZeroStepping( G4int*     302   inline G4int SeverityOfZeroStepping( G4int* noZeroSteps ) const; 
300     // Report on severity of error and number     303     // Report on severity of error and number of zero steps,
301     // in case Navigator is stuck and is retur    304     // in case Navigator is stuck and is returning zero steps.
302     // Values: 1 (small problem),  5 (correcti    305     // Values: 1 (small problem),  5 (correcting), 
303     //         9 (ready to abandon), 10 (aband    306     //         9 (ready to abandon), 10 (abandoned)
304                                                   307 
305   void SetSavedState();                           308   void SetSavedState(); 
306     // ( fValidExitNormal, fExitNormal, fExiti    309     // ( fValidExitNormal, fExitNormal, fExiting, fEntering, 
307     //   fBlockedPhysicalVolume, fBlockedRepli    310     //   fBlockedPhysicalVolume, fBlockedReplicaNo, fLastStepWasZero); 
308   void RestoreSavedState();                       311   void RestoreSavedState(); 
309     // Copy aspects of the state, to enable a     312     // Copy aspects of the state, to enable a non-state changing
310     //  call to ComputeStep                       313     //  call to ComputeStep
311                                                   314 
312   inline G4ThreeVector GetCurrentLocalCoordina    315   inline G4ThreeVector GetCurrentLocalCoordinate() const;
313     // Return the local coordinate of the poin    316     // Return the local coordinate of the point in the reference system
314     // of its containing volume that was found    317     // of its containing volume that was found by LocalGlobalPointAndSetup.
315     // The local coordinate of the last locate    318     // The local coordinate of the last located track.
316                                                   319 
317   inline G4ThreeVector NetTranslation() const;    320   inline G4ThreeVector NetTranslation() const;
318   inline G4RotationMatrix NetRotation() const;    321   inline G4RotationMatrix NetRotation() const;
319     // Compute+return the local->global transl    322     // Compute+return the local->global translation/rotation of current volume.
320                                                   323 
321   inline void EnableBestSafety( G4bool value=     324   inline void EnableBestSafety( G4bool value= false );
322     // Enable best-possible evaluation of isot    325     // Enable best-possible evaluation of isotropic safety
323                                                   326 
324   virtual void ResetState();                      327   virtual void ResetState();
325     // Utility method to reset the navigator s    328     // Utility method to reset the navigator state machine.
326                                                   329 
327  protected:  // with description                  330  protected:  // with description
328                                                   331 
329   inline G4ThreeVector ComputeLocalPoint(const    332   inline G4ThreeVector ComputeLocalPoint(const G4ThreeVector& rGlobPoint) const;
330     // Return position vector in local coordin    333     // Return position vector in local coordinate system, given a position
331     // vector in world coordinate system.         334     // vector in world coordinate system.
332                                                   335 
333   inline G4ThreeVector ComputeLocalAxis(const     336   inline G4ThreeVector ComputeLocalAxis(const G4ThreeVector& pVec) const;
334     // Return the local direction of the speci    337     // Return the local direction of the specified vector in the reference
335     // system of the volume that was found by     338     // system of the volume that was found by LocalGlobalPointAndSetup.
336     // The Local Coordinates of point in world    339     // The Local Coordinates of point in world coordinate system.
337                                                   340 
338   inline EVolume VolumeType(const G4VPhysicalV    341   inline EVolume VolumeType(const G4VPhysicalVolume *pVol) const;
339     // Characterise `type' of volume - normal/    342     // Characterise `type' of volume - normal/replicated/parameterised.
340                                                   343 
341   inline EVolume CharacteriseDaughters(const G    344   inline EVolume CharacteriseDaughters(const G4LogicalVolume *pLog) const;
342     // Characterise daughter of logical volume    345     // Characterise daughter of logical volume.
343                                                   346 
344   inline G4int GetDaughtersRegularStructureId(    347   inline G4int GetDaughtersRegularStructureId(const G4LogicalVolume *pLog) const;
345     // Get regular structure ID of first daugh    348     // Get regular structure ID of first daughter
346                                                   349 
347   virtual void SetupHierarchy();                  350   virtual void SetupHierarchy();
348     // Renavigate & reset hierarchy described     351     // Renavigate & reset hierarchy described by current history
349     // o Reset volumes                            352     // o Reset volumes
350     // o Recompute transforms and/or solids of    353     // o Recompute transforms and/or solids of replicated/parameterised
351     //   volumes.                                 354     //   volumes.
352                                                   355 
353  private:                                         356  private:
354                                                   357 
                                                   >> 358   G4ITNavigator1(const G4ITNavigator1&);
                                                   >> 359   G4ITNavigator1& operator=(const G4ITNavigator1&);
                                                   >> 360     // Private copy-constructor and assignment operator.
                                                   >> 361 
355   void ComputeStepLog(const G4ThreeVector& pGl    362   void ComputeStepLog(const G4ThreeVector& pGlobalpoint,
356                             G4double moveLenSq    363                             G4double moveLenSq) const;
357     // Log and checks for steps larger than th    364     // Log and checks for steps larger than the tolerance
358                                                   365 
359  protected:  // without description               366  protected:  // without description
360                                                   367 
361   G4double kCarTolerance;                         368   G4double kCarTolerance;
362     // Geometrical tolerance for surface thick    369     // Geometrical tolerance for surface thickness of shapes.
363                                                   370 
364   //                                              371   //
365   // BEGIN State information                      372   // BEGIN State information
366   //                                              373   //
367                                                   374 
368   G4NavigationHistory fHistory;                   375   G4NavigationHistory fHistory;
369     // Transformation and history of the curre    376     // Transformation and history of the current path
370     // through the geometrical hierarchy.         377     // through the geometrical hierarchy.
371                                                   378 
372   G4bool fEnteredDaughter;                        379   G4bool fEnteredDaughter;
373     // A memory of whether in this Step a daug    380     // A memory of whether in this Step a daughter volume is entered 
374     // (set in Compute & Locate).                 381     // (set in Compute & Locate).
375     //  After Compute: it expects to enter a d    382     //  After Compute: it expects to enter a daughter
376     //  After Locate:  it has entered a daught    383     //  After Locate:  it has entered a daughter
377                                                   384 
378   G4bool fExitedMother;                           385   G4bool fExitedMother;
379     // A similar memory whether the Step exite    386     // A similar memory whether the Step exited current "mother" volume
380     // completely, not entering daughter.         387     // completely, not entering daughter.
381                                                   388 
382   G4bool fWasLimitedByGeometry{false};         << 389   G4bool fWasLimitedByGeometry;
383     // Set true if last Step was limited by ge    390     // Set true if last Step was limited by geometry.
384                                                   391 
385   G4ThreeVector fStepEndPoint;                    392   G4ThreeVector fStepEndPoint;
386     // Endpoint of last ComputeStep               393     // Endpoint of last ComputeStep 
387     // can be used for optimisation (e.g. when    394     // can be used for optimisation (e.g. when computing safety).
388   G4ThreeVector fLastStepEndPointLocal;           395   G4ThreeVector fLastStepEndPointLocal; 
389     // Position of the end-point of the last c    396     // Position of the end-point of the last call to ComputeStep 
390     // in last Local coordinates.                 397     // in last Local coordinates.
391                                                   398 
392   G4int  fVerbose{0};                          << 399   G4int  fVerbose;
393     // Verbose(ness) level  [if > 0, printout     400     // Verbose(ness) level  [if > 0, printout can occur].
394                                                   401 
395  private:                                         402  private:
396                                                   403 
397   G4bool fActive;                                 404   G4bool fActive;
398     // States if the navigator is activated or    405     // States if the navigator is activated or not.
399                                                   406 
400   G4bool fLastTriedStepComputation;               407   G4bool fLastTriedStepComputation; 
401     // Whether ComputeStep was called since th    408     // Whether ComputeStep was called since the last call to a Locate method
402     // Uses: - distinguish parts of state whic    409     // Uses: - distinguish parts of state which differ before/after calls
403     //         to ComputeStep or one of the Lo    410     //         to ComputeStep or one of the Locate methods;
404     //       - avoid two consecutive calls to     411     //       - avoid two consecutive calls to compute-step (illegal).
405                                                   412 
406   G4bool fEntering,fExiting;                      413   G4bool fEntering,fExiting;
407     // Entering/Exiting volumes blocking/setup    414     // Entering/Exiting volumes blocking/setup
408     // o If exiting                               415     // o If exiting
409     //      volume ptr & replica number (set &    416     //      volume ptr & replica number (set & used by Locate..())
410     //      used for blocking on redescent of     417     //      used for blocking on redescent of geometry
411     // o If entering                              418     // o If entering
412     //      volume ptr & replica number (set b    419     //      volume ptr & replica number (set by ComputeStep(),used by
413     //      Locate..()) of volume for `automat    420     //      Locate..()) of volume for `automatic' entry
414                                                   421 
415   G4VPhysicalVolume *fBlockedPhysicalVolume;      422   G4VPhysicalVolume *fBlockedPhysicalVolume;
416   G4int fBlockedReplicaNo;                        423   G4int fBlockedReplicaNo;
417                                                   424 
418   G4ThreeVector fLastLocatedPointLocal;           425   G4ThreeVector fLastLocatedPointLocal;
419     // Position of the last located point rela    426     // Position of the last located point relative to its containing volume.
420   G4bool fLocatedOutsideWorld;                    427   G4bool fLocatedOutsideWorld;
421     // Whether the last call to Locate methods    428     // Whether the last call to Locate methods left the world
422                                                   429 
423   G4bool fValidExitNormal;    // Set true if h    430   G4bool fValidExitNormal;    // Set true if have leaving volume normal
424   G4ThreeVector fExitNormal;  // Leaving volum    431   G4ThreeVector fExitNormal;  // Leaving volume normal, in the
425                               // volume contai    432                               // volume containing the exited
426                               // volume's coor    433                               // volume's coordinate system
427   G4ThreeVector fGrandMotherExitNormal;  // Le    434   G4ThreeVector fGrandMotherExitNormal;  // Leaving volume normal, in its 
428                                          // ow    435                                          // own coordinate system
429   G4bool  fChangedGrandMotherRefFrame;   // Wh    436   G4bool  fChangedGrandMotherRefFrame;   // Whether frame is changed
430                                                   437 
431   G4ThreeVector fExitNormalGlobalFrame;  // Le    438   G4ThreeVector fExitNormalGlobalFrame;  // Leaving volume normal, in the
432                                          // gl    439                                          // global coordinate system
433   G4bool  fCalculatedExitNormal;  // Has it be    440   G4bool  fCalculatedExitNormal;  // Has it been computed since
434                                   // the last     441                                   // the last call to ComputeStep
435                                   // Covers bo    442                                   // Covers both Global and GrandMother
436                                                   443    
437   // Count zero steps - as one or two can occu    444   // Count zero steps - as one or two can occur due to changing momentum at
438   //                    a boundary or at an ed    445   //                    a boundary or at an edge common between volumes
439   //                  - several are likely a p    446   //                  - several are likely a problem in the geometry
440   //                    description or in the     447   //                    description or in the navigation
441   //                                              448   //
442   G4bool fLastStepWasZero;                        449   G4bool fLastStepWasZero;
443     // Whether the last ComputeStep moved Zero    450     // Whether the last ComputeStep moved Zero. Used to check for edges.
444                                                   451 
445   G4bool fLocatedOnEdge;                          452   G4bool fLocatedOnEdge;       
446     // Whether the Navigator has detected an e    453     // Whether the Navigator has detected an edge
447   G4int fNumberZeroSteps;                         454   G4int fNumberZeroSteps;
448     // Number of preceding moves that were Zer    455     // Number of preceding moves that were Zero. Reset to 0 after finite step
449   G4int fActionThreshold_NoZeroSteps;             456   G4int fActionThreshold_NoZeroSteps;  
450     // After this many failed/zero steps, act     457     // After this many failed/zero steps, act (push etc) 
451   G4int fAbandonThreshold_NoZeroSteps;            458   G4int fAbandonThreshold_NoZeroSteps; 
452     // After this many failed/zero steps, aban    459     // After this many failed/zero steps, abandon track
453                                                   460 
454   G4ThreeVector  fPreviousSftOrigin;              461   G4ThreeVector  fPreviousSftOrigin;
455   G4double       fPreviousSafety;                 462   G4double       fPreviousSafety; 
456     // Memory of last safety origin & value. U    463     // Memory of last safety origin & value. Used in ComputeStep to ensure
457     // that origin of current Step is in the s    464     // that origin of current Step is in the same volume as the point of the
458     // last relocation                            465     // last relocation
459                                                   466 
460   //                                              467   //
461   // END State information                        468   // END State information
462   //                                              469   //
463                                                   470 
464   // Save key state information (NOT the navig    471   // Save key state information (NOT the navigation history stack)
465   //                                              472   //
466   struct G4SaveNavigatorState : public G4ITNav    473   struct G4SaveNavigatorState : public G4ITNavigatorState_Lock1
467   {                                               474   { 
468      G4SaveNavigatorState();                      475      G4SaveNavigatorState();
469      ~G4SaveNavigatorState() override= default << 476      virtual ~G4SaveNavigatorState(){;}
470      G4ThreeVector sExitNormal;                   477      G4ThreeVector sExitNormal;  
471      G4bool sValidExitNormal;                     478      G4bool sValidExitNormal;    
472      G4bool sEntering, sExiting;                  479      G4bool sEntering, sExiting;
473      G4VPhysicalVolume* spBlockedPhysicalVolum    480      G4VPhysicalVolume* spBlockedPhysicalVolume;
474      G4int sBlockedReplicaNo;                     481      G4int sBlockedReplicaNo;  
475      G4int sLastStepWasZero;                      482      G4int sLastStepWasZero; 
476                                                   483 
477      // !>                                        484      // !>
478      G4bool sLocatedOnEdge;                       485      G4bool sLocatedOnEdge;
479      G4bool sWasLimitedByGeometry;                486      G4bool sWasLimitedByGeometry;
480      G4bool sPushed;                              487      G4bool sPushed;
481      G4int  sNumberZeroSteps;                     488      G4int  sNumberZeroSteps;
482      // <!                                        489      // <!
483                                                   490 
484      //  Potentially relevant                     491      //  Potentially relevant
485      //                                           492      //
486      G4bool sLocatedOutsideWorld;                 493      G4bool sLocatedOutsideWorld;
487      G4ThreeVector sLastLocatedPointLocal;        494      G4ThreeVector sLastLocatedPointLocal; 
488      G4bool sEnteredDaughter, sExitedMother;      495      G4bool sEnteredDaughter, sExitedMother;
489      G4ThreeVector  sPreviousSftOrigin;           496      G4ThreeVector  sPreviousSftOrigin;
490      G4double       sPreviousSafety;              497      G4double       sPreviousSafety; 
491   } ;                                             498   } ;
492                                                   499 
493   G4SaveNavigatorState* fpSaveState;              500   G4SaveNavigatorState* fpSaveState;
494                                                   501 
495                                                   502 
496   // Tracking Invariants                          503   // Tracking Invariants
497   //                                              504   //
498   G4VPhysicalVolume  *fTopPhysical{nullptr};   << 505   G4VPhysicalVolume  *fTopPhysical;
499     // A link to the topmost physical volume i    506     // A link to the topmost physical volume in the detector.
500     // Must be positioned at the origin and un    507     // Must be positioned at the origin and unrotated.
501                                                   508 
502   // Utility information                          509   // Utility information
503   //                                              510   //
504   G4bool fCheck{false};                        << 511   G4bool fCheck;
505     // Check-mode flag  [if true, more strict     512     // Check-mode flag  [if true, more strict checks are performed].
506   G4bool fPushed{false}, fWarnPush{true};      << 513   G4bool fPushed, fWarnPush;
507     // Push flags  [if true, means a stuck par    514     // Push flags  [if true, means a stuck particle has been pushed].
508                                                   515 
509   // Helpers/Utility classes                      516   // Helpers/Utility classes
510   //                                              517   //
511   G4NormalNavigation  fnormalNav;                 518   G4NormalNavigation  fnormalNav;
512   G4VoxelNavigation fvoxelNav;                    519   G4VoxelNavigation fvoxelNav;
513   G4ParameterisedNavigation fparamNav;            520   G4ParameterisedNavigation fparamNav;
514   G4ReplicaNavigation freplicaNav;                521   G4ReplicaNavigation freplicaNav;
515   G4RegularNavigation fregularNav;                522   G4RegularNavigation fregularNav;
516   G4VoxelSafety       *fpVoxelSafety;             523   G4VoxelSafety       *fpVoxelSafety;
517 };                                                524 };
518                                                   525 
519 #include "G4ITNavigator1.icc"                     526 #include "G4ITNavigator1.icc"
520                                                   527 
521 #endif                                            528 #endif
522                                                   529 
523                                                   530 
524 // NOTES:                                         531 // NOTES:
525 //                                                532 //
526 // The following methods provide detailed info    533 // The following methods provide detailed information when a Step has
527 // arrived at a geometrical boundary.  They di    534 // arrived at a geometrical boundary.  They distinguish between the different
528 // causes that can result in the track leaving    535 // causes that can result in the track leaving its current volume.
529 //                                                536 //
530 // Four cases are possible:                       537 // Four cases are possible:
531 //                                                538 //
532 // 1) The particle has reached a boundary of a    539 // 1) The particle has reached a boundary of a daughter of the current volume:
533 //     (this could cause the relocation to ent    540 //     (this could cause the relocation to enter the daughter itself
534 //     or a potential granddaughter or further    541 //     or a potential granddaughter or further descendant)
535 //                                                542 //     
536 // 2) The particle has reached a boundary of t    543 // 2) The particle has reached a boundary of the current
537 //     volume, exiting into a mother (regardle    544 //     volume, exiting into a mother (regardless the level
538 //     at which it is located in the tree):       545 //     at which it is located in the tree):
539 //                                                546 //
540 // 3) The particle has reached a boundary of t    547 // 3) The particle has reached a boundary of the current
541 //     volume, exiting into a volume which is     548 //     volume, exiting into a volume which is not in its
542 //     parental hierarchy:                        549 //     parental hierarchy:
543 //                                                550 //
544 // 4) The particle is not on a boundary betwee    551 // 4) The particle is not on a boundary between volumes:
545 //     the function returns an exception, and     552 //     the function returns an exception, and the caller is
546 //     reccomended to compare the G4touchables    553 //     reccomended to compare the G4touchables associated
547 //     to the preStepPoint and postStepPoint t    554 //     to the preStepPoint and postStepPoint to handle this case.
548 //                                                555 //
549 //   G4bool        EnteredDaughterVolume()        556 //   G4bool        EnteredDaughterVolume()
550 //   G4bool        IsExitNormalValid()            557 //   G4bool        IsExitNormalValid()
551 //   G4ThreeVector GetLocalExitNormal()           558 //   G4ThreeVector GetLocalExitNormal()
552 //                                                559 //
553 // The expected usefulness of these methods is    560 // The expected usefulness of these methods is to allow the caller to
554 // determine how to compute the surface normal    561 // determine how to compute the surface normal at the volume boundary. The two
555 // possibilities are to obtain the normal from    562 // possibilities are to obtain the normal from:
556 //                                                563 //
557 //   i) the solid associated with the volume o    564 //   i) the solid associated with the volume of the initial point of the Step.
558 //      This is valid for cases 2 and 3.          565 //      This is valid for cases 2 and 3.  
559 //      (Note that the initial point is genera    566 //      (Note that the initial point is generally the PreStepPoint of a Step).
560 //   or                                           567 //   or
561 //                                                568 // 
562 //  ii) the solid of the final point, ie of th    569 //  ii) the solid of the final point, ie of the volume after the relocation.
563 //      This is valid for case 1.                 570 //      This is valid for case 1.
564 //      (Note that the final point is generall    571 //      (Note that the final point is generally the PreStepPoint of a Step).
565 //                                                572 //
566 // This way the caller can always get a valid     573 // This way the caller can always get a valid normal, pointing outside
567 // the solid for which it is computed, that ca    574 // the solid for which it is computed, that can be used at his own
568 // discretion.                                    575 // discretion.
569                                                   576