19#include "fmt/format.h"
33 for (
auto& gbtUniqueId : gbtUniqueIds) {
36 for (
int ilink = 0; ilink < 10; ++ilink) {
37 bool isLoc = ilink < 8;
40#if defined(MID_RAW_VECTORS)
41 mDataShapers.emplace_back(shaper);
43 auto uniqueRegLocId = makeUniqueId(isLoc, uniqueId);
44 mDataShapers.emplace(uniqueRegLocId, shaper);
50#if defined(MID_RAW_VECTORS)
51 mDecoders.emplace_back(decoder);
53 mDecoders.emplace(uniqueRegLocId, decoder);
59#if defined(MID_RAW_VECTORS)
61 mIndex = [](uint8_t, uint8_t locId,
bool isLoc) {
return 8 * (1 -
static_cast<size_t>(isLoc)) + (locId % 8); };
63 mIndex = [](uint8_t crateId, uint8_t locId,
bool isLoc) {
return 10 * (2 * (crateId % 4) + (locId / 8)) + 8 * (1 -
static_cast<size_t>(isLoc)) + (locId % 8); };
71 auto ds = mDataShapers.find(uniqueId);
72 if (
ds == mDataShapers.end()) {
79 auto& err = mErrors[uniqueId];
81 static unsigned int nTotalErr = 0;
82 if (err == 1 && nTotalErr++ < 3) {
85 for (
int ich = 0; ich < 4; ++ich) {
86 board.patternsBP[ich] = decoder.
getPattern(0, ich);
87 board.patternsNBP[ich] = decoder.
getPattern(1, ich);
89 LOG(alarm) <<
"FEEId: " << mFeeId <<
" board not found: " << board;
93 return ds->second.onDone(decoder,
data, rofs);
99 for (
auto& shaper : mDataShapers) {
100#if defined(MID_RAW_VECTORS)
101 shaper.set(
orbit, trigger);
103 shaper.second.set(
orbit, trigger);
MID e-link data shaper manager.
uint8_t getInputs() const
Gets the inputs.
uint8_t getStatusWord() const
Gets the status word.
uint16_t getPattern(int cathode, int chamber) const
uint8_t getTriggerWord() const
Gets the trigger word.
void setBareDecoder(bool isBare)
void init(uint16_t feeId, bool isDebugMode, bool isBare=false, const ElectronicsDelay &electronicsDelay=ElectronicsDelay(), const FEEIdConfig &feeIdConfig=FEEIdConfig())
void onDone(const ELinkDecoder &decoder, uint8_t boardUniqueId, std::vector< ROBoard > &data, std::vector< ROFRecord > &rofs)
Main function to be executed when decoding is done.
void set(uint32_t orbit, uint32_t trigger)
const std::vector< uint16_t > & getGBTUniqueIdsInLink(uint16_t feeId) const
uint8_t getCrateIdFromGBTUniqueId(uint16_t gbtUniqueId)
Gets the crate ID from the GBT unique ID.
uint8_t getGBTIdInCrate(uint16_t gbtUniqueId)
Gets the link ID in crate from the RO ID.
uint8_t makeUniqueLocID(uint8_t crateId, uint8_t locId)
bool isLoc(uint8_t statusWord)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"