5 * Revision 1.1.1.1 1995/10/24 10:20:55 cernlib
9 #include "geant321/pilot.h"
10 *CMZ : 3.21/02 29/03/94 15.41.30 by S.Giani
12 SUBROUTINE GSAPHI(V,PHIL,PHIH,SAF)
14 C. ******************************************************************
17 C. * Subroutine GSAPHI computes the 'safety radius' from the *
18 C. * point V to phi limits PHIL and PHIH. The safety radius is *
19 C. * returned in SAF. *
20 C. * A.C.McPherson 5th Sept. 1984. *
22 C. ******************************************************************
24 #include "geant321/gconsp.inc"
29 IF(R.GT.0.0) R=SQRT(R)
34 C Check for case of complete 360 degree region.
38 IF(DPHI.LE.0.0) DPHI=DPHI+360.0
39 IF(DPHI.GE.360.0) GO TO 10
44 IF(SL*V(2)+CL*V(1).GT.0.0) SAF=ABS(SL*V(1)-CL*V(2))
49 IF(SH*V(2)+CH*V(1).GT.0.0) SAF2=ABS(SH*V(1)-CH*V(2))
51 IF(SAF2.LT.SAF) SAF=SAF2