Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/geometry/navigation/src/G4NormalNavigation.cc

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/src/G4NormalNavigation.cc (Version 11.3.0) and /geometry/navigation/src/G4NormalNavigation.cc (Version 10.2)


  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 //
                                                   >>  27 // $Id: G4NormalNavigation.cc 93289 2015-10-15 10:01:15Z gcosmo $
                                                   >>  28 //
                                                   >>  29 //
 26 // class G4NormalNavigation Implementation         30 // class G4NormalNavigation Implementation
 27 //                                                 31 //
 28 // Author: P.Kent, 1996                            32 // Author: P.Kent, 1996
 29 //                                                 33 //
 30 // -------------------------------------------     34 // --------------------------------------------------------------------
 31                                                    35 
 32 #include "G4NormalNavigation.hh"                   36 #include "G4NormalNavigation.hh"
 33 #include "G4NavigationLogger.hh"                   37 #include "G4NavigationLogger.hh"
 34 #include "G4AffineTransform.hh"                    38 #include "G4AffineTransform.hh"
 35                                                    39 
 36 // *******************************************     40 // ********************************************************************
 37 // Constructor                                     41 // Constructor
 38 // *******************************************     42 // ********************************************************************
 39 //                                                 43 //
 40 G4NormalNavigation::G4NormalNavigation()           44 G4NormalNavigation::G4NormalNavigation()
                                                   >>  45    : fCheck(false)
 41 {                                                  46 {
 42   fLogger = new G4NavigationLogger("G4NormalNa     47   fLogger = new G4NavigationLogger("G4NormalNavigation");
 43 }                                                  48 }
 44                                                    49 
 45 // *******************************************     50 // ********************************************************************
 46 // Destructor                                      51 // Destructor
 47 // *******************************************     52 // ********************************************************************
 48 //                                                 53 //
 49 G4NormalNavigation::~G4NormalNavigation()          54 G4NormalNavigation::~G4NormalNavigation()
 50 {                                                  55 {
 51   delete fLogger;                                  56   delete fLogger;
 52 }                                                  57 }
 53                                                    58 
 54 // *******************************************     59 // ********************************************************************
 55 // ComputeStep                                     60 // ComputeStep
 56 // *******************************************     61 // ********************************************************************
 57 //                                                 62 //
 58 //  On entry                                       63 //  On entry
 59 //    exitNormal, validExitNormal:  for previo     64 //    exitNormal, validExitNormal:  for previous exited volume (daughter)
 60 //                                                 65 // 
 61 //  On exit                                        66 //  On exit
 62 //    exitNormal, validExitNormal:  for mother     67 //    exitNormal, validExitNormal:  for mother, if exiting it (else unchanged)
 63 G4double                                           68 G4double
 64 G4NormalNavigation::ComputeStep(const G4ThreeV <<  69 G4NormalNavigation::ComputeStep(const G4ThreeVector &localPoint,
 65                                 const G4ThreeV <<  70                                 const G4ThreeVector &localDirection,
 66                                 const G4double     71                                 const G4double currentProposedStepLength,
 67                                       G4double <<  72                                       G4double &newSafety,
 68                                       G4Naviga <<  73                                       G4NavigationHistory &history,
 69                                       G4bool&  <<  74                                       G4bool &validExitNormal,
 70                                       G4ThreeV <<  75                                       G4ThreeVector &exitNormal,
 71                                       G4bool&  <<  76                                       G4bool &exiting,
 72                                       G4bool&  <<  77                                       G4bool &entering,
 73                                       G4VPhysi <<  78                                       G4VPhysicalVolume *(*pBlockedPhysical),
 74                                       G4int& b <<  79                                       G4int &blockedReplicaNo)
 75 {                                                  80 {
 76   G4VPhysicalVolume *motherPhysical, *samplePh <<  81   G4VPhysicalVolume *motherPhysical, *samplePhysical, *blockedExitedVol=0;
 77                     *blockedExitedVol = nullpt << 
 78   G4LogicalVolume *motherLogical;                  82   G4LogicalVolume *motherLogical;
 79   G4VSolid *motherSolid;                           83   G4VSolid *motherSolid;
 80   G4ThreeVector sampleDirection;                   84   G4ThreeVector sampleDirection;
 81   G4double ourStep = currentProposedStepLength <<  85   G4double ourStep=currentProposedStepLength, ourSafety;
 82   G4double motherSafety, motherStep = DBL_MAX; <<  86   G4double motherSafety, motherStep=DBL_MAX;
 83   G4long localNoDaughters, sampleNo;           <<  87   G4int localNoDaughters, sampleNo;
 84   G4bool motherValidExitNormal = false;        <<  88   G4bool motherValidExitNormal=false;
 85   G4ThreeVector motherExitNormal;                  89   G4ThreeVector motherExitNormal; 
 86                                                    90 
 87   motherPhysical = history.GetTopVolume();         91   motherPhysical = history.GetTopVolume();
 88   motherLogical  = motherPhysical->GetLogicalV     92   motherLogical  = motherPhysical->GetLogicalVolume();
 89   motherSolid    = motherLogical->GetSolid();      93   motherSolid    = motherLogical->GetSolid();
 90                                                    94 
 91   // Compute mother safety                         95   // Compute mother safety
 92   //                                               96   //
 93   motherSafety = motherSolid->DistanceToOut(lo     97   motherSafety = motherSolid->DistanceToOut(localPoint);
 94   ourSafety = motherSafety; // Working isotrop     98   ourSafety = motherSafety; // Working isotropic safety
 95                                                    99 
 96   localNoDaughters = motherLogical->GetNoDaugh    100   localNoDaughters = motherLogical->GetNoDaughters();
 97                                                   101   
 98 #ifdef G4VERBOSE                                  102 #ifdef G4VERBOSE
 99   if ( fCheck && ( (localNoDaughters>0) || (ou    103   if ( fCheck && ( (localNoDaughters>0) || (ourStep < motherSafety) )  )
100   {                                               104   {
101     fLogger->PreComputeStepLog(motherPhysical,    105     fLogger->PreComputeStepLog(motherPhysical, motherSafety, localPoint);
102   }                                               106   }
103 #endif                                            107 #endif
104   // Compute daughter safeties & intersections    108   // Compute daughter safeties & intersections
105   //                                              109   //
106                                                   110 
107   // Exiting normal optimisation                  111   // Exiting normal optimisation
108   //                                              112   //
109   if ( exiting && validExitNormal )            << 113   if ( exiting&&validExitNormal )
110   {                                               114   {
111     if ( localDirection.dot(exitNormal)>=kMinE    115     if ( localDirection.dot(exitNormal)>=kMinExitingNormalCosine )
112     {                                             116     {
113       // Block exited daughter volume             117       // Block exited daughter volume
114       //                                          118       //
115       blockedExitedVol = (*pBlockedPhysical);     119       blockedExitedVol = (*pBlockedPhysical);
116       ourSafety = 0;                              120       ourSafety = 0;
117     }                                             121     }
118   }                                               122   }
119   exiting  = false;                               123   exiting  = false;
120   entering = false;                               124   entering = false;
121                                                   125 
122 #ifdef G4VERBOSE                                  126 #ifdef G4VERBOSE
123   if ( fCheck )                                   127   if ( fCheck )
124   {                                               128   {
125     // Compute early:                             129     // Compute early:
126     //  a) to check whether point is (wrongly)    130     //  a) to check whether point is (wrongly) outside
127     //               (signaled if step < 0 or     131     //               (signaled if step < 0 or step == kInfinity )
128     //  b) to check value against answer of da    132     //  b) to check value against answer of daughters!
129                                                   133 
130     motherStep = motherSolid->DistanceToOut(lo    134     motherStep = motherSolid->DistanceToOut(localPoint,
131                                             lo    135                                             localDirection,
132                                             tr    136                                             true,
133                                            &mo    137                                            &motherValidExitNormal,
134                                            &mo    138                                            &motherExitNormal);
135                                                   139 
136     if( (motherStep >= kInfinity) || (motherSt    140     if( (motherStep >= kInfinity) || (motherStep < 0.0) )
137     {                                             141     {
138       // Error - indication of being outside s    142       // Error - indication of being outside solid !!
139       fLogger->ReportOutsideMother(localPoint,    143       fLogger->ReportOutsideMother(localPoint, localDirection, motherPhysical);
140                                                   144     
141       ourStep = motherStep = 0.0;                 145       ourStep = motherStep = 0.0;
142                                                   146    
143       exiting = true;                          << 147       exiting= true;
144       entering = false;                        << 148       entering= false;
145                                                   149     
146       // If we are outside the solid does the     150       // If we are outside the solid does the normal make sense?
147       validExitNormal = motherValidExitNormal; << 151       validExitNormal= motherValidExitNormal;
148       exitNormal = motherExitNormal;           << 152       exitNormal= motherExitNormal;
149                                                   153     
150       *pBlockedPhysical = nullptr; // or mothe << 154       *pBlockedPhysical= 0; // or motherPhysical ?
151       blockedReplicaNo = 0;  // or motherRepli << 155       blockedReplicaNo= 0;  // or motherReplicaNumber ?
152                                                   156     
153       newSafety = 0.0;                         << 157       newSafety= 0.0;
154       return ourStep;                             158       return ourStep;
155     }                                             159     }
156   }                                               160   }
157 #endif                                            161 #endif
158                                                   162 
159   for ( sampleNo=localNoDaughters-1; sampleNo>    163   for ( sampleNo=localNoDaughters-1; sampleNo>=0; sampleNo--)
160   {                                               164   {
161     samplePhysical = motherLogical->GetDaughte    165     samplePhysical = motherLogical->GetDaughter(sampleNo);
162     if ( samplePhysical!=blockedExitedVol )       166     if ( samplePhysical!=blockedExitedVol )
163     {                                             167     {
164       G4AffineTransform sampleTf(samplePhysica    168       G4AffineTransform sampleTf(samplePhysical->GetRotation(),
165                                  samplePhysica    169                                  samplePhysical->GetTranslation());
166       sampleTf.Invert();                          170       sampleTf.Invert();
167       const G4ThreeVector samplePoint = sample    171       const G4ThreeVector samplePoint = sampleTf.TransformPoint(localPoint);
168       const G4VSolid *sampleSolid =               172       const G4VSolid *sampleSolid =
169               samplePhysical->GetLogicalVolume    173               samplePhysical->GetLogicalVolume()->GetSolid();
170       const G4double sampleSafety =               174       const G4double sampleSafety =
171               sampleSolid->DistanceToIn(sample    175               sampleSolid->DistanceToIn(samplePoint);
172                                                   176 
173       if ( sampleSafety<ourSafety )               177       if ( sampleSafety<ourSafety )
174       {                                           178       {
175         ourSafety=sampleSafety;                   179         ourSafety=sampleSafety;
176       }                                           180       }
177                                                   181     
178       if ( sampleSafety<=ourStep )                182       if ( sampleSafety<=ourStep )
179       {                                           183       {
180         sampleDirection = sampleTf.TransformAx    184         sampleDirection = sampleTf.TransformAxis(localDirection);
181         const G4double sampleStep =               185         const G4double sampleStep =
182                 sampleSolid->DistanceToIn(samp    186                 sampleSolid->DistanceToIn(samplePoint,sampleDirection);
183 #ifdef G4VERBOSE                                  187 #ifdef G4VERBOSE        
184         if( fCheck )                              188         if( fCheck )
185         {                                         189         {
186           fLogger->PrintDaughterLog(sampleSoli    190           fLogger->PrintDaughterLog(sampleSolid, samplePoint,
187                                     sampleSafe    191                                     sampleSafety, true,
188                                     sampleDire    192                                     sampleDirection, sampleStep);          
189         }                                         193         }
190 #endif                                            194 #endif
191         if ( sampleStep<=ourStep )                195         if ( sampleStep<=ourStep )
192         {                                         196         {
193           ourStep  = sampleStep;                  197           ourStep  = sampleStep;
194           entering = true;                        198           entering = true;
195           exiting  = false;                       199           exiting  = false;
196           *pBlockedPhysical = samplePhysical;     200           *pBlockedPhysical = samplePhysical;
197           blockedReplicaNo  = -1;                 201           blockedReplicaNo  = -1;
198 #ifdef G4VERBOSE                                  202 #ifdef G4VERBOSE
199           if( fCheck )                            203           if( fCheck )
200           {                                       204           {
201             fLogger->AlongComputeStepLog(sampl    205             fLogger->AlongComputeStepLog(sampleSolid, samplePoint,
202                                          sampl << 206               sampleDirection, localDirection, sampleSafety, sampleStep);
203                                          sampl << 
204           }                                       207           }
205 #endif                                            208 #endif          
206         }                                         209         }
207                                                   210 
208 #ifdef G4VERBOSE                                  211 #ifdef G4VERBOSE
209         if( fCheck && (sampleStep < kInfinity)    212         if( fCheck && (sampleStep < kInfinity) && (sampleStep >= motherStep) )
210         {                                         213         {
211            // The intersection point with the     214            // The intersection point with the daughter is at or after the exit
212            // point from the mother volume.  D    215            // point from the mother volume.  Double check!
213            fLogger->CheckDaughterEntryPoint(sa    216            fLogger->CheckDaughterEntryPoint(sampleSolid,
214                                             sa    217                                             samplePoint, sampleDirection,
215                                             mo    218                                             motherSolid,
216                                             lo << 219                                             localPoint,  localDirection,
217                                             mo << 220                                             motherStep,  sampleStep);
218         }                                         221         }
219 #endif                                            222 #endif
220       } // end of if ( sampleSafety <= ourStep    223       } // end of if ( sampleSafety <= ourStep ) 
221 #ifdef G4VERBOSE                                  224 #ifdef G4VERBOSE
222       else if ( fCheck )                       << 225       else if( fCheck )
223       {                                           226       {
224          fLogger->PrintDaughterLog(sampleSolid << 227          fLogger->PrintDaughterLog(sampleSolid,  samplePoint,
225                                    sampleSafet    228                                    sampleSafety, false,
226                                    G4ThreeVect    229                                    G4ThreeVector(0.,0.,0.), -1.0 );
227       }                                           230       }
228 #endif                                            231 #endif          
229     }                                             232     }
230   }                                               233   }
231   if ( currentProposedStepLength<ourSafety )      234   if ( currentProposedStepLength<ourSafety )
232   {                                               235   {
233     // Guaranteed physics limited                 236     // Guaranteed physics limited
234     //                                            237     //
235     entering = false;                             238     entering = false;
236     exiting  = false;                             239     exiting  = false;
237     *pBlockedPhysical = nullptr;               << 240     *pBlockedPhysical = 0;
238     ourStep = kInfinity;                          241     ourStep = kInfinity;
239   }                                               242   }
240   else                                            243   else
241   {                                               244   {
242     // Consider intersection with mother solid    245     // Consider intersection with mother solid
243     //                                            246     //
244     if ( motherSafety<=ourStep )                  247     if ( motherSafety<=ourStep )
245     {                                             248     {
246       if ( !fCheck )  // The call is moved abo    249       if ( !fCheck )  // The call is moved above when running in check_mode
247       {                                           250       {
248         motherStep = motherSolid->DistanceToOu    251         motherStep = motherSolid->DistanceToOut(localPoint,
249                                                   252                                                 localDirection,
250                                                   253                                                 true,
251                                                   254                                                &motherValidExitNormal,
252                                                   255                                                &motherExitNormal);
253       }                                           256       }
254 #ifdef G4VERBOSE                                  257 #ifdef G4VERBOSE
255       else  // check_mode                         258       else  // check_mode
256       {                                           259       {
257         fLogger->PostComputeStepLog(motherSoli    260         fLogger->PostComputeStepLog(motherSolid, localPoint, localDirection,
258                                     motherStep    261                                     motherStep, motherSafety);
259         if( motherValidExitNormal )               262         if( motherValidExitNormal )
260         {                                         263         {
261           fLogger->CheckAndReportBadNormal(mot    264           fLogger->CheckAndReportBadNormal(motherExitNormal,
262                                            loc    265                                            localPoint,
263                                            loc    266                                            localDirection,
264                                            mot    267                                            motherStep,
265                                            mot    268                                            motherSolid,
266                                            "Fr    269                                            "From motherSolid::DistanceToOut" );
267         }                                         270         }
268       }                                           271       }
269 #endif                                            272 #endif
270                                                   273 
271       if( (motherStep >= kInfinity) || (mother    274       if( (motherStep >= kInfinity) || (motherStep < 0.0) )
272       {                                           275       {
273 #ifdef G4VERBOSE                               << 276         // Clearly outside the mother solid!
274         if( fCheck )  // Clearly outside the m << 277 #ifdef G4VERBOSE         
275         {                                      << 278         fLogger->ReportOutsideMother(localPoint, localDirection, motherPhysical);
276           fLogger->ReportOutsideMother(localPo << 279 #endif         
277                                        motherP << 
278         }                                      << 
279 #endif                                         << 
280         ourStep = motherStep = 0.0;               280         ourStep = motherStep = 0.0;
281         exiting = true;                           281         exiting = true;
282         entering = false;                         282         entering = false;
283         // validExitNormal= motherValidExitNor    283         // validExitNormal= motherValidExitNormal;
284         // exitNormal= motherExitNormal;          284         // exitNormal= motherExitNormal;
285         //  The normal could be useful - but o    285         //  The normal could be useful - but only if near the mother
286         //  But it could be unreliable!           286         //  But it could be unreliable!
287         validExitNormal = false;                  287         validExitNormal = false;
288         *pBlockedPhysical = nullptr; // or mot << 288         *pBlockedPhysical= 0; // or motherPhysical ?
289         blockedReplicaNo = 0;  // or motherRep << 289         blockedReplicaNo= 0;  // or motherReplicaNumber ?
290         newSafety= 0.0;                           290         newSafety= 0.0;
291         return ourStep;                           291         return ourStep;
292       }                                           292       }
293                                                   293 
294       if ( motherStep<=ourStep )                  294       if ( motherStep<=ourStep )
295       {                                           295       {
296         ourStep  = motherStep;                    296         ourStep  = motherStep;
297         exiting  = true;                          297         exiting  = true;
298         entering = false;                         298         entering = false;
299         validExitNormal = motherValidExitNorma << 299         validExitNormal= motherValidExitNormal;
300         exitNormal = motherExitNormal;         << 300         exitNormal= motherExitNormal;
301                                                   301         
302         if ( motherValidExitNormal )              302         if ( motherValidExitNormal )
303         {                                         303         {
304           const G4RotationMatrix *rot = mother    304           const G4RotationMatrix *rot = motherPhysical->GetRotation();
305           if (rot != nullptr)                  << 305           if (rot)
306           {                                       306           {
307             exitNormal *= rot->inverse();         307             exitNormal *= rot->inverse();
308 #ifdef G4VERBOSE                                  308 #ifdef G4VERBOSE
309             if( fCheck )                          309             if( fCheck )
310             {                                  << 
311                fLogger->CheckAndReportBadNorma    310                fLogger->CheckAndReportBadNormal(exitNormal,        // rotated
312                                                   311                                                 motherExitNormal,  // original 
313                                                   312                                                 *rot,
314                                                   313                                                 "From RotationMatrix" );
315             }                                  << 
316 #endif                                            314 #endif            
317           }                                       315           }
318         }                                         316         }
319       }                                           317       }
320       else                                        318       else
321       {                                           319       {
322         validExitNormal = false;                  320         validExitNormal = false;
323       }                                           321       }
324     }                                             322     }
325   }                                               323   }
326   newSafety = ourSafety;                          324   newSafety = ourSafety;
327   return ourStep;                                 325   return ourStep;
328 }                                                 326 }
329                                                   327 
330 // *******************************************    328 // ********************************************************************
331 // ComputeSafety                                  329 // ComputeSafety
332 // *******************************************    330 // ********************************************************************
333 //                                                331 //
334 G4double G4NormalNavigation::ComputeSafety(con << 332 G4double G4NormalNavigation::ComputeSafety(const G4ThreeVector &localPoint,
335                                            con << 333                                            const G4NavigationHistory &history,
336                                            con    334                                            const G4double)
337 {                                                 335 {
338   G4VPhysicalVolume *motherPhysical, *samplePh    336   G4VPhysicalVolume *motherPhysical, *samplePhysical;
339   G4LogicalVolume *motherLogical;                 337   G4LogicalVolume *motherLogical;
340   G4VSolid *motherSolid;                          338   G4VSolid *motherSolid;
341   G4double motherSafety, ourSafety;               339   G4double motherSafety, ourSafety;
342   G4long localNoDaughters, sampleNo;           << 340   G4int localNoDaughters, sampleNo;
343                                                   341 
344   motherPhysical = history.GetTopVolume();        342   motherPhysical = history.GetTopVolume();
345   motherLogical  = motherPhysical->GetLogicalV    343   motherLogical  = motherPhysical->GetLogicalVolume();
346   motherSolid    = motherLogical->GetSolid();     344   motherSolid    = motherLogical->GetSolid();
347                                                   345 
348   // Compute mother safety                        346   // Compute mother safety
349   //                                              347   //
350   motherSafety = motherSolid->DistanceToOut(lo    348   motherSafety = motherSolid->DistanceToOut(localPoint);
351   ourSafety = motherSafety; // Working isotrop    349   ourSafety = motherSafety; // Working isotropic safety
352                                                   350 
353 #ifdef G4VERBOSE                                  351 #ifdef G4VERBOSE
354   if( fCheck )                                    352   if( fCheck )
355   {                                               353   {
356     fLogger->ComputeSafetyLog(motherSolid,loca << 354     fLogger->ComputeSafetyLog(motherSolid,localPoint,motherSafety,true,true);
357   }                                               355   }
358 #endif                                            356 #endif
359                                                   357 
360   // Compute daughter safeties                    358   // Compute daughter safeties 
361   //                                              359   //
362   localNoDaughters = motherLogical->GetNoDaugh    360   localNoDaughters = motherLogical->GetNoDaughters();
363   for ( sampleNo=localNoDaughters-1; sampleNo>    361   for ( sampleNo=localNoDaughters-1; sampleNo>=0; sampleNo-- )
364   {                                               362   {
365     samplePhysical = motherLogical->GetDaughte    363     samplePhysical = motherLogical->GetDaughter(sampleNo);
366     G4AffineTransform sampleTf(samplePhysical-    364     G4AffineTransform sampleTf(samplePhysical->GetRotation(),
367                                samplePhysical-    365                                samplePhysical->GetTranslation());
368     sampleTf.Invert();                            366     sampleTf.Invert();
369     const G4ThreeVector samplePoint =             367     const G4ThreeVector samplePoint =
370             sampleTf.TransformPoint(localPoint    368             sampleTf.TransformPoint(localPoint);
371     const G4VSolid *sampleSolid =                 369     const G4VSolid *sampleSolid =
372             samplePhysical->GetLogicalVolume()    370             samplePhysical->GetLogicalVolume()->GetSolid();
373     const G4double sampleSafety =                 371     const G4double sampleSafety =
374             sampleSolid->DistanceToIn(samplePo    372             sampleSolid->DistanceToIn(samplePoint);
375     if ( sampleSafety<ourSafety )                 373     if ( sampleSafety<ourSafety )
376     {                                             374     {
377       ourSafety = sampleSafety;                   375       ourSafety = sampleSafety;
378     }                                             376     }
379 #ifdef G4VERBOSE                                  377 #ifdef G4VERBOSE
380     if(fCheck)                                    378     if(fCheck)
381     {                                             379     {
382       fLogger->ComputeSafetyLog(sampleSolid, s << 380       fLogger->ComputeSafetyLog(sampleSolid,samplePoint,
383                                 sampleSafety,  << 381                                 sampleSafety,false,false);
384         // Not mother, no banner                  382         // Not mother, no banner
385     }                                             383     }
386 #endif                                            384 #endif
387   }                                               385   }
388   return ourSafety;                               386   return ourSafety;
389 }                                                 387 }
390                                                   388 
391 // The following methods have been imported to    389 // The following methods have been imported to this source file
392 // in order to avoid dependency of the header  << 390 //  in order to avoid dependency of the header file on the
393 // header implementation of G4NavigationLogger << 391 //  header implementation of G4NavigationLogger.
394                                                   392 
395 // *******************************************    393 // ********************************************************************
396 // GetVerboseLevel                                394 // GetVerboseLevel
397 // *******************************************    395 // ********************************************************************
398 //                                                396 //
399 G4int G4NormalNavigation::GetVerboseLevel() co    397 G4int G4NormalNavigation::GetVerboseLevel() const
400 {                                                 398 {
401   return fLogger->GetVerboseLevel();              399   return fLogger->GetVerboseLevel();
402 }                                                 400 }
403                                                   401 
404 // *******************************************    402 // ********************************************************************
405 // SetVerboseLevel                                403 // SetVerboseLevel
406 // *******************************************    404 // ********************************************************************
407 //                                                405 //
408 void G4NormalNavigation::SetVerboseLevel(G4int    406 void G4NormalNavigation::SetVerboseLevel(G4int level)
409 {                                                 407 {
410   fLogger->SetVerboseLevel(level);                408   fLogger->SetVerboseLevel(level);
411 }                                                 409 }
                                                   >> 410 
412                                                   411