EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
polleptox.F
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file polleptox.F
1 
2 *72*********************************************************************
3 
4  SUBROUTINE polleptox
5 
6  IMPLICIT NONE
7 
8 C...Select process and choose kinematical variables (x,y; x,Q2; x,W2)
9 C...according to the differential cross section.
10  COMMON /lintrl/ psave(3,4,5),ksave(4),xmin,xmax,ymin,ymax,
11  &q2min,q2max,w2min,w2max,ilep,inu,ig,iz
12  REAL psave,xmin,xmax,ymin,ymax,q2min,q2max,w2min,w2max
13  INTEGER ksave,ilep,inu,ig,iz
14  SAVE /lintrl/
15 
16 *
17 * to avoid variable conflictions, a second keep element is necessary
18 * with the same common block name (see LPTOU2)
19 *
20  COMMON /leptou/ cut(14),lst(40),parl(30),
21  & x,y,w2,q2,u
22  REAL cut,parl,x,y,w2,q2,u
23  INTEGER lst
24  SAVE /leptou/
25 
26  COMMON /linter/ pari(50),ewqc(2,2,8),qc(8),zl(2,4),zq(2,8),pq(17)
27  REAL pari,ewqc,qc,zl,zq,pq
28  SAVE /linter/
29 
30  COMMON /loptim/ optx(4),opty(4),optq2(4),optw2(4),comfac
31  REAL optx,opty,optq2,optw2,comfac
32  SAVE /loptim/
33 
34 
35 * this Common block appears only in S LEPTOX
36  COMMON /flinfo/ rflq,rflg,rflm,rflt
37  REAL rflq,rflg,rflm,rflt
38  SAVE /flinfo/
39 
40  INTEGER nlupdm,nplbuf
41  parameter(nlupdm=4000,nplbuf=5)
42  common/lujets/n,k(nlupdm,5),p(nlupdm,nplbuf),v(nlupdm,5)
43  INTEGER n,k
44  REAL p,v
45  SAVE /lujets/
46 
47  common/ludat2/kchg(500,3),pmas(500,4),parf(2000),vckm(4,4)
48  INTEGER kchg
49  REAL pmas,parf,vckm
50  SAVE /ludat2/
51 
52 
53  INTEGER ih,i,ncut,ii
54  INTEGER lqcd,ltm,lht,lkinem
55  REAL w2low,w2upp,ylow,yupp,q2low,q2upp,pnt,pqh,s,pm2,
56  +xpq,xdpq,gfq2,aemcor,ulalem,zlep,a,b,flg,flq,
57  +flm,flt,f2em,pqh17,weight,hx,xfact,q2fact,hy,yfact,hq2,
58  +w2fact,sigl,sigr,sigma,viol,yq,yqb,fyq,fydq,hw2,which
59  REAL rlu
60 *...Added array XDPQ to store delta parton distributions
61  dimension pqh(17,2),pnt(2,2),xpq(-6:6),xdpq(-6:6)
62 *---
63 CGI-001122...d- & u-valence weights for p & n target & helicity state
64  REAL pntdu(2,2,2)
65 CMM-010306...anti d- & u-quark weights for p & n target & helicity state
66  REAL pntdus(2,2,2)
67  DOUBLE PRECISION dari27,dari28
68  DATA dari27,dari28/2*0.d0/
69  DATA w2low,w2upp,ylow,yupp,q2low,q2upp/6*0./
70 
71  DO 10 ih=1,2
72  DO 5 i=1,2
73 CGI-001122
74  pntdu(i,1,ih)=0.
75  pntdu(i,2,ih)=0.
76 CMM-010306
77  pntdus(i,1,ih)=0.
78  pntdus(i,2,ih)=0.
79  5 pnt(i,ih)=0.
80  DO 6 i=1,8
81  ewqc(1,ih,i)=0.
82  6 ewqc(2,ih,i)=0.
83  DO 10 i=1,17
84  10 pqh(i,ih)=0.
85  DO 20 i=1,17
86  20 pq(i)=0.
87 
88  lst(21)=0
89  ncut=0
90  s=parl(21)
91  pm2=psave(3,2,5)**2
92  IF(lst(2).NE.1) THEN
93  q2low=max(q2min,x*ymin*s,(w2min-pm2)*x/max(1.-x,1.e-22))
94  q2upp=min(q2max,x*ymax*s,(w2max-pm2)*x/max(1.-x,1.e-22))
95  ylow=max(ymin,q2min/max(s*x,1.e-22),
96  & (w2min-pm2)/max(s*(1.-x),1.e-22))
97  yupp=min(ymax,q2max/max(s*x,1.e-22),
98  & (w2max-pm2)/max(s*(1.-x),1.e-22))
99  w2low=max(w2min,(1.-x)*ymin*s+pm2,q2min*(1.-x)/max(x,1.e-22)+pm2)
100  w2upp=min(w2max,(1.-x)*ymax*s+pm2,q2max*(1.-x)/max(x,1.e-22)+pm2)
101  goto 110
102  ENDIF
103 
104  IF(pari(28).LT.0.5) THEN
105 C...For first call, reset double precision counters.
106  dari27=0.d0
107  dari28=0.d0
108  ENDIF
109  100 dari28=dari28+1.d0
110  pari(28)=dari28
111  101 CONTINUE
112 C...Choose x according to the distribution
113 C...hx(x) = a + b/x + c/x**2 + d/x**3. In detail
114 C...hq=OPTX(1)/(XMAX-XMIN) + 1/ln(XMAX/XMIN)*OPTX(2)/X
115 C... +XMIN*XMAX/(XMAX-XMIN)*OPTX(3)/X**2
116 C... +2*(XMIN*XMAX)**2/(XMAX**2-XMIN**2)*OPTX(4)/X**3
117  which=(optx(1)+optx(2)+optx(3)+optx(4))*rlu(0)
118  IF(which.LE.optx(1)) THEN
119  x=xmin+rlu(0)*(xmax-xmin)
120  ELSEIF(which.LE.(optx(1)+optx(2))) THEN
121  x=xmin*(xmax/xmin)**rlu(0)
122  ELSEIF(which.LE.(optx(1)+optx(2)+optx(3))) THEN
123  x=xmin*xmax/(xmax+rlu(0)*(xmin-xmax))
124  ELSE
125  x=sqrt((xmin*xmax)**2/(xmax**2+rlu(0)*(xmin**2-xmax**2)))
126  ENDIF
127  IF(lst(31).EQ.1) THEN
128 C...Choose Q**2 according to the distribution
129 C...hq(Q2) = a + b/(Q2) + c/(Q2)**2 + d/(Q2)**3. In detail
130 C...hq=OPTQ2(1)/(Q2MAX-Q2MIN) + 1/ln(Q2MAX/Q2MIN)*OPTQ2(2)/Q2
131 C... +Q2MIN*Q2MAX/(Q2MAX-Q2MIN)*OPTQ2(3)/Q2**2
132 C... +2*(Q2MIN*Q2MAX)**2/(Q2MAX**2-Q2MIN**2)*OPTQ2(4)/Q2**3
133  q2low=max(q2min,x*ymin*s,(w2min-pm2)*x/(1.-x))
134  q2upp=min(q2max,x*ymax*s,(w2max-pm2)*x/(1.-x))
135  IF(q2upp.LT.q2low) goto 101
136  which=(optq2(1)+optq2(2)+optq2(3)+optq2(4))*rlu(0)
137  IF(which.LE.optq2(1)) THEN
138  q2=q2low+rlu(0)*(q2upp-q2low)
139  ELSEIF(which.LE.(optq2(1)+optq2(2))) THEN
140  q2=q2low*(q2upp/q2low)**rlu(0)
141  ELSEIF(which.LE.(optq2(1)+optq2(2)+optq2(3))) THEN
142  q2=q2low*q2upp/(q2upp+rlu(0)*(q2low-q2upp))
143  ELSE
144  q2=sqrt((q2low*q2upp)**2/(q2upp**2+rlu(0)*(q2low**2-q2upp**2)))
145  ENDIF
146  y=q2/(parl(21)*x)
147  IF(y.LT.ymin.OR.y.GT.ymax) goto 100
148  ELSEIF(lst(31).EQ.2) THEN
149 C...Choose y according to the distribution
150 C...hy(y) = a + b/y + c/y**2 + d/y**3. In detail
151 C...hy=OPTY(1)/(YMAX-YMIN) + 1/ln(YMAX/YMIN)*OPTY(2)/Y
152 C... +YMIN*YMAX/(YMAX-YMIN)*OPTY(3)/Y**2
153 C... +2*(YMIN*YMAX)**2/(YMAX**2-YMIN**2)*OPTY(4)/Y**3
154  ylow=max(ymin,q2min/(s*x),(w2min-pm2)/(s*(1.-x)))
155  yupp=min(ymax,q2max/(s*x),(w2max-pm2)/(s*(1.-x)))
156  IF(yupp.LT.ylow) goto 101
157  which=(opty(1)+opty(2)+opty(3)+opty(4))*rlu(0)
158  IF(which.LE.opty(1)) THEN
159  y=ylow+rlu(0)*(yupp-ylow)
160  ELSEIF(which.LE.(opty(1)+opty(2))) THEN
161  y=ylow*(yupp/ylow)**rlu(0)
162  ELSEIF(which.LE.(opty(1)+opty(2)+opty(3))) THEN
163  y=ylow*yupp/(yupp+rlu(0)*(yupp-ylow))
164  ELSE
165  y=sqrt((ylow*yupp)**2/(yupp**2+rlu(0)*(ylow**2-yupp**2)))
166  ENDIF
167  q2=x*y*parl(21)
168  IF(q2.LT.q2min.OR.q2.GT.q2max) goto 100
169  ELSEIF(lst(31).EQ.3) THEN
170 C...Choose W**2 according to the distribution
171 C...hw(W2) = a + b/(W2) + c/(W2)**2 + d/(W2)**3. In detail
172 C...hw=OPTW2(1)/(W2MAX-W2MIN) + 1/ln(W2MAX/W2MIN)*OPTW2(2)/W2
173 C... +W2MIN*W2MAX/(W2MAX-W2MIN)*OPTW2(3)/W2**2
174 C... +2*(W2MIN*W2MAX)**2/(W2MAX**2-W2MIN**2)*OPTW2(4)/W2**3
175  w2low=max(w2min,(1.-x)*ymin*s+pm2,q2min*(1.-x)/x+pm2)
176  w2upp=min(w2max,(1.-x)*ymax*s+pm2,q2max*(1.-x)/x+pm2)
177  IF(w2upp.LT.w2low) goto 101
178  which=(optw2(1)+optw2(2)+optw2(3)+optw2(4))*rlu(0)
179  IF(which.LE.optw2(1)) THEN
180  w2=w2low+rlu(0)*(w2upp-w2low)
181  ELSEIF(which.LE.(optw2(1)+optw2(2))) THEN
182  w2=w2low*(w2upp/w2low)**rlu(0)
183  ELSEIF(which.LE.(optw2(1)+optw2(2)+optw2(3))) THEN
184  w2=w2low*w2upp/(w2upp+rlu(0)*(w2low-w2upp))
185  ELSE
186  w2=sqrt((w2low*w2upp)**2/(w2upp**2+rlu(0)*(w2low**2-w2upp**2)))
187  ENDIF
188  y=(w2-pm2)/((1.-x)*parl(21))
189  q2=x*y*parl(21)
190  IF(y.LT.ymin.OR.y.GT.ymax) goto 100
191  IF(q2.LT.q2min.OR.q2.GT.q2max) goto 100
192  ENDIF
193  110 IF(lkinem(lst(2)).NE.0) THEN
194  ncut=ncut+1
195  IF(lst(2).EQ.1) THEN
196  IF(ncut.LE.9999) goto 100
197  IF(lst(3).GE.1) WRITE(6,1200)
198  ENDIF
199  lst(21)=2
200  RETURN
201  ENDIF
202 
203  pari(24)=(1.+(1.-y)**2)/2.
204  pari(25)=1.-y
205  pari(26)=(1.-(1.-y)**2)/2.
206 *...Get also parton distributions. Give in input array XPQ
207  CALL lnstrf(x,q2,xpq)
208  CALL dnstrf(x,q2,xdpq)
209 C...Lepton helicity state, only one contributes in some cases.
210  ih=1
211  IF(parl(6).GT.+0.99) ih=2
212  200 lst(30)=sign(1.,ih-1.5)
213  pqh(17,ih)=0.
214  pnt(1,ih)=0.
215  pnt(2,ih)=0.
216 CGI-001122
217  pntdu(1,1,ih)=0.
218  pntdu(1,2,ih)=0.
219  pntdu(2,1,ih)=0.
220  pntdu(2,2,ih)=0.
221 CMM-010306
222  pntdus(1,1,ih)=0.
223  pntdus(1,2,ih)=0.
224  pntdus(2,1,ih)=0.
225  pntdus(2,2,ih)=0.
226 
227  IF(lst(23).EQ.2) THEN
228 C...Charged current: zero cross-section for one helicity state.
229  IF(ksave(1).LT.0.AND.ih.EQ.1
230  & .OR.ksave(1).GT.0.AND.ih.EQ.2) goto 240
231  yq=pari(24)-lst(30)*pari(26)
232  yqb=pari(24)+lst(30)*pari(26)
233  IF(pari(11).GT.1.e-06) THEN
234  IF(k(3,2).LT.0) THEN
235  pnt(1,ih)=(1.-pari(11))*pari(13)*yq
236  pnt(2,ih)=pari(11)*pari(12)*yq
237 CGI-001122...Save u-valence weights for p & n target
238  pntdu(1,2,ih)=pari(13)*yq
239  pntdu(2,2,ih)=pari(12)*yq
240 CMM-010306...Save anti u-quark weights for p & n target
241  pntdus(1,2,ih)=pari(43)*yq
242  pntdus(2,2,ih)=pari(42)*yq
243  ELSE
244  pnt(1,ih)=(1.-pari(11))*pari(12)*yq
245  pnt(2,ih)=pari(11)*pari(13)*yq
246 CGI-001122...Save d-valence weights for p & n target
247  pntdu(1,1,ih)=pari(12)*yq
248  pntdu(2,1,ih)=pari(13)*yq
249 CMM-010306...Save anti d-quark weights for p & n target
250  pntdus(1,1,ih)=pari(42)*yq
251  pntdus(2,1,ih)=pari(43)*yq
252  ENDIF
253  ENDIF
254  DO 220 i=1,lst(12)
255  IF(k(3,2)*qc(i).LT.0) THEN
256  pqh(i,ih)=xpq(i)*yq
257  ELSE
258  pqh(i+lst(12),ih)=xpq(-i)*yqb
259  ENDIF
260  220 CONTINUE
261  ELSE
262 C...Neutral current: electromagnetic or weak or both with interference.
263  gfq2=q2/(pmas(23,1)**2+q2)*sqrt(2.)*parl(17)*pmas(23,1)**2/
264  & (3.1415927*parl(16))
265 C...Correction to obtain Q**2 dependent alpha-em, if desired.
266  aemcor=1.
267  IF(lst(18).GE.2) aemcor=ulalem(q2)/parl(16)
268  ii=3-ih
269  zlep=zl(ih,ilep+2*inu)
270  DO 230 i=1,max(lst(12),lst(13))
271  a=(-ig*qc(i)*aemcor+iz*gfq2*zlep*zq(ih,i))**2
272  b=(-ig*qc(i)*aemcor+iz*gfq2*zlep*zq(ii,i))**2
273 C...Save helicity-dependent electroweak quark couplings for later use.
274  ewqc(1,ih,i)=a
275  ewqc(2,ih,i)=b
276  IF(i.GT.lst(12)) goto 230
277  fyq=(a+b)*pari(24)+(a-b)*pari(26)
278 *...Y factor for polarization dependent part of the c.s.
279  fydq=(a+b)*pari(26)
280 *---
281 *...Added polarization dependent part of the q event c.s. (quarks).
282 *...Before it was: PQH(I,IH)=XPQ(I)*FYQ
283 *...Now it is:
284  pqh(i,ih)=xpq(i)*fyq+lst(40)*xdpq(i)*fydq
285 *---
286 *...Added isospin contributions from polarized terms.
287 *...FOUR EMPTY CELLS OF ARRAY PARI HAVE BEEN USED: PARI(38) AND PARI(39).
288 CAL-290704 PARI(44) and PARI(45) Have the polarized light sea.
289  IF(i.LE.2.AND.pari(11).GT.1.e-06) THEN
290  pnt(1,ih)=pnt(1,ih)+(1.-pari(11))*(pari(11+i)*fyq+
291  & lst(40)*pari(37+i)*fydq)
292  pnt(2,ih)=pnt(2,ih)+pari(11)*(pari(14-i)*fyq+
293  & lst(40)*pari(40-i)*fydq)
294 CGI-001122...Save d- & u-valence weights for p & n target
295 CAL-290704 Added spin dependant LST(40) part to these
296  pntdu(1,i,ih)=pari(11+i)*fyq
297  & + lst(40) * pari(37+i)*fydq
298  pntdu(2,i,ih)=pari(14-i)*fyq
299  & + lst(40) * pari(40-i)*fydq
300 CMM-010306...Save anti d- & u-quark weights for p & n target
301 CAL-290704 Added spin dependant LST(40) part to these too
302  pntdus(1,i,ih)=((a+b)*pari(24)-(a-b)*pari(26))
303  & * pari(41+i) + lst(40) * pari(43+i) * fydq
304  pntdus(2,i,ih)=((a+b)*pari(24)-(a-b)*pari(26))
305  & * pari(44-i) + lst(40) * pari(46-i) * fydq
306 
307 
308  ENDIF
309 *---
310 *...Added polarization dependent part of the q event c.s. (antiquarks).
311 *...Before it was:PQH(I+LST(12),IH)=XPQ(-I)*((A+B)*PARI(24)-(A-B)*PARI(26))
312 *...Now it is:
313  pqh(i+lst(12),ih)=xpq(-i)*((a+b)*pari(24)-(a-b)*pari(26))+
314  & lst(40)*xdpq(-i)*fydq
315 *---
316  230 CONTINUE
317  ENDIF
318  240 CONTINUE
319  DO 300 i=1,lst(12)
320  300 pqh(17,ih)=pqh(17,ih)+pqh(i,ih)+pqh(i+lst(12),ih)
321 
322  IF(abs(parl(6)).LT.0.99.AND.ih.EQ.1) THEN
323  ih=2
324  goto 200
325  ENDIF
326 
327  flq=0.
328  flg=0.
329  flm=0.
330  flt=0.
331  IF(lst(11).NE.0.AND.(lst(23).EQ.1.OR.lst(23).EQ.4)
332  &.AND.lst(2).NE.-3) THEN
333 C...Include F_L for photon exchange (unless QCD grid being set up)
334  lqcd=mod(lst(11),10)
335  ltm=mod(lst(11)/10,10)
336  lht=lst(11)/100
337 C...Include QCD, target mass and/or higher twist contr. to long. str fcn
338 C...FL from interpolation.
339  IF(lqcd.EQ.1.OR.ltm.EQ.1) CALL flipol(flq,flg,flm)
340 C...Event simulation: if requested, get FL by event-by-event integration
341 * IF(LST(2).GT.0.AND.
342 * & (LQCD.EQ.2.OR.LTM.EQ.2)) CALL FLINTG(FLQ,FLG,FLM)
343 *** IF(LST(2).GT.0.) then
344 *******If (LQCD.EQ.2.OR.LTM.EQ.2) CALL FLINTG(FLQ,FLG,FLM)
345  If (lqcd.EQ.2) CALL flintg(flq,flg,flm)
346 **** If (LTM.EQ.2) CALL FLINTG(FLQ,FLG,FLM)
347 ** endif
348 
349  IF(ltm.GE.1.OR.lht.GE.1) THEN
350  f2em=0.
351  DO 301 i=1,lst(12)
352  301 f2em=f2em+qc(i)**2*(xpq(i)+xpq(-i))
353  IF(ltm.GE.1) flm=flm-2.*x**2*psave(3,2,5)**2/q2*f2em
354  IF(lht.GE.1) flt=8.*parl(19)/q2*f2em
355  ENDIF
356  DO 305 ih=1,2
357  pqh17=pqh(17,ih)
358 C...Note factor 2 at the end, since PQH(IH,17) contains overall factor 2
359  pqh(17,ih)=pqh(17,ih)-y**2*(flq+flg+flm+flt)
360  DO 305 i=1,16
361  305 pqh(i,ih)=pqh(i,ih)*pqh(17,ih)/pqh17
362  ENDIF
363 
364  DO 310 i=1,17
365  310 pq(i)=(1.-parl(6))/2.*pqh(i,1)+(1.+parl(6))/2.*pqh(i,2)
366 
367 C...Relative contribution from longitudinal str. fcn. and higher twist.
368  rflq=-y**2*flq/max(pq(17),1.e-33)
369  rflg=-y**2*flg/max(pq(17),1.e-33)
370  rflm=-y**2*flm/max(pq(17),1.e-33)
371  rflt=-y**2*flt/max(pq(17),1.e-33)
372 
373 
374 C...Common factor for matrix elements.
375  IF(lst(31).EQ.1) THEN
376  IF(lst(23).EQ.2) THEN
377  comfac=1./x/(1.+q2/pmas(24,1)**2)**2
378  ELSE
379  comfac=1./x/q2**2
380  ENDIF
381  ELSEIF(lst(31).EQ.2) THEN
382  IF(lst(23).EQ.2) THEN
383  comfac=1./(1.+q2/pmas(24,1)**2)**2*parl(21)
384  ELSE
385  comfac=1./q2**2*parl(21)
386  ENDIF
387  ELSEIF(lst(31).EQ.3) THEN
388  IF(lst(23).EQ.2) THEN
389  comfac=1./x/(1.+q2/pmas(24,1)**2)**2 * x/(1.-x)
390  ELSE
391  comfac=1./x/q2**2 * x/(1.-x)
392  ENDIF
393  ENDIF
394 C-check: Move change of COMFAC to below??
395 C...Prepare for Q2 weighting.
396 C WEIGHT=1/Q2**2
397  weight=1.d0
398  comfac=comfac/weight
399  IF(lst(2).LE.-2) RETURN
400  hx=optx(1)/(xmax-xmin) + 1./alog(xmax/xmin)*optx(2)/x
401  &+xmin*xmax/(xmax-xmin)*optx(3)/x**2
402  &+2*(xmin*xmax)**2/(xmax**2-xmin**2)*optx(4)/x**3
403  xfact=optx(1)+optx(2)+optx(3)+optx(4)
404  IF(lst(31).EQ.1) THEN
405  hq2=optq2(1)/(q2upp-q2low)
406  & +1./alog(q2upp/q2low)*optq2(2)/q2
407  & +q2low*q2upp/(q2upp-q2low)*optq2(3)/q2**2
408  & +2*(q2low*q2upp)**2/(q2upp**2-q2low**2)*optq2(4)/q2**3
409  q2fact=optq2(1)+optq2(2)+optq2(3)+optq2(4)
410  comfac=comfac*xfact*q2fact/hx/hq2
411  ELSEIF(lst(31).EQ.2) THEN
412  hy=opty(1)/(yupp-ylow)+1./alog(yupp/ylow)*opty(2)/y
413  & +ylow*yupp/(yupp-ylow)*opty(3)/y**2
414  & +2*(ylow*yupp)**2/(yupp**2-ylow**2)*opty(4)/y**3
415  yfact=opty(1)+opty(2)+opty(3)+opty(4)
416  comfac=comfac*xfact*yfact/hx/hy
417  ELSEIF(lst(31).EQ.3) THEN
418  hw2=optw2(1)/(w2upp-w2low)
419  & +1./alog(w2upp/w2low)*optw2(2)/w2
420  & +w2low*w2upp/(w2upp-w2low)*optw2(3)/w2**2
421  & +2*(w2low*w2upp)**2/(w2upp**2-w2low**2)*optw2(4)/w2**3
422  w2fact=optw2(1)+optw2(2)+optw2(3)+optw2(4)
423  comfac=comfac*xfact*w2fact/hx/hw2
424  ENDIF
425  IF(lst(2).LE.0) RETURN
426 
427 C-check: Move change of COMFAC to here?
428  sigl=(1.-parl(6))/2.*pqh(17,1)
429  sigr=(1.+parl(6))/2.*pqh(17,2)
430  sigma=sigl+sigr
431  IF(lst(2).EQ.1) THEN
432 C...When chosing (x,y), reject according to maximum of "cross-section",
433 C...update cross-section estimate.
434  dari27=dari27+dble(sigma)*dble(comfac)*weight
435  pari(27)=dari27
436  viol=sigma*comfac/pari(lst(23))
437  IF(viol.GT.pari(32)) THEN
438  pari(32)=viol
439  IF(pari(32).GT.1.) THEN
440  pari(lst(23))=pari(lst(23))*pari(32)
441  IF(lst(3).GE.1) WRITE(6,1300) pari(32),int(pari(30)+1),
442  & pari(lst(23)),x,y,q2,w2
443  pari(32)=1.
444  ENDIF
445  ENDIF
446  IF(viol.LT.rlu(0)) goto 100
447  parl(24)=pari(31)*dari27/dari28
448  ENDIF
449  IF(abs(parl(6)).LT.0.99) THEN
450 C...Choose helicity of incoming lepton.
451  ih=1
452  IF(rlu(0)*sigma.GT.sigl) ih=2
453  ENDIF
454  lst(30)=sign(1.,ih-1.5)
455 CGI-001122...Save parton density weights for chosen helicity
456  DO 510 i=1,17
457  510 pq(i)=pqh(i,ih)
458 
459 C...Choose target nucleon, proton or neutron.
460  lst(22)=1
461  k(2,2)=2212
462  IF(pari(11).GT.1.e-06) THEN
463  IF(rlu(0).LT.(pari(11)*(pqh(17,ih)-pnt(1,ih)-pnt(2,ih))+
464  & pnt(2,ih))/pqh(17,ih)) THEN
465  lst(22)=2
466  k(2,2)=2112
467  ENDIF
468 CGI-001122...Save parton density weights for chosen target nucleon
469 CMM-010306...and take also care of the anti u- and anti d-quarks
470  pq(17)=pq(17)-pq(1)-pq(2)-pq(1+lst(12))-pq(2+lst(12))
471  pq(1) =pntdu(lst(22),1,ih)
472  pq(2) =pntdu(lst(22),2,ih)
473  pq(1+lst(12))=pntdus(lst(22),1,ih)
474  pq(2+lst(12))=pntdus(lst(22),2,ih)
475  pq(17)=pq(17)+pq(1)+pq(2)+pq(1+lst(12))+pq(2+lst(12))
476  ENDIF
477 
478  RETURN
479  1200 FORMAT(' Warning: LEPTOX is looping, cannot find allowed ',
480  &'phase space point due to cuts,',/,
481  &10x,'check, in particular, CUT(11) to CUT(14)')
482  1300 FORMAT(' Warning: maximum violated by a factor ',f7.3,
483  &' in event ',i7,/,' maximum increased by this factor to ',e12.3,
484  &/,' Point of violation: x, y, Q**2, W**2 = ',4g10.3)
485  END