SLAC PEP-II
BABAR
SLAC<->RAL
Babar logo
HEPIC E,S & H Databases PDG HEP preprints
Organization Detector Computing Physics Documentation
Personnel Glossary Sitemap Search Hypernews
Unwrap page!
Det. Search
Who's who?
Meetings
FAQ
Images
Archive
Systems
Performance
Intern. region
Vertex Tracker
Drift chamber
DIRC
Calorimeter
IFR
LST
Magnet
Electronics
Trigger
Operations
Run Coordination
Contact Experts
Shift Takers Info
Operations Manual
Electronic Logbook
Ops Hypernews
Shift Signup
Check this page for HTML 4.01 Transitional compliance with the
W3C Validator
(More checks...)

Proto-II Data Structure

Note:This page is not up to date (sorry). See Cosmic Run Phase 3, Phase 4 and Phase 5 for latest changes.

See also Where to Find the Proto-II Test Data, Proto-II Cosmic Run Procedure and Proto-II TDC Threshold.

The structure of the data taken from Proto-II is defined in proto2.h under /nfs/babar/download/dch/OdfProto/src. What is actually stored in the structure is explained below.


Data File

Each data file consists of a run header followed by a sequence of event records.

Run Header

The run header is defined in proto2.h as:
    typedef struct _RunHeader {
    uint16_t    version_number;
    uint16_t    run_number;
    time_t  start_time;
    uint8_t comment[512];
    } RunHeader;
It consists of 4 fields, of which only 2 are currently used:
  • run_number = run number;
  • start_time = time when the run started.

Event Record

Each event record consists of a event header followed by the body of the data.

The event header is defined in proto2.h as:

    #define MAX_OFFSETS 16

    typedef struct _EventHeader {
    uint32_t    event_size;
    uint32_t    event_flags;
    time_t  event_time; 
    uint16_t    event_number;
    uint16_t    numHits;
    uint32_t    offset[MAX_OFFSETS][2];
    } EventHeader;
It consists of 6 fields:
  • event_size = size (in bytes) of this event record;
  • event_flag = type of the event, defined as a logical OR of event flags:
        #define BEGIN_DATA  0x0001
        #define END_DATA    0x0002
        #define END_RUN     0x0004
        #define BEGIN_RUN   0x0008
        #define BEGIN_CAL   0x0010
        #define END_CAL     0x0020
        #define CAL_DATA    0x0100
        #define COSMIC_DATA 0x0200
        #define PHYSICS_DATA    0x0400
        #define SLOW_DATA   0x0800
        #define WAVEFORMS   0x1000
        #define FEATURES    0x2000
        #define HODOSCOPE   0x4000
    
    Only 7 of these flags are currently used:
    • BEGIN_RUN = the first event of the run.
    • BEGIN_CAL = the first calibration event. Usually the first event of the run as well.
    • END_CAL = the last calibration event.
    • BEGIN_DATA = the first real event. Usually follows the last calibration event.
    • CAL_DATA = a calibration event.
    • COSMIC_DATA = a real event.
    • SLOW_DATA = contains slow control record.
    Note that the END_RUN and END_DATA flags are not available due to an ``implementation short-cut.'' In fact, the last event in the data file may not even be complete: you are expected to treat an end-of-file error as a normal end-of-run.
  • event_time = time when the event occured.
  • event_number = event number.
  • numHits = number of hits in the event. Currently, numHits is set to 64, i.e. the number of wires being read out. This will hopefully change in the future so that we can skip wires with no TDC hits.
  • offset = type and location of the data records.
    • offset[i][0] = offset (in bytes) from the first byte of the event header to the first byte of the i-th data record of this event.
    • offset[i][1] = type of the i-th data record, defined as:
          #define TYPE_HODOSCOPE  1
          #define TYPE_HITS   2
          #define TYPE_WAVEFORMS  3
          #define TYPE_FEATURES   4
          #define TYPE_CAL_PARAMS 5
          #define TYPE_SLOW_DATA  6
      
      Only 3 types have been implemented so far:
      • TYPE_HITS = Hit records containing TDC hits.
      • TYPE_CALPARAMS = CalParams records containing calibration parameter setting.
      • TYPE_SLOW_DATA = SlowData records containing slow control data.
      offset[i][1] == 0 indicates there is no more data in this event.

Hit Records

Each event contains numHits records of type Hit, defined as:
    typedef struct _Hit {
    uint16_t    layer;
    uint16_t    wire;
    uint16_t    tdc; 
    uint16_t    disc_thresh;
    uint16_t    gain_flags;
    uint16_t    hit_flags;
    } Hit;
The first 4 fields contain:
  • layer = layer number.
  • wire = wire number.
  • tdc = TDC count. One count is approximately 0.5 ns. Due to a quirk in the readout hardware, TDC count overflows at some value around 1900. It is probably safe to consider anything greater than 1850 as `no hit'.
  • disc_thresh = discriminator threshold in mV.
You can safely ignore the last two fields for the moment.

CalParams Records

Each event contains numHits records of type CalParams. Each CalParams[i] correspond to Hit[i].
    typedef struct _CalParams   {
    uint16_t    delay;
    uint16_t    amplitude;
    uint16_t    charge;
    uint16_t    gain_params;
    } CalParams;
The first 2 fields contain:
  • delay = calibration strobe delay in ns. This is set to 0 for channels that are not selected for calibration in this event.
  • amplitude = calibration DAC value in mV.
  • gain_params = calibration gain setting, either 1 or 33.
You can safely ignore charge for the moment.

SlowData Record

Events logging changes in slow data (temperature, pressure, gas flow, and humidity) contain one record of type SlowData, defined as:
     typedef struct _SlowData   {
     float  temp_front_gas;
     float  temp_rear_gas;
     float  temp_front_cover;
     float  temp_rear_cover;
     float  temp_room;
     float  rh_front_cover;
     float  rh_rear_cover;
     float  press_chamber;
     float  press_atmosphere;
     float  flow_nitrogen;
     float  flow_helium;
     float  flow_c4h10;
     float  flow_cf4;         
     float  volts_anode;        
     float  volts_cathode1;
     float  volts_cathode2;
     float  volts_cathode3;
     } SlowData;
The first five fields contain temperatures:
  • temp_front_gas = temperature inside front of chamber.
  • temp_rear_gas = temperature inside rear of chamber.
  • temp_front_cover = temperature inside front cover.
  • temp_rear_cover = temperature inside rear cover.
  • temp_room = not used. (Room Temperature)

The next two fields contain the relative humidity in the front and rear cover of the chamber. When these fields have a value of zero, the humidity can be assumed to be less than 5% relative to dew point.

The following two fields contain pressure data: absolute chamber pressure and atmospheric pressure, respectively. Pressure is measured in millibar.

The next three fields contain gas flow measurements:
  • flow_nitrogen = nitrogen flow in standard litres per min.
  • flow_helium = helium flow in standard litres per min.
  • flow_c4h10 = isobutane flow in standard litres per min.
  • flow_cf4 = not used. (Freon Flow)

Finally, the last four fields contain the logged high voltage readings. All measurements are in volts; one volt of reading corresponds to one kilovolt output.

  • volts_anode = anode voltage (nominally 2020V)
  • volts_cathode1 = first shaping voltage (nominally 350V)
  • volts_cathode2 = second shaping voltage (nominally 910V)
  • volts_cathode3 = third shaping voltage (nominally 910V)

Masahiro Morii 05-Nov-1997
Trevor Lanting 02-Apr-1997