Reading CODA data
xcefdump
- xcefdump
- This is a program disributed with CODA to read CODA data files. It will allow you to look at the contents of headers and ROC banks but it doesn;t decode the ROC bank. You can find it under $CODA/bin
Event Stucture
The CODA event structure is to write "Banks" which are in the form headers containing 2 long words (32 x 2 = 64 bits)
Below is an example of a hex dump of a CODA file
hex dump
Using the unix command "od -h filename" on a coda data file I saw the following table of hexadecimal shorts
0000000 2000 0000 0000 0000 0008 0000 0008 0000 0000020 01a3 0000 0002 0000 0027 0000 0100 c0da 0000040 0004 0000 01cc 0011 e7ff 4730 0078 0000 0000060 0001 0000 0004 0000 01cc 0012 e804 4730 0000100 0000 0000 0000 0000 000a 0000 10cc 0001 0000120 0004 0000 0100 c000 0001 0000 0001 0000 0000140 0000 0000 0003 0000 0101 0002 4c52 5343 0000160 0000 0000 000a 0000 10cc 0001 0004 0000 0000200 0100 c000 0002 0000 0001 0000 0000 0000 0000220 0003 0000 0102 0002 4c52 5343 0000 0000 0000240 000a 0000 10cc 0001 0004 0000 0100 c000 0000260 0003 0000 0001 0000 0000 0000 0003 0000 0000300 0103 0002 4c52 5343 0000 0000 000a 0000 0000320 10cc 0001 0004 0000 0100 c000 0004 0000 0000340 0001 0000 0000 0000 0003 0000 0104 0002 0000360 4c52 5343 0000 0000 000a 0000 10cc 0001
Perhaps the most obvious hex is the value "c0da" at the end of line 20.
The first two lines contain file information
0000000 2000 0000 0000 0000 0008 0000 0008 0000
0000020 01a3 0000 0002 0000 0027 0000 0100 c0da
The next line
0000040 0004 0000 01cc 0011 e7ff 4730 0078 0000
tells you that the bank length is "0x0004 = 0d4 " which is saying there are 4 long words (NOT including this one) in the bank.
the next hex words
"01cc 0011 " represent the next 32 bit long word where "0xcc" is the least significant bit 0 to bit 7 (first 8 bits = 1101100 b). The hex constant "0xcc" is used as the "number" in the header word. The next hex snipet "0x01" is used for the data type in the header. The tag is aliased as the event type "0x0011 = 17 d = 10001 b is the highest 16 bits of the 32 bit long word which tells you that this event is #17 which corresponds to a prestart event.
The remain three 32 bit , "0xe7ff 4730", "0078 0000" and "0001 0000", tell you the time, run number, and run type respectively.
"e7ff 4730" = " "0078 0000" = 0x78 = 120 d = run number 120. Notice how you swap the hex; 0x00780000
0x00000078 "0001 0000" = 0x1 = 1 d = run type =1
Based on the above output from OD we can define the Bank Header and Prestart events as
Generic Bank Header
length | ||
tag(bits 16 | 31)data type(bits 8 | 15)number (bits 0 | 7)
The prestart event
The prestart event labeled in the Generic Bank Header with the tag = 17.
length= 4 | ||
tag=Event type =17(bits 16 | 31)data type=1(bits 8 | 15)number= 0xCC (bits 0 | 7)
unix time | ||
run number= 120 | ||
Runtype= 1 |
Go Events
Bank Names
In the CODA readout list (gen_int_list.crl) I will write a 4 letter string with the name of the bank via the command
*rol->dabufp++ = *((unsigned long*)"SCLR");
You can see it in the raw CODA data file using
od -c v260_sclr.dat | less 0000000 \0 \0 \0 \0 \0 \0 \0 \b \0 \0 \0 \b \0 \0 \0 0000020 243 001 \0 \0 002 \0 \0 \0 ' \0 \0 \0 \0 001 332 300 0000040 004 \0 \0 \0 314 001 021 \0 377 347 0 G x \0 \0 \0 0000060 001 \0 \0 \0 004 \0 \0 \0 314 001 022 \0 004 350 0 G 0000100 \0 \0 \0 \0 \0 \0 \0 \0 \n \0 \0 \0 314 020 001 \0 0000120 004 \0 \0 \0 \0 001 \0 300 001 \0 \0 \0 001 \0 \0 \0 0000140 \0 \0 \0 \0 003 \0 \0 \0 001 001 002 \0 R L C S 0000160 \0 \0 \0 \0 \n \0 \0 \0 314 020 001 \0 004 \0 \0 \0
It appears in reverse order at the end of line 140.