MCE flat-file format

From MCEWiki
Revision as of 12:11, 19 March 2008 by 24.84.194.46 (talk) (Frame header)

This document describes one of MAS/MCE's output file formats. The "DAS flat-file" format is closely related to the form that frame data have when they arrive at the PC from the MCE. This format has many weaknesses as far as end users are concerned. Only flat-files with "header version 6" are described here.

The data consist of any number of "frames". In a given flat-file, all frames should have the same size. The frame size can be determined from the first 28 bytes of the file. No MCE flat-file will be shorter than 28 bytes.

The natural data unit of MCE data is the 32-bit unsigned integer. We refer to 32-bit integers as "words". All offsets are expressed in terms of words, and should be multiplied by 4 to get the byte offset.

An MCE/DAS frame, up to and including header version 6, consists of the following:

  • 43 words of header information
  • 8*R*N words of data, where N is the number of readout cards reporting and R is the number of rows reporting.
  • 1 word of checksum information

Frame header

The variety of frame headers is described in the document "MCE File Formats", version 3.3. This document is out of date in many ways, but the descriptions of the frame headers up to version 6 should be accurate.

http://www.phas.ubc.ca/%7Emce/mcedocs/index.html


A summary of the contents of the header are as follows: (some esoteric fields are omitted; absent offsets are not necessarily unused)

Offset Name Category Detail
0 Frame status bits Status/Structure described below
1 CC frame counter Status internal counter, starts at the value of "cc ret_dat_s" and increments by 1 for each output frame.
2 row_len Timing Dwell time of the multiplexer on each row, in units of 1/50 MHz
3 num_rows_reported Structure Number of rows in each column that are reported in each output frame.
4 data_rate Timing Number of internal frames that MCE processes before outputting one to the user.
6 header version Structure 6, the number "six". Subject to change in future header versions.
7 ramp value Status Current value of the internal ramping parameter
8 ramp address Status Card and parameter address of the internal ramping parameter (bits [31-16] are card_addr, bits [15-0] are param_id)
9 num_rows Timing Number of rows that the MCE is servoing
10 Sync box number Status Synchronization number, originating at the sync box, that is used to synchronize data from multiple MCEs and the housekeeping system
11 run_id Status Contents of "cc run_id", typically the ctime (unix time) associated with the acquisition.
12 user_word Status Contents of "cc user_word", which the user may use to store other significant information.

Frame status bits

Bit Category Detail
0 Status Last frame bit, indicates that current acquisition cycle has completed. This does not necessarily indicate the last frame in a flat-file.
1 Status Stop bit, indicates that MCE was commanded to stop acquisition and this is the last frame.
2 Status Sync box free run mode bit, indicates that sync box is generating the data valid information (rather than accepting an external trigger)
3 Status Sync box error bit.
4 Status TES bias square wave level (not present in most firmware)
10 Structure Readout card 1 data are present.
11 Structure Readout card 2 data are present.
12 Structure Readout card 3 data are present.
13 Structure Readout card 4 data are present.

Bits 10-13 are especially relevant for determining the frame size and data structure.

Timing parameters

The internal frame rate of the MCE (the rate at which a given row is servoed) and the output frame rate of the MCE (the rate at which frames are returned to the PC and recorded to disk) can be calculated as follows:

f_internal = 50 MHz / (num_rows * row_len)
f_output   = f_internal / data_rate

Structure determination

The size and structure of the readout data block can be determined from

  • num_rows_reported
  • bits 10-13 of the frame status bits