Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
py3ent.f
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file py3ent.f
1 
2 C*********************************************************************
3 
4 C...PY3ENT
5 C...Stores three partons or particles in their CM frame,
6 C...with the first along the +z axis and the third in the (x,z)
7 C...plane with x > 0.
8 
9  SUBROUTINE py3ent(IP,KF1,KF2,KF3,PECM,X1,X3)
10 
11 C...Double precision and integer declarations.
12  IMPLICIT DOUBLE PRECISION(a-h, o-z)
13  IMPLICIT INTEGER(i-n)
14  INTEGER pyk,pychge,pycomp
15 C...Commonblocks.
16  common/pyjets/n,npad,k(4000,5),p(4000,5),v(4000,5)
17  common/pydat1/mstu(200),paru(200),mstj(200),parj(200)
18  common/pydat2/kchg(500,4),pmas(500,4),parf(2000),vckm(4,4)
19  SAVE /pyjets/,/pydat1/,/pydat2/
20 
21 C...Standard checks.
22  mstu(28)=0
23  IF(mstu(12).NE.12345) CALL pylist(0)
24  ipa=max(1,iabs(ip))
25  IF(ipa.GT.mstu(4)-2) CALL pyerrm(21,
26  &'(PY3ENT:) writing outside PYJETS memory')
27  kc1=pycomp(kf1)
28  kc2=pycomp(kf2)
29  kc3=pycomp(kf3)
30  IF(kc1.EQ.0.OR.kc2.EQ.0.OR.kc3.EQ.0) CALL pyerrm(12,
31  &'(PY3ENT:) unknown flavour code')
32 
33 C...Find masses. Reset K, P and V vectors.
34  pm1=0d0
35  IF(mstu(10).EQ.1) pm1=p(ipa,5)
36  IF(mstu(10).GE.2) pm1=pymass(kf1)
37  pm2=0d0
38  IF(mstu(10).EQ.1) pm2=p(ipa+1,5)
39  IF(mstu(10).GE.2) pm2=pymass(kf2)
40  pm3=0d0
41  IF(mstu(10).EQ.1) pm3=p(ipa+2,5)
42  IF(mstu(10).GE.2) pm3=pymass(kf3)
43  DO 110 i=ipa,ipa+2
44  DO 100 j=1,5
45  k(i,j)=0
46  p(i,j)=0d0
47  v(i,j)=0d0
48  100 CONTINUE
49  110 CONTINUE
50 
51 C...Check flavours.
52  kq1=kchg(kc1,2)*isign(1,kf1)
53  kq2=kchg(kc2,2)*isign(1,kf2)
54  kq3=kchg(kc3,2)*isign(1,kf3)
55  IF(mstu(19).EQ.1) THEN
56  mstu(19)=0
57  ELSEIF(kq1.EQ.0.AND.kq2.EQ.0.AND.kq3.EQ.0) THEN
58  ELSEIF(kq1.NE.0.AND.kq2.EQ.2.AND.(kq1+kq3.EQ.0.OR.
59  & kq1+kq3.EQ.4)) THEN
60  ELSE
61  CALL pyerrm(2,'(PY3ENT:) unphysical flavour combination')
62  ENDIF
63  k(ipa,2)=kf1
64  k(ipa+1,2)=kf2
65  k(ipa+2,2)=kf3
66 
67 C...Store partons/particles in K vectors for normal case.
68  IF(ip.GE.0) THEN
69  k(ipa,1)=1
70  IF(kq1.NE.0.AND.(kq2.NE.0.OR.kq3.NE.0)) k(ipa,1)=2
71  k(ipa+1,1)=1
72  IF(kq2.NE.0.AND.kq3.NE.0) k(ipa+1,1)=2
73  k(ipa+2,1)=1
74 
75 C...Store partons in K vectors for parton shower evolution.
76  ELSE
77  k(ipa,1)=3
78  k(ipa+1,1)=3
79  k(ipa+2,1)=3
80  kcs=4
81  IF(kq1.EQ.-1) kcs=5
82  k(ipa,kcs)=mstu(5)*(ipa+1)
83  k(ipa,9-kcs)=mstu(5)*(ipa+2)
84  k(ipa+1,kcs)=mstu(5)*(ipa+2)
85  k(ipa+1,9-kcs)=mstu(5)*ipa
86  k(ipa+2,kcs)=mstu(5)*ipa
87  k(ipa+2,9-kcs)=mstu(5)*(ipa+1)
88  ENDIF
89 
90 C...Check kinematics.
91  mkerr=0
92  IF(0.5d0*x1*pecm.LE.pm1.OR.0.5d0*(2d0-x1-x3)*pecm.LE.pm2.OR.
93  &0.5d0*x3*pecm.LE.pm3) mkerr=1
94  pa1=sqrt(max(1d-10,(0.5d0*x1*pecm)**2-pm1**2))
95  pa2=sqrt(max(1d-10,(0.5d0*(2d0-x1-x3)*pecm)**2-pm2**2))
96  pa3=sqrt(max(1d-10,(0.5d0*x3*pecm)**2-pm3**2))
97  cthe2=(pa3**2-pa1**2-pa2**2)/(2d0*pa1*pa2)
98  cthe3=(pa2**2-pa1**2-pa3**2)/(2d0*pa1*pa3)
99  IF(abs(cthe2).GE.1.001d0.OR.abs(cthe3).GE.1.001d0) mkerr=1
100  cthe3=max(-1d0,min(1d0,cthe3))
101  IF(mkerr.NE.0) CALL pyerrm(13,
102  &'(PY3ENT:) unphysical kinematical variable setup')
103 
104 C...Store partons/particles in P vectors.
105  p(ipa,3)=pa1
106  p(ipa,4)=sqrt(pa1**2+pm1**2)
107  p(ipa,5)=pm1
108  p(ipa+2,1)=pa3*sqrt(1d0-cthe3**2)
109  p(ipa+2,3)=pa3*cthe3
110  p(ipa+2,4)=sqrt(pa3**2+pm3**2)
111  p(ipa+2,5)=pm3
112  p(ipa+1,1)=-p(ipa+2,1)
113  p(ipa+1,3)=-p(ipa,3)-p(ipa+2,3)
114  p(ipa+1,4)=sqrt(p(ipa+1,1)**2+p(ipa+1,3)**2+pm2**2)
115  p(ipa+1,5)=pm2
116 
117 C...Set N. Optionally fragment/decay.
118  n=ipa+2
119  IF(ip.EQ.0) CALL pyexec
120 
121  RETURN
122  END