Summary of Raw DAQ File Format
==========================
This document provides a description of the output file provided to the First Level Analysis Program (FLAP) by the main DAQ Program.  The raw data file consists of several headers to provide information about the options the user has selected for the particular series of measurements, data from analog sensors via the HP Multi-Function Unit, and temperature + raw pixel distributions from DCOP sensors.

Original:19 May, 2000 by Kaori Maeshima
Updated: 31 May, 2000 by Rober Lee
Updated: 23 June,2000 by KM

============================
I.  Data Format Conventions
======================
Each Run makes a file.
File name:  rdata_rrrrrr__MMddhhmm.dat

                  rrrrrr is run number
                      MM is month (01 - 12)
                      dd is date  (01 - 31)
                      hh is hour  (00 - 23)
                      mm is minute(00 - 59)

A run file contains 3 types of record:

   r-type=1:  Begin Run Record; 

   r-type=2:  Event Record; ( N times where N is the total number of Events)

   r-type=3   End Run Record;

Each record starts with '$' sign followed by 
record type;  then,
a record number; (Record number start with 1.)

Within a record, each data word is separated by a semicolumn.
The event # starts with 1.  So, the record number = event# + 1.
The 1st record (begin run record) starts with 1;, 
nth event record starts with $(n+1);, and the end run record is $(N+2);.

Comment lines start with % (added by daq program) to prevent 
accidental '$' sign to be put at the top of the line.

Event Cluster is a cluster of J*(laser off events) plus K*( Laser on events).
Between the cluser, there is a time interval (=T) specified by a user.

We do NOT change the readout conditions (D_TOT, D_read, J, K, T, etc....)
during the run.
If we want to change any run condition, we start a new run.

Each events contains;
        all the HP channel readout + 
        All the DCOPS Temp. readout +  
        user specified DCOPS CCDread out.

===============================
The Begin Run Record Format:
===============================
$record-type;  ( = 1)
record #;
time;
run #;

D_TOT;
D_read;
xxxxxxxxxxxxxxx;  (15 digit number, each is either 0 or 1) (1 for read out)
               (the left most digit is the sensor 1)
number of events with laser off ( = J); (in one cluster)
number of events with laser 302/301 on  ( = K); (in one cluster)
number of events with laser 303/301 on  ( = L); (in one cluster)
time between each cluster reading ( = T); (in seconds)
logbook page #;
name (initial) of a person who started this run;
%comment lines


==========================
The Event Record Format:
==========================
$record type; ( = 2)
record #;
time; 
event #
laser 1 on/off (1 or 0);
laser 2 on/off (1 or 0);
HP data (20 floating numbers, ch 101 - 120 readout)
TT out (temp. reading in degree C., D_TOT times in reverse order)
DCOPS data (2048 lines * D_read)


============================
The End Run Record Format:
============================
$record type; ( = 3)
record #;
time; 
%comments