C------------------------------------------------
      FUNCTION OPTRKLEV1(name,trnev)
C------------------------------------------------
C     Written by Emiliano Mocchiutti
C     v. 0.2
C	
      INCLUDE 'COMMON.TXT'
C
      CHARACTER*100 name
C
      INTEGER lrec, optrklev1,trnev
      INTEGER istat
      PARAMETER (lrec=8190)
      REAL hmemor(9000000)
      integer Iquest(100)    
      COMMON /pawc/hmemor
      Common /QUEST/ Iquest
      CALL HLIMIT(9000000)
      Iquest(10) = 256000
C
      optrklev1 = 0
      trnev = 0
C
C     CHANGE here (hbname and hbnt if you want another ntuple id number
C
      call HROPEN(79,'LEVEL1',name,'QP',4096,istat)
      if(istat.ne.0) goto 19      
      call HRIN(21,9999,20)       
      call access_level1
      call HNOENT(41,trnev)

 19   continue

C
c
      RETURN
      END


      SUBROUTINE access_level1
*
      include 'COMMON.TXT'

      CALL HBNAME(41,' ',0,'$CLEAR')
*
      CALL HBNAME(41,'GENERAL',GOOD1,'$SET')
*
      CALL HBNAME(41,'CPU',PKT_TYPE1,'$SET')
*
      CALL HBNAME(41,'CLUSTER',NCLSTR1,'$SET')
*
      CALL HBNAME(41,'CNOISE',CNEV,'$SET')
*

*
      return
      END
