Problem 1902 - rounding error on phi side in G4ReplicaNavigation
Summary: rounding error on phi side in G4ReplicaNavigation
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: geometry/navigation (show other problems)
Version: 10.2
Hardware: All All
: P4 normal
Assignee: Gabriele Cosmo
URL:
Depends on:
Blocks:
 
Reported: 2016-10-18 03:18 CEST by Alexei Sibidanov
Modified: 2016-11-15 09:12 CET (History)
0 users

See Also:


Attachments
G4ReplicaNavigation.cc patch (497 bytes, patch)
2016-10-18 03:18 CEST, Alexei Sibidanov
Details | Diff

Note You need to log in before you can comment on or make changes to this problem.
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.