Finding Distance to Next Boundary

+-------------+                                               +----------##
| Geant 3.10  |               GEANT User's Guide              | GEOM310  ##
+-------------+                                               +----------##
                                   

Author(s) : R.Brun,A.C.McPherson Submitted: 01.06.83 Origin : Same Revised: 20.05.86

            +------------------------------------------------+
            |CALL GNEXT (X,SNEXT*,SAFETY*) |
            +------------------------------------------------+
                                  

Finds distance to the next boundary. It takes explicit account of shape content and uniqueness.

X
Vector of current coordinates and direction cosines
SNEXT
Distance from current point to volume boundary in specified direction
SAFETY
Safety distance, irrespective of direction

The distance to the next boundary is evaluated analytically using the volume geometrical parameters. When used in a tracking context it happens very frequently that a particle may have many steps in the same volume.In that case it is time consuming to always call the GMEDIA and GNEXT routines. The safety radius parameter can be exploited by the tracking routines, in such a way that GMEDIA and GNEXT are only called when the sum of all steps in the current volume is greater than SAFETY

In some volumes with complicated configuration the evaluation of the safety radius will be much too time consuming . In order to not lose time on one side to gain it somewhere else, the safety radius is returned=0.

    +----------------------------------------------------------------+
    | CALL GNEXTS (X,SH,P,*IDIST*,SNEXT*,SAFETY*) |
    +----------------------------------------------------------------+
                                  

This is a steering routine which calls one of a series of specialized routines depending on the shape of the volume for which it is called . These routines compute both the absolute shortest distance from the point (assumed to be INSIDE the volume) to the boundary of the volume and also the distance along a vector to that boundary.If a flag is zero or if the distance along the vector is less than the current value of the argument SNEXT then that argument is updated with the new value.The absolute shortest distance is always returned.

X
An array , the first 3 components of which define the point and the second three define the vector.
SH
Indicates the shape number of the volume [GEOM 050]
P
An array containing whether the parameters defining the volume.
IDIST
Is the flag indicating whether the value of SNEXT should be overwritten anyway (IDIST=0)or only with a lower value (IDIST=1). It is always returned as 1.
SNEXT
When overwritten(see IDIST)the distance along the vector to the boundary of the volume.
SAFETY
Always the shortest distance to the boundary.

   +------------------------------------------------------------------+
   | CALL GNOSOUT (X,SH,P,*IDIST*,SNEXT*,SAFETY*) |
   +------------------------------------------------------------------+
                                  

This is a steering routine which calls one of a series of specialized routines depending on the shape of the volume for which it is called. These routines compute both the absolute shortest distance from the point (assumed to be OUTSIDE the volume) to the boundary of the volume and also the distance along a vector to that boundary. If a positive value is found for the distance along the vector and if a flag is zero or if that distance is less than the current value of the argument SNEXT then that argument is updated with the new value . The absolute shortest distance is always returned.

Parameters are explained in GNEXTS above , except that in the event that IDIST is zero and no positive distance to the volume along the vector is found then IDIST remains as zero.