37 mElinkManager.
init(ulFeeId, isDebugMode,
false, electronicsDelay, feeIdConfig);
41 void operator()(gsl::span<const uint8_t> payload, uint32_t
orbit, uint32_t trigger, std::vector<ROBoard>&
data, std::vector<ROFRecord>& rofs)
46 auto it = payload.begin();
47 auto end = payload.end();
49 if (mELinkDecoder.
isZero(*it)) {
60 if (mELinkDecoder.
add(it,
end)) {
61 mElinkManager.
onDone(mELinkDecoder,
data, rofs);
62 mELinkDecoder.
reset();
79 mElinkManager.
init(feeId, isDebugMode,
true, electronicsDelay);
82 void operator()(gsl::span<const uint8_t> payload, uint32_t
orbit, uint32_t trigger, std::vector<ROBoard>&
data, std::vector<ROFRecord>& rofs)
87 auto it = payload.begin();
88 auto end = payload.end();
90 if (mELinkDecoder.
isZero(*it)) {
101 if (mELinkDecoder.
add(it,
end)) {
102 mElinkManager.
onDone(mELinkDecoder, mCrateId, mOffset + mELinkDecoder.
getId() % 8,
data, rofs);
103 mELinkDecoder.
reset();
111 ELinkDecoder mELinkDecoder{};
112 ELinkManager mElinkManager{};
121 mElinkManager.
init(feeId, isDebugMode,
true, electronicsDelay);
124 for (
int ilink = 0; ilink < 10; ++ilink) {
129 void operator()(gsl::span<const uint8_t> payload, uint32_t
orbit, uint32_t trigger, std::vector<ROBoard>&
data, std::vector<ROFRecord>& rofs)
137 size_t ilink = 0, linkMask = 0, byteOffset = 0;
139 for (
int ireg = 0; ireg < 2; ++ireg) {
140 byteOffset = 5 * ireg;
143 linkMask = (1 << ilink);
144 for (
size_t idx = byteOffset + 4; idx < payload.size(); idx += 16) {
146 if ((mIsFeeding & linkMask) || byte) {
147 processRegDebug(ilink,
byte);
151 for (
int ib = 0; ib < 4; ++ib) {
152 ilink = ib + 4 * ireg;
153 linkMask = (1 << ilink);
154 if (mMask & linkMask) {
155 for (
size_t idx = byteOffset + ib; idx < payload.size(); idx += 16) {
157 if ((mIsFeeding & linkMask) || byte) {
158 processLoc(ilink,
byte);
167 void processLoc(
size_t ilink, uint8_t
byte)
170 auto& decoder = mElinkManager.
getDecoder(mBoardUniqueIds[ilink],
true);
171 if (decoder.getNBytes() > 0) {
173 if (decoder.isComplete()) {
174 mElinkManager.
onDone(decoder, mBoardUniqueIds[ilink], *mData, *mROFs);
176 mIsFeeding &= (~(1 << ilink));
178 }
else if ((
byte & (raw::sSTARTBIT | raw::sCARDTYPE)) == (raw::sSTARTBIT | raw::sCARDTYPE)) {
180 mIsFeeding |= (1 << ilink);
184 void processRegDebug(
size_t ilink, uint8_t
byte)
187 auto& decoder = mElinkManager.
getDecoder(mBoardUniqueIds[ilink],
false);
188 if (decoder.getNBytes() > 0) {
190 if (decoder.isComplete()) {
191 mElinkManager.
onDone(decoder, mBoardUniqueIds[ilink], *mData, *mROFs);
193 mIsFeeding &= (~(1 << ilink));
195 }
else if (
byte & raw::sSTARTBIT) {
197 mIsFeeding |= (1 << ilink);
201 bool mIsDebugMode{
false};
203 uint16_t mIsFeeding{0};
204 ELinkManager mElinkManager{};
205 std::vector<uint8_t> mBoardUniqueIds{};
206 std::vector<ROBoard>* mData{
nullptr};
207 std::vector<ROFRecord>* mROFs{
nullptr};
224 std::cout <<
"Error: GBT decoder not defined for UL. Please use Link decoder instead" << std::endl;
Raw data utilities for MID.
MID e-link data shaper manager.
Hardware Id to FeeId mapper.
Class interface for the MID link decoder.
Structure to store the readout board information.
bool isZero(uint8_t byte) const
Checks if this is a zero.
void add(const uint8_t byte)
Adds a byte.
void setBareDecoder(bool isBare)
uint8_t getId() const
Gets the card ID.
void addAndComputeSize(const uint8_t byte)
ELinkDecoder & getDecoder(uint8_t boardUniqueId, bool isLoc)
Returns the decoder.
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)
void process(gsl::span< const uint8_t > payload, uint32_t orbit, uint32_t trigger, std::vector< ROBoard > &data, std::vector< ROFRecord > &rofs)
std::function< void(gsl::span< const uint8_t >, uint32_t orbit, uint32_t trigger, std::vector< ROBoard > &data, std::vector< ROFRecord > &rofs)> mDecode
void operator()(gsl::span< const uint8_t > payload, uint32_t orbit, uint32_t trigger, std::vector< ROBoard > &data, std::vector< ROFRecord > &rofs)
GBTBareDecoderImplV1(uint16_t feeId, bool isDebugMode=false, uint8_t mask=0xFF, const ElectronicsDelay &electronicsDelay=ElectronicsDelay())
GBTUserLogicDecoderImplV1(uint16_t feeId, bool isDebugMode=false, const ElectronicsDelay &electronicsDelay=ElectronicsDelay())
void operator()(gsl::span< const uint8_t > payload, uint32_t orbit, uint32_t trigger, std::vector< ROBoard > &data, std::vector< ROFRecord > &rofs)
GBTUserLogicDecoderImplV2(uint16_t ulFeeId, bool isDebugMode=false, const ElectronicsDelay &electronicsDelay=ElectronicsDelay(), const FEEIdConfig &feeIdConfig=FEEIdConfig())
void operator()(gsl::span< const uint8_t > payload, uint32_t orbit, uint32_t trigger, std::vector< ROBoard > &data, std::vector< ROFRecord > &rofs)
uint8_t itsSharedClusterMap uint8_t
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 isBare(const o2::header::RDHAny &rdh)
Test if the data comes from the common logic.
std::unique_ptr< LinkDecoder > createGBTDecoder(const o2::header::RDHAny &rdh, uint16_t feeId, bool isDebugMode, uint8_t mask, const ElectronicsDelay &electronicsDelay)
std::unique_ptr< LinkDecoder > createLinkDecoder(const o2::header::RDHAny &rdh, uint16_t feeId, bool isDebugMode, uint8_t mask, const ElectronicsDelay &electronicsDelay, const FEEIdConfig &feeIdConfig)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...