	integer n(100,12,4)

	open(1,file='lmc_u2o901.comp',status='old')

	do j=1,12
	  do i=1,100
            do k=1,4
            n(i,j,k) = 0
            end do
          end do
	end do
1	read(1,*,end=99) itype, iflag, v, x, x, x, ichip

	imag = nint((v-10)/0.25)
        ioff=0
	n(imag,1+ioff,ichip) = n(imag,1+ioff,ichip)+1
        if (mod(itype,100) .eq. 1) 
     &     n(imag,2+ioff,ichip) = n(imag,2+ioff,ichip) + 1
        if (mod(itype,100) .eq. 1 .or. mod(itype,100) .eq. 2) 
     &     n(imag,3+ioff,ichip) = n(imag,3+ioff,ichip) + 1

        if (itype .lt. 100) then
          ioff=3
	n(imag,1+ioff,ichip) = n(imag,1+ioff,ichip)+1
        if (mod(itype,100) .eq. 1) 
     &     n(imag,2+ioff,ichip) = n(imag,2+ioff,ichip) + 1
        if (mod(itype,100) .eq. 1 .or. mod(itype,100) .eq. 2) 
     &     n(imag,3+ioff,ichip) = n(imag,3+ioff,ichip) + 1
        end if

        if (mod(iflag,2) .ne. 1) then
          ioff=6
	n(imag,1+ioff,ichip) = n(imag,1+ioff,ichip)+1
        if (mod(itype,100) .eq. 1) 
     &     n(imag,2+ioff,ichip) = n(imag,2+ioff,ichip) + 1
        if (mod(itype,100) .eq. 1 .or. mod(itype,100) .eq. 2) 
     &     n(imag,3+ioff,ichip) = n(imag,3+ioff,ichip) + 1
  
          if (itype .lt. 100) then
            ioff=9
	n(imag,1+ioff,ichip) = n(imag,1+ioff,ichip)+1
        if (mod(itype,100) .eq. 1) 
     &     n(imag,2+ioff,ichip) = n(imag,2+ioff,ichip) + 1
        if (mod(itype,100) .eq. 1 .or. mod(itype,100) .eq. 2) 
     &     n(imag,3+ioff,ichip) = n(imag,3+ioff,ichip) + 1
          end if

        end if

	goto 1

99	continue
	do imag=1,100
         do ichip=1,4
          if (n(imag,1,ichip) .gt. 0) then
	 print *, ichip,10+imag*0.25,(n(imag,j,ichip),j=1,12)
	  end if
         end do
	end do

	stop
	end
