|
|
#include <RPCAMCRawToDigi.h>
|
bool | processBlocks (int fed, std::uint64_t const *&word, std::uint64_t const *word_end, std::uint16_t &crc, RPCAMCLinkCounters &counters, std::map< RPCAMCLink, rpcamc13::AMCPayload > &amc_payload) const |
|
bool | processCDFHeaders (int fed, std::uint64_t const *&word, std::uint64_t const *&word_end, std::uint16_t &crc, RPCAMCLinkCounters &counters) const |
|
bool | processCDFTrailers (int fed, unsigned int nwords, std::uint64_t const *&word, std::uint64_t const *&word_end, std::uint16_t &crc, RPCAMCLinkCounters &counters) const |
|
Definition at line 21 of file RPCAMCRawToDigi.h.
◆ RPCAMCRawToDigi()
◆ ~RPCAMCRawToDigi()
RPCAMCRawToDigi::~RPCAMCRawToDigi |
( |
| ) |
|
|
override |
◆ beginRun()
◆ compute_crc16_64bit()
void RPCAMCRawToDigi::compute_crc16_64bit |
( |
std::uint16_t & |
crc, |
|
|
std::uint64_t const & |
word |
|
) |
| |
|
inlinestatic |
◆ fillDescriptions()
◆ processBlocks()
Definition at line 195 of file RPCAMCRawToDigi.cc.
201 while (
word < word_end) {
208 unsigned int n_amc(
header.getNAMC());
209 if (
word + n_amc + 1 >= word_end) {
213 edm::LogWarning(
"RPCAMCRawToDigi") <<
"AMC13 Block can not be complete for FED " << fed;
220 for (
unsigned int amc = 0;
amc < n_amc; ++
amc) {
227 unsigned int size_in_block(amc13_amc_header.getSizeInBlock());
228 if (size_in_block == 0) {
231 payload_word = payload_word_end;
232 payload_word_end += size_in_block;
234 unsigned int amc_number(amc13_amc_header.getAMCNumber());
239 edm::LogWarning(
"RPCAMCRawToDigi") <<
"Invalid AMC Number " << amc_number <<
" for FED " << fed;
243 if (payload_word_end > word_end) {
248 <<
"AMC Block can not be complete for FED " << fed <<
" at AMC " << amc_number;
254 if (amc13_amc_header.isFirstBlock()) {
255 payload.setAMCHeader(amc13_amc_header);
260 if (!amc13_amc_header.isValid()) {
265 <<
"AMC13 AMC Header is reporting an invalid "
266 <<
"Event Counter or Bunch Counter for FED " << fed <<
", AMC " << amc_number;
271 if (amc_number != amc_amc_header.getAMCNumber()) {
276 <<
"AMC Number inconsistent in AMC13 AMC Header vs AMC Header: " << amc_number <<
" vs "
277 << amc_amc_header.getAMCNumber();
281 if (amc_amc_header.hasDataLength() && amc13_amc_header.hasTotalSize() &&
282 amc13_amc_header.getSize() != amc_amc_header.getDataLength()) {
287 <<
"AMC size inconsistent in AMC13 AMC Header vs AMC Header: " << amc13_amc_header.getSize() <<
" vs "
288 << amc_amc_header.getDataLength();
293 if (amc13_amc_header.isLastBlock()) {
294 if (!amc13_amc_header.isFirstBlock()) {
297 payload.getAMCHeader().setCRCOk(amc13_amc_header.isCRCOk());
298 payload.getAMCHeader().setLengthCorrect(amc13_amc_header.isLengthCorrect());
300 if (!amc13_amc_header.isCRCOk()) {
305 <<
"AMC13 AMC Header is reporting a mismatched "
306 <<
"Event Counter or Bunch Counter for FED " << fed <<
", AMC " << amc_number;
310 if (!amc13_amc_header.isLengthCorrect()) {
314 edm::LogWarning(
"RPCAMCRawToDigi") <<
"AMC13 AMC Header is reporting an incorrect length "
315 <<
"for FED " << fed <<
", AMC " << amc_number;
319 if (amc13_amc_header.hasTotalSize() &&
320 amc13_amc_header.getSize() != (
payload.getData().size() + size_in_block)) {
324 edm::LogWarning(
"RPCAMCRawToDigi") <<
"Size in AMC13 AMC Header doesn't match payload size "
325 <<
"for FED " << fed <<
", AMC " << amc_number;
329 if (!
payload.getData().empty() && (
payload.getData().size() + size_in_block) < 3) {
333 edm::LogWarning(
"RPCAMCRawToDigi") <<
"Size in AMC13 AMC Header doesn't match payload size "
334 <<
"for FED " << fed <<
", AMC " << amc_number;
339 if (size_in_block > 0) {
340 payload.insert(payload_word, size_in_block);
345 for (;
word < payload_word_end; ++
word) {
349 word = payload_word_end;
References RPCAMCLinkCounters::add(), amc, RPCAMCLinkEvents::amc_amc13_block_incomplete_, RPCAMCLinkEvents::amc_amc13_crc_mismatch_, RPCAMCLinkEvents::amc_amc13_evc_bc_invalid_, RPCAMCLinkEvents::amc_amc13_length_incorrect_, RPCAMCLinkEvents::amc_amc13_size_inconsistent_, RPCAMCLinkEvents::amc_event_, RPCAMCLinkEvents::amc_number_mismatch_, RPCAMCLinkEvents::amc_payload_incomplete_, RPCAMCLinkEvents::amc_size_mismatch_, calculate_crc_, compute_crc16_64bit(), RPCAMCLinkEvents::fed_amc13_amc_number_invalid_, RPCAMCLinkEvents::fed_amc13_block_incomplete_, fill_counters_, rpcamc::Header::getAMCNumber(), rpcamc13::AMCHeader::getAMCNumber(), rpcamc::Header::getDataLength(), rpcamc13::AMCHeader::getSize(), rpcamc13::AMCHeader::getSizeInBlock(), rpcamc::Header::hasDataLength(), rpcamc13::AMCHeader::hasTotalSize(), RecoTauValidation_cfi::header, rpcamc13::AMCHeader::isCRCOk(), rpcamc13::AMCHeader::isFirstBlock(), rpcamc13::AMCHeader::isLastBlock(), rpcamc13::AMCHeader::isLengthCorrect(), rpcamc13::AMCHeader::isValid(), RPCAMCLink::max_amcnumber_, jets_cff::payload, and RPCAMCLink::wildcard_.
Referenced by produce().
◆ processCDFHeaders()
bool RPCAMCRawToDigi::processCDFHeaders |
( |
int |
fed, |
|
|
std::uint64_t const *& |
word, |
|
|
std::uint64_t const *& |
word_end, |
|
|
std::uint16_t & |
crc, |
|
|
RPCAMCLinkCounters & |
counters |
|
) |
| const |
|
protected |
◆ processCDFTrailers()
bool RPCAMCRawToDigi::processCDFTrailers |
( |
int |
fed, |
|
|
unsigned int |
nwords, |
|
|
std::uint64_t const *& |
word, |
|
|
std::uint64_t const *& |
word_end, |
|
|
std::uint16_t & |
crc, |
|
|
RPCAMCLinkCounters & |
counters |
|
) |
| const |
|
protected |
◆ produce()
Definition at line 50 of file RPCAMCRawToDigi.cc.
53 event.getByToken(
raw_token_, raw_data_collection);
57 std::map<RPCAMCLink, rpcamc13::AMCPayload> amc_payload;
65 std::uint16_t crc(0xffff);
76 LogDebug(
"RPCAMCRawToDigi") <<
"Handling FED " << fed <<
" with length " << nwords;
96 word_end = reinterpret_cast<std::uint64_t const *>(raw_data.
data()) + nwords - 1;
101 FEDTrailer trailer(reinterpret_cast<unsigned char const *>(word_end));
102 if ((
unsigned int)(trailer.crc()) != crc) {
106 edm::LogWarning(
"RPCAMCRawToDigi") <<
"FED Trailer CRC doesn't match for FED id " << fed;
References calculate_crc_, compute_crc16_64bit(), FEDTrailer::crc(), FEDRawData::data(), RPCAMCLinkEvents::fed_event_, RPCAMCLinkEvents::fed_trailer_crc_mismatch_, FEDRawDataCollection::FEDData(), fill_counters_, LogDebug, eostools::move(), processBlocks(), processCDFHeaders(), processCDFTrailers(), raw_token_, rpc_unpacker_, singleTopDQM_cfi::setup, FEDRawData::size(), and RPCAMCLink::wildcard_.
◆ calculate_crc_
bool RPCAMCRawToDigi::calculate_crc_ |
|
protected |
◆ fill_counters_
bool RPCAMCRawToDigi::fill_counters_ |
|
protected |
◆ raw_token_
◆ rpc_unpacker_
static unsigned const int fed_amc13_amc_number_invalid_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static const int max_amcnumber_
static const int wildcard_
static unsigned const int amc_amc13_length_incorrect_
def create(alignables, pedeDump, additionalData, outputFile, config)
bool processCDFTrailers(int fed, unsigned int nwords, std::uint64_t const *&word, std::uint64_t const *&word_end, std::uint16_t &crc, RPCAMCLinkCounters &counters) const
static unsigned const int fed_trailer_length_mismatch_
static unsigned const int amc_number_mismatch_
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
bool processBlocks(int fed, std::uint64_t const *&word, std::uint64_t const *word_end, std::uint16_t &crc, RPCAMCLinkCounters &counters, std::map< RPCAMCLink, rpcamc13::AMCPayload > &amc_payload) const
static unsigned const int amc_event_
static unsigned const int fed_event_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static unsigned const int amc_payload_incomplete_
static unsigned const int fed_header_check_fail_
static unsigned const int fed_trailer_crc_mismatch_
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
static unsigned const int fed_trailer_check_fail_
edm::EDGetTokenT< FEDRawDataCollection > raw_token_
static unsigned const int amc_amc13_block_incomplete_
static void fillDescription(edm::ParameterSetDescription &desc)
static void compute_crc16_64bit(std::uint16_t &crc, std::uint64_t const &word)
std::unique_ptr< RPCAMCUnpacker > rpc_unpacker_
static unsigned const int fed_amc13_block_incomplete_
void add(unsigned int event, RPCAMCLink const &link, unsigned int count=1)
bool processCDFHeaders(int fed, std::uint64_t const *&word, std::uint64_t const *&word_end, std::uint16_t &crc, RPCAMCLinkCounters &counters) const
size_t size() const
Lenght of the data buffer in bytes.
static unsigned const int amc_amc13_size_inconsistent_
static unsigned const int amc_amc13_evc_bc_invalid_
static unsigned const int amc_size_mismatch_
static unsigned const int fed_header_id_mismatch_
unsigned long long uint64_t
unsigned short compute_crc_8bit(unsigned short crc, unsigned char data)
static unsigned const int amc_amc13_crc_mismatch_