Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pyzdis.f
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file pyzdis.f
1 
2 C*********************************************************************
3 
4 C...PYZDIS
5 C...Generates the longitudinal splitting variable z.
6 
7  SUBROUTINE pyzdis(KFL1,KFL2,PR,Z)
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  common/pydat2/kchg(500,4),pmas(500,4),parf(2000),vckm(4,4)
16  SAVE /pydat1/,/pydat2/
17 
18 C...Check if heavy flavour fragmentation.
19  kfla=iabs(kfl1)
20  kflb=iabs(kfl2)
21  kflh=kfla
22  IF(kfla.GE.10) kflh=mod(kfla/1000,10)
23 
24 C...Lund symmetric scaling function: determine parameters of shape.
25  IF(mstj(11).EQ.1.OR.(mstj(11).EQ.3.AND.kflh.LE.3).OR.
26  &mstj(11).GE.4) THEN
27  fa=parj(41)
28  IF(mstj(91).EQ.1) fa=parj(43)
29  IF(kflb.GE.10) fa=fa+parj(45)
30  fbb=parj(42)
31  IF(mstj(91).EQ.1) fbb=parj(44)
32  fb=fbb*pr
33  fc=1d0
34  IF(kfla.GE.10) fc=fc-parj(45)
35  IF(kflb.GE.10) fc=fc+parj(45)
36  IF(mstj(11).GE.4.AND.(kflh.EQ.4.OR.kflh.EQ.5)) THEN
37  fred=parj(46)
38  IF(mstj(11).EQ.5.AND.kflh.EQ.5) fred=parj(47)
39  fc=fc+fred*fbb*parf(100+kflh)**2
40  ENDIF
41  mc=1
42  IF(abs(fc-1d0).GT.0.01d0) mc=2
43 
44 C...Determine position of maximum. Special cases for a = 0 or a = c.
45  IF(fa.LT.0.02d0) THEN
46  ma=1
47  zmax=1d0
48  IF(fc.GT.fb) zmax=fb/fc
49  ELSEIF(abs(fc-fa).LT.0.01d0) THEN
50  ma=2
51  zmax=fb/(fb+fc)
52  ELSE
53  ma=3
54  zmax=0.5d0*(fb+fc-sqrt((fb-fc)**2+4d0*fa*fb))/(fc-fa)
55  IF(zmax.GT.0.9999d0.AND.fb.GT.100d0) zmax=min(zmax,1d0-fa/fb)
56  ENDIF
57 
58 C...Subdivide z range if distribution very peaked near endpoint.
59  mmax=2
60  IF(zmax.LT.0.1d0) THEN
61  mmax=1
62  zdiv=2.75d0*zmax
63  IF(mc.EQ.1) THEN
64  fint=1d0-log(zdiv)
65  ELSE
66  zdivc=zdiv**(1d0-fc)
67  fint=1d0+(1d0-1d0/zdivc)/(fc-1d0)
68  ENDIF
69  ELSEIF(zmax.GT.0.85d0.AND.fb.GT.1d0) THEN
70  mmax=3
71  fscb=sqrt(4d0+(fc/fb)**2)
72  zdiv=fscb-1d0/zmax-(fc/fb)*log(zmax*0.5d0*(fscb+fc/fb))
73  IF(ma.GE.2) zdiv=zdiv+(fa/fb)*log(1d0-zmax)
74  zdiv=min(zmax,max(0d0,zdiv))
75  fint=1d0+fb*(1d0-zdiv)
76  ENDIF
77 
78 C...Choice of z, preweighted for peaks at low or high z.
79  100 z=pyr(0)
80  fpre=1d0
81  IF(mmax.EQ.1) THEN
82  IF(fint*pyr(0).LE.1d0) THEN
83  z=zdiv*z
84  ELSEIF(mc.EQ.1) THEN
85  z=zdiv**z
86  fpre=zdiv/z
87  ELSE
88  z=(zdivc+z*(1d0-zdivc))**(1d0/(1d0-fc))
89  fpre=(zdiv/z)**fc
90  ENDIF
91  ELSEIF(mmax.EQ.3) THEN
92  IF(fint*pyr(0).LE.1d0) THEN
93  z=zdiv+log(z)/fb
94  fpre=exp(fb*(z-zdiv))
95  ELSE
96  z=zdiv+z*(1d0-zdiv)
97  ENDIF
98  ENDIF
99 
100 C...Weighting according to correct formula.
101  IF(z.LE.0d0.OR.z.GE.1d0) goto 100
102  fexp=fc*log(zmax/z)+fb*(1d0/zmax-1d0/z)
103  IF(ma.GE.2) fexp=fexp+fa*log((1d0-z)/(1d0-zmax))
104  fval=exp(max(-50d0,min(50d0,fexp)))
105  IF(fval.LT.pyr(0)*fpre) goto 100
106 
107 C...Generate z according to Field-Feynman, SLAC, (1-z)**c OR z**c.
108  ELSE
109  fc=parj(50+max(1,kflh))
110  IF(mstj(91).EQ.1) fc=parj(59)
111  110 z=pyr(0)
112  IF(fc.GE.0d0.AND.fc.LE.1d0) THEN
113  IF(fc.GT.pyr(0)) z=1d0-z**(1d0/3d0)
114  ELSEIF(fc.GT.-1.AND.fc.LT.0d0) THEN
115  IF(-4d0*fc*z*(1d0-z)**2.LT.pyr(0)*((1d0-z)**2-fc*z)**2)
116  & goto 110
117  ELSE
118  IF(fc.GT.0d0) z=1d0-z**(1d0/fc)
119  IF(fc.LT.0d0) z=z**(-1d0/fc)
120  ENDIF
121  ENDIF
122 
123  RETURN
124  END