      REAL FUNCTION qlookraw()
*********************************************************
*                                                       *
* This file was generated by HUWFUN.                    *
*                                                       *
*********************************************************
*
*     Ntuple Id:      2    
*     Ntuple Title:   Pamela data
*     Creation:       13/07/2004 11.39.53
*
*********************************************************
*
      INCLUDE 'comcheck.txt'
*
      vector ver(4,22)
      integer l, bit, bi, i, k, se
      INTEGER st4, shit(4,11), shit2, shit3
*
*--   Enter user code here
*     
      do l=1,4
         i = l
         st4 = 0
c         st4 = IAND(stwerr(l) ! ,'00FF'x)
         st4 = stwerr(l) ! ,'00FF'x)
         if (st4.ne.0) then
            do bit=0, 6
               bi = ibits(st4,bit,1)
               if (bit.eq.0.and.bi.ne.0) ver(i,7)=ver(i,7)+1
               if (bit.eq.1.and.bi.ne.0) ver(i,6)=ver(i,6)+1
               if (bit.eq.2.and.bi.ne.0) ver(i,5)=ver(i,5)+1
               if (bit.eq.3.and.bi.ne.0) ver(i,4)=ver(i,4)+1
               if (bit.eq.4.and.bi.ne.0) ver(i,3)=ver(i,3)+1
               if (bit.eq.5.and.bi.ne.0) ver(i,2)=ver(i,2)+1
               if (bit.eq.6.and.bi.ne.0) ver(i,1)=ver(i,1)+1
            enddo
         endif
         if (perror(l).eq.128.) ver(i,8)=ver(i,8)+1
         if (perror(l).eq.129.) ver(i,9)=ver(i,9)+1
         if (perror(l).eq.130.) ver(i,10)=ver(i,10)+1
         if (perror(l).eq.131.) ver(i,11)=ver(i,11)+1
         if (perror(l).eq.132.) ver(i,12)=ver(i,12)+1
         if (perror(l).eq.133.) ver(i,13)=ver(i,13)+1
         if (perror(l).eq.134.) ver(i,14)=ver(i,14)+1
         if (perror(l).eq.135.) ver(i,15)=ver(i,15)+1
         if (perror(l).eq.136.) ver(i,16)=ver(i,16)+1
         if (perror(l).eq.137.) ver(i,17)=ver(i,17)+1
         if (perror(l).eq.138.) ver(i,18)=ver(i,18)+1
         if (perror(l).eq.139.) ver(i,19)=ver(i,19)+1
         if (perror(l).eq.140.) ver(i,20)=ver(i,20)+1
         if (perror(l).eq.141.) ver(i,21)=ver(i,21)+1
      enddo
      do l = 1, 4
         do i = 1, 11
            shit(l,i) = 0
         enddo
      enddo
      do l = 1, 2
         do i = 1, 22
            if (l.eq.1.and.mod(i,2).eq.0) then 
               se = 1
               pl = i / 2
            endif
            if (l.eq.1.and.mod(i,2).ne.0) then
               se = 2
               pl = 1 + (i - 1)/2
            endif
            if (l.eq.2.and.mod(i,2).eq.0) then
               se = 3
               pl = i / 2
            endif
            if (l.eq.2.and.mod(i,2).ne.0) then 
               se = 4
               pl = 1 + (i - 1)/2
            endif
            do k = 1, 96
               if (dexy(l,i,k).gt.0.and.dexy(l,i,k).lt.10000.) then
                  shit(se,pl) = shit(se,pl) + 1
c                  print *,'ou!',se ,pl
               ELSEIF (dexy(l,i,k).lt.0.) then
                  ver(se,22) = ver(se,22) + 1
               endif
            enddo
         enddo
      enddo
      shit3 = 0
      do i = 100, 400, 100
         shit2 = 0
         do l = 1, 11
c            print *,'i+l ',i+l
c            print *,'shit ',float(shit(i/100,l))
            call hf1(i+l+1000,float(shit(i/100,l)),1.)
            shit2 = shit2 + shit(i/100,l)
         enddo
         call hf1(i+1050,float(shit2),1.)
         shit3 = shit3 + shit2
      enddo
      call hf1(1500,float(shit3),1.)
C      
      END
