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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/G4SafetyCalculator.hh (Version 11.3.0) and /geometry/navigation/include/G4SafetyCalculator.hh (Version 10.0.p4)


  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 // G4SafetyCalculator                             
 27 //                                                
 28 // Class description:                             
 29 //                                                
 30 // A class that provides an estimate of the is    
 31 //   minimum distance from a global point to t    
 32 //   of the current volume or the nearest daug    
 33 // This estimate can be an underestimate, eith    
 34 //   provides an underestimate (for speed) or     
 35 //   substantial additional computations.         
 36 //                                                
 37 // Obtains from the navigator the current tran    
 38                                                   
 39 // Author: John Apostolakis, CERN - February 2    
 40 // -------------------------------------------    
 41 #ifndef G4SafetyCalculator_HH                     
 42 #define G4SafetyCalculator_HH 1                   
 43                                                   
 44 #include "geomdefs.hh"                            
 45                                                   
 46 #include "G4ThreeVector.hh"                       
 47 #include "G4AffineTransform.hh"                   
 48 #include "G4RotationMatrix.hh"                    
 49                                                   
 50 #include "G4LogicalVolume.hh"             // U    
 51 #include "G4TouchableHistoryHandle.hh"            
 52                                                   
 53 #include "G4NavigationHistory.hh"                 
 54 #include "G4NormalNavigation.hh"                  
 55 #include "G4VoxelNavigation.hh"                   
 56 #include "G4ParameterisedNavigation.hh"           
 57 #include "G4ReplicaNavigation.hh"                 
 58 #include "G4RegularNavigation.hh"                 
 59 #include "G4VExternalNavigation.hh"               
 60                                                   
 61 #include "G4VoxelSafety.hh"                       
 62                                                   
 63 #include <iostream>                               
 64                                                   
 65 class G4VPhysicalVolume;                          
 66                                                   
 67 class G4SafetyCalculator                          
 68 {                                                 
 69   public:                                         
 70                                                   
 71     G4SafetyCalculator( const G4Navigator& nav    
 72                         const G4NavigationHist    
 73       // Constructor - initialisers and setup.    
 74                                                   
 75     G4SafetyCalculator(const G4SafetyCalculato    
 76     G4SafetyCalculator& operator=(const G4Safe    
 77       // Copy constructor & assignment operato    
 78                                                   
 79     ~G4SafetyCalculator() = default;              
 80       // Destructor. No actions.                  
 81                                                   
 82     G4double SafetyInCurrentVolume(const G4Thr    
 83                                          G4VPh    
 84                                    const G4dou    
 85                                          G4boo    
 86       // Calculate the isotropic distance to t    
 87       // specified point in the global coordin    
 88       // The globalpoint utilised *must* be lo    
 89       // current volume (it also must *not* be    
 90       // The value returned can be an underest    
 91       // if complex volumes are involved).        
 92       // The calculation will not look beyond     
 93       // to avoid extra volume safety calculat    
 94                                                   
 95     G4VExternalNavigation* GetExternalNavigati    
 96     void SetExternalNavigation(G4VExternalNavi    
 97       // Accessor & modifier for custom extern    
 98                                                   
 99     void CompareSafetyValues( G4double oldSafe    
100                               G4double newValu    
101                               G4VPhysicalVolum    
102                         const G4ThreeVector &g    
103                               G4bool keepState    
104                               G4double maxLeng    
105                               G4bool enteredVo    
106                               G4bool exitedVol    
107       // Compare estimates of the safety, and     
108                                                   
109   protected:                                      
110                                                   
111     void QuickLocateWithinVolume(const G4Three    
112                                        G4VPhys    
113       // Prepare state of sub-navigators by in    
114                                                   
115     inline G4ThreeVector ComputeLocalPoint(con    
116       // Return position vector in local coord    
117       // vector in world coordinate system.       
118                                                   
119     inline G4ThreeVector ComputeLocalAxis(cons    
120       // Return the local direction of the spe    
121       // system of the volume that was found b    
122       // The Local Coordinates of point in wor    
123                                                   
124     inline EVolume CharacteriseDaughters(const    
125       // Characterise daughter of logical volu    
126                                                   
127     inline G4int GetDaughtersRegularStructureI    
128       // Get regular structure ID of first dau    
129                                                   
130   private:                                        
131                                                   
132     // BEGIN -- Tracking Invariants part 1        
133     //                                            
134     const G4Navigator& fNavigator;                
135       // Associated navigator. Needed for deta    
136       // for optimisation                         
137                                                   
138     const G4NavigationHistory& fNavHistory;       
139       // Associated navigator's navigation his    
140       // of the current path through the geome    
141     //                                            
142     // END   -- Tracking Invariants part 1        
143                                                   
144     G4double fkCarTolerance;                      
145       // Cached tolerance.                        
146                                                   
147     // BEGIN State information                    
148     //                                            
149     G4ThreeVector  fPreviousSftOrigin;            
150     G4double       fPreviousSafety = 0.0;         
151       // Memory of last safety origin & value.    
152       // that origin of current Step is in the    
153       // last relocation.                         
154                                                   
155     // Helpers/Utility classes - their state c    
156     //                                            
157     G4NormalNavigation fnormalNav;                
158     G4VoxelNavigation fvoxelNav;                  
159     G4ParameterisedNavigation fparamNav;          
160     G4ReplicaNavigation freplicaNav;              
161     G4RegularNavigation fregularNav;              
162     G4VExternalNavigation* fpExternalNav = nul    
163     G4VoxelSafety fVoxelSafety;                   
164 };                                                
165                                                   
166 // Auxiliary inline methods -- copied from G4N    
167                                                   
168 // Return  local coordinates given point in th    
169 //                                                
170 inline G4ThreeVector                              
171 G4SafetyCalculator::ComputeLocalPoint(const G4    
172 {                                                 
173   return fNavHistory.GetTopTransform().Transfo    
174 }                                                 
175                                                   
176 // Returns local direction given vector direct    
177 //                                                
178 inline G4ThreeVector                              
179 G4SafetyCalculator::ComputeLocalAxis(const G4T    
180 {                                                 
181   return fNavHistory.GetTopTransform().Transfo    
182 }                                                 
183                                                   
184 inline EVolume                                    
185 G4SafetyCalculator::CharacteriseDaughters(cons    
186 {                                                 
187   return pLog->CharacteriseDaughters();           
188 }                                                 
189                                                   
190 inline G4int                                      
191 G4SafetyCalculator::GetDaughtersRegularStructu    
192 {                                                 
193   G4int regId = 0;                                
194   G4VPhysicalVolume *pVol;                        
195                                                   
196   if ( pLog->GetNoDaughters() == 1 )              
197   {                                               
198     pVol = pLog->GetDaughter(0);                  
199     regId = pVol->GetRegularStructureId();        
200   }                                               
201   return regId;                                   
202 }                                                 
203                                                   
204 #endif                                            
205