Beamloss Monitor File Format

Once triggered, the beamloss monitor will store the last 100 ms of the signal before the trigger on a file. This file starts with a header, followed by the ADC values, organized in rows of fixed length. The number of rows, and their length is defined in the header. The numbers are stored binary (Intel) format. The header is defined in the include file shown below. To download this file shift-click here when you use netscape, or right-click here for windows explorer.

#ifndef	BLMHDR_H
#include	

typedef struct header	{
	int		magic1;
	int		magic2;
	unsigned short	version;
	short		channels;
	short		oversampling;
	short		decimation;
	unsigned int	pre;
	unsigned int	post;
	struct timeval	trigtime;
	double		t0;
	double		period;
	unsigned int	nbytes;
	int		spare[32];
}	HEADER;

#define	BLMHDR_H
#endif

The header is a structure with a length of 180 bytes, which contains the information to decode the rest of the file. Most variables in this structure will always have the same values, given in brackets below. Integer values in the structure are aligned on 4-byte boundaries, shorts on 2-bytes, and doubles on 8-byte boundaries.

Definition of header variables. Numbers in the values column are the normal values for this variable.
Variable nameSizeDescriptionValue
magic1 int file identifier (0x02102001)
magic2 int second file identifier (0x1345)
version short version identifier
most significant byte: major,
least significant byte: minor
(0x0100)
channels short number of active channels (8)
oversampling short ADC setting (1)
decimation short ADC setting (4)
pre unsigned int number of samples before the trigger (-)
post unsigned int number of samples after the trigger (-)
trigtime 2 ints timestamp of trigger (seconds, µ seconds) (-)
t0 double time of first sample with respect to trigger (-)
period double time between two samples (0.768 µ s)
nbytes unsigned int data length (file excl. header) (2031616)
spare 32 ints in version 1.0 not used, uninitialized data! (-)

The header is followed by the ADC data. This data is organized in rows of length header.channels (shorts), which is always an even number. There are header.pre + header.post of these rows. Each row contains the data from the ADC for different channels, taken at the same time. The first row contains samples taken header.t0 seconds with respect to the time of the trigger. Each following row is taken header.period seconds later. ADC values are signed numbers in the range [-32484,32484], corresponding to input values in the range -1.03..1.03   V.