Problem 1902

Summary: rounding error on phi side in G4ReplicaNavigation
Product: Geant4 Reporter: Alexei Sibidanov <sibid>
Component: geometry/navigationAssignee: Gabriele Cosmo <Gabriele.Cosmo>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P4    
Version: 10.2   
Hardware: All   
OS: All   
Attachments: G4ReplicaNavigation.cc patch

Description Alexei Sibidanov 2016-10-18 03:18:13 CEST
Created attachment 421 [details]
G4ReplicaNavigation.cc   patch

I suggest the following the patch against the situation when a point is exactly on phi border in replica and due to rounding errors it is always outside of any phi wedge which lead to kInfinity result instead of 0.


--- geant4.10.02.p02/source/geometry/navigation/src/G4ReplicaNavigation.cc      2016-06-29 07:03:28.000000000 -0700
+++ G4ReplicaNavigation.cc      2016-10-17 18:04:59.981794218 -0700
@@ -355,7 +355,7 @@
     compS = -sinSPhi*localDirection.x()+cosSPhi*localDirection.y();
     compE = -sinSPhi*localDirection.x()-cosSPhi*localDirection.y();
 
-    if ( (pDistS<=0)&&(pDistE<=0) )
+    if ( (pDistS<=halfkCarTolerance)&&(pDistE<=halfkCarTolerance) )
     {
       // Inside both phi *full* planes
       //
Comment 1 Gabriele Cosmo 2016-11-15 09:12:24 CET
Thanks for the suggested patch. A fix is now included in the development version and will be available in the next release.