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 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/src/G4ErrorPropagationNavigator.cc (Version 11.3.0) and /geometry/navigation/src/G4ErrorPropagationNavigator.cc (Version 7.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 // class G4ErrorPropagationNavigator implement    
 27 //                                                
 28 // Author: Pedro Arce, CIEMAT                     
 29 // -------------------------------------------    
 30                                                   
 31 #include "G4ErrorPropagationNavigator.hh"         
 32                                                   
 33 #include "globals.hh"                             
 34 #include "G4ThreeVector.hh"                       
 35 #include "G4ErrorPropagatorData.hh"               
 36 #include "G4ErrorSurfaceTarget.hh"                
 37                                                   
 38 #include "G4ErrorPlaneSurfaceTarget.hh"           
 39 #include "G4ErrorCylSurfaceTarget.hh"             
 40                                                   
 41 G4double G4ErrorPropagationNavigator::            
 42 ComputeStep ( const G4ThreeVector &pGlobalPoin    
 43               const G4ThreeVector &pDirection,    
 44               const G4double pCurrentProposedS    
 45                     G4double &pNewSafety )        
 46 {                                                 
 47   G4double safetyGeom = DBL_MAX;                  
 48                                                   
 49   G4double Step = G4Navigator::ComputeStep(pGl    
 50                                            pCu    
 51                                            saf    
 52                                                   
 53   G4ErrorPropagatorData* g4edata                  
 54     = G4ErrorPropagatorData::GetErrorPropagato    
 55                                                   
 56   if ( g4edata != nullptr )                       
 57   {                                               
 58     const G4ErrorTarget* target = g4edata->Get    
 59     if( target != nullptr )                       
 60     {                                             
 61       G4double StepPlane=target->GetDistanceFr    
 62                                                   
 63       if( StepPlane < 0. ) // Negative means t    
 64       {                    // will not be foun    
 65         StepPlane = DBL_MAX;                      
 66       }                                           
 67 #ifdef G4VERBOSE                                  
 68       if( G4ErrorPropagatorData::verbose() >=     
 69       {                                           
 70         G4cout << "G4ErrorPropagationNavigator    
 71                << "  Target step: " << StepPla    
 72                << ", Transportation step: " <<    
 73         target->Dump( "G4ErrorPropagationNavig    
 74       }                                           
 75 #endif                                            
 76                                                   
 77       if( StepPlane < Step )                      
 78       {                                           
 79 #ifdef G4VERBOSE                                  
 80         if( G4ErrorPropagatorData::verbose() >    
 81         {                                         
 82           G4cout << "G4ErrorPropagationNavigat    
 83                  << "  TargetCloserThanBoundar    
 84                  << Step << G4endl;               
 85         }                                         
 86 #endif                                            
 87         Step = StepPlane;                         
 88         g4edata->SetState(G4ErrorState_TargetC    
 89       }                                           
 90       else                                        
 91       {                                           
 92         g4edata->SetState(G4ErrorState_Propaga    
 93       }                                           
 94     }                                             
 95   }                                               
 96   G4double safetyTarget = TargetSafetyFromPoin    
 97                                                   
 98   // Avoid call to G4Navigator::ComputeSafety     
 99   //                                              
100   pNewSafety = std::min(safetyGeom, safetyTarg    
101                                                   
102 #ifdef G4VERBOSE                                  
103   if( G4ErrorPropagatorData::verbose() >= 3 )     
104   {                                               
105     G4cout << "G4ErrorPropagationNavigator::Co    
106            << "  Step: " << Step << ", Compute    
107            << G4endl;                             
108   }                                               
109 #endif                                            
110                                                   
111   return Step;                                    
112 }                                                 
113                                                   
114 //--------------------------------------------    
115                                                   
116 G4double G4ErrorPropagationNavigator::            
117 TargetSafetyFromPoint( const G4ThreeVector& pG    
118 {                                                 
119   G4double safety = DBL_MAX;                      
120                                                   
121   G4ErrorPropagatorData* g4edata                  
122     = G4ErrorPropagatorData::GetErrorPropagato    
123                                                   
124   if ( g4edata != nullptr )                       
125   {                                               
126     const G4ErrorTarget* target = g4edata->Get    
127     if( target != nullptr )                       
128     {                                             
129        safety = target->GetDistanceFromPoint(p    
130     }                                             
131   }                                               
132   return safety;                                  
133 }                                                 
134                                                   
135 //--------------------------------------------    
136                                                   
137 G4double G4ErrorPropagationNavigator::            
138 ComputeSafety( const G4ThreeVector &pGlobalPoi    
139                const G4double pMaxLength,         
140                const G4bool keepState )           
141 {                                                 
142   G4double safetyGeom = G4Navigator::ComputeSa    
143                                                   
144                                                   
145   G4double safetyTarget = TargetSafetyFromPoin    
146                                                   
147   return std::min(safetyGeom, safetyTarget);      
148 }                                                 
149                                                   
150 //--------------------------------------------    
151                                                   
152 G4ThreeVector G4ErrorPropagationNavigator::       
153 GetGlobalExitNormal( const G4ThreeVector& poin    
154 {                                                 
155   G4ErrorPropagatorData* g4edata                  
156         = G4ErrorPropagatorData::GetErrorPropa    
157   const G4ErrorTarget* target = nullptr;          
158                                                   
159   G4ThreeVector normal(0.0, 0.0, 0.0);            
160   G4double      distance= 0;                      
161                                                   
162   // Determine which 'geometry' limited the st    
163   if ( g4edata != nullptr )                       
164   {                                               
165     target = g4edata->GetTarget();                
166     if( target != nullptr )                       
167     {                                             
168       distance = target->GetDistanceFromPoint(    
169     }                                             
170   }                                               
171                                                   
172   if( distance > kCarTolerance || (target == n    
173     // Not reached the target or if a target d    
174     // this seems the best we can do              
175   {                                               
176     normal = G4Navigator::GetGlobalExitNormal(    
177   }                                               
178   else                                            
179   {                                               
180     switch( target->GetType() )                   
181     {                                             
182       case G4ErrorTarget_GeomVolume:              
183         // The volume is in the 'real' mass ge    
184         normal = G4Navigator::GetGlobalExitNor    
185         break;                                    
186       case G4ErrorTarget_TrkL:                    
187         normal = G4ThreeVector( 0.0, 0.0, 0.0)    
188         *valid = false;                           
189         G4Exception("G4ErrorPropagationNavigat    
190                     "Geometry1003",               
191                     JustWarning, "Unexpected v    
192         break;                                    
193       case G4ErrorTarget_PlaneSurface:            
194       case G4ErrorTarget_CylindricalSurface:      
195         const auto surfTarget= static_cast<con    
196         normal = surfTarget->GetTangentPlane(p    
197         *valid = true;                            
198         break;                                    
199                                                   
200 //      default:                                  
201 //        normal= G4ThreeVector( 0.0, 0.0, 0.0    
202 //        *valid = false;                         
203 //        G4Exception("G4ErrorPropagationNavig    
204 //                    "Geometry:003",             
205 //                    FatalException, "Impossi    
206 //        break;                                  
207     }                                             
208   }                                               
209   return normal;                                  
210 }                                                 
211                                                   
212