integer function cbnt() implicit none include 'grid3_cbnt.inc' integer cut1 real esel integer nsel, i, j, ih, imax, keep(20), ktmp real tmp, order(20) real p0, p1, p2, p3, eet, eeta, ephi real pt_4e, phi_4e, eta_4e, m4esq, m4e write(*,*) idnevt, run, event call hf1(1,1.0*run,1.0) call hf1(2,1.0*event,1.0) call hf1(3,1.0*event,1.0) call hf1(4,1.0*event,1.0) call hf1(5,1.0*event,1.0) call hf1(6,1.0*event,1.0) * Electron info * Without cuts. write(*,*) eg_nc, ' electrons' call hf1(101, 1.0*eg_nc, 1.0) nsel = 0 do i = 1, eg_nc call hf1(102, eg_et(i), 1.0) call hf1(103, eg_eta(i), 1.0) call hf1(104, eg_phi(i), 1.0) * Select electrons. tmp = esel(i) if ( tmp .gt. 0.0 ) then nsel = nsel + 1 keep(nsel) = i order(nsel) = tmp endif enddo call hf1(111, 1.0*nsel, 1.0) * Sort electrons. do i = 2, nsel do j = i-1, 1, -1 if ( order(j+1) .le. order(j) ) goto 100 tmp = order(j) ktmp = keep(j) order(j) = order(j+1) keep(j) = keep(j-1) order(j+1) = tmp keep(j+1) = ktmp 100 enddo enddo imax = nsel if ( imax .gt. 4 ) then imax = 4 endif do i = 1, imax ih = 100 + 10*i j = keep(i) call hf1(ih+2, eg_et(j), 11.0) call hf1(ih+3, eg_eta(j), 1.0) call hf1(ih+4, eg_phi(j), 1.0) enddo * Loop over electrons and 4e mass from leading electrons. if ( nsel .ge. 4 ) then p0 = 0.0 p1 = 0.0 p2 = 0.0 p3 = 0.0 do i = 1, 4 j = keep(i) eet = eg_et(j) eeta = eg_eta(j) ephi = eg_phi(j) p0 = p0 + eet*cosh(eeta) p3 = p3 + eet*sinh(eeta) p1 = p1 + eet*cos(ephi) p2 = p2 + eet*sin(ephi) enddo pt_4e = sqrt(p1*p1 + p2*p2) phi_4e = atan2(p2, p1) * eta_4e = atanh(p3/p0) m4esq = p0*p0 - pt_4e*pt_4e - p3*p3 m4e = 0.0 if ( m4esq .ge. 0.0 ) then m4e = sqrt(m4esq) endif call hf1(152, pt_4e, 11.0) * call hf1(153, eta_4e, 1.0) call hf1(154, phi_4e, 1.0) call hf1(155, m4e, 1.0) endif *Exit cbnt = 1 return end * Cut 1 on event. integer function cut1() include 'grid3_cbnt.inc' cut1 = 0 if ( eg_nc .ge. 4 ) then cut1 = 1 endif return end * Electron sorting function. Higher values will be placed * ahead of lower ones. Anything <= 0 is rejected. real function esel(ielec) implicit none integer ielec real val include 'grid3_cbnt.inc' esel = 0.0 val = eg_et(ielec) if ( val .ge. 5 ) then esel = val endif return end