Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/geometry/navigation/include/G4Navigator.icc

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 /geometry/navigation/include/G4Navigator.icc (Version 11.3.0) and /geometry/navigation/include/G4Navigator.icc (Version 9.6.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 // G4Navigator class Inline implementation     << 
 27 //                                                 26 //
 28 // ------------------------------------------- <<  27 // $Id$
                                                   >>  28 //
                                                   >>  29 // 
                                                   >>  30 // class G4Navigator Inline implementation
                                                   >>  31 //
                                                   >>  32 // ********************************************************************
 29                                                    33 
 30 // *******************************************     34 // ********************************************************************
 31 // GetCurrentLocalCoordinate                       35 // GetCurrentLocalCoordinate
 32 //                                                 36 //
 33 // Returns the local coordinate of the current     37 // Returns the local coordinate of the current track
 34 // *******************************************     38 // ********************************************************************
 35 //                                                 39 //
 36 inline                                             40 inline
 37 G4ThreeVector G4Navigator::GetCurrentLocalCoor     41 G4ThreeVector G4Navigator::GetCurrentLocalCoordinate() const
 38 {                                                  42 {
 39   return fLastLocatedPointLocal;                   43   return fLastLocatedPointLocal;
 40 }                                                  44 }
 41                                                    45 
 42 // *******************************************     46 // ********************************************************************
 43 // ComputeLocalAxis                                47 // ComputeLocalAxis
 44 //                                                 48 //
 45 // Returns local direction of vector direction     49 // Returns local direction of vector direction in world coord system
 46 // *******************************************     50 // ********************************************************************
 47 //                                                 51 //
 48 inline                                             52 inline
 49 G4ThreeVector G4Navigator::ComputeLocalAxis(co     53 G4ThreeVector G4Navigator::ComputeLocalAxis(const G4ThreeVector& pVec) const
 50 {                                                  54 {
 51   return fHistory.GetTopTransform().TransformA <<  55   return (fHistory.GetTopTransform().IsRotated())
                                                   >>  56          ? fHistory.GetTopTransform().TransformAxis(pVec) : pVec ;
 52 }                                                  57 }
 53                                                    58 
 54 // *******************************************     59 // ********************************************************************
 55 // ComputeLocalPoint                               60 // ComputeLocalPoint
 56 //                                                 61 //
 57 // Returns local coordinates of a point in the     62 // Returns local coordinates of a point in the world coord system
 58 // *******************************************     63 // ********************************************************************
 59 //                                                 64 //
 60 inline                                             65 inline
 61 G4ThreeVector                                      66 G4ThreeVector
 62 G4Navigator::ComputeLocalPoint(const G4ThreeVe     67 G4Navigator::ComputeLocalPoint(const G4ThreeVector& pGlobalPoint) const
 63 {                                                  68 {
 64   return fHistory.GetTopTransform().TransformP <<  69   return ( fHistory.GetTopTransform().TransformPoint(pGlobalPoint) ) ;
 65 }                                                  70 }
 66                                                    71 
 67 // *******************************************     72 // ********************************************************************
 68 // GetWorldVolume                                  73 // GetWorldVolume
 69 //                                                 74 //
 70 // Returns the current  world (`topmost') volu     75 // Returns the current  world (`topmost') volume
 71 // *******************************************     76 // ********************************************************************
 72 //                                                 77 //
 73 inline                                             78 inline
 74 G4VPhysicalVolume* G4Navigator::GetWorldVolume     79 G4VPhysicalVolume* G4Navigator::GetWorldVolume() const
 75 {                                                  80 {
 76   return fTopPhysical;                             81   return fTopPhysical;
 77 }                                                  82 }
 78                                                    83 
 79 // *******************************************     84 // ********************************************************************
 80 // SetWorldVolume                                  85 // SetWorldVolume
 81 //                                                 86 //
 82 // Sets the world (`topmost') volume               87 // Sets the world (`topmost') volume
 83 // *******************************************     88 // ********************************************************************
 84 //                                                 89 //
 85 inline                                             90 inline
 86 void G4Navigator::SetWorldVolume(G4VPhysicalVo     91 void G4Navigator::SetWorldVolume(G4VPhysicalVolume* pWorld)
 87 {                                                  92 {
 88   if ( !(pWorld->GetTranslation() == G4ThreeVe <<  93   if ( !(pWorld->GetTranslation()==G4ThreeVector(0,0,0)) )
 89   {                                                94   {
 90     G4Exception ("G4Navigator::SetWorldVolume(     95     G4Exception ("G4Navigator::SetWorldVolume()", "GeomNav0002",
 91                  FatalException, "Volume must      96                  FatalException, "Volume must be centered on the origin.");
 92   }                                                97   }
 93   const G4RotationMatrix* rm = pWorld->GetRota     98   const G4RotationMatrix* rm = pWorld->GetRotation();
 94   if ( (rm != nullptr) && (!rm->isIdentity())  <<  99   if ( rm && (!rm->isIdentity()) )
 95   {                                               100   {
 96     G4Exception ("G4Navigator::SetWorldVolume(    101     G4Exception ("G4Navigator::SetWorldVolume()", "GeomNav0002",
 97                  FatalException, "Volume must     102                  FatalException, "Volume must not be rotated.");
 98   }                                               103   }
 99   fTopPhysical = pWorld;                          104   fTopPhysical = pWorld;
100   fHistory.SetFirstEntry(pWorld);                 105   fHistory.SetFirstEntry(pWorld);
101 }                                                 106 }
102                                                   107 
103 // *******************************************    108 // ********************************************************************
104 // SetGeometrycallyLimitedStep                    109 // SetGeometrycallyLimitedStep
105 //                                                110 //
106 // Informs the navigator that the previous Ste    111 // Informs the navigator that the previous Step calculated
107 // by the geometry was taken in its entirety      112 // by the geometry was taken in its entirety
108 // *******************************************    113 // ********************************************************************
109 //                                                114 //
110 inline                                            115 inline
111 void G4Navigator::SetGeometricallyLimitedStep(    116 void G4Navigator::SetGeometricallyLimitedStep()
112 {                                                 117 {
113   fWasLimitedByGeometry = true;                << 118   fWasLimitedByGeometry=true;
114 }                                                 119 }
115                                                   120 
116 // *******************************************    121 // ********************************************************************
117 // ResetStackAndState                             122 // ResetStackAndState
118 //                                                123 //
119 // Resets stack and minimum of navigator state    124 // Resets stack and minimum of navigator state `machine'
120 // *******************************************    125 // ********************************************************************
121 //                                                126 //
122 inline                                            127 inline
123 void G4Navigator::ResetStackAndState()            128 void G4Navigator::ResetStackAndState()
124 {                                                 129 {
125   fHistory.Reset();                               130   fHistory.Reset();
126   ResetState();                                   131   ResetState();
127 }                                                 132 }
128                                                   133 
129 // *******************************************    134 // ********************************************************************
130 // VolumeType                                     135 // VolumeType
131 // *******************************************    136 // ********************************************************************
132 //                                                137 //
133 inline                                            138 inline
134 EVolume G4Navigator::VolumeType(const G4VPhysi    139 EVolume G4Navigator::VolumeType(const G4VPhysicalVolume *pVol) const
135 {                                                 140 {
136   return pVol->VolumeType();                   << 141   EVolume type;
                                                   >> 142   EAxis axis;
                                                   >> 143   G4int nReplicas;
                                                   >> 144   G4double width,offset;
                                                   >> 145   G4bool consuming;
                                                   >> 146   if ( pVol->IsReplicated() )
                                                   >> 147   {
                                                   >> 148     pVol->GetReplicationData(axis,nReplicas,width,offset,consuming);
                                                   >> 149     type = (consuming) ? kReplica : kParameterised;
                                                   >> 150   }
                                                   >> 151   else
                                                   >> 152   {
                                                   >> 153     type = kNormal;
                                                   >> 154   }
                                                   >> 155   return type;
137 }                                                 156 }
138                                                   157 
139 // *******************************************    158 // ********************************************************************
140 // CharacteriseDaughters                          159 // CharacteriseDaughters
141 // *******************************************    160 // ********************************************************************
142 //                                                161 //
143 inline                                            162 inline
144 EVolume G4Navigator::CharacteriseDaughters(con    163 EVolume G4Navigator::CharacteriseDaughters(const G4LogicalVolume *pLog) const
145 {                                                 164 {
146   return pLog->CharacteriseDaughters();        << 165   EVolume type;
                                                   >> 166   EAxis axis;
                                                   >> 167   G4int nReplicas;
                                                   >> 168   G4double width,offset;
                                                   >> 169   G4bool consuming;
                                                   >> 170   G4VPhysicalVolume *pVol;
                                                   >> 171 
                                                   >> 172   if ( pLog->GetNoDaughters()==1 )
                                                   >> 173   {
                                                   >> 174     pVol = pLog->GetDaughter(0);
                                                   >> 175     if (pVol->IsReplicated())
                                                   >> 176     {
                                                   >> 177       pVol->GetReplicationData(axis,nReplicas,width,offset,consuming);
                                                   >> 178       type = (consuming) ? kReplica : kParameterised;
                                                   >> 179     }
                                                   >> 180     else
                                                   >> 181     {
                                                   >> 182       type = kNormal;
                                                   >> 183     }
                                                   >> 184   }
                                                   >> 185   else
                                                   >> 186   {
                                                   >> 187     type = kNormal;
                                                   >> 188   }
                                                   >> 189   return type;
147 }                                                 190 }
148                                                   191 
149 // *******************************************    192 // ********************************************************************
150 // GetDaughtersRegularStructureId                 193 // GetDaughtersRegularStructureId
151 // *******************************************    194 // ********************************************************************
152 //                                                195 //
153 inline                                            196 inline
154 G4int G4Navigator::                               197 G4int G4Navigator::
155 GetDaughtersRegularStructureId(const G4Logical    198 GetDaughtersRegularStructureId(const G4LogicalVolume *pLog) const
156 {                                                 199 {
157   G4int regId = 0;                                200   G4int regId = 0;
158   G4VPhysicalVolume *pVol;                        201   G4VPhysicalVolume *pVol;
159                                                   202 
160   if ( pLog->GetNoDaughters() == 1 )           << 203   if ( pLog->GetNoDaughters()==1 )
161   {                                               204   {
162     pVol = pLog->GetDaughter(0);                  205     pVol = pLog->GetDaughter(0);
163     regId = pVol->GetRegularStructureId();        206     regId = pVol->GetRegularStructureId();
164   }                                               207   }
165   return regId;                                   208   return regId;
166 }                                                 209 }
167                                                   210 
168 // *******************************************    211 // ********************************************************************
169 // GetGlobalToLocalTransform                      212 // GetGlobalToLocalTransform
170 //                                                213 //
171 // Returns local to global transformation.        214 // Returns local to global transformation.
172 // I.e. transformation that will take point or    215 // I.e. transformation that will take point or axis in world coord system
173 // and return one in the local coord system       216 // and return one in the local coord system
174 // *******************************************    217 // ********************************************************************
175 //                                                218 //
176 inline                                            219 inline
177 const G4AffineTransform& G4Navigator::GetGloba    220 const G4AffineTransform& G4Navigator::GetGlobalToLocalTransform() const
178 {                                                 221 {
179   return fHistory.GetTopTransform();              222   return fHistory.GetTopTransform();
180 }                                                 223 }
181                                                   224 
182 // *******************************************    225 // ********************************************************************
183 // GetLocalToGlobalTransform                      226 // GetLocalToGlobalTransform
184 //                                                227 //
185 // Returns global to local transformation         228 // Returns global to local transformation 
186 // *******************************************    229 // ********************************************************************
187 //                                                230 //
188 inline                                            231 inline
189 const G4AffineTransform G4Navigator::GetLocalT    232 const G4AffineTransform G4Navigator::GetLocalToGlobalTransform() const
190 {                                                 233 {
191   return fHistory.GetTopTransform().Inverse(); << 234   G4AffineTransform  tempTransform;
                                                   >> 235   tempTransform = fHistory.GetTopTransform().Inverse(); 
                                                   >> 236   return tempTransform;
192 }                                                 237 }
193                                                   238 
194 // *******************************************    239 // ********************************************************************
195 // NetTranslation                                 240 // NetTranslation
196 //                                                241 //
197 // Computes+returns the local->global translat    242 // Computes+returns the local->global translation of current volume
198 // *******************************************    243 // ********************************************************************
199 //                                                244 //
200 inline                                            245 inline
201 G4ThreeVector G4Navigator::NetTranslation() co    246 G4ThreeVector G4Navigator::NetTranslation() const
202 {                                                 247 {
203   return fHistory.GetTopTransform().InverseNet << 248   G4AffineTransform tf(fHistory.GetTopTransform().Inverse());
                                                   >> 249   return tf.NetTranslation();
204 }                                                 250 }
205                                                   251 
206 // *******************************************    252 // ********************************************************************
207 // NetRotation                                    253 // NetRotation
208 //                                                254 //
209 // Computes+returns the local->global rotation    255 // Computes+returns the local->global rotation of current volume
210 // *******************************************    256 // ********************************************************************
211 //                                                257 //
212 inline                                            258 inline
213 G4RotationMatrix G4Navigator::NetRotation() co    259 G4RotationMatrix G4Navigator::NetRotation() const
214 {                                                 260 {
215   return fHistory.GetTopTransform().InverseNet << 261   G4AffineTransform tf(fHistory.GetTopTransform().Inverse());
                                                   >> 262   return tf.NetRotation();
                                                   >> 263 }
                                                   >> 264 
                                                   >> 265 // ********************************************************************
                                                   >> 266 // CreateGRSVolume
                                                   >> 267 //
                                                   >> 268 // `Touchable' creation method: caller has deletion responsibility
                                                   >> 269 // ********************************************************************
                                                   >> 270 //
                                                   >> 271 inline
                                                   >> 272 G4GRSVolume* G4Navigator::CreateGRSVolume() const
                                                   >> 273 {
                                                   >> 274   G4AffineTransform tf(fHistory.GetTopTransform().Inverse());
                                                   >> 275   return new G4GRSVolume(fHistory.GetTopVolume(),
                                                   >> 276                          tf.NetRotation(),
                                                   >> 277                          tf.NetTranslation());
                                                   >> 278 }
                                                   >> 279 
                                                   >> 280 // ********************************************************************
                                                   >> 281 // CreateGRSSolid
                                                   >> 282 //
                                                   >> 283 // `Touchable' creation method: caller has deletion responsibility
                                                   >> 284 // ********************************************************************
                                                   >> 285 //
                                                   >> 286 inline
                                                   >> 287 G4GRSSolid* G4Navigator::CreateGRSSolid() const
                                                   >> 288 {
                                                   >> 289   G4AffineTransform tf(fHistory.GetTopTransform().Inverse());
                                                   >> 290   return new G4GRSSolid(fHistory.GetTopVolume()->GetLogicalVolume()->GetSolid(),
                                                   >> 291                         tf.NetRotation(),
                                                   >> 292                         tf.NetTranslation());
216 }                                                 293 }
217                                                   294 
218 // *******************************************    295 // ********************************************************************
219 // CreateTouchableHistory                         296 // CreateTouchableHistory
220 //                                                297 //
221 // `Touchable' creation method: caller has del    298 // `Touchable' creation method: caller has deletion responsibility
222 // *******************************************    299 // ********************************************************************
223 //                                                300 //
224 inline                                            301 inline
225 G4TouchableHistory* G4Navigator::CreateTouchab    302 G4TouchableHistory* G4Navigator::CreateTouchableHistory() const
226 {                                                 303 {
227   return new G4TouchableHistory(fHistory);        304   return new G4TouchableHistory(fHistory);
228 }                                                 305 }
229                                                   306 
230 // *******************************************    307 // ********************************************************************
231 // CreateTouchableHistory(history)                308 // CreateTouchableHistory(history)
232 //                                                309 //
233 // `Touchable' creation method: caller has del    310 // `Touchable' creation method: caller has deletion responsibility
234 // *******************************************    311 // ********************************************************************
235 //                                                312 //
236 inline                                            313 inline
237 G4TouchableHistory*                               314 G4TouchableHistory*
238 G4Navigator::CreateTouchableHistory(const G4Na    315 G4Navigator::CreateTouchableHistory(const G4NavigationHistory* history) const
239 {                                                 316 {
240   return new G4TouchableHistory(*history);        317   return new G4TouchableHistory(*history);
241 }                                                 318 }
242                                                   319 
243 // *******************************************    320 // ********************************************************************
244 // LocateGlobalPointAndUpdateTouchableHandle      321 // LocateGlobalPointAndUpdateTouchableHandle
245 // *******************************************    322 // ********************************************************************
246 //                                                323 //
247 inline                                            324 inline
248 void G4Navigator::LocateGlobalPointAndUpdateTo    325 void G4Navigator::LocateGlobalPointAndUpdateTouchableHandle(
249                                const G4ThreeVe    326                                const G4ThreeVector&       position,
250                                const G4ThreeVe    327                                const G4ThreeVector&       direction,
251                                      G4Touchab    328                                      G4TouchableHandle&   oldTouchableToUpdate,
252                                const G4bool       329                                const G4bool               RelativeSearch )
253 {                                                 330 {
254   G4VPhysicalVolume* pPhysVol;                    331   G4VPhysicalVolume* pPhysVol;
255   pPhysVol = LocateGlobalPointAndSetup( positi    332   pPhysVol = LocateGlobalPointAndSetup( position,&direction,RelativeSearch );
256   if( fEnteredDaughter || fExitedMother )         333   if( fEnteredDaughter || fExitedMother )
257   {                                               334   {
258      oldTouchableToUpdate = CreateTouchableHis    335      oldTouchableToUpdate = CreateTouchableHistory();
259      if( pPhysVol == nullptr )                 << 336      if( pPhysVol == 0 )
260      {                                            337      {
261        // We want to ensure that the touchable    338        // We want to ensure that the touchable is correct in this case.
262        // The method below should do this and  << 339        //  The method below should do this and recalculate a lot more ....
263        //                                         340        //
264        oldTouchableToUpdate->UpdateYourself( p    341        oldTouchableToUpdate->UpdateYourself( pPhysVol, &fHistory );
265      }                                            342      }
266   }                                               343   }
267   return;                                         344   return;
268 }                                                 345 }
269                                                   346 
270 // *******************************************    347 // ********************************************************************
271 // LocateGlobalPointAndUpdateTouchable            348 // LocateGlobalPointAndUpdateTouchable
272 //                                                349 //
273 // Use direction                                  350 // Use direction
274 // *******************************************    351 // ********************************************************************
275 //                                                352 //
276 inline                                            353 inline
277 void G4Navigator::LocateGlobalPointAndUpdateTo    354 void G4Navigator::LocateGlobalPointAndUpdateTouchable(
278                            const G4ThreeVector    355                            const G4ThreeVector&       position,
279                            const G4ThreeVector    356                            const G4ThreeVector&       direction,
280                                  G4VTouchable*    357                                  G4VTouchable*        touchableToUpdate,
281                            const G4bool           358                            const G4bool               RelativeSearch  )
282 {                                                 359 {
283   G4VPhysicalVolume* pPhysVol;                    360   G4VPhysicalVolume* pPhysVol;
284   pPhysVol = LocateGlobalPointAndSetup( positi    361   pPhysVol = LocateGlobalPointAndSetup( position, &direction, RelativeSearch);  
285   touchableToUpdate->UpdateYourself( pPhysVol,    362   touchableToUpdate->UpdateYourself( pPhysVol, &fHistory );
286 }                                                 363 }
287                                                   364 
288 // *******************************************    365 // ********************************************************************
289 // LocateGlobalPointAndUpdateTouchable            366 // LocateGlobalPointAndUpdateTouchable
290 // *******************************************    367 // ********************************************************************
291 //                                                368 //
292 inline                                            369 inline
293 void G4Navigator::LocateGlobalPointAndUpdateTo    370 void G4Navigator::LocateGlobalPointAndUpdateTouchable(
294                            const G4ThreeVector    371                            const G4ThreeVector&       position,
295                                  G4VTouchable*    372                                  G4VTouchable*        touchableToUpdate,
296                            const G4bool           373                            const G4bool               RelativeSearch )
297 {                                                 374 {
298   G4VPhysicalVolume* pPhysVol;                    375   G4VPhysicalVolume* pPhysVol;
299   pPhysVol = LocateGlobalPointAndSetup( positi << 376   pPhysVol = LocateGlobalPointAndSetup( position, 0, RelativeSearch);  
300   touchableToUpdate->UpdateYourself( pPhysVol,    377   touchableToUpdate->UpdateYourself( pPhysVol, &fHistory );
301 }                                                 378 }
302                                                   379 
303 // *******************************************    380 // ********************************************************************
304 // GetVerboseLevel                                381 // GetVerboseLevel
305 // *******************************************    382 // ********************************************************************
306 //                                                383 //
307 inline                                            384 inline
308 G4int G4Navigator::GetVerboseLevel() const        385 G4int G4Navigator::GetVerboseLevel() const
309 {                                                 386 {
310   return fVerbose;                                387   return fVerbose;
311 }                                                 388 }
312                                                   389 
313 // *******************************************    390 // ********************************************************************
314 // SetVerboseLevel                                391 // SetVerboseLevel
315 // *******************************************    392 // ********************************************************************
316 //                                                393 //
317 inline                                            394 inline
318 void G4Navigator::SetVerboseLevel(G4int level)    395 void G4Navigator::SetVerboseLevel(G4int level)
319 {                                                 396 {
320   fVerbose = level;                               397   fVerbose = level;
321   fnormalNav.SetVerboseLevel(level);              398   fnormalNav.SetVerboseLevel(level);
322   GetVoxelNavigator().SetVerboseLevel(level);  << 399   fvoxelNav.SetVerboseLevel(level);
323   fparamNav.SetVerboseLevel(level);               400   fparamNav.SetVerboseLevel(level);
324   freplicaNav.SetVerboseLevel(level);             401   freplicaNav.SetVerboseLevel(level);
325   fregularNav.SetVerboseLevel(level);             402   fregularNav.SetVerboseLevel(level);
326   if (fpExternalNav != nullptr) { fpExternalNa << 
327 }                                                 403 }
328                                                   404 
329 // *******************************************    405 // ********************************************************************
330 // IsActive                                       406 // IsActive
331 // *******************************************    407 // ********************************************************************
332 //                                                408 //
333 inline                                            409 inline
334 G4bool G4Navigator::IsActive() const              410 G4bool G4Navigator::IsActive() const
335 {                                                 411 {
336   return fActive;                                 412   return fActive;
337 }                                                 413 }
338                                                   414 
339 // *******************************************    415 // ********************************************************************
340 // Activate                                       416 // Activate
341 // *******************************************    417 // ********************************************************************
342 //                                                418 //
343 inline                                            419 inline
344 void G4Navigator::Activate(G4bool flag)           420 void G4Navigator::Activate(G4bool flag)
345 {                                                 421 {
346   fActive = flag;                                 422   fActive = flag;
347 }                                                 423 }
348                                                   424 
349 // *******************************************    425 // ********************************************************************
350 // EnteredDaughterVolume                          426 // EnteredDaughterVolume
351 //                                                427 //
352 // To inform the caller if the track is enteri    428 // To inform the caller if the track is entering a daughter volume
353 // *******************************************    429 // ********************************************************************
354 //                                                430 //
355 inline                                            431 inline
356 G4bool G4Navigator::EnteredDaughterVolume() co    432 G4bool G4Navigator::EnteredDaughterVolume() const
357 {                                                 433 {
358   return fEnteredDaughter;                        434   return fEnteredDaughter;
359 }                                                 435 }
360                                                   436 
361 // *******************************************    437 // ********************************************************************
362 // ExitedMotherVolume                             438 // ExitedMotherVolume
363 // *******************************************    439 // ********************************************************************
364 //                                                440 //
365 inline                                            441 inline
366 G4bool G4Navigator::ExitedMotherVolume() const    442 G4bool G4Navigator::ExitedMotherVolume() const
367 {                                                 443 {
368   return fExitedMother;                           444   return fExitedMother;
369 }                                                 445 }
370                                                   446 
371 // *******************************************    447 // ********************************************************************
372 // CheckMode                                      448 // CheckMode
373 // *******************************************    449 // ********************************************************************
374 //                                                450 //
375 inline                                            451 inline
376 void  G4Navigator::CheckMode(G4bool mode)         452 void  G4Navigator::CheckMode(G4bool mode)
377 {                                                 453 {
378   fCheck = mode;                                  454   fCheck = mode;
379   fnormalNav.CheckMode(mode);                     455   fnormalNav.CheckMode(mode);
380   GetVoxelNavigator().CheckMode(mode);         << 456   fvoxelNav.CheckMode(mode);
381   fparamNav.CheckMode(mode);                      457   fparamNav.CheckMode(mode);
382   freplicaNav.CheckMode(mode);                    458   freplicaNav.CheckMode(mode);
383   fregularNav.CheckMode(mode);                    459   fregularNav.CheckMode(mode);
384   if (fpExternalNav != nullptr) { fpExternalNa << 
385 }                                                 460 }
386                                                   461 
387 // *******************************************    462 // ********************************************************************
388 // IsCheckModeActive                              463 // IsCheckModeActive
389 // *******************************************    464 // ********************************************************************
390 //                                                465 //
391 inline                                            466 inline
392 G4bool G4Navigator::IsCheckModeActive() const     467 G4bool G4Navigator::IsCheckModeActive() const
393 {                                                 468 {
394   return fCheck;                                  469   return fCheck;
395 }                                                 470 }
396                                                   471 
397 // *******************************************    472 // ********************************************************************
398 // SetPushVerbosity                               473 // SetPushVerbosity
399 // *******************************************    474 // ********************************************************************
400 //                                                475 //
401 inline                                            476 inline
402 void G4Navigator::SetPushVerbosity(G4bool mode    477 void G4Navigator::SetPushVerbosity(G4bool mode)
403 {                                                 478 {
404   fWarnPush = mode;                               479   fWarnPush = mode;
405 }                                                 480 }
406                                                   481 
407 // *******************************************    482 // ********************************************************************
408 // SeverityOfZeroStepping                         483 // SeverityOfZeroStepping
409 //                                                484 //
410 // Reports on severity of error in case Naviga    485 // Reports on severity of error in case Navigator is stuck
411 // and is returning zero steps                    486 // and is returning zero steps
412 // *******************************************    487 // ********************************************************************
413 //                                                488 //
414 inline                                            489 inline 
415 G4int G4Navigator::SeverityOfZeroStepping( G4i    490 G4int G4Navigator::SeverityOfZeroStepping( G4int* noZeroSteps ) const 
416 {                                                 491 {
417   G4int severity = 0, noZeros = fNumberZeroSte << 492   G4int severity=0, noZeros= fNumberZeroSteps;
418   if( noZeroSteps != nullptr )                 << 493   if( noZeroSteps) *noZeroSteps = fNumberZeroSteps;
419   {                                            << 494 
420     *noZeroSteps = fNumberZeroSteps;           << 
421   }                                            << 
422   if( noZeros >= fAbandonThreshold_NoZeroSteps    495   if( noZeros >= fAbandonThreshold_NoZeroSteps )
423   {                                               496   {
424     severity = 10;                                497     severity = 10;
425   }                                               498   }
426   if( noZeros > 0 && noZeros < fActionThreshol    499   if( noZeros > 0 && noZeros < fActionThreshold_NoZeroSteps )
427   {                                               500   {
428     severity =  5 * noZeros / fActionThreshold    501     severity =  5 * noZeros / fActionThreshold_NoZeroSteps;
429   }                                               502   }
430   else if( noZeros == fActionThreshold_NoZeroS    503   else if( noZeros == fActionThreshold_NoZeroSteps )
431   {                                               504   {
432     severity =  5;                                505     severity =  5; 
433   }                                               506   }
434   else if( noZeros >= fAbandonThreshold_NoZero    507   else if( noZeros >= fAbandonThreshold_NoZeroSteps - 2 )
435   {                                               508   {
436     severity =  9;                                509     severity =  9; 
437   }                                               510   }
438   else if( noZeros < fAbandonThreshold_NoZeroS    511   else if( noZeros < fAbandonThreshold_NoZeroSteps - 2 )
439   {                                               512   {
440     severity =  5 + 4 * (noZeros-fAbandonThres    513     severity =  5 + 4 * (noZeros-fAbandonThreshold_NoZeroSteps)
441                       / fActionThreshold_NoZer    514                       / fActionThreshold_NoZeroSteps;
442   }                                               515   }
443   return severity;                                516   return severity;
444 }                                                 517 }
445                                                   518 
446 // *******************************************    519 // ********************************************************************
447 // GetVoxelNavigator                           << 
448 // ******************************************* << 
449 //                                             << 
450 inline                                         << 
451 G4VoxelNavigation& G4Navigator::GetVoxelNaviga << 
452 {                                              << 
453   return *fpvoxelNav;                          << 
454 }                                              << 
455                                                << 
456 // ******************************************* << 
457 // EnableBestSafety                               520 // EnableBestSafety
458 // *******************************************    521 // ********************************************************************
459 //                                                522 //
460 inline void G4Navigator::EnableBestSafety( G4b    523 inline void G4Navigator::EnableBestSafety( G4bool value )
461 {                                                 524 {
462   GetVoxelNavigator().EnableBestSafety( value  << 525   fvoxelNav.EnableBestSafety( value );
463 }                                              << 
464                                                << 
465 // ******************************************* << 
466 // SetExternalNavigation                       << 
467 // ******************************************* << 
468 //                                             << 
469 inline                                         << 
470 G4VExternalNavigation* G4Navigator::GetExterna << 
471 {                                              << 
472   return fpExternalNav;                        << 
473 }                                              << 
474                                                << 
475 // ******************************************* << 
476 // Clone                                       << 
477 // ******************************************* << 
478 //                                             << 
479 inline                                         << 
480 G4Navigator* G4Navigator::Clone() const        << 
481 {                                              << 
482   auto  clone_nav = new G4Navigator();         << 
483   clone_nav->SetWorldVolume(fTopPhysical);     << 
484   if( fpExternalNav != nullptr )               << 
485   {                                            << 
486     clone_nav->SetExternalNavigation(fpExterna << 
487   }                                            << 
488   return clone_nav;                            << 
489 }                                                 526 }
490                                                   527