next up previous contents index
Next: More general Ntuples: Up: Row-Wise-Ntuples (RWN) Previous: Circular buffer

Disk resident Ntuples

 

Prior to booking the RWN, a new HBOOK RZ file is created using HROPEN. The top directory name of this file is passed to routine HBOOKN when the Ntuple is booked.

Filling proceeds as before but now, when the buffer in memory is full, it is written to the HBOOK file and then reused for the next elements of the Ntuple. This normally results in a more efficient utilisation of the memory, both when the Ntuple is created and when it is reprocessed.

Recommended way of creating a RWN

      PROGRAM TEST
      PARAMETER (NWPAWC = 15000)
      COMMON/PAWC/PAW(NWPAWC)
      CHARACTER*8 CHTAGS(5)
      DIMENSION EVENT(5)
      EQUIVALENCE (EVENT(1),X),(EVENT(2),Y),(EVENT(3),Z)
      EQUIVALENCE (EVENT(4),ENERGY),(EVENT(5),ELOSS)
      DATA CHTAGS/'X','Y','Z','Energy','Eloss'/
*
      CALL HLIMIT(NWPAWC)
      CALL HROPEN(1,'EXAMPLE','EXAMPLE.DAT','N',1024,ISTAT)
      IF(ISTAT.NE.0)GO TO 99
*
      CALL HBOOKN(10,'A Row-Wise-Ntuple',5,'//EXAMPLE',5000,CHTAGS)
      CALL HBOOK1(100,'Energy distribution',100,0.,100.,0.)
*
      DO 10 I=1,10000
         CALL RANNOR(X,Y)
         Z=SQRT(X*X+Y*Y)
         ENERGY=50. + 10.*X
         ELOSS=10.*ABS(Y)
         CALL HFN(10,EVENT)
         CALL HFILL(100,ENERGY,0.,1.)
 10   CONTINUE
*
      CALL HROUT(0,ICYCLE,' ')
      CALL HREND('EXAMPLE')
*
 99   CONTINUE
      END

When the Ntuple is filled, routine HFN will automatically write the buffer to the directory in the RZ file, which was specified in the call to HBOOKN (the top directory //EXAMPLE in the example above). If the current directory (CD)   is different, HFN will save and later automatically restore the CD.

The Ntuple created by the program shown above can be processed by PAW as follows.

Reading an RWN in a PAW session

            PAW > Histo/file  1  example.dat
            PAW > Histo/plot 100
            PAW > Ntuple/plot 10.energy
            PAW > Ntuple/plot 10.eloss  energy<50
            PAW > Ntuple/plot 10.eloss%energy  x<2.and.sqrt(z)>1

By default HROPEN creates a file that can be extended up to 32000 blocks, i.e. 128 Mbytes for a record length LREC of 1024 words. If one wishes to create very large Ntuples, one should make two changes to the above procedure.

This can be achieved as by changing the previous call to HROPEN as follows:

Writing very large Ntuple files

              COMMON/QUEST/IQUEST(100)
              CALL HLIMIT(150000)
*
*     Create HBOOK file with the maximum record length (32756 bytes)
*     and maximum number of records (65000)
*
              IQUEST(10) = 65000
              CALL HROPEN(1,'EXAMPLE','EXAMPLE.DAT','NQ',8192,ISTAT)
              IF(ISTAT.NE.0)GO TO 99
 


next up previous contents index
Next: More general Ntuples: Up: Row-Wise-Ntuples (RWN) Previous: Circular buffer

Janne Saarela
Tue May 16 09:09:27 METDST 1995