|
|
Go to the documentation of this file.
68 std::unique_ptr<PackingSetup>
prov_;
89 o <<
"L1T Block Header " <<
h.getID() <<
" with size " <<
h.getSize();
96 minFeds_(
config.getParameter<unsigned
int>(
"MinFeds")),
97 fwId_(
config.getParameter<unsigned
int>(
"FWId")),
98 dmxFwId_(
config.getParameter<unsigned
int>(
"DmxFWId")),
99 fwOverride_(
config.getParameter<
bool>(
"FWOverride")),
100 tmtCheck_(
config.getParameter<
bool>(
"TMTCheck")),
101 ctp7_mode_(
config.getUntrackedParameter<
bool>(
"CTP7")),
102 mtf7_mode_(
config.getUntrackedParameter<
bool>(
"MTF7")) {
106 throw cms::Exception(
"L1TRawToDigi") <<
"Can only use one unpacking mode concurrently!";
110 prov_->registerProducts(producesCollector());
134 std::unique_ptr<UnpackerCollections> coll =
prov_->getCollections(
event);
139 if (!
feds.isValid()) {
140 LogError(
"L1T") <<
"Cannot unpack: no FEDRawDataCollection found";
144 unsigned valid_count = 0;
148 LogDebug(
"L1T") <<
"Found FEDRawDataCollection with ID " <<
fedId <<
" and size " << l1tRcd.
size();
152 if (l1tRcd.
size() > 0) {
153 LogError(
"L1T") <<
"Cannot unpack: invalid L1T raw data (size = " << l1tRcd.
size() <<
") for ID " <<
fedId
154 <<
". Returning empty collections!";
157 LogInfo(
"L1T") <<
"During unpacking, encountered empty L1T raw data (size = " << l1tRcd.
size()
158 <<
") for FED ID " <<
fedId <<
".";
165 const unsigned char*
data = l1tRcd.
data();
169 LogDebug(
"L1T") <<
"Found SLink header:"
170 <<
" Trigger type " <<
header.triggerType() <<
" L1 event ID " <<
header.lvl1ID()
171 <<
" BX Number " <<
header.bxID() <<
" FED source " <<
header.sourceID() <<
" FED version "
174 LogWarning(
"L1T") <<
"Did not find a SLink header!";
179 if (trailer.
check()) {
180 LogDebug(
"L1T") <<
"Found SLink trailer:"
181 <<
" Length " << trailer.
fragmentLength() <<
" CRC " << trailer.
crc() <<
" Status "
184 LogWarning(
"L1T") <<
"Did not find a SLink trailer!";
200 LogError(
"L1T") <<
"Could not extract AMC13 Packet.";
208 auto payload64 =
amc.data();
209 const uint32_t*
start = (
const uint32_t*)payload64.get();
214 std::unique_ptr<Payload>
payload;
216 LogDebug(
"L1T") <<
"Using CTP7 mode";
220 LogDebug(
"L1T") <<
"Using MTF7 mode";
223 LogDebug(
"L1T") <<
"Using MP7 mode";
226 unsigned fw =
payload->getAlgorithmFWVersion();
227 unsigned board =
amc.blockHeader().getBoardID();
228 unsigned amc_no =
amc.blockHeader().getAMCNumber();
234 else if (
fedId == 1366)
241 std::unique_ptr<Block>
block;
245 unsigned bxId =
header.bxID();
246 unsigned unpackTMT = (!
tmtCheck_ || ((tmtId - 1) == ((bxId - 1 + 3) % 9)));
247 unsigned isCaloL2TMT =
250 if (!isCaloL2TMT || unpackTMT) {
252 std::cout <<
">>> block to unpack <<<" << std::endl
253 <<
"hdr: " << std::hex << std::setw(8) << std::setfill(
'0') <<
block->header().raw()
254 <<
std::dec <<
" (ID " <<
block->header().getID() <<
", size " <<
block->header().getSize()
255 <<
", CapID 0x" << std::hex << std::setw(2) << std::setfill(
'0') <<
block->header().getCapID()
257 for (
const auto&
word :
block->payload()) {
269 LogDebug(
"L1T") <<
"Cannot find an unpacker for"
270 <<
"\n\tblock: ID " <<
block->header().getID() <<
", size " <<
block->header().getSize()
271 <<
"\n\tAMC: # " << amc_no <<
", board ID 0x" << std::hex << board <<
std::dec
272 <<
"\n\tFED ID " <<
fedId <<
", and FW ID " <<
fw;
274 }
else if (!unpacker->second->unpack(*
block, coll.get())) {
275 LogDebug(
"L1T") <<
"Error unpacking data for block ID " <<
block->header().getID() <<
", AMC # " << amc_no
276 <<
", board ID " << board <<
", FED ID " <<
fedId <<
", and FW ID " <<
fw <<
"!";
286 LogWarning(
"L1T") <<
"Unpacked " << valid_count <<
" non-empty FED IDs but minimum is set to " <<
minFeds_
296 desc.add<std::vector<int>>(
"FedIds", {})->setComment(
"required parameter: default value is invalid");
297 desc.add<
std::string>(
"Setup",
"")->setComment(
"required parameter: default value is invalid");
300 desc.add<
unsigned int>(
"FWId", 0)->setComment(
301 "Ignored unless FWOverride is true. Calo Stage1: 32 bits: if the first eight bits are 0xff, will read the "
303 desc.add<
unsigned int>(
"DmxFWId", 0)
305 "Ignored unless FWOverride is true. Calo Stage1: 32 bits: if the first eight bits are 0xff, will read "
306 "the 74x MC format.\n");
307 desc.add<
bool>(
"FWOverride",
false)->setComment(
"Firmware version should be taken as FWId parameters");
308 desc.add<
bool>(
"TMTCheck",
true)->setComment(
"Flag for turning on/off Calo Layer 2 TMT node check");
309 desc.addUntracked<
bool>(
"CTP7",
false);
310 desc.addUntracked<
bool>(
"MTF7",
false);
312 desc.addUntracked<
int>(
"lenSlinkHeader", 8);
313 desc.addUntracked<
int>(
"lenSlinkTrailer", 8);
314 desc.addUntracked<
int>(
"lenAMCHeader", 8);
315 desc.addUntracked<
int>(
"lenAMCTrailer", 0);
316 desc.addUntracked<
int>(
"lenAMC13Header", 8);
317 desc.addUntracked<
int>(
"lenAMC13Trailer", 8);
318 desc.addUntracked<
bool>(
"debug",
false)->setComment(
"turn on verbose output");
319 desc.add<
unsigned int>(
"MinFeds", 0)
320 ->setComment(
"optional parameter: warn if less than MinFeds non-empty FED ids unpacked.");
321 descriptions.
add(
"l1tRawToDigi",
desc);
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)
void endRun(edm::Run const &, edm::EventSetup const &) override
void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
const unsigned int amcSlotNum
uint16_t crc() const
Cyclic Redundancy Code of the event fragment including header and trailer.
void produce(edm::Event &, const edm::EventSetup &) override
uint8_t evtStatus() const
Event fragment status information.
Log< level::Info, false > LogInfo
Log< level::Warning, false > LogWarning
std::vector< amc::Packet > payload() const
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
bool check() const
Check that the trailer is OK.
void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
#define DEFINE_FWK_MODULE(type)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
L1TRawToDigi(const edm::ParameterSet &)
std::ostream & operator<<(std::ostream &o, const l1t::BlockHeader &h)
Log< level::Error, false > LogError
size_t size() const
Lenght of the data buffer in bytes.
std::vector< int > fedIds_
std::unique_ptr< PackingSetup > prov_
std::unique_ptr< PackingSetup > make(const std::string &) const
char data[epos_bytes_allocation]
unsigned long long uint64_t
edm::EDGetTokenT< FEDRawDataCollection > fedData_
static const PackingSetupFactory * get()
const unsigned int offsetBoardId
uint8_t ttsBits() const
Current value of the Trigger Throttling System bits.
uint32_t fragmentLength() const
The length of the event fragment counted in 64-bit words including header and trailer.
void beginRun(edm::Run const &, edm::EventSetup const &) override