Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
py2frm.f
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file py2frm.f
1 
2 C*********************************************************************
3 
4 C...PY2FRM
5 C...An interface from a two-fermion generator to include
6 C...parton showers and hadronization.
7 
8  SUBROUTINE py2frm(IRAD,ITAU,ICOM)
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  SAVE /pyjets/,/pydat1/
18 C...Local arrays.
19  dimension ijoin(2),intau(2)
20 
21 C...Call PYHEPC to convert input from HEPEVT to PYJETS common.
22  IF(icom.EQ.0) THEN
23  mstu(28)=0
24  CALL pyhepc(2)
25  ENDIF
26 
27 C...Loop through entries and pick up all final fermions/antifermions.
28  i1=0
29  i2=0
30  DO 100 i=1,n
31  IF(k(i,1).LE.0.OR.k(i,1).GT.10) goto 100
32  kfa=iabs(k(i,2))
33  IF((kfa.GE.1.AND.kfa.LE.6).OR.(kfa.GE.11.AND.kfa.LE.16)) THEN
34  IF(k(i,2).GT.0) THEN
35  IF(i1.EQ.0) THEN
36  i1=i
37  ELSE
38  CALL pyerrm(16,'(PY2FRM:) more than one fermion')
39  ENDIF
40  ELSE
41  IF(i2.EQ.0) THEN
42  i2=i
43  ELSE
44  CALL pyerrm(16,'(PY2FRM:) more than one antifermion')
45  ENDIF
46  ENDIF
47  ENDIF
48  100 CONTINUE
49 
50 C...Check that event is arranged according to conventions.
51  IF(i1.EQ.0.OR.i2.EQ.0) THEN
52  CALL pyerrm(16,'(PY2FRM:) event contains too few fermions')
53  ENDIF
54  IF(i2.LT.i1) THEN
55  CALL pyerrm(6,'(PY2FRM:) fermions arranged in wrong order')
56  ENDIF
57 
58 C...Check whether fermion pair is quarks or leptons.
59  IF(iabs(k(i1,2)).LT.10.AND.iabs(k(i2,2)).LT.10) THEN
60  iql12=1
61  ELSEIF(iabs(k(i1,2)).GT.10.AND.iabs(k(i2,2)).GT.10) THEN
62  iql12=2
63  ELSE
64  CALL pyerrm(16,'(PY2FRM:) fermion pair inconsistent')
65  ENDIF
66 
67 C...Decide whether to allow or not photon radiation in showers.
68  mstj(41)=2
69  IF(irad.EQ.0) mstj(41)=1
70 
71 C...Do colour joining and parton showers.
72  ip1=i1
73  ip2=i2
74  IF(iql12.EQ.1) THEN
75  ijoin(1)=ip1
76  ijoin(2)=ip2
77  CALL pyjoin(2,ijoin)
78  ENDIF
79  IF(iql12.EQ.1.OR.irad.EQ.1) THEN
80  pm12s=(p(ip1,4)+p(ip2,4))**2-(p(ip1,1)+p(ip2,1))**2-
81  & (p(ip1,2)+p(ip2,2))**2-(p(ip1,3)+p(ip2,3))**2
82  CALL pyshow(ip1,ip2,sqrt(max(0d0,pm12s)))
83  ENDIF
84 
85 C...Do fragmentation and decays. Possibly except tau decay.
86  IF(itau.EQ.0) THEN
87  ntau=0
88  DO 110 i=1,n
89  IF(iabs(k(i,2)).EQ.15.AND.k(i,1).EQ.1) THEN
90  ntau=ntau+1
91  intau(ntau)=i
92  k(i,1)=11
93  ENDIF
94  110 CONTINUE
95  ENDIF
96  CALL pyexec
97  IF(itau.EQ.0) THEN
98  DO 120 i=1,ntau
99  k(intau(i),1)=1
100  120 CONTINUE
101  ENDIF
102 
103 C...Call PYHEPC to convert output from PYJETS to HEPEVT common.
104  IF(icom.EQ.0) THEN
105  mstu(28)=0
106  CALL pyhepc(1)
107  ENDIF
108 
109  END