Problem 1715

Summary: G4Exception : GeomSolids1002 with a Sphere as Sensitive Detector
Product: Geant4 Reporter: Matthew Lund <matthewl.lund>
Component: geometry/solidsAssignee: Gabriele Cosmo <Gabriele.Cosmo>
Status: RESOLVED FIXED    
Severity: trivial CC: John.Apostolakis, matthewl.lund
Priority: P5    
Version: 10.1   
Hardware: All   
OS: All   
Attachments: Test Example

Description Matthew Lund 2015-02-18 01:27:16 CET
Created attachment 319 [details]
Test Example

When using several spheres as sensitive detectors and a proton spectrum from the General Particle Source, I continually get G4Exception : GeomSolids1002
      issued by : G4Sphere::DistanceToOut(p,v,..)
Logic error: snxt = kInfinity  ???. I've tried multiple very different geometries, with the same issue of a sphere within an inner geometry. I've checked for overlaps, used the geometry check, and event the David package, no overlaps. Below is an example of the error message, and I'm attaching a copy of the application and geometries, if you run the gcr.mac macro file, it will replicate the problem. You can also see the same problem if the col3iss1_spheres.gdml geometry is replaced with apollo_cm1.gdml. I've tested multiple geometries, replicated in Geant4.10 and Geant4.10.01, and duplicated the error on Linux and Mac computers. I did not see the error in Geant4.9.6


-----------------------------------------------------------
    *** Dump for solid - ICRUSpherePhantom10_01_150.000mm_Solid_148209088 ***
    ===================================================
 Solid type: G4Sphere
 Parameters: 
    inner radius: 0 mm 
    outer radius: 150 mm 
    starting phi of segment  : 0 degrees 
    delta phi of segment     : 360 degrees 
    starting theta of segment: 0 degrees 
    delta theta of segment   : 180 degrees 
-----------------------------------------------------------

-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomSolids1002
      issued by : G4Sphere::DistanceToOut(p,v,..)
Undefined side for valid surface normal to solid.
Position:

p.x() = -91.44491856280547 mm
p.y() = -30.05375847107553 mm
p.z() = 115.0494491635918 mm

Direction:

v.x() = 0.8144523635332459
v.y() = 0.3328515178106197
v.z() = -0.4752654149275709

Proposed distance :

snxt = 9e+99 mm

*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------

G4WT2 > 
G4WT2 > -----------------------------------------------------------
    *** Dump for solid - ICRUSpherePhantom10_01_150.000mm_Solid_148209088 ***
    ===================================================
 Solid type: G4Sphere
 Parameters: 
    inner radius: 0 mm 
    outer radius: 150 mm 
    starting phi of segment  : 0 degrees 
    delta phi of segment     : 360 degrees 
    starting theta of segment: 0 degrees 
    delta theta of segment   : 180 degrees 
-----------------------------------------------------------

-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomSolids1002
      issued by : G4Sphere::DistanceToOut(p,v,..)
Logic error: snxt = kInfinity  ???
Position:

p.x() = -91.44491856280547 mm
p.y() = -30.05375847107553 mm
p.z() = 115.0494491635918 mm

Rp = 150.0059241564871 mm

Direction:

v.x() = 0.8144523635332459
v.y() = 0.3328515178106197
v.z() = -0.4752654149275709

Proposed distance :

snxt = 9e+99 mm

*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
Comment 1 Gabriele Cosmo 2015-02-21 11:34:36 CET
Thanks for the report.
I could reproduce the problem on vanilla 10.1 release (MacOS Yosemite 64-bits, sequential run).
The application provided shows a total of ~20 of such warnings out of 1M events.
In addition to that, I also observe -one- of warning message, where a negative path length is proposed:

  G4VParticleChange::CheckIt    : the true step length is negative  !!  Difference:  1.47875e-09[MeV] 
e- E=18.5113 pos=14.5118, 0.70007, 5.75209
      -----------------------------------------------
        G4ParticleChange Information  
      -----------------------------------------------
        # of 2ndaries       :                    0
      -----------------------------------------------
        Energy Deposit (MeV):                    0
        Non-ionizing Energy Deposit (MeV):                    0
        Track Status        :                Alive
        True Path Length (mm) :            -1.48e-09
        Stepping Control      :                    0
        Mass (GeV)   :                    0
        Charge (eplus)   :                    0
        MagneticMoment   :                    0
                :  =                    0*[e hbar]/[2 m]
        Position - x (mm)   :             1.45e+04
        Position - y (mm)   :                  700
        Position - z (mm)   :             5.75e+03
        Time (ns)           :                0.171
        Proper Time (ns)    :              0.00282
        Momentum Direct - x :            -0.000615
        Momentum Direct - y :               -0.951
        Momentum Direct - z :                0.308
        Kinetic Energy (MeV):                 18.5
        Velocity  (/c):                    1
        Polarization - x    :                    0
        Polarization - y    :                    0
        Polarization - z    :                    0
        Touchable (pointer) :       0x7fe954b6c208

The warning message issued by G4Sphere is correct, indicating an abnormal call to DistanceToOut() for a point effectively located outside the sphere.
Fixes which certainly affect this behaviour have been recently introduced in the current development branch for transportation and also EM back-scattering. These fixes will appear in the next patch to release 10.1.
I've verified that no such warnings are issued when using the current development branch.
Leaving the problem report open for further verification.
Comment 2 Gabriele Cosmo 2015-04-01 16:14:59 CEST
The fix for this problem, unfortunately, could not be included in the last patch to release 10.1 (10.1.p01) just released, as it turns out causing some unwanted side effects, requiring further investigations.
Will keep posting as soon as a final solution is found.
Comment 3 Gabriele Cosmo 2015-06-25 15:22:57 CEST
Fix is now provided in release 10.1.p02.