Syntax Manual for bdl Files

A bdl file consists of two parts:

Note that everything is case sensitive.  For the field types, I have tried to be reasonably forgiving when possible (float and Float are both acceptable), but I make no guarantees.

The first line of the file must read either
Type: Constants
or
Type: Snapshot

The second line of the file must read:
Name: XXX
Where XXX is the name of your constants object and must match the file name (without the
.bdl extension.)  Please make sure you choose a unique name for your constants that starts with a prefix appropriate to the detector component.  If your bdl file is named SVSparsificationChannel.bdl, for example, the second line of the file should read:
Name: SVSparsificationChannel

The bdl pre-compiler will append DB to the beginning of your Name when creating the client class that you will use, i.e. Offline users would use CLEOConstants<DBSVSparsificationChannel> objects.

The third line of your .bdl file must be:
{

The last line of your .bdl file must be:
}

Each line between the { and } specifies a single field for your constants.  The syntax of a standard field specification line is:

    type    fieldName

(No punctuation.  Use tabs and spaces as you like)

Allowed standard types are:
Int8, Int16, Int32, UInt8, UInt16, UInt32, Float, Double, Boolean, Char, String

The first field must be of type UInt8, UInt16 or UInt32 and is used as an index parameter.  This field should typically be a channel number or something similar.

The constant record class will have get_fieldName() and set_fieldName(type) functions for each field that provide access to the data values.

In addition, there are two compressed floating point types, Float8 and Float16.  The field  specification line for these two types contains two additional real number parameters, a scale and an offset.  The syntax for the specification line is:

    Float8    MyFloat    scale    offset

The data for this field will be stored as a UInt8, but the get_MyFloat() function will return a float value calculated by first multiplying by the scale factor and then adding the offset parameter.  Similarly, the set_MyFloat(float) function will first subtract the offset and then divide by the scale to determine the appropriate UInt8 value to store.  In addition to the standard get_ and set_ functions, Float8 and Float16 type parameters will also have get_raw_MyFloat() and set_raw_MyFloat(UInt8) functions that give you access to the raw UInt8 or UInt16 value actually stored.


Type: Constants
Name: SVExampleDummy
{
   UInt32      ChannelNumber
   Float8       PedestalValue   6.4   160.0
   Boolean BadChannel
}


That's it!  For offline users, this file must be installed in the BDL area of the Common software.  Using cvs, check out the BDL package.  There are subdirectories for each detector component, with separate directories for Alignment and Calibration for each component.  Add your bdl file in the appropriate directory.  If you are creating the first bdl file in a given directory, you also have to add a Makefile, which you can do by simply copying one from one of the other directories and changing the line that starts with "BDLCONSTANTS = ".  This line must contain a space separated list of all the bdl files in the directory.  If your constants don't seem to fit into this structure, talk to ccon3.  For online users, see the DAQIII Online Database Page. All the code necessary for the constants classes described below will be automatically generated by a series of precompiler steps.