ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pyhimult.f
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file pyhimult.f
1 
2 C*********************************************************************
3 
4  SUBROUTINE pyhimult(MMUL)
5 
6 C...Initializes treatment of multiple interactions, selects kinematics
7 C...of hardest interaction if low-pT physics included in run, and
8 C...generates all non-hardest interactions.
9  common/lujets/n,k(9000,5),p(9000,5),v(9000,5)
10  SAVE /lujets/
11  common/ludat1/mstu(200),paru(200),mstj(200),parj(200)
12  SAVE /ludat1/
13  common/ludat2/kchg(500,3),pmas(500,4),parf(2000),vckm(4,4)
14  SAVE /ludat2/
15  common/pyhisubs/msel,msub(200),kfin(2,-40:40),ckin(200)
16  SAVE /pyhisubs/
17  common/pyhipars/mstp(200),parp(200),msti(200),pari(200)
18  SAVE /pyhipars/
19  common/pyhiint1/mint(400),vint(400)
20  SAVE /pyhiint1/
21  common/pyhiint2/iset(200),kfpr(200,2),coef(200,20),icol(40,4,2)
22  SAVE /pyhiint2/
23  common/pyhiint3/xsfx(2,-40:40),isig(1000,3),sigh(1000)
24  SAVE /pyhiint3/
25  common/pyhiint5/ngen(0:200,3),xsec(0:200,3)
26  SAVE /pyhiint5/
27  dimension nmul(20),sigm(20),kstr(500,2)
28  SAVE xt2,xt2fac,xc2,xts,irbin,rbin,nmul,sigm
29 
30 C...Initialization of multiple interaction treatment.
31  IF(mmul.EQ.1) THEN
32  IF(mstp(122).GE.1) WRITE(mstu(11),1000) mstp(82)
33  isub=96
34  mint(1)=96
35  vint(63)=0.
36  vint(64)=0.
37  vint(143)=1.
38  vint(144)=1.
39 
40 C...Loop over phase space points: xT2 choice in 20 bins.
41  100 sigsum=0.
42  DO 120 ixt2=1,20
43  nmul(ixt2)=mstp(83)
44  sigm(ixt2)=0.
45  DO 110 itry=1,mstp(83)
46  rsca=0.05*((21-ixt2)-rlu(0))
47  xt2=vint(149)*(1.+vint(149))/(vint(149)+rsca)-vint(149)
48  xt2=max(0.01*vint(149),xt2)
49  vint(25)=xt2
50 
51 C...Choose tau and y*. Calculate cos(theta-hat).
52  IF(rlu(0).LE.coef(isub,1)) THEN
53  taup=(2.*(1.+sqrt(1.-xt2))/xt2-1.)**rlu(0)
54  tau=xt2*(1.+taup)**2/(4.*taup)
55  ELSE
56  tau=xt2*(1.+tan(rlu(0)*atan(sqrt(1./xt2-1.)))**2)
57  ENDIF
58  vint(21)=tau
59  CALL pyhiklim(2)
60  ryst=rlu(0)
61  myst=1
62  IF(ryst.GT.coef(isub,7)) myst=2
63  IF(ryst.GT.coef(isub,7)+coef(isub,8)) myst=3
64  CALL pyhikmap(2,myst,rlu(0))
65  vint(23)=sqrt(max(0.,1.-xt2/tau))*(-1)**int(1.5+rlu(0))
66 
67 C...Calculate differential cross-section.
68  vint(71)=0.5*vint(1)*sqrt(xt2)
69  CALL pyhisigh(nchn,sigs)
70  110 sigm(ixt2)=sigm(ixt2)+sigs
71  120 sigsum=sigsum+sigm(ixt2)
72  sigsum=sigsum/(20.*mstp(83))
73 
74 C...Reject result if sigma(parton-parton) is smaller than hadronic one.
75  IF(sigsum.LT.1.1*vint(106)) THEN
76  IF(mstp(122).GE.1) WRITE(mstu(11),1100) parp(82),sigsum
77  parp(82)=0.9*parp(82)
78  vint(149)=4.*parp(82)**2/vint(2)
79  goto 100
80  ENDIF
81  IF(mstp(122).GE.1) WRITE(mstu(11),1200) parp(82), sigsum
82 
83 C...Start iteration to find k factor.
84  yke=sigsum/vint(106)
85  so=0.5
86  xi=0.
87  yi=0.
88  xk=0.5
89  iit=0
90  130 IF(iit.EQ.0) THEN
91  xk=2.*xk
92  ELSEIF(iit.EQ.1) THEN
93  xk=0.5*xk
94  ELSE
95  xk=xi+(yke-yi)*(xf-xi)/(yf-yi)
96  ENDIF
97 
98 C...Evaluate overlap integrals.
99  IF(mstp(82).EQ.2) THEN
100  sp=0.5*paru(1)*(1.-exp(-xk))
101  sop=sp/paru(1)
102  ELSE
103  IF(mstp(82).EQ.3) deltab=0.02
104  IF(mstp(82).EQ.4) deltab=min(0.01,0.05*parp(84))
105  sp=0.
106  sop=0.
107  b=-0.5*deltab
108  140 b=b+deltab
109  IF(mstp(82).EQ.3) THEN
110  ov=exp(-b**2)/paru(2)
111  ELSE
112  cq2=parp(84)**2
113  ov=((1.-parp(83))**2*exp(-min(100.,b**2))+2.*parp(83)*
114  & (1.-parp(83))*2./(1.+cq2)*exp(-min(100.,b**2*2./(1.+cq2)))+
115  & parp(83)**2/cq2*exp(-min(100.,b**2/cq2)))/paru(2)
116  ENDIF
117  pacc=1.-exp(-min(100.,paru(1)*xk*ov))
118  sp=sp+paru(2)*b*deltab*pacc
119  sop=sop+paru(2)*b*deltab*ov*pacc
120  IF(b.LT.1..OR.b*pacc.GT.1e-6) goto 140
121  ENDIF
122  yk=paru(1)*xk*so/sp
123 
124 C...Continue iteration until convergence.
125  IF(yk.LT.yke) THEN
126  xi=xk
127  yi=yk
128  IF(iit.EQ.1) iit=2
129  ELSE
130  xf=xk
131  yf=yk
132  IF(iit.EQ.0) iit=1
133  ENDIF
134  IF(abs(yk-yke).GE.1e-5*yke) goto 130
135 
136 C...Store some results for subsequent use.
137  vint(145)=sigsum
138  vint(146)=sop/so
139  vint(147)=sop/sp
140 
141 C...Initialize iteration in xT2 for hardest interaction.
142  ELSEIF(mmul.EQ.2) THEN
143  IF(mstp(82).LE.0) THEN
144  ELSEIF(mstp(82).EQ.1) THEN
145  xt2=1.
146  xt2fac=xsec(96,1)/vint(106)*vint(149)/(1.-vint(149))
147  ELSEIF(mstp(82).EQ.2) THEN
148  xt2=1.
149  xt2fac=vint(146)*xsec(96,1)/vint(106)*vint(149)*(1.+vint(149))
150  ELSE
151  xc2=4.*ckin(3)**2/vint(2)
152  IF(ckin(3).LE.ckin(5).OR.mint(82).GE.2) xc2=0.
153  ENDIF
154 
155  ELSEIF(mmul.EQ.3) THEN
156 C...Low-pT or multiple interactions (first semihard interaction):
157 C...choose xT2 according to dpT2/pT2**2*exp(-(sigma above pT2)/norm)
158 C...or (MSTP(82)>=2) dpT2/(pT2+pT0**2)**2*exp(-....).
159  isub=mint(1)
160  IF(mstp(82).LE.0) THEN
161  xt2=0.
162  ELSEIF(mstp(82).EQ.1) THEN
163  xt2=xt2fac*xt2/(xt2fac-xt2*log(rlu(0)))
164  ELSEIF(mstp(82).EQ.2) THEN
165  IF(xt2.LT.1..AND.exp(-xt2fac*xt2/(vint(149)*(xt2+
166  & vint(149)))).GT.rlu(0)) xt2=1.
167  IF(xt2.GE.1.) THEN
168  xt2=(1.+vint(149))*xt2fac/(xt2fac-(1.+vint(149))*log(1.-
169  & rlu(0)*(1.-exp(-xt2fac/(vint(149)*(1.+vint(149)))))))-
170  & vint(149)
171  ELSE
172  xt2=-xt2fac/log(exp(-xt2fac/(xt2+vint(149)))+rlu(0)*
173  & (exp(-xt2fac/vint(149))-exp(-xt2fac/(xt2+vint(149)))))-
174  & vint(149)
175  ENDIF
176  xt2=max(0.01*vint(149),xt2)
177  ELSE
178  xt2=(xc2+vint(149))*(1.+vint(149))/(1.+vint(149)-
179  & rlu(0)*(1.-xc2))-vint(149)
180  xt2=max(0.01*vint(149),xt2)
181  ENDIF
182  vint(25)=xt2
183 
184 C...Low-pT: choose xT2, tau, y* and cos(theta-hat) fixed.
185  IF(mstp(82).LE.1.AND.xt2.LT.vint(149)) THEN
186  IF(mint(82).EQ.1) ngen(0,1)=ngen(0,1)-1
187  IF(mint(82).EQ.1) ngen(isub,1)=ngen(isub,1)-1
188  isub=95
189  mint(1)=isub
190  vint(21)=0.01*vint(149)
191  vint(22)=0.
192  vint(23)=0.
193  vint(25)=0.01*vint(149)
194 
195  ELSE
196 C...Multiple interactions (first semihard interaction).
197 C...Choose tau and y*. Calculate cos(theta-hat).
198  IF(rlu(0).LE.coef(isub,1)) THEN
199  taup=(2.*(1.+sqrt(1.-xt2))/xt2-1.)**rlu(0)
200  tau=xt2*(1.+taup)**2/(4.*taup)
201  ELSE
202  tau=xt2*(1.+tan(rlu(0)*atan(sqrt(1./xt2-1.)))**2)
203  ENDIF
204  vint(21)=tau
205  CALL pyhiklim(2)
206  ryst=rlu(0)
207  myst=1
208  IF(ryst.GT.coef(isub,7)) myst=2
209  IF(ryst.GT.coef(isub,7)+coef(isub,8)) myst=3
210  CALL pyhikmap(2,myst,rlu(0))
211  vint(23)=sqrt(max(0.,1.-xt2/tau))*(-1)**int(1.5+rlu(0))
212  ENDIF
213  vint(71)=0.5*vint(1)*sqrt(vint(25))
214 
215 C...Store results of cross-section calculation.
216  ELSEIF(mmul.EQ.4) THEN
217  isub=mint(1)
218  xts=vint(25)
219  IF(iset(isub).EQ.1) xts=vint(21)
220  IF(iset(isub).EQ.2) xts=(4.*vint(48)+2.*vint(63)+2.*vint(64))/
221  & vint(2)
222  IF(iset(isub).EQ.3.OR.iset(isub).EQ.4) xts=vint(26)
223  rbin=max(0.000001,min(0.999999,xts*(1.+vint(149))/
224  & (xts+vint(149))))
225  irbin=int(1.+20.*rbin)
226  IF(isub.EQ.96) nmul(irbin)=nmul(irbin)+1
227  IF(isub.EQ.96) sigm(irbin)=sigm(irbin)+vint(153)
228 
229 C...Choose impact parameter.
230  ELSEIF(mmul.EQ.5) THEN
231  IF(mstp(82).EQ.3) THEN
232  vint(148)=rlu(0)/(paru(2)*vint(147))
233  ELSE
234  rtype=rlu(0)
235  cq2=parp(84)**2
236  IF(rtype.LT.(1.-parp(83))**2) THEN
237  b2=-log(rlu(0))
238  ELSEIF(rtype.LT.1.-parp(83)**2) THEN
239  b2=-0.5*(1.+cq2)*log(rlu(0))
240  ELSE
241  b2=-cq2*log(rlu(0))
242  ENDIF
243  vint(148)=((1.-parp(83))**2*exp(-min(100.,b2))+2.*parp(83)*
244  & (1.-parp(83))*2./(1.+cq2)*exp(-min(100.,b2*2./(1.+cq2)))+
245  & parp(83)**2/cq2*exp(-min(100.,b2/cq2)))/(paru(2)*vint(147))
246  ENDIF
247 
248 C...Multiple interactions (variable impact parameter) : reject with
249 C...probability exp(-overlap*cross-section above pT/normalization).
250  rncor=(irbin-20.*rbin)*nmul(irbin)
251  sigcor=(irbin-20.*rbin)*sigm(irbin)
252  DO 150 ibin=irbin+1,20
253  rncor=rncor+nmul(ibin)
254  150 sigcor=sigcor+sigm(ibin)
255  sigabv=(sigcor/rncor)*vint(149)*(1.-xts)/(xts+vint(149))
256  vint(150)=exp(-min(100.,vint(146)*vint(148)*sigabv/vint(106)))
257 
258 C...Generate additional multiple semihard interactions.
259  ELSEIF(mmul.EQ.6) THEN
260 
261 C...Reconstruct strings in hard scattering.
262  isub=mint(1)
263  nmax=mint(84)+4
264  IF(iset(isub).EQ.1) nmax=mint(84)+2
265  nstr=0
266  DO 170 i=mint(84)+1,nmax
267  kcs=kchg(lucomp(k(i,2)),2)*isign(1,k(i,2))
268  IF(kcs.EQ.0) goto 170
269  DO 160 j=1,4
270  IF(kcs.EQ.1.AND.(j.EQ.2.OR.j.EQ.4)) goto 160
271  IF(kcs.EQ.-1.AND.(j.EQ.1.OR.j.EQ.3)) goto 160
272  IF(j.LE.2) THEN
273  ist=mod(k(i,j+3)/mstu(5),mstu(5))
274  ELSE
275  ist=mod(k(i,j+1),mstu(5))
276  ENDIF
277  IF(ist.LT.mint(84).OR.ist.GT.i) goto 160
278  IF(kchg(lucomp(k(ist,2)),2).EQ.0) goto 160
279  nstr=nstr+1
280  IF(j.EQ.1.OR.j.EQ.4) THEN
281  kstr(nstr,1)=i
282  kstr(nstr,2)=ist
283  ELSE
284  kstr(nstr,1)=ist
285  kstr(nstr,2)=i
286  ENDIF
287  160 CONTINUE
288  170 CONTINUE
289 
290 C...Set up starting values for iteration in xT2.
291  xt2=vint(25)
292  IF(iset(isub).EQ.1) xt2=vint(21)
293  IF(iset(isub).EQ.2) xt2=(4.*vint(48)+2.*vint(63)+2.*vint(64))/
294  & vint(2)
295  IF(iset(isub).EQ.3.OR.iset(isub).EQ.4) xt2=vint(26)
296  isub=96
297  mint(1)=96
298  IF(mstp(82).LE.1) THEN
299  xt2fac=xsec(isub,1)*vint(149)/((1.-vint(149))*vint(106))
300  ELSE
301  xt2fac=vint(146)*vint(148)*xsec(isub,1)/vint(106)*
302  & vint(149)*(1.+vint(149))
303  ENDIF
304  vint(63)=0.
305  vint(64)=0.
306  vint(151)=0.
307  vint(152)=0.
308  vint(143)=1.-vint(141)
309  vint(144)=1.-vint(142)
310 
311 C...Iterate downwards in xT2.
312  180 IF(mstp(82).LE.1) THEN
313  xt2=xt2fac*xt2/(xt2fac-xt2*log(rlu(0)))
314  IF(xt2.LT.vint(149)) goto 220
315  ELSE
316  IF(xt2.LE.0.01*vint(149)) goto 220
317  xt2=xt2fac*(xt2+vint(149))/(xt2fac-(xt2+vint(149))*
318  & log(rlu(0)))-vint(149)
319  IF(xt2.LE.0.) goto 220
320  xt2=max(0.01*vint(149),xt2)
321  ENDIF
322  vint(25)=xt2
323 
324 C...Choose tau and y*. Calculate cos(theta-hat).
325  IF(rlu(0).LE.coef(isub,1)) THEN
326  taup=(2.*(1.+sqrt(1.-xt2))/xt2-1.)**rlu(0)
327  tau=xt2*(1.+taup)**2/(4.*taup)
328  ELSE
329  tau=xt2*(1.+tan(rlu(0)*atan(sqrt(1./xt2-1.)))**2)
330  ENDIF
331  vint(21)=tau
332  CALL pyhiklim(2)
333  ryst=rlu(0)
334  myst=1
335  IF(ryst.GT.coef(isub,7)) myst=2
336  IF(ryst.GT.coef(isub,7)+coef(isub,8)) myst=3
337  CALL pyhikmap(2,myst,rlu(0))
338  vint(23)=sqrt(max(0.,1.-xt2/tau))*(-1)**int(1.5+rlu(0))
339 
340 C...Check that x not used up. Accept or reject kinematical variables.
341  x1m=sqrt(tau)*exp(vint(22))
342  x2m=sqrt(tau)*exp(-vint(22))
343  IF(vint(143)-x1m.LT.0.01.OR.vint(144)-x2m.LT.0.01) goto 180
344  vint(71)=0.5*vint(1)*sqrt(xt2)
345  CALL pyhisigh(nchn,sigs)
346  IF(sigs.LT.xsec(isub,1)*rlu(0)) goto 180
347 
348 C...Reset K, P and V vectors. Select some variables.
349  DO 190 i=n+1,n+2
350  DO 190 j=1,5
351  k(i,j)=0
352  p(i,j)=0.
353  190 v(i,j)=0.
354  rflav=rlu(0)
355  pt=0.5*vint(1)*sqrt(xt2)
356  phi=paru(2)*rlu(0)
357  cth=vint(23)
358 
359 C...Add first parton to event record.
360  k(n+1,1)=3
361  k(n+1,2)=21
362  IF(rflav.GE.max(parp(85),parp(86))) k(n+1,2)=
363  & 1+int((2.+parj(2))*rlu(0))
364  p(n+1,1)=pt*cos(phi)
365  p(n+1,2)=pt*sin(phi)
366  p(n+1,3)=0.25*vint(1)*(vint(41)*(1.+cth)-vint(42)*(1.-cth))
367  p(n+1,4)=0.25*vint(1)*(vint(41)*(1.+cth)+vint(42)*(1.-cth))
368  p(n+1,5)=0.
369 
370 C...Add second parton to event record.
371  k(n+2,1)=3
372  k(n+2,2)=21
373  IF(k(n+1,2).NE.21) k(n+2,2)=-k(n+1,2)
374  p(n+2,1)=-p(n+1,1)
375  p(n+2,2)=-p(n+1,2)
376  p(n+2,3)=0.25*vint(1)*(vint(41)*(1.-cth)-vint(42)*(1.+cth))
377  p(n+2,4)=0.25*vint(1)*(vint(41)*(1.-cth)+vint(42)*(1.+cth))
378  p(n+2,5)=0.
379 
380  IF(rflav.LT.parp(85).AND.nstr.GE.1) THEN
381 C....Choose relevant string pieces to place gluons on.
382  DO 210 i=n+1,n+2
383  dmin=1e8
384  DO 200 istr=1,nstr
385  i1=kstr(istr,1)
386  i2=kstr(istr,2)
387  dist=(p(i,4)*p(i1,4)-p(i,1)*p(i1,1)-p(i,2)*p(i1,2)-
388  & p(i,3)*p(i1,3))*(p(i,4)*p(i2,4)-p(i,1)*p(i2,1)-
389  & p(i,2)*p(i2,2)-p(i,3)*p(i2,3))/max(1.,p(i1,4)*p(i2,4)-
390  & p(i1,1)*p(i2,1)-p(i1,2)*p(i2,2)-p(i1,3)*p(i2,3))
391  IF(istr.EQ.1.OR.dist.LT.dmin) THEN
392  dmin=dist
393  ist1=i1
394  ist2=i2
395  istm=istr
396  ENDIF
397  200 CONTINUE
398 
399 C....Colour flow adjustments, new string pieces.
400  IF(k(ist1,4)/mstu(5).EQ.ist2) k(ist1,4)=mstu(5)*i+
401  & mod(k(ist1,4),mstu(5))
402  IF(mod(k(ist1,5),mstu(5)).EQ.ist2) k(ist1,5)=
403  & mstu(5)*(k(ist1,5)/mstu(5))+i
404  k(i,5)=mstu(5)*ist1
405  k(i,4)=mstu(5)*ist2
406  IF(k(ist2,5)/mstu(5).EQ.ist1) k(ist2,5)=mstu(5)*i+
407  & mod(k(ist2,5),mstu(5))
408  IF(mod(k(ist2,4),mstu(5)).EQ.ist1) k(ist2,4)=
409  & mstu(5)*(k(ist2,4)/mstu(5))+i
410  kstr(istm,2)=i
411  kstr(nstr+1,1)=i
412  kstr(nstr+1,2)=ist2
413  210 nstr=nstr+1
414 
415 C...String drawing and colour flow for gluon loop.
416  ELSEIF(k(n+1,2).EQ.21) THEN
417  k(n+1,4)=mstu(5)*(n+2)
418  k(n+1,5)=mstu(5)*(n+2)
419  k(n+2,4)=mstu(5)*(n+1)
420  k(n+2,5)=mstu(5)*(n+1)
421  kstr(nstr+1,1)=n+1
422  kstr(nstr+1,2)=n+2
423  kstr(nstr+2,1)=n+2
424  kstr(nstr+2,2)=n+1
425  nstr=nstr+2
426 
427 C...String drawing and colour flow for q-qbar pair.
428  ELSE
429  k(n+1,4)=mstu(5)*(n+2)
430  k(n+2,5)=mstu(5)*(n+1)
431  kstr(nstr+1,1)=n+1
432  kstr(nstr+1,2)=n+2
433  nstr=nstr+1
434  ENDIF
435 
436 C...Update remaining energy; iterate.
437  n=n+2
438  IF(n.GT.mstu(4)-mstu(32)-10) THEN
439  CALL luerrm(11,'(PYHIMULT:) no more memory left in LUJETS')
440  IF(mstu(21).GE.1) RETURN
441  ENDIF
442  mint(31)=mint(31)+1
443  vint(151)=vint(151)+vint(41)
444  vint(152)=vint(152)+vint(42)
445  vint(143)=vint(143)-vint(41)
446  vint(144)=vint(144)-vint(42)
447  IF(mint(31).LT.240) goto 180
448  220 CONTINUE
449  ENDIF
450 
451 C...Format statements for printout.
452  1000 FORMAT(/1x,'****** PYHIMULT: initialization of multiple inter',
453  &'actions for MSTP(82) =',i2,' ******')
454  1100 FORMAT(8x,'pT0 =',f5.2,' GeV gives sigma(parton-parton) =',1p,
455  &e9.2,' mb: rejected')
456  1200 FORMAT(8x,'pT0 =',f5.2,' GeV gives sigma(parton-parton) =',1p,
457  &e9.2,' mb: accepted')
458 
459  RETURN
460  END