EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
lepto.F
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file lepto.F
1 
2 C **********************************************************************
3 
4  SUBROUTINE lepto
5 
6  IMPLICIT NONE
7 
8 C...Administer the generation of an event.
9 C...Note: if error flag LST(21) is non-zero, no proper event generated.
10 
11  COMMON /lintrl/ psave(3,4,5),ksave(4),xmin,xmax,ymin,ymax,
12  &q2min,q2max,w2min,w2max,ilep,inu,ig,iz
13  REAL psave,xmin,xmax,ymin,ymax,q2min,q2max,w2min,w2max
14  INTEGER ksave,ilep,inu,ig,iz
15  SAVE /lintrl/
16 
17 *
18 * to avoid variable conflictions, a second keep element is necessary
19 * with the same common block name (see LPTOU2)
20 *
21  COMMON /leptou/ cut(14),lst(40),parl(30),
22  & x,y,w2,q2,u
23  REAL cut,parl,x,y,w2,q2,u
24  INTEGER lst
25  SAVE /leptou/
26 
27  COMMON /linter/ pari(50),ewqc(2,2,8),qc(8),zl(2,4),zq(2,8),pq(17)
28  REAL pari,ewqc,qc,zl,zq,pq
29  SAVE /linter/
30 
31  INTEGER nlupdm,nplbuf
32  parameter(nlupdm=4000,nplbuf=5)
33  common/lujets/n,k(nlupdm,5),p(nlupdm,nplbuf),v(nlupdm,5)
34  INTEGER n,k
35  REAL p,v
36  SAVE /lujets/
37 
38  common/ludat1/mstu(200),paru(200),mstj(200),parj(200)
39  INTEGER mstu,mstj
40  REAL paru,parj
41  SAVE /ludat1/
42 
43  COMMON /lboost/ dbeta(2,3),stheta(2),sphi(2),pb(5),phir
44  DOUBLE PRECISION dbeta
45  REAL stheta,sphi,pb,phir
46  SAVE /lboost/
47 
48 
49 * if ARIADNE is used to simulate the parton shower evolution, the
50 * ARDAT1 Common block is neccessary for a proper interface.
51 * if ARIADNE is used to simulate the parton shower evolution, the
52 * ARDAT1 Common block is neccessary for a proper interface.
53  COMMON /ardat1/ para(40),msta(40)
54  REAL para
55  INTEGER msta
56  SAVE /ardat1/
57 
58 
59  INTEGER nummis,nwarn,i,j,ns,l17
60  REAL ulmass,ulangl,rlu,ulalps
61  REAL qg,qqb,spq,srlu,plu,pt,phi,energy,p2,atan
62  DOUBLE PRECISION detot,dari29,dari30
63  dimension spq(17)
64  DATA nummis,nwarn/0,10/,dari29,dari30/2*0.d0/
65 
66  l17=0
67  1 lst(21)=0
68  DO 10 i=1,10
69  DO 10 j=1,5
70  k(i,j)=0
71  10 v(i,j)=0.
72  DO 15 i=1,4
73  k(i,1)=21
74  15 k(i,2)=ksave(i)
75  k(4,1)=1
76  n=2
77 
78  IF(lst(17).NE.0.AND.lst(2).GT.0) THEN
79 C...Lepton and/or nucleon energy may vary from event to event,
80  IF(l17.EQ.0) THEN
81 C...Momentum vectors from P(i,j) i=1,2 j=1,2,3 on entry in LEPTO
82  DO 20 i=1,2
83  p(i,5)=ulmass(k(i,2))
84  p(i,4)=sqrt(p(i,1)**2+p(i,2)**2+p(i,3)**2+p(i,5)**2)
85  DO 20 j=1,5
86  20 psave(3,i,j)=p(i,j)
87  ELSE
88 C...Momentum vectors from PSAVE if new try, i.e. jump back to 1
89  DO 25 i=1,2
90  DO 25 j=1,5
91  25 p(i,j)=psave(3,i,j)
92  ENDIF
93  l17=1
94 C...Transform to cms of incoming particles, lepton along +z axis.
95  DO 30 j=1,3
96  30 dbeta(1,j)=(dble(p(1,j))+dble(p(2,j)))/
97  & (dble(p(1,4))+dble(p(2,4)))
98  CALL ludbrb(0,0,0.,0.,-dbeta(1,1),-dbeta(1,2),-dbeta(1,3))
99  sphi(1)=ulangl(p(1,1),p(1,2))
100  CALL ludbrb(0,0,0.,-sphi(1),0.d0,0.d0,0.d0)
101  stheta(1)=ulangl(p(1,3),p(1,1))
102  CALL ludbrb(0,0,-stheta(1),0.,0.d0,0.d0,0.d0)
103  lst(28)=2
104  parl(21)=2.*(p(1,4)*p(2,4)-p(1,3)*p(2,3))
105  ELSE
106 C...Initial state momenta fixed from LINIT call.
107  DO 42 i=1,2
108  DO 40 j=1,5
109  40 p(i,j)=psave(3,i,j)
110  42 IF(psave(3,1,3).LT.0.) p(i,3)=-psave(3,i,3)
111  lst(28)=3
112  ENDIF
113  CALL leptox
114 C...Return if error or if no event to be generated.
115  IF(lst(21).NE.0.OR.lst(2).LE.0.OR.lst(7).EQ.-1) RETURN
116 
117  IF(pari(29).LT.0.5) THEN
118 C...For first call, reset double precision counters.
119  dari29=0.d0
120  dari30=0.d0
121  ENDIF
122  dari29=dari29+1.d0
123  pari(29)=dari29
124 C CALL GULIST(-3,2)
125 C...Scattered lepton and exchanged boson added to event record in LKINEM
126 C...Transform to lepton-nucleon cms if not made earlier
127  IF(lst(17).EQ.0) THEN
128  DO 46 i=3,4
129  DO 45 j=1,5
130  45 psave(3,i,j)=p(i,j)
131  46 IF(psave(3,1,3).LT.0.) psave(3,i,3)=-p(i,3)
132  CALL ludbrb(0,0,0.,0.,0.d0,0.d0,-dbeta(1,3))
133  lst(28)=2
134  ENDIF
135  DO 50 i=1,4
136  DO 50 j=1,5
137  50 psave(2,i,j)=p(i,j)
138 C CALL GULIST(-2,2)
139 
140 C...Prepare for parton cascade.
141  IF(lst(8).GE.2.AND.mod(lst(8),10).NE.9) CALL lshowr(0)
142 
143 C...Transform to hadronic cms, boost parameters in double precision.
144  detot=dble(p(1,4))-dble(p(4,4))+dble(p(2,4))
145  dbeta(2,1)=-dble(p(4,1))/detot
146  dbeta(2,2)=-dble(p(4,2))/detot
147  dbeta(2,3)=(dble(p(1,3))-dble(p(4,3))+dble(p(2,3)))/detot
148  CALL ludbrb(0,0,0.,0.,-dbeta(2,1),-dbeta(2,2),-dbeta(2,3))
149  sphi(2)=0.
150  stheta(2)=ulangl(p(3,3),p(3,1))
151  CALL ludbrb(0,0,-stheta(2),0.,0.d0,0.d0,0.d0)
152  lst(28)=1
153  DO 60 i=1,4
154  DO 60 j=1,5
155  60 psave(1,i,j)=p(i,j)
156 C...Save momentum of exchanged boson (used in subroutine LFRAME).
157  DO 70 j=1,5
158  70 pb(j)=p(3,j)
159 C CALL GULIST(-1,2)
160 
161  90 n=4
162  mstu(1)=n+1
163  lst(26)=n+1
164  lst(27)=0
165  parl(25)=ulalps(q2)
166  IF(lst(8).EQ.1.OR.lst(8)/10.EQ.1.OR.mod(lst(8),10).EQ.9) THEN
167 C...Probabilities for hard, first order QCD events.
168 CAE...Corrected what to do when LQGEV or LQQBEV fail. Now make LQEV.
169  CALL lqcdpr(qg,qqb)
170 
171  DO 100 i=1,17
172  100 spq(i)=pq(i)
173  200 srlu=rlu(0)
174 
175  IF(srlu.GT.qqb+qg) THEN
176  CALL lqev
177  ELSEIF(srlu.GT.qqb) THEN
178  IF(lst(8).EQ.9) THEN
179  DO 211 i=1,17
180  211 pq(i)=spq(i)
181  CALL lqev
182  ELSE
183  CALL lqgev
184  DO 212 i=1,17
185  pq(i)=spq(i)
186  212 CONTINUE
187  ENDIF
188  ELSE
189  CALL lqqbev
190  DO 213 i=1,17
191  pq(i)=spq(i)
192  213 CONTINUE
193  IF(lst(8).EQ.9.AND.lst(21).EQ.0) THEN
194  IF(plu(5,11).LT.q2*para(20)) THEN
195  DO 220 i=1,17
196  220 pq(i)=spq(i)
197  CALL lqevar(k(5,2),k(7,2))
198  ENDIF
199  ENDIF
200  ENDIF
201  IF(lst(21).NE.0) THEN
202  230 CALL lqev
203  IF(lst(21).NE.0) goto 230
204  ENDIF
205  ELSE
206 C...QPM model without QCD corrections (cascade applied later).
207  300 CALL lqev
208  IF(lst(21).NE.0) goto 300
209  ENDIF
210 
211  ns=mstu(1)
212  mstu(1)=0
213 C CALL GULIST(-3,2)
214 C WRITE(6,*) ' LST(24)=',LST(24)
215 CJR-- no preclustering of small systems
216  mstj(14)=-1
217 CJR--
218  IF(lst(8).LE.1.OR.mod(lst(8),10).EQ.9) THEN
219 C...No parton cascade, introduce primordial kt.
220  IF(parl(3).GT.1.e-03) THEN
221  CALL lprikt(parl(3),pt,phi)
222  CALL ludbrb(ns,n,0.,-phi,0.d0,0.d0,0.d0)
223  CALL ludbrb(ns,n,atan(2.*pt/sqrt(w2)),phi,0.d0,0.d0,0.d0)
224  ENDIF
225  IF(mod(lst(8),10).NE.9) THEN
226 C...Check system against fragmentation cuts.
227  mstu(24)=0
228  CALL luprep(0)
229  IF(mstu(24).NE.0) THEN
230  IF(lst(3).GE.1) WRITE(6,*)'LUPREP error MSTU(24)=',mstu(24),
231  & ', New event generated'
232  lst(21)=1
233  goto 1
234  ENDIF
235  ENDIF
236  ELSEIF(lst(24).EQ.1) THEN
237 C...Include parton cascades (+ remnant & kt) on q-event
238  CALL lshowr(1)
239  ELSE
240 C...Include parton cascades (+ remnant & kt) on qg- or qqbar-event
241  CALL lmeps
242  ENDIF
243  IF(lst(21).NE.0) THEN
244 C IF(LST(3).GE.1)
245 C & WRITE(6,*)'Cascade error LST(21)= ',LST(21),
246 C & ', New event generated'
247  goto 1
248  ENDIF
249 
250 CJR-- Soft colour interactions
251  IF(lst(34).EQ.1) CALL lsci(parl(7))
252  IF(lst(21).NE.0) goto 1
253 CJR-- take care of small systems
254  CALL lsmall
255  IF(lst(21).NE.0) THEN
256  IF(lst(3).GE.1) WRITE(6,*)' LSMALL error LST(21)= ',lst(21),
257  & ', New event generated'
258  goto 1
259  ENDIF
260  mstj(14)=1
261  CALL luprep(0)
262  IF(mstu(24).NE.0) THEN
263  IF(lst(3).GE.1) WRITE(6,*)' LUPREP error MSTU(24)= ',mstu(24),
264  & ', New event generated'
265  lst(21)=1
266  ENDIF
267 CJR--
268  IF(lst(21).NE.0) goto 1
269 
270  DO 400 i=1,n
271 C...Correct energy-momentum-mass mismatch for real particle
272  IF(p(i,5).LT.0.) goto 400
273  energy=sqrt(dble(p(i,5))**2+dble(p(i,1))**2+dble(p(i,2))**2+
274  &dble(p(i,3))**2)
275  p2=dble(p(i,4))**2-dble(p(i,1))**2-dble(p(i,2))**2-dble(p(i,3))**2
276  IF(abs(energy-p(i,4))/(psave(3,1,4)+psave(3,2,4)).GT.paru(11))THEN
277  nummis=nummis+1
278 C...For testing purposes
279 C IF(LST(3).GE.1.AND.NUMMIS.LE.NWARN) THEN
280 C WRITE(6,1000) I,(K(I,J),J=1,2),(P(I,J),J=1,5),
281 C & SIGN(SQRT(ABS(P2)),P2),ENERGY,INT(DARI29),NWARN
282 C IF(ABS(P2-P(I,5)**2).GT.400.) CALL LULIST(2)
283 C ENDIF
284 CAE WRITE(6,*) 'Energy mismatch',LST(24),PARL(28),PARL(29),NUMMIS
285  goto 90
286  ENDIF
287  p(i,4)=energy
288  400 CONTINUE
289 
290  dari30=dari30+1.d0
291  pari(30)=dari30
292 Ctest IF(LST(23).EQ.2) PARL(24)=PARL(24)*DARI30/DARI29
293 
294  DO 500 i=1,n
295  DO 500 j=1,5
296  500 v(i,j)=0.
297  IF(lst(7).EQ.1) THEN
298  CALL luexec
299  IF(mstu(24).NE.0) THEN
300  WRITE(6,*) ' Error from JETSET, new event made'
301  goto 90
302  ENDIF
303  ENDIF
304 
305 C CALL GULIST(-1,2)
306 C...Transform to desired frame
307 C LST(28)=1
308  lst(29)=0
309  phir=6.2832*rlu(0)
310  IF(lst(17).EQ.0) THEN
311  IF(lst(5).GE.2) CALL lframe(lst(5),0)
312 C...Restore momenta (e,p,boson,L) due to numerical errors from boosts
313 C...But only in frames 1-3
314  IF(lst(28).GT.0 .AND. lst(28).LT.4) THEN
315  DO 600 i=1,4
316  DO 600 j=1,5
317  600 p(i,j)=psave(lst(28),i,j)
318  ENDIF
319  IF(lst(6).EQ.1.AND.lst(28).GE.2) THEN
320 C...Random rotation in azimuthal angle
321  CALL ludbrb(0,0,0.,phir,0.d0,0.d0,0.d0)
322  lst(29)=1
323  ENDIF
324  ELSE
325  IF(lst(5).GE.2) CALL lframe(lst(5),lst(6))
326  ENDIF
327 C...Deactivate scattered lepton
328  IF(mod(lst(4),10).EQ.0) k(4,1)=21
329 C CALL GULIST(0,2)
330 
331  RETURN
332  1000 FORMAT(' Warning: too large numerical mismatch in ',
333  &'particle energy-momentum-mass',
334  &/,3x,'I K(I,1) ..2) P(I,1) P(I,2) P(I,3)',
335  &' P(I,4) P(I,5) mass energy',/,i4,2i6,7f8.3,/,
336  &' Event no.',i8,' regenerated. Only first',i5,' warnings printed')
337  END