Problem 232

Summary: A problem about handling tolerance at G4Sphere::DistanceToOut
Product: Geant4 Reporter: tkoi
Component: geometry/solidsAssignee: Vladimir.Grichine
Status: RESOLVED WORKSFORME    
Severity: minor    
Priority: P2    
Version: 3.0   
Hardware: All   
OS: Linux   

Description tkoi 2001-03-20 17:15:40 CET
In G4Sphere::DistanceToOut, there is a problem or inconsistency to other
program unit about handling tolerance  This function is called when stepping
manager judged that a particle is in the Sphere and calculates the distance to
the Outside of the Sphere
However miss judgments of the stepping manager that actual point is outside of
the sphere but stepping manager thinks the point is inside of the sphere
sometimes arises.
When such miss-judgment occurred, the function replied
G4Exception("Invalid enum in G4Sphere::DistanceToOut");
and core dumped. To avoid such a situation, a tolerance is used and the
function accepts outside points that have shorter distance than the tolerance
from the shell of the sphere.
In Orginal code of Geant4, tolerance has unique value as 1.0e-9, but generally
such miss-judgments happen as a function of the scale size ( here, radius of
sphere).

So I would like to suggest following modification.

Line 1865 in G4Sphere.cc
G4double  Rmax_plus=  fRmax+kRadTolerance*0.5;	ORGINAL-CODE
G4double  Rmax_plus= fRmax*(1+kRadTolerance*0.5);	SUGGESTION

and

Line 1872 in G4Sphere.cc
if (c < kRadTolerance*fRmax)	ORGINAL-CODE
if (c < (kRadTolerance+0.25*kRadTolerance*kRadTolerance)*fRmax*fRmax)
	SUGGESTION

( because c has dimension of m**2. )

There is responsibility for the Miss-judgment of the place in Stepping manager
as well
However, I can not find how to decide physical volume from position coordinate
system.
So, I do not understand gTouchableh enough.
If anyone give me an explanation of gTouchableh and gHow to decide Physical
Volumeh,
I will appreciate very much.

Problem like this may happen not only other part of G4Shere but also other
solids.
Comment 1 Vladimir.Grichine 2001-11-21 02:21:59 CET
kCarTolerance is responsible for computer accuracy and should be fixed for
applications with dimensions usual for HEP experments. However a user can play
with its value in the case of applications with exotic dimensions (very small or
very high). In this case the user is responsible for physical meaning of the
results obtained.