10 #define EDM_ML_DEBUG 1
31 <<
", CRC " << std::hex << std::setw(8) << std::setfill(
'0') <<
getCRC() <<
std::dec
33 <<
"\n\tBX " << (
bx &
BX_mask) <<
", LV1 ID " << (lv1_id &
LV1_mask) <<
", block # "
34 <<
block <<
", CRC " << std::hex << std::setw(8) << std::setfill(
'0') << crc;
41 std::string dstring(reinterpret_cast<const char*>(
start), reinterpret_cast<const char*>(
end) + 4);
52 const std::vector<uint64_t>&
load,
54 edm::LogInfo(
"AMC") <<
"Adding board " << board <<
" with payload size " <<
load.size() <<
" as payload #"
74 std::map<int, int> amc_index;
92 amc_index[
payload_.back().blockHeader().getAMCNumber()] =
i;
95 unsigned int tot_size = 0;
96 unsigned int tot_nblocks = 0;
97 unsigned int maxblocks = 0;
99 bool check_crc =
false;
101 tot_size +=
amc.blockHeader().getSize();
102 tot_nblocks +=
amc.blockHeader().getBlocks();
103 maxblocks =
std::max(maxblocks,
amc.blockHeader().getBlocks());
105 if (
amc.blockHeader().validCRC())
109 unsigned int words = tot_size +
115 <<
"but expected " << words <<
" words: " << tot_size <<
" payload words, " << tot_nblocks
116 <<
" AMC header words, and 2 AMC 13 header words.";
123 amc.addPayload(
data,
amc.blockHeader().getBlockSize());
124 data +=
amc.blockHeader().getBlockSize();
134 LogDebug(
"L1T") <<
"checking data checksum of " << std::hex << crc <<
std::dec;
137 t.check(crc, 0, lv1,
bx);
140 for (
unsigned int b = 1;
b < maxblocks; ++
b) {
142 std::vector<amc::BlockHeader>
headers;
162 LogDebug(
"L1T") <<
"checking data checksum of " << std::hex << crc <<
std::dec;
167 t.check(crc,
b, lv1,
bx);
171 amc.finalize(lv1,
bx, legacy_mc, mtf7_mode);
178 unsigned int maxblocks = 0;
187 unsigned int words = 0;
189 unsigned int maxblocks = 0;
192 words +=
amc.header().getSize();
199 return words +
blocks + maxblocks * 2;
203 if (size < this->
size() * 8)
211 for (
unsigned int b = 0;
b <
blocks(); ++
b) {
214 std::vector<uint64_t> block_headers;
215 std::vector<uint64_t> block_load;
217 edm::LogInfo(
"AMC") <<
"Considering block " <<
b <<
" for payload " <<
amc.blockHeader().getBoardID()
218 <<
" with size " <<
amc.size() <<
" and " <<
amc.blocks() <<
" blocks";
219 if (
amc.blocks() <
b + 1)
222 block_headers.push_back(
amc.blockHeader(
b));
223 auto words =
amc.block(
b);
224 block_load.insert(block_load.end(), words.begin(), words.end());
229 edm::LogInfo(
"AMC") <<
"Writing header for AMC13 packet: "
230 <<
"format version " <<
h.getFormatVersion() <<
", " <<
h.getNumberOfAMCs()
231 <<
" AMC packets, orbit " <<
h.getOrbitNumber();
236 block_headers.insert(block_headers.end(), block_load.begin(), block_load.end());
237 for (
const auto&
word : block_headers)