HBOOK files are in fact ZEBRA RZ files [bib-ZEBRARZ]. Input/output error return codes are available vin the ZEBRA communication vector IQUEST, and the user should consult the RZ manual for their meaning. Both disk and memory resident files are supported, the latter being particularly useful in online applications, where histogram data have to be shared between different processes.
HBOOK files are written in Zebra exchange format and thus need not be converted when transferred between different computer systems using binary ftp (see section [more info]), or accessed over the network using a distributed file system such as AFS or NFS.
+------------------------------+ | CALL HRPUT (ID,CHFILE,CHOPT) | +------------------------------+
Action: Write a histogram to a given direct access file. This routine cannot be used for Ntuples.
+------------------------------+ | CALL HRGET (ID,CHFILE,CHOPT) | +------------------------------+
Action: Read a histogram from a given direct access file. This routine cannot be used for Ntuples.
Remarks:
The following remarks apply to both HRPUT and HRGET.
+----------------------------------------------------+ | CALL HROPEN (LUN,CHTOP,CHFILE,CHOPT,*LREC*,ISTAT*) | +----------------------------------------------------+
Action: Open a direct access HBOOK file. If several direct access files are opened, they are identified by the top directory only.
Input parameter(s)
Output parameter(s)
Remarks:
+------------------------------+ |CALL HRFILE (LUN,CHTOP,CHOPT) | +------------------------------+
Action: Establishes a temporary unique correspondance between a logical unit and a top directory name. Users should call HROPEN instead of HRFILE.
By default, HROPEN ( HRFILE) creates new files (option N) with the maximum number of records set to a large number (default 32000). If this is insufficient, the user can override this value by specifying the Q option and setting IQUEST(10) to the actual number of records required (up to a maximum of 65K), as shown below.
Overriding the default record allocation
COMMON/QUEST/IQUEST(100) ! Declare IQUEST communication vector IQUEST(10) = 65000 ! I require 65000 records CALL HROPEN(1,'FILE','file.ext','NQ',1024,ISTAT) ! Call HROPEN
Note that after a call to HROPEN ( HRFILE) (if CHTOP='MYDST' for example), the current directory is set to '//MYDST'. If LUN is an existing file, one can change the current directory to an existing subdirectory 'SUBDIR' using CALL HCDIR ('SUBDIR',' '), which sets the current directory CD to '//CHTOP/SUBDIR'.
Notice that when calling HCDIR or HRFILE on a direct access file, the current directory in memory will be the latest current directory set.
+------------------------------+ |CALL HROUT (ID,ICYCLE*,CHOPT) | +------------------------------+
Action: Write a histogram from the current directory in memory onto the current directory on the direct access file.
Experienced users may invoke routines from the ZEBRA RZ package to purge a directory, i.e. delete all versions of an identifier but the most recent one using routine RZPURG.
Reading from a direct-access file or global section
+------------------------------+ | CALL HRIN (ID,ICYCLE,IOFSET) | +------------------------------+
Action: Read a histogram from the current directory on the direct access file (or global section) into the current directory in memory.
Scratching histogram in a file
+----------------------------+ |CALL HSCR (ID,ICYCLE,CHOPT) | +----------------------------+
Action: Scratch (delete) a histogram from the current directory in the direct access file.
+--------------------+ | CALL HREND (CHTOP) | +--------------------+
Action: Closes a direct access file if is not needed anymore or when the options 'N' or 'U' are specified in HRFILE.
A Fortran CLOSE statement should follow a call to HREND.