Previous: Mixed data set
Up: Data set types
Next: Structure definitions in DSPACK
Previous Page: Mixed data set
Next Page: Structure definitions in DSPACK

Structures

These data sets consist of items which are defined data sets (or arrays of data sets) themselves. Each item may in turn consist of structures etc.

For example - imagine that we want to describe a box in space - like a detector. It can be built of 2 frames each having 4 corners which are just space points. Additionally we may want to keep another space point giving the position of the centre of the box and some flags needed to display the detector with the event display - like colour, on/off flag and the name.

The way we would do it in c or Fortran would be something like that:

Example of C and Fortran structures

In C:

typedef struct point { float x; float y; float z; } point;

typedef struct frame { point c[4]; } frame;

typedef struct bflags { int colour; int onoff; char name[16]; } bflags;

typedef struct box { frame f[2]; point position; bflags flags; } box;

Or in Fortran:

structure /POINT/ real X real Y real Z end structure

structure /FRAME/ record/POINT/ C(4) end structure

structure /BFLAGS/ Integer*4 COLOUR Logical*4 ONOFF Character*16 NAME end structure

structure /BOX/ record/FRAME/ F(2) record/POINT/ POSITION record/BFLAGS/ FLAGS end structure

In both languages we may now create an array of boxes and store our data in it. This construct can be exactly matched by a DSPACK data set (in fact the text above was produced by a tool which reads a header of a DSPACK data file and outputs c or fortran headers describing the data sets found there).

wwwd@na49
Fri Nov 4 02:19:40 MET 1994