]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/MUON/src/DDL/RawDataFormat.hpp
Renaming file to fall inline with coding conventions.
[u/mrichter/AliRoot.git] / HLT / MUON / src / DDL / RawDataFormat.hpp
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Author: Artur Szostak
4 // Email:  artur@alice.phy.uct.ac.za | artursz@iafrica.com
5 //
6 ////////////////////////////////////////////////////////////////////////////////
7
8 #ifndef dHLT_DDL_RAW_DATA_FORMAT_HPP
9 #define dHLT_DDL_RAW_DATA_FORMAT_HPP
10
11 #include "BasicTypes.hpp"
12
13 namespace dHLT
14 {
15 namespace DDL
16 {
17
18 ////////////////////////////////////////////////////////////////////////////////
19 // Common DDL header structure.
20
21 /* Refer to:
22    ALICE-INT-2002-010 v 2.0
23  */
24  
25 struct DDLHeader
26 {
27         // Word 0:
28         UInt blocklength      : 32;
29         // Word 1:
30         UInt L2bunchcross     : 12;
31         UInt reserved1        :  4;  // Must be zero.
32         UInt L1triggertype    :  8;
33         UInt formatversion    :  8;
34         // Word 2:
35         UInt L2orbit          : 24;
36         UInt reserved2        :  8;  // Must be zero.
37         // Word 3:
38         UInt subdetectors     : 24;
39         UInt blockattribs     :  8;
40         // Word 4:
41         UInt TTCbunchcross    : 12;
42         UInt statuserror      : 16;
43         UInt reserved3        :  4;  // Must be zero.
44         // Word 5:
45         UInt triggerclasslow  : 32;
46         // Word 6:
47         UInt triggerclasshigh : 18;
48         UInt reserved4        : 10;  // Must be zero.
49         UInt roilow           :  4;
50         // Word 7:
51         UInt roihigh          : 32;
52 };
53
54
55 ////////////////////////////////////////////////////////////////////////////////
56 // Data structures for Tracking chamber DDL streams.
57
58 /* Refer to:
59    http://aliweb.cern.ch/people/tkuhr/Rawdata.html
60  */
61
62 struct BlockHeader
63 {
64         UInt blocklength;
65         UInt datalength;
66         UInt dspid;
67         UInt triggercounter[4];
68         UInt padding;    // Must be zero.
69 };
70
71
72 struct DSPHeader
73 {
74         UInt blocklength;
75         UInt datalength;
76         UInt triggercounter[4];
77         UInt dspid;
78         UInt eventflag;   // 1 for odd 0 for even number of 32-bit words.
79 };
80
81
82 struct PatchBusHeader
83 {
84         UInt blocklength;
85         UInt datalength;
86         UInt patchbusid;
87         UInt counter;
88 };
89
90
91 struct ADCData
92 {
93         struct
94         {
95                 UInt signal    : 12;
96                 UInt channel   :  6;
97                 UInt manuid    : 11;
98                 UInt control0  :  1;
99                 UInt control1  :  1;
100                 UInt parity    :  1;
101         };
102 };
103
104
105 ////////////////////////////////////////////////////////////////////////////////
106 // Data structures for L0 trigger DDL streams.
107
108 /* Refer to:
109    http://aliweb.cern.ch/people/tkuhr/Rawdata.html
110  */
111  
112 struct LocalData
113 {
114         // Word 0
115         UInt x1 : 16;
116         UInt x2 : 16;
117         // Word 1
118         UInt x3 : 16;
119         UInt x4 : 16;
120         // Word 2
121         UInt y1 : 16;
122         UInt y2 : 16;
123         // Word 3
124         UInt y3 : 16;
125         UInt y4 : 16;
126         // Word 4
127         UInt xpos     : 5;
128         UInt xdev     : 5;
129         UInt ypos     : 4;
130         UInt ytrigger : 1;
131         UInt decision : 4;
132         UInt address  : 4;  // Board address
133         UInt reserved : 9;  // Must be zero.
134 };
135
136
137 struct RegionalData
138 {
139         // Regional header word.
140         struct
141         {
142                 UInt reserved     : 14;  // Must be zero.
143                 UInt version      : 8;
144                 UInt id           : 5;  // regional ID.
145                 UInt serialnumber : 5;
146         };
147         
148         LocalData localcard[16];  // 16 * 5 words of local card data.
149
150         // 2, 32-bit words of regional input data.
151         struct
152         {
153                 // Word 0
154                 UInt input0 : 4;
155                 UInt input1 : 4;
156                 UInt input2 : 4;
157                 UInt input3 : 4;
158                 UInt input4 : 4;
159                 UInt input5 : 4;
160                 UInt input6 : 4;
161                 UInt input7 : 4;
162                 // Word 1
163                 UInt input8 : 4;
164                 UInt input9 : 4;
165                 UInt inputA : 4;
166                 UInt inputB : 4;
167                 UInt inputC : 4;
168                 UInt inputD : 4;
169                 UInt inputE : 4;
170                 UInt inputF : 4;
171         };
172         UInt output;  // regional card output.
173 };
174
175
176 struct EnhancedHeader
177 {
178         struct
179         {
180                 UInt reserved     : 14;  // Must be zero.
181                 UInt eventtype    :  4;
182                 UInt serialnumber :  4;
183                 UInt version      :  8;
184                 UInt darcid       :  2;
185         };
186         UChar globalinput[16];
187         UInt globaloutput;
188 };
189
190
191 struct TriggerData
192 {
193         EnhancedHeader header;
194         RegionalData regionalcard[8];
195         UInt endmarker[2];  // 2 words indicating end of data. Each word must = 0xDEADFACE
196 };
197
198
199 }; // DDL
200 }; // dHLT
201
202 #endif // dHLT_DDL_RAW_DATA_FORMAT_HPP