******** The g-2 data format (preliminary) ******************** 1) General structure: Event header (6*4 bytes) Electronics id (2 bytes) sub detector evt size (2 bytes) data Electronics id (2 bytes) sub detector evt size (2 bytes) data ...... 2) Event header word 0: Total event length in 32 bit words, including header word 1: record type: 0: event record 1: begin record 2: pause record 3: resume record 4: end record word 2: run number word 3: event number word 4: run mode 0: beam 1: flight simulator 2: pseudo word 5: unused 3) Electronics id bit: 31-30 spare (0) 29-28 data format (0) 27-20 sequential number (1-12) 19-16 electronics type MTDC: 1 (0001) WFD: 2 (0010) FastBus: 3 (0011) CAMAC: 4 (0100) PSD: 8 (1000) 15-0 data size in 32 bit words (including header word) 4) MTDC data buffer A list of 32-bit words, all of the following format: bit: 31-12 time 11-8 error/parity 7-3 channel id 2 pulse edge 1 synchronization error 0 unused 5) WFD data buffer 32-bit daughter-header bit 17 daughter board (0 == top, 1 == bottom) bit 16 phase bit 0-15 event length (==X) X/2 32 bit ADC words, each byte of which is an ADC-value during 5 ns. (0-255, 255== 1V) X/2 32-bit time/discriminator words bits 31-16 == time bits 15-0 == discr. info (ask Rob) All of this 4 times for one WFD 6) PSD data buffer 7) FastBus data buffer 8) CAMAC data buffer ********** WFD data structure *********************** Data from each WFD input channel is stored on separate memory locations. The WFD buffers have the following format: WFD ********** MTDC data structure *********************** ********* DAQ additions to the data ******************* Since i/o is the limiting factor, the DAQ should only add a minimal amount of information to the data. This information should provide for each 'sub-detector': 1) a means to identify the data source WFD/MTDC/others 2) a means to relate data to detector stations 3) the data format (future: compression/reduction) 4) the 'sub-detector' size Each event should have an header containing info as: 1) run number 2) event number 3) date 4) trigger type 5) run mode The standard UNIDAQ header consits of 6 long words which gives us some spares. By just adding these minimal additions, the buffers from MTDC and WFD will not have to be decoded on-line. Only when using data compression does the online have to touch the buffers. This guards the data against possible decoding bugs.