11 IMPLICIT DOUBLE PRECISION(a-
h, o-
z)
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)
20 dimension dps(5),psi(4),nfi(3),nfl(3),ifet(3),kflf(3),
21 &kflo(2),pxo(2),pyo(2),wo(2)
24 IF(mstj(12).GT.3) CALL
pyerrm(9,
'(PYINDF:) MSTJ(12)>3 options'//
25 &
' are not treated as expected in independent fragmentation')
37 IF(
i.GT.min(
n,mstu(4)-mstu(32)))
THEN
38 CALL
pyerrm(12,
'(PYINDF:) failed to reconstruct jet system')
39 IF(mstu(21).GE.1)
RETURN
41 IF(
k(
i,1).NE.1.AND.
k(
i,1).NE.2) goto 110
44 kq=kchg(kc,2)*isign(1,
k(
i,2))
47 IF(kq.NE.2) kqsum=kqsum+kq
54 IF(
k(
i,1).EQ.2.OR.(mstj(3).LE.5.AND.
n.GT.
i.AND.
55 &
k(
i+1,1).EQ.2)) goto 110
56 IF(njet.NE.1.AND.kqsum.NE.0)
THEN
57 CALL
pyerrm(12,
'(PYINDF:) unphysical flavour combination')
58 IF(mstu(21).GE.1)
RETURN
64 CALL
pyrobo(nsav+1,nsav+njet,0d0,0d0,-dps(1)/dps(4),
65 & -dps(2)/dps(4),-dps(3)/dps(4))
71 DO 140
i=nsav+1,nsav+njet
75 nfi(kfa)=nfi(kfa)+isign(1,
k(
i,2))
76 ELSEIF(kfa.GT.1000)
THEN
79 IF(kfla.LE.3) nfi(kfla)=nfi(kfla)+isign(1,
k(
i,2))
80 IF(kflb.LE.3) nfi(kflb)=nfi(kflb)+isign(1,
k(
i,2))
88 CALL
pyerrm(14,
'(PYINDF:) caught in infinite loop')
89 IF(mstu(21).GE.1)
RETURN
100 DO 230 ip1=nsav+1,nsav+njet
107 IF(kflh.GT.10) kflh=mod(kflh/1000,10)
109 wf=
p(ip1,4)+sqrt(
p(ip1,1)**2+
p(ip1,2)**2+
p(ip1,3)**2)
112 170
IF(iabs(
k(ip1,2)).NE.21)
THEN
115 CALL
pyptdi(0,pxo(1),pyo(1))
119 ELSEIF(mstj(2).LE.2)
THEN
121 IF(mstj(2).EQ.2) mstj(91)=1
122 kflo(1)=int(1d0+(2d0+parj(2))*
pyr(0))*(-1)**int(
pyr(0)+0.5d0)
123 CALL
pyptdi(0,pxo(1),pyo(1))
130 IF(mstj(2).EQ.4) mstj(91)=1
131 kflo(1)=int(1d0+(2d0+parj(2))*
pyr(0))*(-1)**int(
pyr(0)+0.5d0)
133 CALL
pyptdi(0,pxo(1),pyo(1))
136 wo(1)=wf*
pyr(0)**(1d0/3d0)
152 IF(
i.GE.mstu(4)-mstu(32)-njet-5)
THEN
153 CALL
pyerrm(11,
'(PYINDF:) no more memory left in PYJETS')
154 IF(mstu(21).GE.1)
RETURN
162 IF(
k(
i,2).EQ.0) goto 180
163 IF(irank.EQ.1.AND.iabs(kfl1).LE.10.AND.iabs(kfl2).GT.10)
THEN
164 IF(
pyr(0).GT.parj(19)) goto 200
172 pr=
p(
i,5)**2+
p(
i,1)**2+
p(
i,2)**2
175 IF(iabs(kfl1).GE.4.AND.iabs(kfl1).LE.8.AND.mstu(90).LT.8)
THEN
183 IF(mstj(3).GE.1.AND.irank.EQ.1.AND.kflh.GE.4.AND.
184 &
p(
i,3).LE.0.001d0)
THEN
185 IF(
w.GE.
p(
i,5)+0.5d0*parj(32)) goto 180
201 IF(mstj(3).GE.0.AND.
p(
i,3).LT.0d0)
THEN
203 IF(mzsav.EQ.1) mstu(90)=mstu(90)-1
205 IF(
w.GT.parj(31)) goto 190
208 IF(mod(mstj(3),5).EQ.4.AND.
n.EQ.nsav1) wf=wf+0.1d0*parj(32)
209 IF(mod(mstj(3),5).EQ.4.AND.
n.EQ.nsav1) goto 170
212 the=
pyangl(
p(ip1,3),sqrt(
p(ip1,1)**2+
p(ip1,2)**2))
216 k(
k(ip1,3),4)=nsav1+1
221 IF(njet.EQ.1.OR.mstj(3).LE.0) goto 490
222 IF(mod(mstj(3),5).NE.0.AND.
n-nsav-njet.LT.2) goto 150
225 DO 240
i=nsav+njet+1,
n
227 kfla=mod(kfa/1000,10)
231 IF(kflb.LE.3) nfl(kflb)=nfl(kflb)-isign(1,
k(
i,2))*(-1)**kflb
232 IF(kflc.LE.3) nfl(kflc)=nfl(kflc)+isign(1,
k(
i,2))*(-1)**kflb
234 IF(kfla.LE.3) nfl(kfla)=nfl(kfla)-isign(1,
k(
i,2))
235 IF(kflb.LE.3) nfl(kflb)=nfl(kflb)-isign(1,
k(
i,2))
236 IF(kflc.LE.3) nfl(kflc)=nfl(kflc)-isign(1,
k(
i,2))
239 nreq=(iabs(nfl(1))+iabs(nfl(2))+iabs(nfl(3))-iabs(nfl(1)+
240 &nfl(2)+nfl(3)))/2+iabs(nfl(1)+nfl(2)+nfl(3))/3
241 IF(nreq.EQ.0) goto 320
247 DO 260
i=nsav+njet+1,
n
248 p2=
p(
i,1)**2+
p(
i,2)**2+
p(
i,3)**2
249 IF(
k(
i,1).EQ.1.AND.p2.LT.p2min) irem=
i
250 IF(
k(
i,1).EQ.1.AND.p2.LT.p2min) p2min=p2
252 IF(irem.EQ.0) goto 150
255 kfla=mod(kfa/1000,10)
258 IF(kfla.GE.4.OR.kflb.GE.4)
k(irem,1)=8
259 IF(
k(irem,1).EQ.8) goto 250
261 isgn=isign(1,
k(irem,2))*(-1)**kflb
262 IF(kflb.LE.3) nfl(kflb)=nfl(kflb)+isgn
263 IF(kflc.LE.3) nfl(kflc)=nfl(kflc)-isgn
265 IF(kfla.LE.3) nfl(kfla)=nfl(kfla)+isign(1,
k(irem,2))
266 IF(kflb.LE.3) nfl(kflb)=nfl(kflb)+isign(1,
k(irem,2))
267 IF(kflc.LE.3) nfl(kflc)=nfl(kflc)+isign(1,
k(irem,2))
270 nreq=(iabs(nfl(1))+iabs(nfl(2))+iabs(nfl(3))-iabs(nfl(1)+
271 &nfl(2)+nfl(3)))/2+iabs(nfl(1)+nfl(2)+nfl(3))/3
272 IF(nreq.GT.nrem) goto 250
273 DO 270
i=nsav+njet+1,
n
274 IF(
k(
i,1).EQ.8)
k(
i,1)=1
279 IF(nfl(1)+nfl(2)+nfl(3).NE.0) nfet=3
280 IF(nreq.LT.nrem) nfet=1
281 IF(iabs(nfl(1))+iabs(nfl(2))+iabs(nfl(3)).EQ.0) nfet=0
283 ifet(
j)=1+(iabs(nfl(1))+iabs(nfl(2))+iabs(nfl(3)))*
pyr(0)
284 kflf(
j)=isign(1,nfl(1))
285 IF(ifet(
j).GT.iabs(nfl(1))) kflf(
j)=isign(2,nfl(2))
286 IF(ifet(
j).GT.iabs(nfl(1))+iabs(nfl(2))) kflf(
j)=isign(3,nfl(3))
288 IF(nfet.EQ.2.AND.(ifet(1).EQ.ifet(2).OR.kflf(1)*kflf(2).GT.0))
290 IF(nfet.EQ.3.AND.(ifet(1).EQ.ifet(2).OR.ifet(1).EQ.ifet(3).OR.
291 &ifet(2).EQ.ifet(3).OR.kflf(1)*kflf(2).LT.0.OR.kflf(1)*kflf(3)
292 &.LT.0.OR.kflf(1)*(nfl(1)+nfl(2)+nfl(3)).LT.0)) goto 280
293 IF(nfet.EQ.0) kflf(1)=1+int((2d0+parj(2))*
pyr(0))
294 IF(nfet.EQ.0) kflf(2)=-kflf(1)
295 IF(nfet.EQ.1) kflf(2)=isign(1+int((2d0+parj(2))*
pyr(0)),-kflf(1))
296 IF(nfet.LE.2) kflf(3)=0
297 IF(kflf(3).NE.0)
THEN
298 kflfc=isign(1000*
max(iabs(kflf(1)),iabs(kflf(3)))+
299 & 100*min(iabs(kflf(1)),iabs(kflf(3)))+1,kflf(1))
300 IF(kflf(1).EQ.kflf(3).OR.(1d0+3d0*parj(4))*
pyr(0).GT.1d0)
301 & kflfc=kflfc+isign(2,kflfc)
305 CALL
pykfdi(kflfc,kflf(2),kfldmp,kf)
307 DO 300
j=1,
max(2,nfet)
308 nfl(iabs(kflf(
j)))=nfl(iabs(kflf(
j)))-isign(1,kflf(
j))
312 npos=min(1+int(
pyr(0)*nrem),nrem)
313 DO 310
i=nsav+njet+1,
n
314 IF(
k(
i,1).EQ.7) npos=npos-1
315 IF(
k(
i,1).EQ.1.OR.npos.NE.0) goto 310
319 p(
i,4)=sqrt(
p(
i,1)**2+
p(
i,2)**2+
p(
i,3)**2+
p(
i,5)**2)
322 nreq=(iabs(nfl(1))+iabs(nfl(2))+iabs(nfl(3))-iabs(nfl(1)+
323 &nfl(2)+nfl(3)))/2+iabs(nfl(1)+nfl(2)+nfl(3))/3
324 IF(nrem.GT.0) goto 280
327 320
IF(mod(mstj(3),5).NE.0.AND.mod(mstj(3),5).NE.4)
THEN
330 DO 330
i=nsav+njet+1,
n
334 psi(4)=psi(1)**2+psi(2)**2+psi(3)**2
336 DO 350
i=nsav+njet+1,
n
337 IF(mod(mstj(3),5).EQ.1) pws=pws+
p(
i,4)
338 IF(mod(mstj(3),5).EQ.2) pws=pws+sqrt(
p(
i,5)**2+(psi(1)*
p(
i,1)+
339 & psi(2)*
p(
i,2)+psi(3)*
p(
i,3))**2/psi(4))
340 IF(mod(mstj(3),5).EQ.3) pws=pws+1d0
342 DO 370
i=nsav+njet+1,
n
343 IF(mod(mstj(3),5).EQ.1) pw=
p(
i,4)
344 IF(mod(mstj(3),5).EQ.2) pw=sqrt(
p(
i,5)**2+(psi(1)*
p(
i,1)+
345 & psi(2)*
p(
i,2)+psi(3)*
p(
i,3))**2/psi(4))
346 IF(mod(mstj(3),5).EQ.3) pw=1d0
350 p(
i,4)=sqrt(
p(
i,1)**2+
p(
i,2)**2+
p(
i,3)**2+
p(
i,5)**2)
354 ELSEIF(mod(mstj(3),5).EQ.4)
THEN
361 DO 410
i=nsav+njet+1,
n
365 pls=(
p(
i,1)*
p(ir1,1)+
p(
i,2)*
p(ir1,2)+
p(
i,3)*
p(ir1,3))/
366 & (
p(ir1,1)**2+
p(ir1,2)**2+
p(ir1,3)**2)
370 p(ir2,4)=
p(ir2,4)+
p(
i,4)
371 p(ir2,5)=
p(ir2,5)+pls
375 IF(
k(
i,1).NE.0) pss=pss+
p(
i,4)/(pecm*(0.8d0*
p(
i,5)+0.2d0))
377 DO 440
i=nsav+njet+1,
n
380 pls=(
p(
i,1)*
p(ir1,1)+
p(
i,2)*
p(ir1,2)+
p(
i,3)*
p(ir1,3))/
381 & (
p(ir1,1)**2+
p(ir1,2)**2+
p(ir1,3)**2)
383 p(
i,
j)=
p(
i,
j)-
p(ir2,
j)/
k(ir2,1)+(1d0/(
p(ir2,5)*pss)-1d0)*
386 p(
i,4)=sqrt(
p(
i,1)**2+
p(
i,2)**2+
p(
i,3)**2+
p(
i,5)**2)
391 IF(mod(mstj(3),5).NE.0)
THEN
395 DO 450
i=nsav+njet+1,
n
398 pqs=pqs+
p(
i,5)**2/
p(
i,4)
400 IF(pms.GE.pecm) goto 150
403 pfac=(pecm-pqs)/(pes-pqs)
406 DO 480
i=nsav+njet+1,
n
410 p(
i,4)=sqrt(
p(
i,1)**2+
p(
i,2)**2+
p(
i,3)**2+
p(
i,5)**2)
412 pqs=pqs+
p(
i,5)**2/
p(
i,4)
414 IF(neco.LT.10.AND.abs(pecm-pes).GT.2d-6*pecm) goto 460
418 490
DO 500
i=nsav+njet+1,
n
419 IF(mstu(16).NE.2)
k(
i,3)=nsav+1
420 IF(mstu(16).EQ.2)
k(
i,3)=
k(
k(
i,3),3)
422 DO 510
i=nsav+1,nsav+njet
425 IF(mstu(16).NE.2)
THEN
431 IF(
k(
i1,5).LT.
k(
i1,4))
THEN
449 p(nsav,5)=sqrt(
max(0d0,dps(4)**2-dps(1)**2-dps(2)**2-dps(3)**2))
459 DO 550 iz=mstu90+1,mstu(90)
460 mstu(90+iz)=mstu(90+iz)-njet+1
464 IF(njet.NE.1) CALL
pyrobo(nsav+1,
n,0d0,0d0,dps(1)/dps(4),
465 &dps(2)/dps(4),dps(3)/dps(4))