34 for (uint32_t iword = 0; iword < inputArray.size();) {
38 <<
"Expected a S-Link header at word " <<
std::dec << iword <<
"/0x" << std::hex << iword <<
" (BOE: 0x" 43 LogDebug(
"HGCalUnpack") <<
"SLink=" << sLink;
52 <<
"Expected a capture block header at word " <<
std::dec << iword <<
"/0x" << std::hex << iword
58 LogDebug(
"HGCalUnpack") <<
"Capture block=" << (
int)captureBlock <<
", capture block header=0x" << std::hex
59 << captureBlockHeader;
70 <<
"Expected a ECON-D header at word " <<
std::dec << iword <<
"/0x" << std::hex << iword
73 const auto& econdHeader = inputArray[iword];
76 LogDebug(
"HGCalUnpack") <<
"ECON-D #" << (
int)econd <<
", first word of ECON-D header=0x" << std::hex
82 throw cms::Exception(
"CorruptData") <<
"Unpacked payload length=" << payloadLength
85 LogDebug(
"HGCalUnpack") <<
"ECON-D #" << (
int)econd <<
", payload length=" << payloadLength;
96 iword += payloadLength;
99 LogDebug(
"HGCalUnpacker") <<
"Padding ECON-D payload to 2 32-bit words (remainder: " << (iword % 2) <<
").";
104 const uint32_t econdBodyStart = iword;
108 LogDebug(
"HGCalUnpack") <<
"Standard ECON-D";
109 const auto enabledERX = enabledERXMapping(sLink, captureBlock, econd);
113 if ((enabledERX >> erx & 1) == 0)
118 LogDebug(
"HGCalUnpack") <<
"ECON-D:eRx=" << (
int)econd <<
":" << (
int)erx
119 <<
", first word of the eRx header=0x" << std::hex << inputArray[iword] <<
"\n" 120 <<
" extracted common mode 0=0x" << std::hex
123 <<
" extracted common mode 1=0x" << std::hex
128 if ((erx % 2 == 0 && (enabledERX >> (erx + 1) & 1) == 0) ||
129 (erx % 2 == 1 && (enabledERX >> (erx - 1) & 1) == 0)) {
133 LogDebug(
"HGCalUnpack") <<
"half ROC turned on, padding to 4 common modes\n" 141 LogDebug(
"HGCalUnpack") <<
"eRx empty";
148 LogDebug(
"HGCalUnpack") <<
"whole eRx header=0x" << std::hex << erxHeader;
151 uint32_t bitCounter = 0;
153 if (((erxHeader >> channel) & 1) == 0)
157 const uint32_t tempIndex = bitCounter / 32 + iword;
158 const uint8_t tempBit = bitCounter % 32;
159 const uint32_t
temp =
160 (tempBit == 0) ? inputArray[tempIndex]
161 : (inputArray[tempIndex] << tempBit) | (inputArray[tempIndex + 1] >> (32 - tempBit));
162 const uint8_t code =
temp >> 28;
171 << (
int)erx <<
":" << (
int)channel <<
"\n" 174 <<
" full word readout=0x" << std::hex <<
temp <<
std::dec <<
", code=0x" 176 <<
" extracted channel data=0x" << std::hex
181 iword += bitCounter / 32;
182 if (bitCounter % 32 != 0)
193 LogDebug(
"HGCalUnpack") <<
"Passthrough ECON-D";
194 const auto enabledERX = enabledERXMapping(sLink, captureBlock, econd);
196 if ((enabledERX >> erx & 1) == 0)
201 uint32_t
temp = inputArray[iword];
202 LogDebug(
"HGCalUnpack") <<
"ECON-D:eRx=" << (
int)econd <<
":" << (
int)erx
203 <<
", first word of the eRx header=0x" << std::hex <<
temp <<
std::dec <<
"\n" 204 <<
" extracted common mode 0=0x" << std::hex
207 <<
" extracted common mode 1=0x" << std::hex
212 if ((erx % 2 == 0 && (enabledERX >> (erx + 1) & 1) == 0) ||
213 (erx % 2 == 1 && (enabledERX >> (erx - 1) & 1) == 0)) {
217 LogDebug(
"HGCalUnpack") <<
"half ROC turned on, padding to 4 common modes\n" 230 << (
int)erx <<
":" << (
int)channel <<
", HGCalElectronicsId=" <<
id.raw()
233 <<
"extracted channel data=0x" << std::hex
248 if (iword - econdBodyStart != payloadLength)
250 <<
"Mismatch between unpacked and expected ECON-D #" << (
int)econd <<
" payload length\n" 251 <<
" unpacked payload length=" << iword - econdBodyStart <<
"\n" 252 <<
" expected payload length=" << payloadLength;
254 if (iword % 2 != 0) {
255 LogDebug(
"HGCalUnpacker") <<
"Padding ECON-D payload to 2 32-bit words (remainder: " << (iword % 2) <<
").";
261 if (iword % 4 != 0) {
262 LogDebug(
"HGCalUnpacker") <<
"Padding capture block to 4 32-bit words (remainder: " << (iword % 4) <<
").";
263 iword += 4 - (iword % 4);
const uint32_t erxBodyMask_[16]
std::vector< uint32_t > commonModeIndex_
Array for logicalMapping between unpacked channels to first common mode.
const uint32_t erxBodyRightShift_[16]
uint32_t sLinkCaptureBlockMax
maximum number of capture blocks in one S-Link
size_t channelDataSize_
Size of unpacked channels.
uint32_t erxChannelMax
maximum number of channels in one eRx
uint32_t payloadLengthMax
maximum length of payload length
uint32_t captureBlockECONDMax
maximum number of ECON-Ds in one capture block
uint32_t econdHeaderMarker
ECON-D header Marker pattern.
std::vector< HGCROCChannelDataFrame< D > > channelData_
Array for unpacked channels.
size_t commonModeDataSize_
Size of unpacked common modes.
wrapper for a 32b data word identifying a readout channel in the raw data The format is the following...
uint32_t econdERXMax
maximum number of eRxs in one ECON-D
uint32_t commonModeMax
maximum number of common modes unpacked
unsigned long long uint64_t
uint32_t captureBlockReserved
Capture block reserved pattern.
HGCalUnpackerConfig config_
uint32_t sLinkBOE
S-Link BOE pattern.
std::vector< uint32_t > badECOND_
Array of indices of bad ECON-Ds.
wrapper for a 32b data word from a single channel and its detid The format is always the same: |1b|1b...
const uint32_t erxBodyBits_[16]
std::vector< uint16_t > commonModeData_
Array for unpacked common modes.