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 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 3.1)


  1 //                                                  1 
  2 // *******************************************    
  3 // * License and Disclaimer                       
  4 // *                                              
  5 // * The  Geant4 software  is  copyright of th    
  6 // * the Geant4 Collaboration.  It is provided    
  7 // * conditions of the Geant4 Software License    
  8 // * LICENSE and available at  http://cern.ch/    
  9 // * include a list of copyright holders.         
 10 // *                                              
 11 // * Neither the authors of this software syst    
 12 // * institutes,nor the agencies providing fin    
 13 // * work  make  any representation or  warran    
 14 // * regarding  this  software system or assum    
 15 // * use.  Please see the license in the file     
 16 // * for the full disclaimer and the limitatio    
 17 // *                                              
 18 // * This  code  implementation is the result     
 19 // * technical work of the GEANT4 collaboratio    
 20 // * By using,  copying,  modifying or  distri    
 21 // * any work based  on the software)  you  ag    
 22 // * use  in  resulting  scientific  publicati    
 23 // * acceptance of all terms of the Geant4 Sof    
 24 // *******************************************    
 25 //                                                
 26 // G4Navigator class Inline implementation        
 27 //                                                
 28 // -------------------------------------------    
 29                                                   
 30 // *******************************************    
 31 // GetCurrentLocalCoordinate                      
 32 //                                                
 33 // Returns the local coordinate of the current    
 34 // *******************************************    
 35 //                                                
 36 inline                                            
 37 G4ThreeVector G4Navigator::GetCurrentLocalCoor    
 38 {                                                 
 39   return fLastLocatedPointLocal;                  
 40 }                                                 
 41                                                   
 42 // *******************************************    
 43 // ComputeLocalAxis                               
 44 //                                                
 45 // Returns local direction of vector direction    
 46 // *******************************************    
 47 //                                                
 48 inline                                            
 49 G4ThreeVector G4Navigator::ComputeLocalAxis(co    
 50 {                                                 
 51   return fHistory.GetTopTransform().TransformA    
 52 }                                                 
 53                                                   
 54 // *******************************************    
 55 // ComputeLocalPoint                              
 56 //                                                
 57 // Returns local coordinates of a point in the    
 58 // *******************************************    
 59 //                                                
 60 inline                                            
 61 G4ThreeVector                                     
 62 G4Navigator::ComputeLocalPoint(const G4ThreeVe    
 63 {                                                 
 64   return fHistory.GetTopTransform().TransformP    
 65 }                                                 
 66                                                   
 67 // *******************************************    
 68 // GetWorldVolume                                 
 69 //                                                
 70 // Returns the current  world (`topmost') volu    
 71 // *******************************************    
 72 //                                                
 73 inline                                            
 74 G4VPhysicalVolume* G4Navigator::GetWorldVolume    
 75 {                                                 
 76   return fTopPhysical;                            
 77 }                                                 
 78                                                   
 79 // *******************************************    
 80 // SetWorldVolume                                 
 81 //                                                
 82 // Sets the world (`topmost') volume              
 83 // *******************************************    
 84 //                                                
 85 inline                                            
 86 void G4Navigator::SetWorldVolume(G4VPhysicalVo    
 87 {                                                 
 88   if ( !(pWorld->GetTranslation() == G4ThreeVe    
 89   {                                               
 90     G4Exception ("G4Navigator::SetWorldVolume(    
 91                  FatalException, "Volume must     
 92   }                                               
 93   const G4RotationMatrix* rm = pWorld->GetRota    
 94   if ( (rm != nullptr) && (!rm->isIdentity())     
 95   {                                               
 96     G4Exception ("G4Navigator::SetWorldVolume(    
 97                  FatalException, "Volume must     
 98   }                                               
 99   fTopPhysical = pWorld;                          
100   fHistory.SetFirstEntry(pWorld);                 
101 }                                                 
102                                                   
103 // *******************************************    
104 // SetGeometrycallyLimitedStep                    
105 //                                                
106 // Informs the navigator that the previous Ste    
107 // by the geometry was taken in its entirety      
108 // *******************************************    
109 //                                                
110 inline                                            
111 void G4Navigator::SetGeometricallyLimitedStep(    
112 {                                                 
113   fWasLimitedByGeometry = true;                   
114 }                                                 
115                                                   
116 // *******************************************    
117 // ResetStackAndState                             
118 //                                                
119 // Resets stack and minimum of navigator state    
120 // *******************************************    
121 //                                                
122 inline                                            
123 void G4Navigator::ResetStackAndState()            
124 {                                                 
125   fHistory.Reset();                               
126   ResetState();                                   
127 }                                                 
128                                                   
129 // *******************************************    
130 // VolumeType                                     
131 // *******************************************    
132 //                                                
133 inline                                            
134 EVolume G4Navigator::VolumeType(const G4VPhysi    
135 {                                                 
136   return pVol->VolumeType();                      
137 }                                                 
138                                                   
139 // *******************************************    
140 // CharacteriseDaughters                          
141 // *******************************************    
142 //                                                
143 inline                                            
144 EVolume G4Navigator::CharacteriseDaughters(con    
145 {                                                 
146   return pLog->CharacteriseDaughters();           
147 }                                                 
148                                                   
149 // *******************************************    
150 // GetDaughtersRegularStructureId                 
151 // *******************************************    
152 //                                                
153 inline                                            
154 G4int G4Navigator::                               
155 GetDaughtersRegularStructureId(const G4Logical    
156 {                                                 
157   G4int regId = 0;                                
158   G4VPhysicalVolume *pVol;                        
159                                                   
160   if ( pLog->GetNoDaughters() == 1 )              
161   {                                               
162     pVol = pLog->GetDaughter(0);                  
163     regId = pVol->GetRegularStructureId();        
164   }                                               
165   return regId;                                   
166 }                                                 
167                                                   
168 // *******************************************    
169 // GetGlobalToLocalTransform                      
170 //                                                
171 // Returns local to global transformation.        
172 // I.e. transformation that will take point or    
173 // and return one in the local coord system       
174 // *******************************************    
175 //                                                
176 inline                                            
177 const G4AffineTransform& G4Navigator::GetGloba    
178 {                                                 
179   return fHistory.GetTopTransform();              
180 }                                                 
181                                                   
182 // *******************************************    
183 // GetLocalToGlobalTransform                      
184 //                                                
185 // Returns global to local transformation         
186 // *******************************************    
187 //                                                
188 inline                                            
189 const G4AffineTransform G4Navigator::GetLocalT    
190 {                                                 
191   return fHistory.GetTopTransform().Inverse();    
192 }                                                 
193                                                   
194 // *******************************************    
195 // NetTranslation                                 
196 //                                                
197 // Computes+returns the local->global translat    
198 // *******************************************    
199 //                                                
200 inline                                            
201 G4ThreeVector G4Navigator::NetTranslation() co    
202 {                                                 
203   return fHistory.GetTopTransform().InverseNet    
204 }                                                 
205                                                   
206 // *******************************************    
207 // NetRotation                                    
208 //                                                
209 // Computes+returns the local->global rotation    
210 // *******************************************    
211 //                                                
212 inline                                            
213 G4RotationMatrix G4Navigator::NetRotation() co    
214 {                                                 
215   return fHistory.GetTopTransform().InverseNet    
216 }                                                 
217                                                   
218 // *******************************************    
219 // CreateTouchableHistory                         
220 //                                                
221 // `Touchable' creation method: caller has del    
222 // *******************************************    
223 //                                                
224 inline                                            
225 G4TouchableHistory* G4Navigator::CreateTouchab    
226 {                                                 
227   return new G4TouchableHistory(fHistory);        
228 }                                                 
229                                                   
230 // *******************************************    
231 // CreateTouchableHistory(history)                
232 //                                                
233 // `Touchable' creation method: caller has del    
234 // *******************************************    
235 //                                                
236 inline                                            
237 G4TouchableHistory*                               
238 G4Navigator::CreateTouchableHistory(const G4Na    
239 {                                                 
240   return new G4TouchableHistory(*history);        
241 }                                                 
242                                                   
243 // *******************************************    
244 // LocateGlobalPointAndUpdateTouchableHandle      
245 // *******************************************    
246 //                                                
247 inline                                            
248 void G4Navigator::LocateGlobalPointAndUpdateTo    
249                                const G4ThreeVe    
250                                const G4ThreeVe    
251                                      G4Touchab    
252                                const G4bool       
253 {                                                 
254   G4VPhysicalVolume* pPhysVol;                    
255   pPhysVol = LocateGlobalPointAndSetup( positi    
256   if( fEnteredDaughter || fExitedMother )         
257   {                                               
258      oldTouchableToUpdate = CreateTouchableHis    
259      if( pPhysVol == nullptr )                    
260      {                                            
261        // We want to ensure that the touchable    
262        // The method below should do this and     
263        //                                         
264        oldTouchableToUpdate->UpdateYourself( p    
265      }                                            
266   }                                               
267   return;                                         
268 }                                                 
269                                                   
270 // *******************************************    
271 // LocateGlobalPointAndUpdateTouchable            
272 //                                                
273 // Use direction                                  
274 // *******************************************    
275 //                                                
276 inline                                            
277 void G4Navigator::LocateGlobalPointAndUpdateTo    
278                            const G4ThreeVector    
279                            const G4ThreeVector    
280                                  G4VTouchable*    
281                            const G4bool           
282 {                                                 
283   G4VPhysicalVolume* pPhysVol;                    
284   pPhysVol = LocateGlobalPointAndSetup( positi    
285   touchableToUpdate->UpdateYourself( pPhysVol,    
286 }                                                 
287                                                   
288 // *******************************************    
289 // LocateGlobalPointAndUpdateTouchable            
290 // *******************************************    
291 //                                                
292 inline                                            
293 void G4Navigator::LocateGlobalPointAndUpdateTo    
294                            const G4ThreeVector    
295                                  G4VTouchable*    
296                            const G4bool           
297 {                                                 
298   G4VPhysicalVolume* pPhysVol;                    
299   pPhysVol = LocateGlobalPointAndSetup( positi    
300   touchableToUpdate->UpdateYourself( pPhysVol,    
301 }                                                 
302                                                   
303 // *******************************************    
304 // GetVerboseLevel                                
305 // *******************************************    
306 //                                                
307 inline                                            
308 G4int G4Navigator::GetVerboseLevel() const        
309 {                                                 
310   return fVerbose;                                
311 }                                                 
312                                                   
313 // *******************************************    
314 // SetVerboseLevel                                
315 // *******************************************    
316 //                                                
317 inline                                            
318 void G4Navigator::SetVerboseLevel(G4int level)    
319 {                                                 
320   fVerbose = level;                               
321   fnormalNav.SetVerboseLevel(level);              
322   GetVoxelNavigator().SetVerboseLevel(level);     
323   fparamNav.SetVerboseLevel(level);               
324   freplicaNav.SetVerboseLevel(level);             
325   fregularNav.SetVerboseLevel(level);             
326   if (fpExternalNav != nullptr) { fpExternalNa    
327 }                                                 
328                                                   
329 // *******************************************    
330 // IsActive                                       
331 // *******************************************    
332 //                                                
333 inline                                            
334 G4bool G4Navigator::IsActive() const              
335 {                                                 
336   return fActive;                                 
337 }                                                 
338                                                   
339 // *******************************************    
340 // Activate                                       
341 // *******************************************    
342 //                                                
343 inline                                            
344 void G4Navigator::Activate(G4bool flag)           
345 {                                                 
346   fActive = flag;                                 
347 }                                                 
348                                                   
349 // *******************************************    
350 // EnteredDaughterVolume                          
351 //                                                
352 // To inform the caller if the track is enteri    
353 // *******************************************    
354 //                                                
355 inline                                            
356 G4bool G4Navigator::EnteredDaughterVolume() co    
357 {                                                 
358   return fEnteredDaughter;                        
359 }                                                 
360                                                   
361 // *******************************************    
362 // ExitedMotherVolume                             
363 // *******************************************    
364 //                                                
365 inline                                            
366 G4bool G4Navigator::ExitedMotherVolume() const    
367 {                                                 
368   return fExitedMother;                           
369 }                                                 
370                                                   
371 // *******************************************    
372 // CheckMode                                      
373 // *******************************************    
374 //                                                
375 inline                                            
376 void  G4Navigator::CheckMode(G4bool mode)         
377 {                                                 
378   fCheck = mode;                                  
379   fnormalNav.CheckMode(mode);                     
380   GetVoxelNavigator().CheckMode(mode);            
381   fparamNav.CheckMode(mode);                      
382   freplicaNav.CheckMode(mode);                    
383   fregularNav.CheckMode(mode);                    
384   if (fpExternalNav != nullptr) { fpExternalNa    
385 }                                                 
386                                                   
387 // *******************************************    
388 // IsCheckModeActive                              
389 // *******************************************    
390 //                                                
391 inline                                            
392 G4bool G4Navigator::IsCheckModeActive() const     
393 {                                                 
394   return fCheck;                                  
395 }                                                 
396                                                   
397 // *******************************************    
398 // SetPushVerbosity                               
399 // *******************************************    
400 //                                                
401 inline                                            
402 void G4Navigator::SetPushVerbosity(G4bool mode    
403 {                                                 
404   fWarnPush = mode;                               
405 }                                                 
406                                                   
407 // *******************************************    
408 // SeverityOfZeroStepping                         
409 //                                                
410 // Reports on severity of error in case Naviga    
411 // and is returning zero steps                    
412 // *******************************************    
413 //                                                
414 inline                                            
415 G4int G4Navigator::SeverityOfZeroStepping( G4i    
416 {                                                 
417   G4int severity = 0, noZeros = fNumberZeroSte    
418   if( noZeroSteps != nullptr )                    
419   {                                               
420     *noZeroSteps = fNumberZeroSteps;              
421   }                                               
422   if( noZeros >= fAbandonThreshold_NoZeroSteps    
423   {                                               
424     severity = 10;                                
425   }                                               
426   if( noZeros > 0 && noZeros < fActionThreshol    
427   {                                               
428     severity =  5 * noZeros / fActionThreshold    
429   }                                               
430   else if( noZeros == fActionThreshold_NoZeroS    
431   {                                               
432     severity =  5;                                
433   }                                               
434   else if( noZeros >= fAbandonThreshold_NoZero    
435   {                                               
436     severity =  9;                                
437   }                                               
438   else if( noZeros < fAbandonThreshold_NoZeroS    
439   {                                               
440     severity =  5 + 4 * (noZeros-fAbandonThres    
441                       / fActionThreshold_NoZer    
442   }                                               
443   return severity;                                
444 }                                                 
445                                                   
446 // *******************************************    
447 // GetVoxelNavigator                              
448 // *******************************************    
449 //                                                
450 inline                                            
451 G4VoxelNavigation& G4Navigator::GetVoxelNaviga    
452 {                                                 
453   return *fpvoxelNav;                             
454 }                                                 
455                                                   
456 // *******************************************    
457 // EnableBestSafety                               
458 // *******************************************    
459 //                                                
460 inline void G4Navigator::EnableBestSafety( G4b    
461 {                                                 
462   GetVoxelNavigator().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 }                                                 
490