Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pyradk.f
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file pyradk.f
1 
2 C*********************************************************************
3 
4 C...PYRADK
5 C...Generates initial state photon radiation.
6 
7  SUBROUTINE pyradk(ECM,MK,PAK,THEK,PHIK,ALPK)
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 C...Function: cumulative hard photon spectrum in QFD case.
18  fxk(xx)=2d0*log(xx)+parj(161)*log(1d0-xx)+parj(162)*xx+
19  &parj(163)*log((xx-szm)**2+szw**2)+parj(164)*atan((xx-szm)/szw)
20 
21 C...Determine whether radiative photon or not.
22  mk=0
23  pak=0d0
24  IF(parj(160).LT.pyr(0)) RETURN
25  mk=1
26 
27 C...Photon energy range. Find photon momentum in QED case.
28  xkl=parj(135)
29  xku=min(parj(136),1d0-(2d0*parj(127)/ecm)**2)
30  IF(mstj(102).LE.1) THEN
31  100 xk=1d0/(1d0+(1d0/xkl-1d0)*((1d0/xku-1d0)/(1d0/xkl-1d0))**pyr(0))
32  IF(1d0+(1d0-xk)**2.LT.2d0*pyr(0)) goto 100
33 
34 C...Ditto in QFD case, by numerical inversion of integrated spectrum.
35  ELSE
36  szm=1d0-(parj(123)/ecm)**2
37  szw=parj(123)*parj(124)/ecm**2
38  fxkl=fxk(xkl)
39  fxku=fxk(xku)
40  fxkd=1d-4*(fxku-fxkl)
41  fxkr=fxkl+pyr(0)*(fxku-fxkl)
42  nxk=0
43  110 nxk=nxk+1
44  xk=0.5d0*(xkl+xku)
45  fxkv=fxk(xk)
46  IF(fxkv.GT.fxkr) THEN
47  xku=xk
48  fxku=fxkv
49  ELSE
50  xkl=xk
51  fxkl=fxkv
52  ENDIF
53  IF(nxk.LT.15.AND.fxku-fxkl.GT.fxkd) goto 110
54  xk=xkl+(xku-xkl)*(fxkr-fxkl)/(fxku-fxkl)
55  ENDIF
56  pak=0.5d0*ecm*xk
57 
58 C...Photon polar and azimuthal angle.
59  pme=2d0*(pymass(11)/ecm)**2
60  120 cthm=pme*(2d0/pme)**pyr(0)
61  IF(1d0-(xk**2*cthm*(1d0-0.5d0*cthm)+2d0*(1d0-xk)*pme/max(pme,
62  &cthm*(1d0-0.5d0*cthm)))/(1d0+(1d0-xk)**2).LT.pyr(0)) goto 120
63  cthe=1d0-cthm
64  IF(pyr(0).GT.0.5d0) cthe=-cthe
65  sthe=sqrt(max(0d0,(cthm-pme)*(2d0-cthm)))
66  thek=pyangl(cthe,sthe)
67  phik=paru(2)*pyr(0)
68 
69 C...Rotation angle for hadronic system.
70  sgn=1d0
71  IF(0.5d0*(2d0-xk*(1d0-cthe))**2/((2d0-xk)**2+(xk*cthe)**2).GT.
72  &pyr(0)) sgn=-1d0
73  alpk=asin(sgn*sthe*(xk-sgn*(2d0*sqrt(1d0-xk)-2d0+xk)*cthe)/
74  &(2d0-xk*(1d0-sgn*cthe)))
75 
76  RETURN
77  END