All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
pxluc5.f
Go to the documentation of this file.
1 CDECK ID>, PXLUC5.
2  SUBROUTINE pxluc5 (N,NRLUDM,P,MSTU46,MSTU47,
3  + paru44,paru45,njet,ijmul,ipass)
4 *.*********************************************************
5 *. ------
6 *. PXLUC5
7 *. ------
8 *. An "in-house" version of the Jetset jet-finding algorithm
9 *. which works entirely through an argument list rather than
10 *. through e.g. the Jetset common blocks. Its operation is
11 *. therefore entirely decoupled from the the operation of Jetset
12 *. (i.e. the values of MST or MSTJ etc. in Jetset common do not
13 *. affect this routine whatsoever).
14 *. The main purpose of an in-house version of the
15 *. Jetset jetfinding algorithm is to have a version
16 *. which is compatible with both Jetset6.3 and Jetset7.1 etc.
17 *. (because of the change in the Jetset common blocks between
18 *. these two versions, the version of this algorithm in the
19 *. Jetset library is version specific).
20 *. The input arguments MSTU46, MSTU47, PARU44, PARU45 correspond
21 *. to the parameters MSTU(46), MSTU(47), PARU(44), PARU(45) of
22 *. Jetset7.1, see "A manual to ... Jetset7.1," T.Sjostrand
23 *. (filename "Jetset7.1 MANUAL A" on the Opal generator disk).
24 *.
25 *. INTEGER NRLUDM,MXJET
26 *. PARAMETER (NRLUDM=1000.or.so,MXJET=10.or.so)
27 *. INTEGER IPASS (NRLUDM),IJMUL (MXJET)
28 *. INTEGER NTRAK,NJET
29 *. REAL PLUND (NRLUDM,5)
30 *. REAL MSTU46,MSTU47,PARU44,PARU45
31 *.
32 *. (define NTRAK, fill PLUND)
33 *. CALL PXLUC5 (NTRAK,NRLUDM,PLUND,MSTU46,MSTU47,
34 *. + PARU44,PARU45,NJET,IJMUL,IPASS)
35 *.
36 *. INPUT : NTRAK Number of tracks
37 *. INPUT : NRLUDM First dimension of PLUND
38 *. IN/OUTPUT : PLUND 4-momenta in Jetset format
39 *. INPUT : MSTU46 same as MSTU(46) in Jetset7.1:jet-finder mode
40 *. INPUT : MSTU47 same as MSTU(47) in Jetset7.1
41 *. INPUT : PARU44 same as PARU(44) in Jetset7.1
42 *. INPUT : PARU45 same as PARU(45) in Jetset7.1
43 *. OUTPUT : NJET Number of jets found
44 *. OUTPUT : IJMUL(i) Jet i contains IJMUL(i) particles
45 *. OUTPUT : IPASS(k) Particle k belongs to jet number IPASS(k)
46 *.
47 *. CALLS : PXANXY,PXPLU3,PXRMX3,PXROF3,PXROB3
48 *. CALLED : PXLTH4
49 *.
50 *. AUTHOR : Modified from LUCLUS (T.Sjostrand) by J.W.Gary
51 *. CREATED : 31-Jan-89
52 *. LAST MOD : 31-Jan-89
53 *.
54 *. Modification Log.
55 *. 05-May-97 D. Chrisman, remove declaration of unused variables
56 *. I1, I2 and PMAS.
57 *.
58 *.*********************************************************
59  IMPLICIT NONE
60  INTEGER locdim
61  parameter(locdim=2000)
62  REAL paru48,pimas,paru43
63  parameter(paru48=0.0001,pimas=0.13957,paru43=0.25)
64  INTEGER mstu42,mstu48,mstu43,mstu46,mstu47,itry1,itry2,
65  + i,j,idel,irec,iemp,ijet,imin,imax,njet,nrem,
66  + inew,iori,npre,ispl,nsav,itry,np,imin1,imin2,nrludm,
67  + n,nloop,ip,ij
68  INTEGER k (locdim,5),ijmul (*),ipass (*)
69  REAL paru44,paru45,r2max,pemax,rinit,pxrr2m,pxrr2t,pss,
70  + pmax,r2,tsav,psjt,r2acc,r2min,pxmas
71  REAL p(nrludm,*),v(locdim,5),ps(5)
72  DATA mstu42 / 2 /,mstu48 / 0 /, mstu43 / 1 /
73 
74 CC...If first time, reset. If reentering, skip preliminaries.
75 **JWG IF(MSTU48.LE.0) THEN
76  np=0
77  DO 100 j=1,5
78  100 ps(j)=0.
79  pss=0.
80 **JWG ELSE
81 **JWG NJET=NSAV
82 **JWG IF(MSTU43.GE.2) N=N-NJET
83 **JWG DO 110 I=N+1,N+NJET
84 **JWG 110 P(I,5)=SQRT(P(I,1)**2+P(I,2)**2+P(I,3)**2)
85 **JWG IF(MSTU46.LE.3) R2ACC=PARU44**2
86 **JWG IF(MSTU46.GE.4) R2ACC=PARU45*PS(5)**2
87 **JWG NLOOP=0
88 **JWG GOTO 290
89 **JWG ENDIF
90 C...Find which particles are to be considered in cluster search.
91  DO 140 i=1,n
92  IF(n+2*np.GE.locdim-5) THEN
93  WRITE (6,fmt='('' PXLUC5: Error, not enough buffer'',
94  + ''space for jet-finer calculation'')')
95  njet = -1
96  go to 990
97  ENDIF
98 C...Take copy of these particles, with space left for jets later on.
99  np=np+1
100  k(n+np,3)=i
101  DO 120 j=1,5
102  120 p(n+np,j)=p(i,j)
103 **JWG IF(MSTU42.EQ.0) P(N+NP,5)=0.
104  pxmas = p(i,5)
105 **JWG IF(MSTU42.EQ.1.AND.PXMAS.NE.0) P(N+NP,5)=PIMAS
106  p(n+np,4)=sqrt(p(n+np,5)**2+p(i,1)**2+p(i,2)**2+p(i,3)**2)
107  p(n+np,5)=sqrt(p(i,1)**2+p(i,2)**2+p(i,3)**2)
108  DO 130 j=1,4
109  130 ps(j)=ps(j)+p(n+np,j)
110  pss=pss+p(n+np,5)
111  140 CONTINUE
112  DO 150 i=n+1,n+np
113  k(i+np,3)=k(i,3)
114  DO 150 j=1,5
115  150 p(i+np,j)=p(i,j)
116  ps(5)=sqrt(max(0.,ps(4)**2-ps(1)**2-ps(2)**2-ps(3)**2))
117 C...Very low multiplicities not considered.
118  IF(np.LT.mstu47) THEN
119  njet=-1
120  RETURN
121  ENDIF
122 C...Find precluster configuration. If too few jets, make harder cuts.
123  nloop=0
124  IF(mstu46.LE.3) r2acc=paru44**2
125  IF(mstu46.GE.4) r2acc=paru45*ps(5)**2
126  rinit=1.25*paru43
127  IF(np.LE.mstu47+2) rinit=0.
128  160 rinit=0.8*rinit
129  npre=0
130  nrem=np
131  DO 170 i=n+np+1,n+2*np
132  170 k(i,4)=0
133 C...Sum up small momentum region. Jet if enough absolute momentum.
134  IF(mstu46.LE.2) THEN
135  DO 180 j=1,4
136  180 p(n+1,j)=0.
137  DO 200 i=n+np+1,n+2*np
138  IF(p(i,5).GT.2.*rinit) goto 200
139  nrem=nrem-1
140  k(i,4)=1
141  DO 190 j=1,4
142  190 p(n+1,j)=p(n+1,j)+p(i,j)
143  200 CONTINUE
144  p(n+1,5)=sqrt(p(n+1,1)**2+p(n+1,2)**2+p(n+1,3)**2)
145  IF(p(n+1,5).GT.2.*rinit) npre=1
146  IF(rinit.GE.0.2*paru43.AND.npre+nrem.LT.mstu47) goto 160
147  ENDIF
148 C...Find fastest remaining particle.
149  210 npre=npre+1
150  pmax=0.
151  DO 220 i=n+np+1,n+2*np
152  IF(k(i,4).NE.0.OR.p(i,5).LE.pmax) goto 220
153  imax=i
154  pmax=p(i,5)
155  220 CONTINUE
156  DO 230 j=1,5
157  230 p(n+npre,j)=p(imax,j)
158  nrem=nrem-1
159  k(imax,4)=npre
160 C...Sum up precluster around it according to pT separation.
161  IF(mstu46.LE.2) THEN
162  DO 250 i=n+np+1,n+2*np
163  IF(k(i,4).NE.0) goto 250
164  r2=pxrr2t(nrludm,p,i,imax)
165  IF(r2.GT.rinit**2) goto 250
166  nrem=nrem-1
167  k(i,4)=npre
168  DO 240 j=1,4
169  240 p(n+npre,j)=p(n+npre,j)+p(i,j)
170  250 CONTINUE
171  p(n+npre,5)=sqrt(p(n+npre,1)**2+p(n+npre,2)**2+p(n+npre,3)**2)
172 C...Sum up precluster around it according to mass separation.
173  ELSE
174  260 imin=0
175  r2min=rinit**2
176  DO 270 i=n+np+1,n+2*np
177  IF(k(i,4).NE.0) goto 270
178  r2=pxrr2m(nrludm,p,i,n+npre)
179  IF(r2.GE.r2min) goto 270
180  imin=i
181  r2min=r2
182  270 CONTINUE
183  IF(imin.NE.0) THEN
184  DO 280 j=1,4
185  280 p(n+npre,j)=p(n+npre,j)+p(imin,j)
186  p(n+npre,5)=sqrt(p(n+npre,1)**2+p(n+npre,2)**2+p(n+npre,3)**2)
187  nrem=nrem-1
188  k(imin,4)=npre
189  goto 260
190  ENDIF
191  ENDIF
192 C...Check if more preclusters to be found. Start over if too few.
193  IF(rinit.GE.0.2*paru43.AND.npre+nrem.LT.mstu47) goto 160
194  IF(nrem.GT.0) goto 210
195  njet=npre
196 C...Reassign all particles to nearest jet. Sum up new jet momenta.
197  290 tsav=0.
198  psjt=0.
199  300 IF(mstu46.LE.1) THEN
200  DO 310 i=n+1,n+njet
201  DO 310 j=1,4
202  310 v(i,j)=0.
203  DO 340 i=n+np+1,n+2*np
204  r2min=pss**2
205  DO 320 ijet=n+1,n+njet
206  IF(p(ijet,5).LT.rinit) goto 320
207  r2=pxrr2t(nrludm,p,i,ijet)
208  IF(r2.GE.r2min) goto 320
209  imin=ijet
210  r2min=r2
211  320 CONTINUE
212  k(i,4)=imin-n
213  DO 330 j=1,4
214  330 v(imin,j)=v(imin,j)+p(i,j)
215  340 CONTINUE
216  psjt=0.
217  DO 360 i=n+1,n+njet
218  DO 350 j=1,4
219  350 p(i,j)=v(i,j)
220  p(i,5)=sqrt(p(i,1)**2+p(i,2)**2+p(i,3)**2)
221  360 psjt=psjt+p(i,5)
222  ENDIF
223 C...Find two closest jets.
224  r2min=2.*r2acc
225  DO 370 itry1=n+1,n+njet-1
226  DO 370 itry2=itry1+1,n+njet
227  IF(mstu46.LE.2) r2=pxrr2t(nrludm,p,itry1,itry2)
228  IF(mstu46.GE.3) r2=pxrr2m(nrludm,p,itry1,itry2)
229  IF(r2.GE.r2min) goto 370
230  imin1=itry1
231  imin2=itry2
232  r2min=r2
233  370 CONTINUE
234 C...If allowed, join two closest jets and start over.
235  IF(njet.GT.mstu47.AND.r2min.LT.r2acc) THEN
236  irec=min(imin1,imin2)
237  idel=max(imin1,imin2)
238  DO 380 j=1,4
239  380 p(irec,j)=p(imin1,j)+p(imin2,j)
240  p(irec,5)=sqrt(p(irec,1)**2+p(irec,2)**2+p(irec,3)**2)
241  DO 390 i=idel+1,n+njet
242  DO 390 j=1,5
243  390 p(i-1,j)=p(i,j)
244  IF(mstu46.GE.2) THEN
245  DO 400 i=n+np+1,n+2*np
246  iori=n+k(i,4)
247  IF(iori.EQ.idel) k(i,4)=irec-n
248  400 IF(iori.GT.idel) k(i,4)=k(i,4)-1
249  ENDIF
250  njet=njet-1
251  goto 290
252 C...Divide up broad jet if empty cluster in list of final ones.
253  ELSEIF(njet.EQ.mstu47.AND.mstu46.LE.1.AND.nloop.LE.2) THEN
254  DO 410 i=n+1,n+njet
255  410 k(i,5)=0
256  DO 420 i=n+np+1,n+2*np
257  420 k(n+k(i,4),5)=k(n+k(i,4),5)+1
258  iemp=0
259  DO 430 i=n+1,n+njet
260  430 IF(k(i,5).EQ.0) iemp=i
261  IF(iemp.NE.0) THEN
262  nloop=nloop+1
263  ispl=0
264  r2max=0.
265  DO 440 i=n+np+1,n+2*np
266  IF(k(n+k(i,4),5).LE.1.OR.p(i,5).LT.rinit) goto 440
267  ijet=n+k(i,4)
268  r2=pxrr2t(nrludm,p,i,ijet)
269  IF(r2.LE.r2max) goto 440
270  ispl=i
271  r2max=r2
272  440 CONTINUE
273  IF(ispl.NE.0) THEN
274  ijet=n+k(ispl,4)
275  DO 450 j=1,4
276  p(iemp,j)=p(ispl,j)
277  450 p(ijet,j)=p(ijet,j)-p(ispl,j)
278  p(iemp,5)=p(ispl,5)
279  p(ijet,5)=sqrt(p(ijet,1)**2+p(ijet,2)**2+p(ijet,3)**2)
280  IF(nloop.LE.2) goto 290
281  ENDIF
282  ENDIF
283  ENDIF
284 C...If generalized thrust has not yet converged, continue iteration.
285  IF(mstu46.LE.1.AND.nloop.LE.2.AND.psjt/pss.GT.tsav+paru48)
286  +THEN
287  tsav=psjt/pss
288  goto 300
289  ENDIF
290 C...Reorder jets according to energy.
291  DO 460 i=n+1,n+njet
292  DO 460 j=1,5
293  460 v(i,j)=p(i,j)
294  DO 490 inew=n+1,n+njet
295  pemax=0.
296  DO 470 itry=n+1,n+njet
297  IF(v(itry,4).LE.pemax) goto 470
298  imax=itry
299  pemax=v(itry,4)
300  470 CONTINUE
301  k(inew,1)=31
302  k(inew,2)=97
303  k(inew,3)=inew-n
304  k(inew,4)=0
305  DO 480 j=1,5
306  480 p(inew,j)=v(imax,j)
307  v(imax,4)=-1.
308  490 k(imax,5)=inew
309 C...Clean up particle-jet assignments and jet information.
310  DO 500 i=n+np+1,n+2*np
311  iori=k(n+k(i,4),5)
312  k(i,4)=iori-n
313  IF(k(k(i,3),1).NE.3) k(k(i,3),4)=iori-n
314  k(iori,4)=k(iori,4)+1
315  500 CONTINUE
316  iemp=0
317  psjt=0.
318  DO 520 i=n+1,n+njet
319  k(i,5)=0
320  psjt=psjt+p(i,5)
321  p(i,5)=sqrt(max(p(i,4)**2-p(i,5)**2,0.))
322  DO 510 j=1,5
323  510 v(i,j)=0.
324  520 IF(k(i,4).EQ.0) iemp=i
325 C...Select storing option. Output variables. Check for failure.
326  IF(iemp.NE.0) THEN
327  njet=-1
328  ENDIF
329  nsav=njet
330  DO 560 ij = 1,njet
331  ijmul(ij) = k(n+ij,4)
332  560 CONTINUE
333  DO 580 ip = 1,np
334  ipass(ip) = k(ip,4)
335  580 CONTINUE
336 
337  990 RETURN
338  END
339 
340 C...Functions: distance measure in pT or (pseudo)mass.
341  FUNCTION pxrr2t (NRLUDM,P,I1,I2)
342  IMPLICIT NONE
343  INTEGER nrludm,i1,i2
344  REAL p (nrludm,*),pxrr2t
345  pxrr2t = (p(i1,5)*p(i2,5)-p(i1,1)*p(i2,1)-p(i1,2)*p(i2,2)-
346  +p(i1,3)*p(i2,3))*2.*p(i1,5)*p(i2,5)/(0.0001+p(i1,5)+p(i2,5))**2
347  RETURN
348  END
349 
350  FUNCTION pxrr2m (NRLUDM,P,I1,I2)
351  IMPLICIT NONE
352  INTEGER nrludm,i1,i2
353  REAL p (nrludm,*),pxrr2m
354  pxrr2m = 2.*p(i1,4)*p(i2,4)*(1.-(p(i1,1)*p(i2,1)+p(i1,2)*
355  +p(i2,2)+p(i1,3)*p(i2,3))/(p(i1,5)*p(i2,5)))
356  RETURN
357  END
real function pxrr2t(NRLUDM, P, I1, I2)
Definition: pxluc5.f:341
subroutine pxluc5(N, NRLUDM, P, MSTU46, MSTU47, PARU44, PARU45, NJET, IJMUL, IPASS)
Definition: pxluc5.f:2
double min(double a, double b)
real function pxrr2m(NRLUDM, P, I1, I2)
Definition: pxluc5.f:350