|
|
Go to the documentation of this file.
21 : calculate_crc_(
config.getParameter<
bool>(
"calculateCRC")),
22 fill_counters_(
config.getParameter<
bool>(
"fillCounters")),
27 producesCollector())) {
29 produces<RPCAMCLinkCounters>();
40 desc.add<
bool>(
"calculateCRC",
true);
41 desc.add<
bool>(
"fillCounters",
true);
44 descs.
add(
"RPCAMCRawToDigi",
desc);
54 event.getByToken(
raw_token_, raw_data_collection);
58 std::map<RPCAMCLink, rpcamc13::AMCPayload> amc_payload;
66 std::uint16_t crc(0xffff);
77 LogDebug(
"RPCAMCRawToDigi") <<
"Handling FED " << fed <<
" with length " << nwords;
97 word_end = reinterpret_cast<std::uint64_t const *>(raw_data.
data()) + nwords - 1;
102 FEDTrailer trailer(reinterpret_cast<unsigned char const *>(word_end));
103 if ((
unsigned int)(trailer.
crc()) != crc) {
107 edm::LogWarning(
"RPCAMCRawToDigi") <<
"FED Trailer CRC doesn't match for FED id " << fed;
125 bool more_headers(
true);
126 for (;
word < word_end && more_headers; ++
word) {
137 edm::LogWarning(
"RPCAMCRawToDigi") <<
"FED Header check failed for FED id " << fed;
141 if (
header.sourceID() != fed) {
146 <<
" does not match requested FED id " << fed;
153 more_headers =
false;
156 return !more_headers;
165 bool more_trailers(
true);
166 for (--word_end; word_end >
word && more_trailers; --word_end) {
167 FEDTrailer trailer(reinterpret_cast<unsigned char const *>(word_end));
168 LogDebug(
"RPCAMCRawToDigi") <<
"CDF Trailer " << std::hex << *word_end <<
std::dec <<
", length "
170 if (!trailer.
check()) {
174 edm::LogWarning(
"RPCAMCRawToDigi") <<
"FED Trailer check failed for FED id " << fed;
182 <<
" does not match actual data size " << nwords <<
" for FED id " << fed;
188 more_trailers =
false;
193 return !more_trailers;
201 std::map<RPCAMCLink, rpcamc13::AMCPayload> &amc_payload)
const {
202 while (
word < word_end) {
209 unsigned int n_amc(
header.getNAMC());
210 if (
word + n_amc + 1 >= word_end) {
214 edm::LogWarning(
"RPCAMCRawToDigi") <<
"AMC13 Block can not be complete for FED " << fed;
221 for (
unsigned int amc = 0;
amc < n_amc; ++
amc) {
229 if (size_in_block == 0) {
232 payload_word = payload_word_end;
233 payload_word_end += size_in_block;
235 unsigned int amc_number(amc13_amc_header.
getAMCNumber());
240 edm::LogWarning(
"RPCAMCRawToDigi") <<
"Invalid AMC Number " << amc_number <<
" for FED " << fed;
244 if (payload_word_end > word_end) {
249 <<
"AMC Block can not be complete for FED " << fed <<
" at AMC " << amc_number;
256 payload.setAMCHeader(amc13_amc_header);
261 if (!amc13_amc_header.
isValid()) {
266 <<
"AMC13 AMC Header is reporting an invalid "
267 <<
"Event Counter or Bunch Counter for FED " << fed <<
", AMC " << amc_number;
277 <<
"AMC Number inconsistent in AMC13 AMC Header vs AMC Header: " << amc_number <<
" vs "
288 <<
"AMC size inconsistent in AMC13 AMC Header vs AMC Header: " << amc13_amc_header.
getSize() <<
" vs "
301 if (!amc13_amc_header.
isCRCOk()) {
306 <<
"AMC13 AMC Header is reporting a mismatched "
307 <<
"Event Counter or Bunch Counter for FED " << fed <<
", AMC " << amc_number;
315 edm::LogWarning(
"RPCAMCRawToDigi") <<
"AMC13 AMC Header is reporting an incorrect length "
316 <<
"for FED " << fed <<
", AMC " << amc_number;
321 amc13_amc_header.
getSize() != (
payload.getData().size() + size_in_block)) {
325 edm::LogWarning(
"RPCAMCRawToDigi") <<
"Size in AMC13 AMC Header doesn't match payload size "
326 <<
"for FED " << fed <<
", AMC " << amc_number;
330 if (!
payload.getData().empty() && (
payload.getData().size() + size_in_block) < 3) {
334 edm::LogWarning(
"RPCAMCRawToDigi") <<
"Size in AMC13 AMC Header doesn't match payload size "
335 <<
"for FED " << fed <<
", AMC " << amc_number;
340 if (size_in_block > 0) {
341 payload.insert(payload_word, size_in_block);
346 for (;
word < payload_word_end; ++
word) {
350 word = payload_word_end;
void beginRun(edm::Run const &run, edm::EventSetup const &setup) override
static unsigned const int fed_amc13_amc_number_invalid_
static void fillDescriptions(edm::ConfigurationDescriptions &descs)
static const int max_amcnumber_
static const int wildcard_
uint16_t crc() const
Cyclic Redundancy Code of the event fragment including header and trailer.
static unsigned const int amc_amc13_length_incorrect_
void produce(edm::Event &event, edm::EventSetup const &setup) override
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_
Log< level::Warning, false > LogWarning
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
bool check() const
Check that the trailer is OK.
const caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple cms::cuda::AtomicPairCounter const GPUCACell *__restrict__ const uint32_t *__restrict__ const gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const GPUCACell::OuterHitOfCell *__restrict__ int32_t uint32_t CAHitNtupletGeneratorKernelsGPU::Counters * counters
static unsigned const int amc_event_
#define DEFINE_FWK_MODULE(type)
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)
~RPCAMCRawToDigi() override
std::unique_ptr< RPCAMCUnpacker > rpc_unpacker_
static unsigned const int fed_amc13_block_incomplete_
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.
RPCAMCRawToDigi(edm::ParameterSet const &config)
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
uint32_t fragmentLength() const
The length of the event fragment counted in 64-bit words including header and trailer.
static unsigned const int amc_amc13_crc_mismatch_