]> git.uio.no Git - u/mrichter/AliRoot.git/blame - GEANT321/ggeom/gsaphi.F
Minor corrections after big transformer changes
[u/mrichter/AliRoot.git] / GEANT321 / ggeom / gsaphi.F
CommitLineData
fe4da5cc 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)
13C.
14C. ******************************************************************
15C. * *
16C. * *
17C. * Subroutine GSAPHI computes the 'safety radius' from the *
18C. * point V to phi limits PHIL and PHIH. The safety radius is *
19C. * returned in SAF. *
20C. * A.C.McPherson 5th Sept. 1984. *
21C. * *
22C. ******************************************************************
23C.
24#include "geant321/gconsp.inc"
25C
26 DIMENSION V(3)
27C
28 R=V(1)**2+V(2)**2
29 IF(R.GT.0.0) R=SQRT(R)
30C
31 PHL=PHIL*DEGRAD
32 PHH=PHIH*DEGRAD
33C
34C Check for case of complete 360 degree region.
35C
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
40C
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))
45C
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))
50C
51 IF(SAF2.LT.SAF) SAF=SAF2
52C
53 10 CONTINUE
54 RETURN
55 END