Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
py2ent.f
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file py2ent.f
1 
2 C*********************************************************************
3 
4 C...PY2ENT
5 C...Stores two partons/particles in their CM frame,
6 C...with the first along the +z axis.
7 
8  SUBROUTINE py2ent(IP,KF1,KF2,PECM)
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/pyjets/n,npad,k(4000,5),p(4000,5),v(4000,5)
16  common/pydat1/mstu(200),paru(200),mstj(200),parj(200)
17  common/pydat2/kchg(500,4),pmas(500,4),parf(2000),vckm(4,4)
18  SAVE /pyjets/,/pydat1/,/pydat2/
19 
20 C...Standard checks.
21  mstu(28)=0
22  IF(mstu(12).NE.12345) CALL pylist(0)
23  ipa=max(1,iabs(ip))
24  IF(ipa.GT.mstu(4)-1) CALL pyerrm(21,
25  &'(PY2ENT:) writing outside PYJETS memory')
26  kc1=pycomp(kf1)
27  kc2=pycomp(kf2)
28  IF(kc1.EQ.0.OR.kc2.EQ.0) CALL pyerrm(12,
29  &'(PY2ENT:) unknown flavour code')
30 
31 C...Find masses. Reset K, P and V vectors.
32  pm1=0d0
33  IF(mstu(10).EQ.1) pm1=p(ipa,5)
34  IF(mstu(10).GE.2) pm1=pymass(kf1)
35  pm2=0d0
36  IF(mstu(10).EQ.1) pm2=p(ipa+1,5)
37  IF(mstu(10).GE.2) pm2=pymass(kf2)
38  DO 110 i=ipa,ipa+1
39  DO 100 j=1,5
40  k(i,j)=0
41  p(i,j)=0d0
42  v(i,j)=0d0
43  100 CONTINUE
44  110 CONTINUE
45 
46 C...Check flavours.
47  kq1=kchg(kc1,2)*isign(1,kf1)
48  kq2=kchg(kc2,2)*isign(1,kf2)
49  IF(mstu(19).EQ.1) THEN
50  mstu(19)=0
51  ELSE
52  IF(kq1+kq2.NE.0.AND.kq1+kq2.NE.4) CALL pyerrm(2,
53  & '(PY2ENT:) unphysical flavour combination')
54  ENDIF
55  k(ipa,2)=kf1
56  k(ipa+1,2)=kf2
57 
58 C...Store partons/particles in K vectors for normal case.
59  IF(ip.GE.0) THEN
60  k(ipa,1)=1
61  IF(kq1.NE.0.AND.kq2.NE.0) k(ipa,1)=2
62  k(ipa+1,1)=1
63 
64 C...Store partons in K vectors for parton shower evolution.
65  ELSE
66  k(ipa,1)=3
67  k(ipa+1,1)=3
68  k(ipa,4)=mstu(5)*(ipa+1)
69  k(ipa,5)=k(ipa,4)
70  k(ipa+1,4)=mstu(5)*ipa
71  k(ipa+1,5)=k(ipa+1,4)
72  ENDIF
73 
74 C...Check kinematics and store partons/particles in P vectors.
75  IF(pecm.LE.pm1+pm2) CALL pyerrm(13,
76  &'(PY2ENT:) energy smaller than sum of masses')
77  pa=sqrt(max(0d0,(pecm**2-pm1**2-pm2**2)**2-(2d0*pm1*pm2)**2))/
78  &(2d0*pecm)
79  p(ipa,3)=pa
80  p(ipa,4)=sqrt(pm1**2+pa**2)
81  p(ipa,5)=pm1
82  p(ipa+1,3)=-pa
83  p(ipa+1,4)=sqrt(pm2**2+pa**2)
84  p(ipa+1,5)=pm2
85 
86 C...Set N. Optionally fragment/decay.
87  n=ipa+1
88  IF(ip.EQ.0) CALL pyexec
89 
90  RETURN
91  END