Reading CODA data

From New IAC Wiki
Jump to navigation Jump to search

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.

Generic Bank Header

The above illustrates the Bank Header format which is used for all banks. The table below identifies the format we observed in the data file using OD and agrees with Figure 4 in appendic E.1 on pg 98 the documentation listed in the CODA 1.4 manual referenced below.

length

tag(bits 16 [math]\rightarrow[/math] 31) data type(bits 8 [math]\rightarrow[/math] 15) number (bits 0 [math]\rightarrow[/math] 7)


The prestart event

0000040 0004 0000 01cc 0011 e7ff 4730 0078 0000

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 [math]\Rightarrow[/math] 0x00000078 "0001 0000" = 0x1 = 1 d = run type =1


Based on the above output from OD we can define Prestart Event Bank as


0004 0000 0x00000004 = 4 d = length= 4
01cc 0011 0x0011 = 17 d = tag=Event type(bits 16 [math]\rightarrow[/math] 31) 0x01 = data type(bits 8 [math]\rightarrow[/math] 15) 0xcc= number (bits 0 [math]\rightarrow[/math] 7)
e7ff 4730 = 0x4730e7ff = 1194387455 d = unix time = seconds from Jan 1, 1970 GMT = Tue, 06 Nov 2007 22:17:35 GMT
0078 0000

0x 00000078 = 120 d = run number

0001 0000

0x 0000 0001 = 1d =Runtype= 1

which agrees with the table in Appendix F.6 on pg 106 of the manual.

Go Event

The next entry in the data file start with the third entry in the line below.

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

"0004 0000" = 0x00000004 = 4 d [math]\Rightarrow[/math] you have another header of length 4 long words.

"01cc 0012" is the next 32 bit word which \Rightarrow the number = 0xcc, the data type = 1 and the tag / event type 0x0012 = 18 d \Rightarrow "Go Event"

According to the Go Event format defined in Appendix F.7 of the manual referenced below, you can expect 3 long words. The first word is the unix time, the next is for "reserved" and the last one is the number of events in the run so far.



0004 0000

length= 4

01cc 0012 tag=Event type =18(bits 16 [math]\rightarrow[/math] 31) data type=1(bits 8 [math]\rightarrow[/math] 15) number= 0xCC (bits 0 [math]\rightarrow[/math] 7)
e804 4730

0x4730e804 = 1194387460 d = unix time = Tue, 06 Nov 2007 22:17:40 GMT

0000 0000

reserved

0000 0000

Event Number

ROC fragment following Go event Event

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
000a 0000 length= 10
10cc 0001 tag=ROC # =0x0001 = 1 d (bits 16 [math]\rightarrow[/math] 31) data type=10(bits 8 [math]\rightarrow[/math] 15) number= 0xCC (bits 0 [math]\rightarrow[/math] 7)
0004 0000
0100 c000
0001 0000
0000 0000
0001 0000
0003 0000
0101 0002
4c52 5343 = Bank name =SCLR: 0x53 = 83 d = S , 0x43 = 67 d= C, 0x4c = 76 d = L, 0x52 = 82 d = R
0000 0000

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.

References

File:Coda 1.4 manual.pdf

Return to DAQ