Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pyangl.f
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file pyangl.f
1 
2 C*********************************************************************
3 
4 C...PYANGL
5 C...Reconstructs an angle from given x and y coordinates.
6 
7  FUNCTION pyangl(X,Y)
8 
9 C...Double precision and integer declarations.
10  IMPLICIT DOUBLE PRECISION(a-h, o-z)
11  IMPLICIT INTEGER(i-n)
12  INTEGER pyk,pychge,pycomp
13 C...Commonblocks.
14  common/pydat1/mstu(200),paru(200),mstj(200),parj(200)
15  SAVE /pydat1/
16 
17  pyangl=0d0
18  r=sqrt(x**2+y**2)
19  IF(r.LT.1d-20) RETURN
20  IF(abs(x)/r.LT.0.8d0) THEN
21  pyangl=sign(acos(x/r),y)
22  ELSE
23  pyangl=asin(y/r)
24  IF(x.LT.0d0.AND.pyangl.GE.0d0) THEN
25  pyangl=paru(1)-pyangl
26  ELSEIF(x.LT.0d0) THEN
27  pyangl=-paru(1)-pyangl
28  ENDIF
29  ENDIF
30 
31  RETURN
32  END