1 SUBROUTINE pxcone(MODE,NTRAK,ITKDM,PTRAK,CONER,EPSLON,OVLIM,
2 + mxjet,njet,pjet,ipass,ijmul,ierr)
83 INTEGER itkdm,mxjet,ntrak,njet,ierr,mode
84 INTEGER ipass (ntrak),ijmul (mxjet)
85 DOUBLE PRECISION ptrak (itkdm,ntrak),pjet (5,mxjet),
86 + coner, epslon, ovlim
88 INTEGER mxprot, mxtrak
89 parameter(mxprot=5000, mxtrak=5000)
90 DOUBLE PRECISION pp(4,mxtrak), pu(3,mxtrak), pj(4,mxprot)
91 LOGICAL jetlis(mxprot,mxtrak)
93 DOUBLE PRECISION cosr,cos2r, vseed(3), vec1(3), vec2(3),ptsq,ppsq,
99 INTEGER i,j,n,mu,n1,n2, iterr, njtorg
100 INTEGER ncall, nprint
101 DOUBLE PRECISION rold, epsold, ovold
102 SAVE ncall,nprint,rold, epsold, ovold
103 DATA ncall,nprint /0,0/
104 DATA rold,epsold,ovold/0.,0.,0./
122 IF((coner.NE.rold .OR. epslon.NE.epsold .OR. ovlim.NE.ovold)
123 + .AND. nprint.LE.10)
THEN
125 WRITE (6,*)
' *********** PXCONE: Cone Jet-finder ***********'
126 WRITE (6,*)
' Written by Luis Del Pozo of OPAL'
127 WRITE (6,*)
' Modified for eta-phi by Mike Seymour'
128 WRITE (6,*)
' Includes bug fixes by Wobisch, Salam'
129 WRITE(6,1000)
' Cone Size R = ',coner,
' Radians'
130 WRITE(6,1001)
' Min Jet energy Epsilon = ',epslon,
' GeV'
131 WRITE(6,1002)
' Overlap fraction parameter = ',ovlim
132 WRITE (6,*)
' PXCONE is not a supported product and is'
133 WRITE (6,*)
' is provided for comparative purposes only'
134 WRITE (6,*)
' ***********************************************'
136 IF (rsep .lt. 1.999)
THEN
138 WRITE (6,*)
' ******************************************'
139 WRITE (6,*)
' ******************************************'
140 WRITE(6,*)
' M Wobisch: private change !!!!!!!!!!!! '
141 WRITE(6,*)
' Rsep is set to ',rsep
142 WRITE(6,*)
' this is ONLY meaningful in a NLO calculation'
143 WRITE(6,*)
' ------------------------ '
144 WRITE(6,*)
' please check what you''re doing!!'
145 WRITE(6,*)
' or ask: Markus.Wobisch@desy.de --'
146 WRITE (6,*)
' ******************************************'
147 WRITE (6,*)
' ******************************************'
148 WRITE (6,*)
' ******************************************'
155 1000
FORMAT(a18,f5.2,a10)
156 1001
FORMAT(a29,f5.2,a5)
157 1002
FORMAT(a33,f5.2)
166 IF (ntrak .GT. mxtrak)
THEN
167 WRITE (6,*)
' PXCONE: Ntrak too large: ',ntrak
180 ptsq=ptrak(1,i)**2+ptrak(2,i)**2
181 ppsq=(sqrt(ptsq+ptrak(3,i)**2)+abs(ptrak(3,i)))**2
182 IF (ptsq.LE.4.25e-18*ppsq)
THEN
185 pp(1,i)=0.5*log(ppsq/ptsq)
187 pp(1,i)=sign(pp(1,i),ptrak(3,i))
191 pp(2,i)=atan2(ptrak(2,i),ptrak(1,i))
206 jetlis(j,i) = .false.
209 CALL pxzerv(4*mxprot,pj)
210 CALL pxzeri(mxjet,ijmul)
219 cos2r = 1-(rsep*coner)**2
224 CALL pxuvec(ntrak,pp,pu,ierr)
225 IF (ierr .NE. 0)
RETURN
233 CALL pxsear(mode,cosr,ntrak,pu,pp,vseed,
234 & njet,jetlis,pj,unstbl,ierr)
235 IF (ierr .NE. 0)
RETURN
248 IF (mode.NE.2) CALL pxnorv(3,vec1,vec1,iterr)
250 DO 150 n2 = n1+1,njet
254 IF (mode.NE.2) CALL pxnorv(3,vec2,vec2,iterr)
255 CALL pxaddv(3,vec1,vec2,vseed,iterr)
257 CALL pxnorv(3,vseed,vseed,iterr)
262 vseed(2)=pxmdpi(vec1(2)+0.5d0*pxmdpi(vec2(2)-vec1(2)))
266 cosval=vec1(1)*vec2(1)+vec1(2)*vec2(2)+vec1(3)*vec2(3)
268 IF (abs(vec1(1)).GE.20.OR.abs(vec2(1)).GE.20)
THEN
272 + ((vec1(1)-vec2(1))**2+pxmdpi(vec1(2)-vec2(2))**2)
276 IF (cosval.LE.cosr.AND.cosval.GE.cos2r)
277 + CALL pxsear(mode,cosr,ntrak,pu,pp,vseed,njet,
278 + jetlis,pj,unstbl,ierr)
281 IF (ierr .NE. 0)
RETURN
286 WRITE (6,*)
' PXCONE: Too many iterations to find a proto-jet'
293 CALL pxord(epslon,njet,ntrak,jetlis,pj)
296 CALL pxolap(mode,njet,ntrak,jetlis,pj,pp,ovlim)
299 CALL pxord(epslon,njet,ntrak,jetlis,pj)
302 IF (njet .GT. mxjet)
THEN
303 WRITE (6,*)
' PXCONE: Found more than MXJET jets'
315 pjet(1,i)=pj(4,i)*cos(pj(2,i))
316 pjet(2,i)=pj(4,i)*sin(pj(2,i))
317 pjet(3,i)=pj(4,i)*sinh(pj(1,i))
318 pjet(4,i)=pj(4,i)*cosh(pj(1,i))
324 IF (jetlis(j,i))
THEN
335 SUBROUTINE pxnorv(N,A,B,ITERR)
337 DOUBLE PRECISION a(n),b(n),c
353 SUBROUTINE pxolap(MODE,NJET,NTRAK,JETLIS,PJ,PP,OVLIM)
360 INTEGER mxtrak, mxprot
361 parameter(mxtrak=5000,mxprot=5000)
362 INTEGER njet, ntrak, mode
363 LOGICAL jetlis(mxprot,mxtrak)
364 DOUBLE PRECISION pj(4,mxprot),pp(4,mxtrak),pxmdpi
367 DOUBLE PRECISION eover
368 DOUBLE PRECISION ovlim
369 INTEGER iterr, ijmin, ijet(mxprot), nj
370 DOUBLE PRECISION vec1(3), vec2(3), cost, thet, thmin
373 IF (njet.LE.1)
RETURN
381 IF (jetlis(i,n).AND.jetlis(j,n))
THEN
386 eover = eover + pp(4,n)
390 IF (eover.GT.ovlim*pj(4,i))
THEN
393 jetlis(i,n) = .false.
416 vec2(1)=pj(1,ijet(j))
417 vec2(2)=pj(2,ijet(j))
418 vec2(3)=pj(3,ijet(j))
420 CALL pxang3(vec1,vec2,cost,thet,iterr)
422 thet=(vec1(1)-vec2(1))**2+pxmdpi(vec1(2)-vec2(2))**2
427 ELSEIF (thet .LT. thmin)
THEN
434 jetlis(j,i) = .false.
436 jetlis(ijmin,i)=.true.
445 IF( jetlis(i,n) )
THEN
448 pj(mu,i) = pj(mu,i) + pp(mu,n)
452 + + pp(4,n)/(pp(4,n)+pj(4,i))*(pp(1,n)-pj(1,i))
454 pj(2,i)=pxmdpi(pj(2,i)
455 + + pp(4,n)/(pp(4,n)+pj(4,i))*pxmdpi(pp(2,n)-pj(2,i)))
458 pj(4,i)=pj(4,i)+pp(4,n)
470 SUBROUTINE pxord(EPSLON,NJET,NTRAK,JETLIS,PJ)
474 INTEGER mxtrak,mxprot
475 parameter(mxtrak=5000,mxprot=5000)
476 INTEGER i, j, index(mxprot)
477 DOUBLE PRECISION ptemp(4,mxprot), elist(mxprot)
479 LOGICAL jetlis(mxprot,mxtrak)
480 LOGICAL logtmp(mxprot,mxtrak)
481 DOUBLE PRECISION epslon,pj(4,mxprot)
491 logtmp(i,j)=jetlis(i,j)
498 CALL pxsorv(njet,elist,index,
'I')
502 pj(j,i)=ptemp(j,index(njet+1-i))
505 jetlis(i,j)=logtmp(index(njet+1-i),j)
511 IF (pj(4,i) .LT. epslon)
THEN
524 SUBROUTINE pxsear(MODE,COSR,NTRAK,PU,PP,VSEED,NJET,
525 + jetlis,pj,unstbl,ierr)
528 INTEGER mxtrak, mxprot
529 parameter(mxtrak=5000,mxprot=5000)
530 INTEGER ntrak, ierr, mode
531 DOUBLE PRECISION cosr,pu(3,mxtrak),pp(4,mxtrak),vseed(3)
533 LOGICAL jetlis(mxprot,mxtrak)
535 DOUBLE PRECISION pj(4,mxprot)
541 LOGICAL pxsame,pxnew,ok
542 LOGICAL newlis(mxtrak),oldlis(mxtrak)
543 DOUBLE PRECISION oaxis(3),naxis(3),pnew(4)
545 parameter(mxiter = 30)
548 oaxis(mu) = vseed(mu)
553 DO 120 iter = 1,mxiter
554 CALL pxtry(mode,cosr,ntrak,pu,pp,oaxis,naxis,pnew,newlis,ok)
559 IF(pxsame(newlis,oldlis,ntrak))
THEN
561 IF (pxnew(newlis,jetlis,ntrak,njet))
THEN
564 IF (njet .EQ. mxprot)
THEN
565 WRITE (6,*)
' PXCONE: Found more than MXPROT proto-jets'
571 jetlis(njet,n) = newlis(n)
593 SUBROUTINE pxsorv(N,A,K,OPT)
603 INTEGER n,i,j,k(nmax),il(nmax),ir(nmax)
607 DOUBLE PRECISION a(nmax),b(nmax)
609 IF (n.GT.nmax) stop
'Sorry, not enough room in Mike''s PXSORV'
616 2
IF(a(i).GT.a(j)) go to 5
617 3
IF(il(j).EQ.0) go to 4
623 5
IF(ir(j).LE.0) go to 6
633 8
IF(il(j).GT.0) go to 20
642 30
IF(opt.EQ.
'I')
RETURN
653 SUBROUTINE pxtry(MODE,COSR,NTRAK,PU,PP,OAXIS,NAXIS,
658 parameter(mxtrak=5000)
662 DOUBLE PRECISION cosr,pu(3*mxtrak),pp(4*mxtrak),oaxis(3),pxmdpi
664 LOGICAL newlis(mxtrak)
665 DOUBLE PRECISION naxis(3),pnew(4)
670 DOUBLE PRECISION cosval,normsq,norm
684 cosval=cosval+oaxis(mu)*pu(mu+npu)
687 IF (abs(pu(1+npu)).GE.20.OR.abs(oaxis(1)).GE.20)
THEN
691 + ((oaxis(1)-pu(1+npu))**2+pxmdpi(oaxis(2)-pu(2+npu))**2)
694 IF (cosval.GE.cosr)
THEN
699 pnew(mu) = pnew(mu) + pp(mu+npp)
703 + + pp(4+npp)/(pp(4+npp)+pnew(4))*(pp(1+npp)-pnew(1))
708 pnew(2)=pxmdpi(pnew(2)
709 + + pp(4+npp)/(pp(4+npp)+pnew(4))
710 + *pxmdpi(pp(2+npp)-pnew(2)))
711 pnew(4)=pnew(4)+pp(4+npp)
722 normsq = normsq + pnew(mu)**2
729 naxis(mu) = pnew(mu)/norm
741 SUBROUTINE pxuvec(NTRAK,PP,PU,IERR)
746 parameter(mxtrak=5000)
748 DOUBLE PRECISION pp(4,mxtrak)
749 DOUBLE PRECISION pu(3,mxtrak)
759 WRITE(6,*)
' PXCONE: An input particle has zero mod(p)'
764 pu(mu,n)=pp(mu,n)/mag
772 SUBROUTINE pxzeri(N,A)
791 SUBROUTINE pxzerv(N,A)
793 DOUBLE PRECISION a(n)
800 SUBROUTINE pxaddv(N,A,B,C,ITERR)
802 DOUBLE PRECISION a(n),b(n),c(n)
810 SUBROUTINE pxang3(A,B,COST,THET,ITERR)
812 DOUBLE PRECISION a(3),b(3),c,cost,thet
813 c=(a(1)**2+a(2)**2+a(3)**2)*(b(1)**2+b(2)**2+b(3)**2)
816 cost=(a(1)*b(1)+a(2)*b(2)+a(3)*b(3))*c
821 LOGICAL FUNCTION pxnew(TSTLIS,JETLIS,NTRAK,NJET)
823 INTEGER mxtrak,mxprot
824 parameter(mxtrak=5000,mxprot=5000)
828 LOGICAL tstlis(mxtrak),jetlis(mxprot*mxtrak)
840 IF(tstlis(n).NEQV.jetlis(in))
THEN
854 LOGICAL FUNCTION pxsame(LIST1,LIST2,N)
856 LOGICAL list1(*),list2(*)
864 IF ( list1(i).NEQV.list2(i) )
THEN
877 DOUBLE PRECISION pxmdpi,phi,pi,twopi,thrpi,eps
878 parameter(pi=3.141592654,twopi=6.283185307,thrpi=9.424777961)
881 IF (pxmdpi.LE.pi)
THEN
882 IF (pxmdpi.GT.-pi)
THEN
884 ELSEIF (pxmdpi.GT.-thrpi)
THEN
887 pxmdpi=-mod(pi-pxmdpi,twopi)+pi
889 ELSEIF (pxmdpi.LE.thrpi)
THEN
892 pxmdpi=mod(pi+pxmdpi,twopi)-pi
894 100
IF (abs(pxmdpi).LT.eps) pxmdpi=0