Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
py6frm.f
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file py6frm.f
1 
2 C*********************************************************************
3 
4 C...PY6FRM
5 C...An interface from a six-fermion generator to include
6 C...parton showers and hadronization.
7 
8  SUBROUTINE py6frm(P12,P13,P21,P23,P31,P32,PTOP,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(6),beta(3),betao(3),betan(3)
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  i3=0
31  i4=0
32  i5=0
33  i6=0
34  DO 100 i=1,n
35  IF(k(i,1).LE.0.OR.k(i,1).GT.10) goto 100
36  kfa=iabs(k(i,2))
37  IF((kfa.GE.1.AND.kfa.LE.6).OR.(kfa.GE.11.AND.kfa.LE.16)) THEN
38  IF(k(i,2).GT.0) THEN
39  IF(i1.EQ.0) THEN
40  i1=i
41  ELSEIF(i3.EQ.0) THEN
42  i3=i
43  ELSEIF(i5.EQ.0) THEN
44  i5=i
45  ELSE
46  CALL pyerrm(16,'(PY6FRM:) more than three fermions')
47  ENDIF
48  ELSE
49  IF(i2.EQ.0) THEN
50  i2=i
51  ELSEIF(i4.EQ.0) THEN
52  i4=i
53  ELSEIF(i6.EQ.0) THEN
54  i6=i
55  ELSE
56  CALL pyerrm(16,'(PY6FRM:) more than three antifermions')
57  ENDIF
58  ENDIF
59  ENDIF
60  100 CONTINUE
61 
62 C...Check that event is arranged according to conventions.
63  IF(i5.EQ.0.OR.i6.EQ.0) THEN
64  CALL pyerrm(16,'(PY6FRM:) event contains too few fermions')
65  ENDIF
66  IF(i2.LT.i1.OR.i3.LT.i2.OR.i4.LT.i3.OR.i5.LT.i4.OR.i6.LT.i5) THEN
67  CALL pyerrm(6,'(PY6FRM:) fermions arranged in wrong order')
68  ENDIF
69 
70 C...Check which fermion pairs are quarks and which leptons.
71  IF(iabs(k(i1,2)).LT.10.AND.iabs(k(i2,2)).LT.10) THEN
72  iql12=1
73  ELSEIF(iabs(k(i1,2)).GT.10.AND.iabs(k(i2,2)).GT.10) THEN
74  iql12=2
75  ELSE
76  CALL pyerrm(16,'(PY6FRM:) first fermion pair inconsistent')
77  ENDIF
78  IF(iabs(k(i3,2)).LT.10.AND.iabs(k(i4,2)).LT.10) THEN
79  iql34=1
80  ELSEIF(iabs(k(i3,2)).GT.10.AND.iabs(k(i4,2)).GT.10) THEN
81  iql34=2
82  ELSE
83  CALL pyerrm(16,'(PY6FRM:) second fermion pair inconsistent')
84  ENDIF
85  IF(iabs(k(i5,2)).LT.10.AND.iabs(k(i6,2)).LT.10) THEN
86  iql56=1
87  ELSEIF(iabs(k(i5,2)).GT.10.AND.iabs(k(i6,2)).GT.10) THEN
88  iql56=2
89  ELSE
90  CALL pyerrm(16,'(PY6FRM:) third fermion pair inconsistent')
91  ENDIF
92 
93 C...Decide whether to allow or not photon radiation in showers.
94  mstj(41)=2
95  IF(irad.EQ.0) mstj(41)=1
96 
97 C...Allow dipole pairings only among leptons and quarks separately.
98  p12d=p12
99  p13d=0d0
100  IF(iql34.EQ.iql56) p13d=p13
101  p21d=0d0
102  IF(iql12.EQ.iql34) p21d=p21
103  p23d=0d0
104  IF(iql12.EQ.iql34.AND.iql12.EQ.iql56) p23d=p23
105  p31d=0d0
106  IF(iql12.EQ.iql34.AND.iql12.EQ.iql56) p31d=p31
107  p32d=0d0
108  IF(iql12.EQ.iql56) p32d=p32
109 
110 C...Decide whether t+tbar.
111  itop=0
112  IF(pyr(0).LT.ptop) THEN
113  itop=1
114 
115 C...If t+tbar: reconstruct t's.
116  it=n+1
117  itb=n+2
118  DO 110 j=1,5
119  k(it,j)=0
120  k(itb,j)=0
121  p(it,j)=p(i1,j)+p(i3,j)+p(i4,j)
122  p(itb,j)=p(i2,j)+p(i5,j)+p(i6,j)
123  v(it,j)=0d0
124  v(itb,j)=0d0
125  110 CONTINUE
126  k(it,1)=1
127  k(itb,1)=1
128  k(it,2)=6
129  k(itb,2)=-6
130  p(it,5)=sqrt(max(0d0,p(it,4)**2-p(it,1)**2-p(it,2)**2-
131  & p(it,3)**2))
132  p(itb,5)=sqrt(max(0d0,p(itb,4)**2-p(itb,1)**2-p(itb,2)**2-
133  & p(itb,3)**2))
134  n=n+2
135 
136 C...If t+tbar: colour join t's and let them shower.
137  ijoin(1)=it
138  ijoin(2)=itb
139  CALL pyjoin(2,ijoin)
140  pmtts=(p(it,4)+p(itb,4))**2-(p(it,1)+p(itb,1))**2-
141  & (p(it,2)+p(itb,2))**2-(p(it,3)+p(itb,3))**2
142  CALL pyshow(it,itb,sqrt(max(0d0,pmtts)))
143 
144 C...If t+tbar: pick up the t's after shower.
145  itnew=it
146  itbnew=itb
147  DO 120 i=itb+1,n
148  IF(k(i,2).EQ.6) itnew=i
149  IF(k(i,2).EQ.-6) itbnew=i
150  120 CONTINUE
151 
152 C...If t+tbar: loop over two top systems.
153  DO 200 it1=1,2
154  IF(it1.EQ.1) THEN
155  ito=it
156  itn=itnew
157  ibo=i1
158  iw1=i3
159  iw2=i4
160  ELSE
161  ito=itb
162  itn=itbnew
163  ibo=i2
164  iw1=i5
165  iw2=i6
166  ENDIF
167  IF(iabs(k(ibo,2)).NE.5) CALL pyerrm(6,
168  & '(PY6FRM:) not b in t decay')
169 
170 C...If t+tbar: find boost from original to new top frame.
171  DO 130 j=1,3
172  betao(j)=p(ito,j)/p(ito,4)
173  betan(j)=p(itn,j)/p(itn,4)
174  130 CONTINUE
175 
176 C...If t+tbar: boost copy of b by t shower and connect it in colour.
177  n=n+1
178  ib=n
179  k(ib,1)=3
180  k(ib,2)=k(ibo,2)
181  k(ib,3)=itn
182  DO 140 j=1,5
183  p(ib,j)=p(ibo,j)
184  v(ib,j)=0d0
185  140 CONTINUE
186  CALL pyrobo(ib,ib,0d0,0d0,-betao(1),-betao(2),-betao(3))
187  CALL pyrobo(ib,ib,0d0,0d0,betan(1),betan(2),betan(3))
188  k(ib,4)=mstu(5)*itn
189  k(ib,5)=mstu(5)*itn
190  k(itn,4)=k(itn,4)+ib
191  k(itn,5)=k(itn,5)+ib
192  k(itn,1)=k(itn,1)+10
193  k(ibo,1)=k(ibo,1)+10
194 
195 C...If t+tbar: construct W recoiling against b.
196  n=n+1
197  iw=n
198  DO 150 j=1,5
199  k(iw,j)=0
200  v(iw,j)=0d0
201  150 CONTINUE
202  k(iw,1)=1
203  kchw=pychge(k(iw1,2))+pychge(k(iw2,2))
204  IF(iabs(kchw).EQ.3) THEN
205  k(iw,2)=isign(24,kchw)
206  ELSE
207  CALL pyerrm(16,'(PY6FRM:) fermion pair inconsistent with W')
208  ENDIF
209  k(iw,3)=iw1
210 
211 C...If t+tbar: construct W momentum, including boost by t shower.
212  DO 160 j=1,4
213  p(iw,j)=p(iw1,j)+p(iw2,j)
214  160 CONTINUE
215  p(iw,5)=sqrt(max(0d0,p(iw,4)**2-p(iw,1)**2-p(iw,2)**2-
216  & p(iw,3)**2))
217  CALL pyrobo(iw,iw,0d0,0d0,-betao(1),-betao(2),-betao(3))
218  CALL pyrobo(iw,iw,0d0,0d0,betan(1),betan(2),betan(3))
219 
220 C...If t+tbar: boost b and W to top rest frame.
221  DO 170 j=1,3
222  beta(j)=(p(ib,j)+p(iw,j))/(p(ib,4)+p(iw,4))
223  170 CONTINUE
224  CALL pyrobo(ib,ib,0d0,0d0,-beta(1),-beta(2),-beta(3))
225  CALL pyrobo(iw,iw,0d0,0d0,-beta(1),-beta(2),-beta(3))
226 
227 C...If t+tbar: let b shower and pick up modified W.
228  pmts=(p(ib,4)+p(iw,4))**2-(p(ib,1)+p(iw,1))**2-
229  & (p(ib,2)+p(iw,2))**2-(p(ib,3)+p(iw,3))**2
230  CALL pyshow(ib,iw,sqrt(max(0d0,pmts)))
231  DO 180 i=iw,n
232  IF(iabs(k(i,2)).EQ.24) iwm=i
233  180 CONTINUE
234 
235 C...If t+tbar: take copy of W decay products.
236  DO 190 j=1,5
237  k(n+1,j)=k(iw1,j)
238  p(n+1,j)=p(iw1,j)
239  v(n+1,j)=v(iw1,j)
240  k(n+2,j)=k(iw2,j)
241  p(n+2,j)=p(iw2,j)
242  v(n+2,j)=v(iw2,j)
243  190 CONTINUE
244  k(iw1,1)=k(iw1,1)+10
245  k(iw2,1)=k(iw2,1)+10
246  k(iwm,1)=k(iwm,1)+10
247  k(iwm,4)=n+1
248  k(iwm,5)=n+2
249  k(n+1,3)=iwm
250  k(n+2,3)=iwm
251  IF(it1.EQ.1) THEN
252  i3=n+1
253  i4=n+2
254  ELSE
255  i5=n+1
256  i6=n+2
257  ENDIF
258  n=n+2
259 
260 C...If t+tbar: boost W decay products, first by effects of t shower,
261 C...then by those of b shower. b and its shower simple boost back.
262  CALL pyrobo(n-1,n,0d0,0d0,-betao(1),-betao(2),-betao(3))
263  CALL pyrobo(n-1,n,0d0,0d0,betan(1),betan(2),betan(3))
264  CALL pyrobo(n-1,n,0d0,0d0,-beta(1),-beta(2),-beta(3))
265  CALL pyrobo(n-1,n,0d0,0d0,-p(iw,1)/p(iw,4),
266  & -p(iw,2)/p(iw,4),-p(iw,3)/p(iw,4))
267  CALL pyrobo(n-1,n,0d0,0d0,p(iwm,1)/p(iwm,4),
268  & p(iwm,2)/p(iwm,4),p(iwm,3)/p(iwm,4))
269  CALL pyrobo(ib,ib,0d0,0d0,beta(1),beta(2),beta(3))
270  CALL pyrobo(iw,n,0d0,0d0,beta(1),beta(2),beta(3))
271  200 CONTINUE
272  ENDIF
273 
274 C...Decide on dipole pairing.
275  ip1=i1
276  ip3=i3
277  ip5=i5
278  prn=pyr(0)*(p12d+p13d+p21d+p23d+p31d+p32d)
279  IF(itop.EQ.1.OR.prn.LT.p12d) THEN
280  ip2=i2
281  ip4=i4
282  ip6=i6
283  ELSEIF(prn.LT.p12d+p13d) THEN
284  ip2=i2
285  ip4=i6
286  ip6=i4
287  ELSEIF(prn.LT.p12d+p13d+p21d) THEN
288  ip2=i4
289  ip4=i2
290  ip6=i6
291  ELSEIF(prn.LT.p12d+p13d+p21d+p23d) THEN
292  ip2=i4
293  ip4=i6
294  ip6=i2
295  ELSEIF(prn.LT.p12d+p13d+p21d+p23d+p31d) THEN
296  ip2=i6
297  ip4=i2
298  ip6=i4
299  ELSE
300  ip2=i6
301  ip4=i4
302  ip6=i2
303  ENDIF
304 
305 C...Do colour joinings and parton showers
306 C...(except ones already made for t+tbar).
307  IF(itop.EQ.0) THEN
308  IF(iql12.EQ.1) THEN
309  ijoin(1)=ip1
310  ijoin(2)=ip2
311  CALL pyjoin(2,ijoin)
312  ENDIF
313  IF(iql12.EQ.1.OR.irad.EQ.1) THEN
314  pm12s=(p(ip1,4)+p(ip2,4))**2-(p(ip1,1)+p(ip2,1))**2-
315  & (p(ip1,2)+p(ip2,2))**2-(p(ip1,3)+p(ip2,3))**2
316  CALL pyshow(ip1,ip2,sqrt(max(0d0,pm12s)))
317  ENDIF
318  ENDIF
319  IF(iql34.EQ.1) THEN
320  ijoin(1)=ip3
321  ijoin(2)=ip4
322  CALL pyjoin(2,ijoin)
323  ENDIF
324  IF(iql34.EQ.1.OR.irad.EQ.1) THEN
325  pm34s=(p(ip3,4)+p(ip4,4))**2-(p(ip3,1)+p(ip4,1))**2-
326  & (p(ip3,2)+p(ip4,2))**2-(p(ip3,3)+p(ip4,3))**2
327  CALL pyshow(ip3,ip4,sqrt(max(0d0,pm34s)))
328  ENDIF
329  IF(iql56.EQ.1) THEN
330  ijoin(1)=ip5
331  ijoin(2)=ip6
332  CALL pyjoin(2,ijoin)
333  ENDIF
334  IF(iql56.EQ.1.OR.irad.EQ.1) THEN
335  pm56s=(p(ip5,4)+p(ip6,4))**2-(p(ip5,1)+p(ip6,1))**2-
336  & (p(ip5,2)+p(ip6,2))**2-(p(ip5,3)+p(ip6,3))**2
337  CALL pyshow(ip5,ip6,sqrt(max(0d0,pm56s)))
338  ENDIF
339 
340 C...Do fragmentation and decays. Possibly except tau decay.
341  IF(itau.EQ.0) THEN
342  ntau=0
343  DO 210 i=1,n
344  IF(iabs(k(i,2)).EQ.15.AND.k(i,1).EQ.1) THEN
345  ntau=ntau+1
346  intau(ntau)=i
347  k(i,1)=11
348  ENDIF
349  210 CONTINUE
350  ENDIF
351  CALL pyexec
352  IF(itau.EQ.0) THEN
353  DO 220 i=1,ntau
354  k(intau(i),1)=1
355  220 CONTINUE
356  ENDIF
357 
358 C...Call PYHEPC to convert output from PYJETS to HEPEVT common.
359  IF(icom.EQ.0) THEN
360  mstu(28)=0
361  CALL pyhepc(1)
362  ENDIF
363 
364  END