When running a simulation I get a line: Invalid enum in G4Sphere::DistanceToOut and then the program crashed. This is the end of log-file: 21 472 51.7 5.6 1.16 0.168 0.575 137 supp1 msc 22 472 52 5.94 0.99 0.172 0.575 138 supp1 msc Sphere parameters: fRmin = 475 mm fRmax = 480 mm fSPhi = 0 degree fDPhi = 360 degree fSTheta = 17.8 degree fDTheta = 144.4 degree Position: p.x() = 471.7356120367253 mm p.y() = 51.95081450791341 mm p.z() = 5.938043020529463 mm Direction: v.x() = -0.519985502840818 v.y() = 0.2521089719986221 v.z() = 0.8161226274728446 Proposed distance : snxt = 9e+99 mm Invalid enum in G4Sphere::DistanceToOut *** G4Exception: Aborting execution ***
The problem is not in G4Sphere. The point is located outside, therefore the call of DistanceToOut is not valid, and the function can not find the proper intersection with surrounding surfaces, showing this exception.
I would add the following: 1. Check your geometry, especially in terms of contacting sphere surfaces. 2. Don't forget that the thickness of theta/phi G4Sphere surfaces has varing value in terms of cartesian dimensions. 3. Try to avoid direct coincidence of theta/phi surfaces in G4Sphere volume tree. If you can provide us with a simplified application showing this behaviour, it would be extremely useful for us to understand the source of the problem.