EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
lmeps.F
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file lmeps.F
1 
2 C **********************************************************************
3 
4  SUBROUTINE lmeps
5 
6  IMPLICIT NONE
7 
8 
9 *
10 * to avoid variable conflictions, a second keep element is necessary
11 * with the same common block name (see LEPTO2)
12 *
13 
14  COMMON /leptou/ cut(14),lst(40),parl(30),
15  & xlp,ylp,w2lp,q2lp,ulp
16  REAL cut,parl,xlp,ylp,w2lp,q2lp,ulp
17  INTEGER lst
18  SAVE /leptou/
19 
20  INTEGER nlupdm,nplbuf
21  parameter(nlupdm=4000,nplbuf=5)
22  common/lujets/n,k(nlupdm,5),p(nlupdm,nplbuf),v(nlupdm,5)
23  INTEGER n,k
24  REAL p,v
25  SAVE /lujets/
26 
27  common/ludat1/mstu(200),paru(200),mstj(200),parj(200)
28  INTEGER mstu,mstj
29  REAL paru,parj
30  SAVE /ludat1/
31 
32  COMMON /lboost/ dbeta(2,3),stheta(2),sphi(2),pb(5),phir
33  DOUBLE PRECISION dbeta
34  REAL stheta,sphi,pb,phir
35  SAVE /lboost/
36 
37  COMMON /pypara/ ipy(80),pypar(80),pyvar(80)
38  REAL pypar,pyvar
39  INTEGER ipy
40  SAVE /pypara/
41 
42 *
43 * to avoid variable conflictions, a second keep element is necessary
44 * with the same common block name (see LYPRO2)
45 *
46  COMMON /lyproc/ isub,kfl(3,2),x(2),sh,th,uh,q2,xsec(0:40)
47  REAL x,sh,th,uh,q2,xsec
48  INTEGER isub,kfl
49  SAVE /lyproc/
50 
51  COMMON /lyint1/ xq(2,-6:6),dsig(-6:6,-6:6,5),fsig(10,10,3)
52  REAL xq,dsig,fsig
53  SAVE /lyint1/
54 
55 
56 
57  INTEGER i,j,ks,ip2,ns,ifl,it,ipu1,ipu2
58  REAL ps,xr,robo,xpq,qmax,t1,t2
59  REAL ulangl
60  DOUBLE PRECISION dpq2,drobo(5)
61  DOUBLE PRECISION deltap(4),dplong,dbtot,dgamma,droot
62  dimension ks(9,5),ps(9,5),robo(5),xpq(-6:6)
63 **HI SAVE KS,PS
64 
65 C CALL GULIST(100,2)
66 C...Save event record in hadronic cms
67  DO 10 i=1,7
68  DO 10 j=1,5
69  ks(i,j)=k(i,j)
70  10 ps(i,j)=p(i,j)
71 C...Rearrange event record to PYSSPA standard
72  ip2=6
73  IF(lst(24).EQ.3) ip2=7
74  DO 20 j=1,5
75  k(3,j)=0.
76  p(3,j)=0.
77  k(4,j)=0
78  p(4,j)=0.
79  k(5,j)=ks(3,j)
80  p(5,j)=ps(3,j)
81  k(7,j)=ks(4,j)
82  p(7,j)=ps(4,j)
83  k(8,j)=ks(5,j)
84  p(8,j)=ps(5,j)
85  k(9,j)=ks(4,j)
86  p(9,j)=ps(4,j)
87  k(10,j)=ks(ip2,j)
88  20 p(10,j)=ps(ip2,j)
89  k(5,3)=3
90  k(6,3)=4
91  k(7,3)=5
92  k(8,3)=6
93  k(9,3)=5
94  k(10,3)=6
95  DO 30 i=5,10
96  30 k(i,1)=21
97  k(9,1)=0
98 C...Incoming parton = outgoing 2 parton - boson fourvectors
99  DO 40 j=1,4
100  40 p(6,j)=p(8,j)+p(10,j)-p(5,j)
101  p(6,5)=0.
102  k(6,2)=lst(25)
103  IF(lst(24).EQ.3) k(6,2)=21
104  n=10
105 C CALL GULIST(101,2)
106 
107  xr=xlp
108  dpq2=dble(q2lp)
109 C...Partons with colour information in hadronic cms frame.
110  DO 120 i=11,27
111  DO 120 j=1,5
112  k(i,j)=0
113  p(i,j)=0.
114  120 v(i,j)=0.
115  ns=20
116  DO 130 j=1,5
117  k(ns+1,j)=k(5,j)
118  p(ns+1,j)=p(5,j)
119  k(ns+3,j)=k(6,j)
120  p(ns+3,j)=p(6,j)
121  k(ns+5,j)=k(8,j)
122  p(ns+5,j)=p(8,j)
123  k(ns+6,j)=k(10,j)
124  130 p(ns+6,j)=p(10,j)
125 C...Old standard continuation lines
126  k(ns+2,1)=-1
127  k(ns+2,3)=ns+1
128  k(ns+4,1)=-1
129  k(ns+4,3)=ns+3
130  p(ns+4,3)=27
131  p(ns+4,4)=27
132 C...Origin and colour info for incoming parton
133  k(ns+3,1)=13
134  k(ns+3,3)=2
135  k(ns+3,4)=27
136  k(ns+3,5)=27
137 C...Colour info for two outgoing partons
138  k(ns+5,1)=3
139  k(ns+6,1)=3
140  IF(k(ns+6,2).EQ.21) THEN
141 C...qg-event
142  IF(k(ns+5,2).GT.0) THEN
143  k(ns+5,4)=(ns+6)*mstu(5)
144  k(ns+5,5)=(ns+7)*mstu(5)
145  k(ns+6,4)=(ns+7)*mstu(5)
146  k(ns+6,5)=(ns+5)*mstu(5)
147  ELSE
148  k(ns+5,4)=(ns+7)*mstu(5)
149  k(ns+5,5)=(ns+6)*mstu(5)
150  k(ns+6,4)=(ns+5)*mstu(5)
151  k(ns+6,5)=(ns+7)*mstu(5)
152  ENDIF
153  ELSE
154 C...qqbar-event
155  k(ns+5,4)=(ns+7)*mstu(5)
156  k(ns+5,5)=(ns+7)*mstu(5)
157  k(ns+6,4)=(ns+7)*mstu(5)
158  k(ns+6,5)=(ns+7)*mstu(5)
159  ENDIF
160 C...Effective outgoing parton = sum of both outgoing partons
161  k(ns+7,1)=14
162  k(ns+7,3)=3
163  IF(lst(24).EQ.2) THEN
164  k(ns+7,2)=k(ns+5,2)
165  IF(k(ns+7,2).EQ.21) WRITE(6,*) ' Warning: K(NS+7,2)=',k(ns+7,2)
166  IF(k(ns+7,2).GT.0) THEN
167  k(ns+7,4)=(ns+3)*mstu(5)+26
168  k(ns+7,5)=(ns+3)*mstu(5)+25
169  ELSE
170  k(ns+7,4)=(ns+3)*mstu(5)+25
171  k(ns+7,5)=(ns+3)*mstu(5)+26
172  ENDIF
173  ELSE
174  k(ns+7,2)=21
175  IF(k(ns+5,2).GT.0) THEN
176  k(ns+7,4)=(ns+3)*mstu(5)+25
177  k(ns+7,5)=(ns+3)*mstu(5)+26
178  ELSE
179  k(ns+7,4)=(ns+3)*mstu(5)+26
180  k(ns+7,5)=(ns+3)*mstu(5)+25
181  ENDIF
182  ENDIF
183  DO 140 j=1,4
184  140 p(ns+7,j)=p(8,j)+p(10,j)
185 
186  it=ns+7
187  IF(abs(p(it,1)).GT.0.1.OR.abs(p(it,2)).GT.0.1) THEN
188 C WRITE(6,*) 'Warning: non-zero pt on final shower initiator'
189 C WRITE(6,*) '1:',IT,K(IT,2),P(IT,1),P(IT,2),P(IT,3),P(IT,4),P(IT,5)
190 C WRITE(6,*) '1:',8 ,K( 8,2),P( 8,1),P( 8,2),P( 8,3),P( 8,4),P( 8,5)
191 C WRITE(6,*) '1:',10,K(10,2),P(10,1),P(10,2),P(10,3),P(10,4),P(10,5)
192  lst(21)=12
193  RETURN
194  ENDIF
195  p(it,1)=0.
196  p(it,2)=0.
197 
198  p(ns+7,5)=sqrt(max(0.,p(ns+7,4)**2-p(ns+7,1)**2-p(ns+7,2)**2-
199  &p(ns+7,3)**2))
200  n=ns+7
201 C CALL GULIST(103,2)
202 
203 C...Scale for bremsstrahlung etc.
204  q2=q2lp
205  ipy(40)=10
206  ipy(47)=n
207 C...Save quantities for later use.
208  x(1)=1.
209  x(2)=xr
210  CALL lystfu(k(2,2),xr,q2lp,xpq)
211  DO 160 ifl=-6,6
212  160 xq(2,ifl)=xpq(ifl)
213  IF(lst(23).EQ.1) THEN
214  isub=39
215  ipy(11)=1
216  ELSEIF(lst(23).EQ.3) THEN
217  isub=39
218  ipy(11)=2
219  ELSEIF(lst(23).EQ.4) THEN
220  isub=39
221  ipy(11)=3
222  ELSEIF(lst(23).EQ.2) THEN
223  isub=40
224  ENDIF
225  kfl(2,1)=k(5,2)
226  kfl(2,2)=k(6,2)
227  kfl(1,1)=kfl(2,1)
228  kfl(1,2)=kfl(2,2)
229  IF(isub.EQ.39) kfl(3,1)=k(1,2)
230  IF(isub.EQ.40) kfl(3,1)=k(1,2)+isign(1,k(1,2))
231  kfl(3,2)=k(27,2)
232  pyvar(2)=parl(21)
233  pyvar(1)=sqrt(pyvar(2))
234  pyvar(3)=p(1,5)
235  pyvar(4)=p(2,5)
236  pyvar(5)=pyvar(1)/2.
237  ipy(41)=k(1,2)
238  ipy(42)=k(2,2)
239  ipy(48)=0
240 
241 C...Generate timelike parton shower (if required)
242  IF(ipy(13).EQ.1) THEN
243  CALL lscale(1,qmax)
244  CALL lushow(25,26,qmax)
245  ENDIF
246  it=25
247  IF(n.GE.27) it=27
248  ns=n
249 C CALL GULIST(104,2)
250 
251 C...Generate spacelike parton shower (if required)
252  ipu1=0
253  ipu2=23
254  IF(x(2)*(1.+(p(it,5)**2+pypar(22))/p(21,5)**2).GT.0.999) THEN
255  lst(21)=13
256  RETURN
257  ENDIF
258  IF(ipy(14).GE.1) THEN
259  CALL lysspa(ipu1,ipu2)
260  IF(lst(21).NE.0) RETURN
261  ENDIF
262  IF(n.EQ.ns) THEN
263  DO 220 i=ns+1,ns+4
264  DO 220 j=1,5
265  k(i,j)=0
266  p(i,j)=0.
267  220 v(i,j)=0.
268  k(ns+1,1)=11
269  k(ns+1,2)=kfl(2,1)
270  k(ns+1,3)=21
271  DO 230 j=1,5
272  230 p(ns+1,j)=p(21,j)
273  k(ns+2,1)=-1
274  k(ns+2,3)=ns+1
275  k(ns+3,1)=13
276  k(ns+3,2)=kfl(2,2)
277  k(ns+3,3)=23
278  k(ns+3,4)=23
279  k(ns+3,5)=23
280  p(ns+3,3)=(p(it,5)**2+q2lp)*(p(21,4)-p(21,3))/(2.*q2lp)
281  p(ns+3,4)=-p(ns+3,3)
282  k(ns+4,1)=-1
283  k(ns+4,3)=ns+3
284  p(ns+4,3)=23
285  p(ns+4,4)=23
286  p(24,1)=ns+3
287  p(24,2)=ns+3
288  k(23,4)=k(23,4)+(ns+3)*mstu(5)
289  k(23,5)=k(23,5)+(ns+3)*mstu(5)
290  ipu1=0
291  ipu2=ns+3
292  n=n+4
293  ENDIF
294 C CALL GULIST(105,2)
295 
296 C...Rotate and boost outgoing parton shower
297  IF(n.GT.31) THEN
298  k(n+1,1)=0
299  DO 210 j=1,4
300  210 p(n+1,j)=p(ns+1,j)+p(ns+3,j)
301  IF(p(n+1,4).LE.1.01*p(it,5)) THEN
302  lst(21)=14
303  RETURN
304  ENDIF
305  robo(1)=ulangl(p(it,3),sqrt(p(it,1)**2+p(it,2)**2))
306  robo(2)=ulangl(p(it,1),p(it,2))
307  IF(abs(robo(1)).GT.0.001.OR.abs(robo(2)).GT.0.001) THEN
308  WRITE(6,*) '1:',it,k(it,2),p(it,1),p(it,2),p(it,3),p(it,4),p(it,5)
309  WRITE(6,*) ' ROBO(1-2)=',robo(1),robo(2)
310  ENDIF
311  CALL ludbrb(25,ns,0.,-robo(2),0.d0,0.d0,0.d0)
312  CALL ludbrb(25,ns,-robo(1),0.,0.d0,0.d0,0.d0)
313 C...Replace old rotation method with x,y,z-boost to preserve QCD phi-dep
314  deltap(1)=dble(p(n+1,1))
315  deltap(2)=dble(p(n+1,2))
316  deltap(3)=dble(p(n+1,3)) - dble(p(it,3))
317  deltap(4)=sqrt(deltap(1)**2+deltap(2)**2+deltap(3)**2)
318  IF(deltap(4).LT.1.d-11) goto 410
319  dplong=-(dble(p(it,3))*deltap(3))/deltap(4)
320  droot=max(0.d0,dble(p(n+1,4))**2-dble(p(it,4))**2+dplong**2)
321  dbtot=-(dplong*dble(p(it,4))-dble(p(n+1,4))*sqrt(droot))/
322 C & SQRT(DBLE(P(N+1,4))**2-DBLE(P(IT,4))**2+DPLONG**2))/
323  & (dplong**2+dble(p(n+1,4))**2)
324  dgamma=1.d0/sqrt(1.d0-dbtot**2)
325  DO 400 i = 1,3
326  400 drobo(i+2)=deltap(i)/(dgamma/(dgamma+1.d0)*
327  & (dble(p(n+1,4))-dgamma*dble(p(it,4)))+dgamma*dble(p(it,4)))
328  CALL ludbrb(25,ns,0.,0.,drobo(3),drobo(4),drobo(5))
329  410 CONTINUE
330 C...End phi-correction
331  ENDIF
332 C CALL GULIST(106,2)
333 
334  q2=q2lp
335 C...Hadron remnant and primordial kt
336  ipy(47)=n
337  CALL lyremn(ipu1,ipu2)
338  IF(ipy(48).EQ.1) THEN
339  lst(21)=15
340  RETURN
341  ENDIF
342 C CALL GULIST(107,2)
343 
344 C...Rearrange partons along strings
345  mstu(24)=0
346  CALL luprep(0)
347  IF(mstu(24).NE.0) THEN
348 C CALL GULIST(188,2)
349  IF(lst(3).GE.1) WRITE(6,*) ' LUPREP error MSTU(24)= ',mstu(24)
350  lst(21)=16
351  RETURN
352  ENDIF
353 C CALL GULIST(109,2)
354 
355 C...Clean up event record -> order:
356 C...1=inc. lepton; 2=inc. nucleon; 3=exch boson; 4=scat. lepton;
357 C...5=inc. parton before initial shower; 6=inc. parton at hard scattering
358 C...after shower; 7,8=first,second parton from hard scattering
359 C...before final shower
360  lst(26)=7
361  DO 510 j=1,5
362  k(n+1,j)=k(4,j)
363  510 p(n+1,j)=p(4,j)
364  DO 520 j=1,5
365  k(3,j)=k(5,j)
366  p(3,j)=p(5,j)
367  k(4,j)=k(9,j)
368  p(4,j)=p(9,j)
369  k(5,j)=k(n+1,j)
370  p(5,j)=p(n+1,j)
371  k(6,j)=k(ns+3,j)
372  p(6,j)=p(ns+3,j)
373 C K(7,J)=K(IT,J)
374 C P(7,J)=P(IT,J)
375  k(7,j)=k(25,j)
376  p(7,j)=p(25,j)
377  k(8,j)=k(26,j)
378  p(8,j)=p(26,j)
379  520 CONTINUE
380  k(3,3)=1
381  k(4,3)=1
382  k(6,1)=21
383  k(6,3)=5
384  k(6,4)=0
385  k(6,5)=0
386  k(7,1)=21
387  k(7,3)=6
388  k(7,4)=0
389  k(7,5)=0
390  k(8,1)=21
391  k(8,3)=6
392  k(8,4)=0
393  k(8,5)=0
394 C...Activate line with scattered lepton.
395  k(4,1)=1
396 C...Deactivate obsolete lines 9, 10, 21, NS+1 (extra lines with boson)
397  k(9,1)=0
398  k(10,1)=0
399  k(21,1)=0
400  IF(k(ns+1,2).EQ.k(3,2)) k(ns+1,1)=0
401 C...Zero irrelevant lines with K(I,1)<0
402  DO 540 i=1,n
403  IF(k(i,1).LT.0) THEN
404  DO 530 j=1,5
405  k(i,j)=0
406  530 p(i,j)=0.
407  ENDIF
408  540 CONTINUE
409 C CALL GULIST(110,2)
410 C...Delete internal parton lines, i.e. with K(I,1)=13,14
411  IF(mod(lst(4)/10,10).EQ.0) THEN
412  CALL ltimex(t1)
413  CALL luedit(14)
414  CALL ltimex(t2)
415 C CALL GULIST(111,2)
416  ENDIF
417 C...Delete empty lines
418  CALL ltimex(t1)
419  CALL luedit(12)
420  CALL ltimex(t2)
421 C CALL GULIST(112,2)
422 
423  RETURN
424  END