1 #ifndef UCTDAQRawData_hh 2 #define UCTDAQRawData_hh 17 if((d[0] & 0x5000000000000000) != 0x5000000000000000) {
18 LogError(
"UCTDAQRawData") <<
"CDF Header does not seem to be correct" 19 << std::showbase << std::internal
20 << std::setfill(
'0') << std::setw(10)
23 <<
"; but continuing!" 37 uint32_t
FOV() {
return ((myDataPtr[0] & 0x00000000000000F0) >> 4);}
38 uint32_t
sourceID() {
return ((myDataPtr[0] & 0x00000000000FFF00) >> 8);}
39 uint32_t
BXID() {
return ((myDataPtr[0] & 0x00000000FFF00000) >> 20);}
40 uint32_t
L1ID() {
return ((myDataPtr[0] & 0x00FFFFFF00000000) >> 32);}
41 uint32_t
eventType() {
return ((myDataPtr[0] & 0x0F00000000000000) >> 56);}
43 return ((myDataPtr[1] & 0x0000000FFFFFFFF0) >> 4);
45 uint32_t
nAMCs() {
return ((myDataPtr[1] & 0x00F0000000000000) >> 52);}
46 uint32_t
uFOV() {
return ((myDataPtr[1] & 0xF000000000000000) >> 60);}
50 return myDataPtr[2+
amc] & 0x000000000000FFFF;
52 LogError(
"UCTDAQRawData") <<
"UCTDAQRawData: Failed to fetch board ID for AMC = " <<
amc <<
"; Max AMC = " << nAMCs() << std::endl;
58 return ((myDataPtr[2+
amc] & 0x00000000000F0000) >> 16);
60 LogError(
"UCTDAQRawData") <<
"UCTDAQRawData: Failed to fetch amc no for AMC = " <<
amc <<
"; Max AMC = " << nAMCs() << std::endl;
66 return ((myDataPtr[2+
amc] & 0x000000000FF00000) >> 20);
68 LogError(
"UCTDAQRawData") <<
"UCTDAQRawData: Failed to fetch amc block no for AMC = " <<
amc <<
"; Max AMC = " << nAMCs() << std::endl;
74 return ((myDataPtr[2+
amc] & 0x00FFFFFF00000000) >> 32);
76 LogError(
"UCTDAQRawData") <<
"UCTDAQRawData: Failed to fetch amc size for AMC = " <<
amc <<
"; Max AMC = " << nAMCs() << std::endl;
82 return ((myDataPtr[2+
amc] & 0x0100000000000000) != 0);
84 LogError(
"UCTDAQRawData") <<
"UCTDAQRawData: Failed to fetch crcError-bit for AMC = " <<
amc <<
"; Max AMC = " << nAMCs() << std::endl;
90 return ((myDataPtr[2+
amc] & 0x0200000000000000) != 0);
92 LogError(
"UCTDAQRawData") <<
"UCTDAQRawData: Failed to fetch isValid-bit for AMC = " <<
amc <<
"; Max AMC = " << nAMCs() << std::endl;
98 return ((myDataPtr[2+
amc] & 0x0400000000000000) != 0);
100 LogError(
"UCTDAQRawData") <<
"UCTDAQRawData: Failed to fetch isPresent-bit for AMC = " <<
amc <<
"; Max AMC = " << nAMCs() << std::endl;
106 return ((myDataPtr[2+
amc] & 0x0800000000000000) != 0);
108 LogError(
"UCTDAQRawData") <<
"UCTDAQRawData: Failed to fetch isEnabled-bit for AMC = " <<
amc <<
"; Max AMC = " << nAMCs() << std::endl;
114 return ((myDataPtr[2+
amc] & 0x1000000000000000) != 0);
116 LogError(
"UCTDAQRawData") <<
"UCTDAQRawData: Failed to fetch isSegmented-bit for AMC = " <<
amc <<
"; Max AMC = " << nAMCs() << std::endl;
122 return ((myDataPtr[2+
amc] & 0x2000000000000000) != 0);
124 LogError(
"UCTDAQRawData") <<
"UCTDAQRawData: Failed to fetch more-bit for AMC = " <<
amc <<
"; Max AMC = " << nAMCs() << std::endl;
130 return ((myDataPtr[2+
amc] & 0x4000000000000000) != 0);
132 LogError(
"UCTDAQRawData") <<
"UCTDAQRawData: Failed to fetch length error bit for AMC = " <<
amc <<
"; Max AMC = " << nAMCs() << std::endl;
139 uint32_t
skip = 2 + nAMCs();
140 for(uint32_t
i = 0;
i <
amc;
i++) {
143 return (uint32_t *) &myDataPtr[
skip];
145 LogError(
"UCTDAQRawData") <<
"UCTDAQRawData: Failed to fetch payload location for AMC = " << amc <<
"; Max AMC = " << nAMCs() << std::endl;
151 for(uint32_t
i = 0;
i < nAMCs();
i++) {
152 skip += (1 + amcSize(
i));
154 return &myDataPtr[
skip];
159 return (data[0] & 0x0000000000000FFF);
164 return ((data[0] & 0x00000000000FF000) >> 12);
169 return ((data[0] & 0x000000000FF00000) >> 20);
174 return ((data[0] & 0xFFFFFFFF00000000) >> 32);
179 for(uint32_t
i = 0;
i < nAMCs();
i++) {
180 skip += (1 + amcSize(
i));
184 if((data[0] & 0xF000000000000000) != 0xA000000000000000) {
185 LogError(
"UCTDAQRawData") <<
"CDF Trailer seems to be wrong : " 186 << std::showbase << std::internal
187 << std::setfill(
'0') << std::setw(10)
197 return ((data[0] & 0x0000000000000004) == 1);
202 return ((data[0] & 0x0000000000000008) == 1);
207 return ((data[0] & 0x00000000000000F0) >> 4);
212 return ((data[0] & 0x0000000000000F00) >> 8);
217 return ((data[0] & 0x0000000000004000) == 1);
222 return ((data[0] & 0x0000000000008000) == 1);
227 return ((data[0] & 0x00000000FFFF0000) >> 16);
232 return ((data[0] & 0x00FFFFFF00000000) >> 32);
237 LogDebug(
"UCTDAQRawData") <<
"Common cDAQ/AMC13 Data Header:" << endl;
238 LogDebug(
"UCTDAQRawData") <<
"Framework Version = " <<
internal << setfill(
'0') << setw(3) << hex << FOV() << endl;
239 LogDebug(
"UCTDAQRawData") <<
"sourceID......... = " <<
dec << sourceID() << endl;
240 LogDebug(
"UCTDAQRawData") <<
"BXID............. = " <<
dec << BXID() << endl;
241 LogDebug(
"UCTDAQRawData") <<
"L1ID............. = " <<
internal << setfill(
'0') << setw(8) << hex << L1ID() << endl;
242 LogDebug(
"UCTDAQRawData") <<
"eventType........ = " <<
internal << setfill(
'0') << setw(3) << hex << eventType() << endl;
243 LogDebug(
"UCTDAQRawData") <<
"orbitNo.......... = " <<
dec << orbitNumber() << endl;
244 LogDebug(
"UCTDAQRawData") <<
"uFOV............. = " <<
internal << setfill(
'0') << setw(8) << hex << uFOV() << endl;
245 LogDebug(
"UCTDAQRawData") <<
"# of CTP7s....... = " <<
dec << nAMCs() << endl;
246 LogDebug(
"UCTDAQRawData") <<
"Phi SlotNo BlockNo Size CRC? Valid? Present? Enabled? Segmented? More? LengthError?" << endl;
247 for(uint32_t
i = 0;
i < nAMCs();
i++) {
248 LogDebug(
"UCTDAQRawData") <<
dec << setfill(
' ') << setw(3) << boardID(
i) <<
" " 249 <<
dec << setfill(
' ') << setw(6) << amcNo(
i) <<
" " 250 <<
dec << setfill(
' ') << setw(7) << amcBlkNo(
i) <<
" " 251 <<
dec << setfill(
' ') << setw(8) << amcSize(
i) <<
" " 252 <<
" " << crcError(
i) <<
" " 253 <<
" " << isValid(
i) <<
" " 254 <<
" " << isPresent(
i) <<
" " 255 <<
" " << isEnabled(
i) <<
" " 256 <<
" " << isSegmented(
i) <<
" " 257 <<
" " << more(
i) <<
" " 258 <<
" " << lengthError(
i) << endl;
260 LogDebug(
"UCTDAQRawData") <<
"AMC13 Trailer:" << endl;
261 LogDebug(
"UCTDAQRawData") <<
"AMC13 BXID....... = " <<
dec << amc13BXID() << endl;
262 LogDebug(
"UCTDAQRawData") <<
"AMC13 L1ID....... = " <<
dec << amc13L1ID() << endl;
263 LogDebug(
"UCTDAQRawData") <<
"AMC13 BlockNo.... = " <<
dec << amc13BlockNo() << endl;
264 LogDebug(
"UCTDAQRawData") <<
"AMC13 CRC32...... = " <<
internal << setfill(
'0') << setw(10) << hex << amc13BXID() << endl;
265 LogDebug(
"UCTDAQRawData") <<
"Common DAQ Trailer:" << endl;
266 LogDebug(
"UCTDAQRawData") <<
"CRC Modified?.... = " << crcModified() << endl;
267 LogDebug(
"UCTDAQRawData") <<
"Last Trailer Word?= " << isLastTrailerWord() << endl;
268 LogDebug(
"UCTDAQRawData") <<
"ttsBits.......... = " <<
internal << setfill(
'0') << setw(3) << hex << ttsBits() << endl;
269 LogDebug(
"UCTDAQRawData") <<
"Event Status..... = " <<
internal << setfill(
'0') << setw(3) << hex << eventStatus() << endl;
270 LogDebug(
"UCTDAQRawData") <<
"Wrong FED ID?.... = " << isWrongFEDID() << endl;
271 LogDebug(
"UCTDAQRawData") <<
"SLink Error?..... = " << isSLinkErrorDetectedByFRL() << endl;
272 LogDebug(
"UCTDAQRawData") <<
"CRC 16........... = " <<
internal << setfill(
'0') << setw(6) << hex << crc16() << endl;
273 LogDebug(
"UCTDAQRawData") <<
"Event Length..... = " <<
dec << eventLength() << endl;
const uint64_t * cdfHeader() const
UCTDAQRawData(const uint64_t *d)
bool isPresent(uint32_t amc=0)
const uint64_t * myDataPtr
bool crcError(uint32_t amc=0)
const uint64_t * cdfTrailerPtr()
const uint64_t * amc13TrailerPtr()
uint32_t boardID(uint32_t amc=0)
bool isEnabled(uint32_t amc=0)
uint32_t amcSize(uint32_t amc=0)
bool isSegmented(uint32_t amc=0)
uint32_t amcBlkNo(uint32_t amc=0)
const uint64_t * dataPtr() const
const uint32_t * amcPayload(uint32_t amc)
unsigned long long uint64_t
bool isSLinkErrorDetectedByFRL()
bool lengthError(uint32_t amc=0)
char data[epos_bytes_allocation]
uint32_t amcNo(uint32_t amc=0)
bool isValid(uint32_t amc=0)
bool more(uint32_t amc=0)