Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pyspen.f
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file pyspen.f
1 
2 C***********************************************************************
3 
4 C...PYSPEN
5 C...Calculates real and imaginary part of Spence function; see
6 C...G. 't Hooft and M. Veltman, Nucl. Phys. B153 (1979) 365.
7 
8  FUNCTION pyspen(XREIN,XIMIN,IREIM)
9 
10 C...Double precision and integer declarations.
11  IMPLICIT DOUBLE PRECISION(a-h, o-z)
12  IMPLICIT INTEGER(i-n)
13  INTEGER pyk,pychge,pycomp
14 C...Commonblocks.
15  common/pydat1/mstu(200),paru(200),mstj(200),parj(200)
16  SAVE /pydat1/
17 C...Local array and data.
18  dimension b(0:14)
19  DATA b/
20  &1.000000d+00, -5.000000d-01, 1.666667d-01,
21  &0.000000d+00, -3.333333d-02, 0.000000d+00,
22  &2.380952d-02, 0.000000d+00, -3.333333d-02,
23  &0.000000d+00, 7.575757d-02, 0.000000d+00,
24  &-2.531135d-01, 0.000000d+00, 1.166667d+00/
25 
26  xre=xrein
27  xim=ximin
28  IF(abs(1d0-xre).LT.1d-6.AND.abs(xim).LT.1d-6) THEN
29  IF(ireim.EQ.1) pyspen=paru(1)**2/6d0
30  IF(ireim.EQ.2) pyspen=0d0
31  RETURN
32  ENDIF
33 
34  xmod=sqrt(xre**2+xim**2)
35  IF(xmod.LT.1d-6) THEN
36  IF(ireim.EQ.1) pyspen=0d0
37  IF(ireim.EQ.2) pyspen=0d0
38  RETURN
39  ENDIF
40 
41  xarg=sign(acos(xre/xmod),xim)
42  sp0re=0d0
43  sp0im=0d0
44  sgn=1d0
45  IF(xmod.GT.1d0) THEN
46  algxre=log(xmod)
47  algxim=xarg-sign(paru(1),xarg)
48  sp0re=-paru(1)**2/6d0-(algxre**2-algxim**2)/2d0
49  sp0im=-algxre*algxim
50  sgn=-1d0
51  xmod=1d0/xmod
52  xarg=-xarg
53  xre=xmod*cos(xarg)
54  xim=xmod*sin(xarg)
55  ENDIF
56  IF(xre.GT.0.5d0) THEN
57  algxre=log(xmod)
58  algxim=xarg
59  xre=1d0-xre
60  xim=-xim
61  xmod=sqrt(xre**2+xim**2)
62  xarg=sign(acos(xre/xmod),xim)
63  algyre=log(xmod)
64  algyim=xarg
65  sp0re=sp0re+sgn*(paru(1)**2/6d0-(algxre*algyre-algxim*algyim))
66  sp0im=sp0im-sgn*(algxre*algyim+algxim*algyre)
67  sgn=-sgn
68  ENDIF
69 
70  xre=1d0-xre
71  xim=-xim
72  xmod=sqrt(xre**2+xim**2)
73  xarg=sign(acos(xre/xmod),xim)
74  zre=-log(xmod)
75  zim=-xarg
76 
77  spre=0d0
78  spim=0d0
79  savere=1d0
80  saveim=0d0
81  DO 100 i=0,14
82  IF(max(abs(savere),abs(saveim)).LT.1d-30) goto 110
83  termre=(savere*zre-saveim*zim)/dble(i+1)
84  termim=(savere*zim+saveim*zre)/dble(i+1)
85  savere=termre
86  saveim=termim
87  spre=spre+b(i)*termre
88  spim=spim+b(i)*termim
89  100 CONTINUE
90 
91  110 IF(ireim.EQ.1) pyspen=sp0re+sgn*spre
92  IF(ireim.EQ.2) pyspen=sp0im+sgn*spim
93 
94  RETURN
95  END