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

CWN and RWN -- Two kinds of Ntuples

In a Row-Wise-Ntuple ( RWN) the elements of each row, usually corresponding to an individual event, are stored contiguously in an HBOOK RZ file. This storage method is similar to that of a conventional DST, where events are stored sequentially and it is particularly suited for small Ntuples (up to a few Mbytes), with only a few columns. You can even use an RWN for larger Ntuples (up to about 20 Mbytes) when you know you want to reference almost all columns in your query commands. A RWN should not be used if there are more than about 100 columns, or when your queries only references a small number of columns. A RWN can only contain floating point data. It is created with HBOOKN and filled with HFN. Routines HGN, HGNF are used to retrieve information about one row.

Figure gif shows schematically how a RWN is laid out in memory, row after row. The buffer size in memory NWBUFF is specified as the primary allocation parameter NWBUFF of the HBOOKN routine. Of course, you must have reserved sufficient space in the    /PAWC/ common when calling the HBOOK initialization routine HLIMIT. The lower line shows how the information is written to an RZ file. The length of the input/output buffer LRECL is specified as an argument of the routine HROPEN.   It is evident that, if you have a small Ntuple and a lot of memory, you can fit the complete Ntuple in memory, thus speeding up the Ntuple operations.

In a Column-Wise-Ntuple ( CWN) the elements of each column are stored sequentially. Data in such an Ntuple can be accessed in a much more flexible and powerful manner than for a RWN. The CWN storage mechanism has been designed to substantially improve access time and facilitate compression of the data, thereby permitting much larger event samples (several hundreds of Mbytes) to be interactively processed, e.g. using PAW. Substantial gains in processing time can be obtained, especially if your queries only reference a few columns. A CWN is not limited to floating point data, but can contain all basic data types (real, integer, unsigned integer, logical or character). A CWN is created with routines HBNT, HBNAME or HBNAMC and filled with HFNT and HFNTB. Information about one row/block/column can be retrieved with routines HGNT, HGNTB, HGNTV and HGNTF.

  

 

 

Figure gif shows the layout of a CWN Ntuple. The buffer size for each of the columns NWBUFF was set equal to the record length LRECL (defined with routine HROPEN). A CWN requires a large value for the length of the common /PAWC/,    in any case larger than the number of columns times the value NWBUFF, i.e. NWPAWC>NWBUFF*NCOL. You can, however, expect important performance improvements by setting the buffer size NWBUFF equal to a multiple of the record length LRECL (via routine HBSET).

In both figures, x\III, y\III, z\III, t\III, etc. represent the columns of event i.


Figure: Schematic structure of a CWN Ntuple


Figure: Schematic structure of a RWN Ntuple


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

Last update: Tue May 16 09:09:27 METDST 1995