]> git.uio.no Git - u/mrichter/AliRoot.git/blob - GEANT321/ggeom/gsaphi.F
100 parameters now allowed for geant shapes
[u/mrichter/AliRoot.git] / GEANT321 / ggeom / gsaphi.F
1 *
2 * $Id$
3 *
4 * $Log$
5 * Revision 1.1.1.1  1995/10/24 10:20:55  cernlib
6 * Geant
7 *
8 *
9 #include "geant321/pilot.h"
10 *CMZ :  3.21/02 29/03/94  15.41.30  by  S.Giani
11 *-- Author :
12       SUBROUTINE GSAPHI(V,PHIL,PHIH,SAF)
13 C.
14 C.    ******************************************************************
15 C.    *                                                                *
16 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.                          *
21 C.    *                                                                *
22 C.    ******************************************************************
23 C.
24 #include "geant321/gconsp.inc"
25 C
26       DIMENSION V(3)
27 C
28       R=V(1)**2+V(2)**2
29       IF(R.GT.0.0) R=SQRT(R)
30 C
31       PHL=PHIL*DEGRAD
32       PHH=PHIH*DEGRAD
33 C
34 C              Check for case of complete 360 degree region.
35 C
36       SAF=BIG
37       DPHI=PHIH-PHIL
38       IF(DPHI.LE.0.0) DPHI=DPHI+360.0
39       IF(DPHI.GE.360.0) GO TO 10
40 C
41       SAF=R
42       SL=SIN(PHL)
43       CL=COS(PHH)
44       IF(SL*V(2)+CL*V(1).GT.0.0) SAF=ABS(SL*V(1)-CL*V(2))
45 C
46       SAF2=R
47       SH=SIN(PHH)
48       CH=COS(PHH)
49       IF(SH*V(2)+CH*V(1).GT.0.0) SAF2=ABS(SH*V(1)-CH*V(2))
50 C
51       IF(SAF2.LT.SAF) SAF=SAF2
52 C
53    10 CONTINUE
54       RETURN
55       END