Definition at line 135 of file L1TRawToDigi.cc.
References amc13HeaderSize_, amc13TrailerSize_, amcHeaderSize_, l1t::stage2::layer2::demux::amcSlotNum, amcTrailerSize_, groupFilesInBlocks::block, FEDHeader::bxID(), FEDTrailer::check(), FEDHeader::check(), coll, gather_cfg::cout, FEDTrailer::crc(), ctp7_mode_, FEDRawData::data(), data, debug_, TauDecayModes::dec, end, FEDTrailer::evtStatus(), FEDRawDataCollection::FEDData(), fedData_, l1t::stage2::layer2::fedId, fedIds_, fwId_, fwOverride_, RecoTauValidation_cfi::header, edm::HandleBase::isValid(), FEDTrailer::lenght(), LogDebug, FEDHeader::lvl1ID(), minFeds_, mtf7_mode_, l1t::stage2::layer2::mp::offsetBoardId, amc13::Packet::parse(), jetCorrFactors_cfi::payload, amc13::Packet::payload(), prov_, FEDRawData::size(), slinkHeaderSize_, slinkTrailerSize_, FEDHeader::sourceID(), tmtCheck_, FEDHeader::triggerType(), FEDTrailer::ttsBits(), FEDHeader::version(), warnsa_, and warnsb_.
Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().
139 std::unique_ptr<UnpackerCollections>
coll =
prov_->getCollections(event);
145 LogError(
"L1T") <<
"Cannot unpack: no FEDRawDataCollection found";
149 unsigned valid_count = 0;
153 LogDebug(
"L1T") <<
"Found FEDRawDataCollection with ID " <<
fedId <<
" and size " << l1tRcd.
size();
156 if (l1tRcd.
size() > 0) {
157 LogError(
"L1T") <<
"Cannot unpack: invalid L1T raw data (size = " 158 << l1tRcd.
size() <<
") for ID " <<
fedId <<
". Returning empty collections!";
161 LogInfo(
"L1T") <<
"During unpacking, encountered empty L1T raw data (size = " 162 << l1tRcd.
size() <<
") for FED ID " <<
fedId <<
".";
169 const unsigned char *
data = l1tRcd.
data();
173 LogDebug(
"L1T") <<
"Found SLink header:" 174 <<
" Trigger type " <<
header.triggerType()
175 <<
" L1 event ID " <<
header.lvl1ID()
176 <<
" BX Number " <<
header.bxID()
177 <<
" FED source " <<
header.sourceID()
178 <<
" FED version " <<
header.version();
180 LogWarning(
"L1T") <<
"Did not find a SLink header!";
185 if (trailer.check()) {
186 LogDebug(
"L1T") <<
"Found SLink trailer:" 187 <<
" Length " << trailer.lenght()
188 <<
" CRC " << trailer.crc()
189 <<
" Status " << trailer.evtStatus()
190 <<
" Throttling bits " << trailer.ttsBits();
192 LogWarning(
"L1T") <<
"Did not find a SLink trailer!";
210 <<
"Could not extract AMC13 Packet.";
218 auto payload64 =
amc.data();
219 const uint32_t *
start = (
const uint32_t*) payload64.get();
222 const uint32_t *
end = start + (
amc.size() * 2);
224 std::unique_ptr<Payload>
payload;
226 LogDebug(
"L1T") <<
"Using CTP7 mode";
229 LogDebug(
"L1T") <<
"Using MTF7 mode";
232 LogDebug(
"L1T") <<
"Using MP7 mode";
233 payload.reset(
new MP7Payload(start, end, legacy_mc));
235 unsigned fw = payload->getAlgorithmFWVersion();
241 unsigned board =
amc.blockHeader().getBoardID();
242 unsigned amc_no =
amc.blockHeader().getAMCNumber();
244 auto unpackers =
prov_->getUnpackers(
fedId, board, amc_no, fw);
247 std::unique_ptr<Block>
block;
248 while ((block = payload->getBlock()).
get()) {
252 unsigned bxId =
header.bxID();
253 unsigned unpackTMT = ( !
tmtCheck_ || ( ( tmtId - 1 ) == ( ( bxId - 1 + 3 ) % 9 ) ) );
256 if( !isCaloL2TMT || unpackTMT ) {
258 std::cout <<
">>> block to unpack <<<" << std::endl
259 <<
"hdr: " << std::hex << std::setw(8) << std::setfill(
'0') << block->header().raw() <<
std::dec 260 <<
" (ID " << block->header().getID() <<
", size " << block->header().getSize()
261 <<
", CapID 0x" << std::hex << std::setw(2) << std::setfill(
'0') << block->header().getCapID()
263 for (
const auto& word: block->payload()) {
265 std::cout <<
"data: " << std::hex << std::setw(8) << std::setfill(
'0') << word <<
std::dec << std::endl;
269 auto unpacker = unpackers.find(block->header().getID());
271 block->amc(
amc.header());
273 if (unpacker == unpackers.end()) {
274 LogDebug(
"L1T") <<
"Cannot find an unpacker for" 275 <<
"\n\tblock: ID " << block->header().getID() <<
", size " << block->header().getSize()
276 <<
"\n\tAMC: # " << amc_no <<
", board ID 0x" << std::hex << board <<
std::dec 277 <<
"\n\tFED ID " <<
fedId <<
", and FW ID " << fw;
279 }
else if (!unpacker->second->unpack(*block, coll.get())) {
280 LogDebug(
"L1T") <<
"Error unpacking data for block ID " 281 << block->header().getID() <<
", AMC # " << amc_no
282 <<
", board ID " << board <<
", FED ID " <<
fedId 283 <<
", and FW ID " << fw <<
"!";
293 LogWarning(
"L1T") <<
"Unpacked " << valid_count <<
" non-empty FED IDs but minimum is set to " <<
minFeds_ <<
"\n";
std::vector< amc::Packet > payload() const
unsigned int offsetBoardId
size_t size() const
Lenght of the data buffer in bytes.
payload
payload postfix for testing
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
std::vector< int > fedIds_
unsigned long long uint64_t
bool parse(const uint64_t *start, const uint64_t *data, unsigned int size, unsigned int lv1, unsigned int bx, bool legacy_mc=false, bool mtf7_mode=false)
char data[epos_bytes_allocation]
std::unique_ptr< PackingSetup > prov_
edm::EDGetTokenT< FEDRawDataCollection > fedData_
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.