21 feHeader_ = std::unique_ptr<FEDFEHeader>();
74 uint16_t offsetBeginningOfChannel = 0;
87 LogDebug(
"FEDBuffer") <<
"Channel " << uint16_t(
i) <<
" (FE unit " << key.
feUnit() <<
" channel "
88 << key.
feChan() <<
" according to external numbering scheme) "
89 <<
"does not fit into buffer. "
90 <<
"Channel starts at " << uint16_t(offsetBeginningOfChannel) <<
" in payload. "
98 uint16_t channelLength =
channels_.back().length();
101 if UNLIKELY (channelLength < minLength) {
103 LogDebug(
"FEDBuffer") <<
"Channel " << uint16_t(
i) <<
" (FE unit " << key.
feUnit() <<
" channel "
104 << key.
feChan() <<
" according to external numbering scheme)"
106 <<
"Channel starts at " << uint16_t(offsetBeginningOfChannel) <<
" in payload. "
107 <<
"Channel length is " << uint16_t(channelLength) <<
". "
108 <<
"Min length is " << uint16_t(minLength) <<
". ";
114 LogDebug(
"FEDBuffer") <<
"Channel " << uint16_t(
i) <<
" (FE unit " << key.
feUnit() <<
" channel "
115 << key.
feChan() <<
" according to external numbering scheme)"
116 <<
"does not fit into buffer. "
117 <<
"Channel starts at " << uint16_t(offsetBeginningOfChannel) <<
" in payload. "
118 <<
"Channel length is " << uint16_t(channelLength) <<
". "
125 const uint16_t offsetEndOfChannel = offsetBeginningOfChannel + channelLength;
128 uint8_t numPaddingBytes = 8 - (offsetEndOfChannel % 8);
129 if (numPaddingBytes == 8)
131 offsetBeginningOfChannel = offsetEndOfChannel + numPaddingBytes;
133 offsetBeginningOfChannel = offsetEndOfChannel;
176 uint8_t lastEnabledFeUnit = 7;
177 while (!(
fePresent(lastEnabledFeUnit) &&
feEnabled(lastEnabledFeUnit)) && lastEnabledFeUnit != 0)
181 const uint16_t offsetLastChannel = lastChannel.
offset();
182 const uint16_t offsetEndOfChannelData = offsetLastChannel + lastChannel.
length();
183 const uint16_t channelDataLength = offsetEndOfChannelData;
185 uint16_t channelDataLengthInWords = channelDataLength / 8;
186 if (channelDataLength % 8)
187 channelDataLengthInWords++;
190 if (channelDataLengthInWords == payloadLengthInWords) {
200 if (!correctPacketCode)
223 if (goldenAddress == 0x00)
259 uint16_t lengthFromChannels = 0;
263 return lengthFromChannels;
280 summary <<
"FE units missing payloads: ";
283 summary << uint16_t(iFE) <<
" ";
285 summary << std::endl;
289 unsigned int badChannels = 0;
297 summary << uint16_t(iCh) <<
": " << fdHeader->
getChannelStatus(iCh) << std::endl;
303 summary <<
"Channels with errors: ";
308 summary << uint16_t(iCh) <<
" ";
312 summary << std::endl;
314 summary <<
"Number of channels with bad status bits: " << badChannels << std::endl;
316 summary <<
"Check channel lengths match buffer length: "
320 summary <<
"Channels with bad packet codes: ";
325 summary << uint16_t(iCh) <<
" ";
328 summary <<
"Check FE unit lengths: " << (
checkFEUnitLengths() ?
"passed" :
"FAILED") << std::endl;
332 summary <<
"Bad FE units:" << std::endl;
337 uint16_t lengthFromHeader = fdHeader->
feUnitLength(iFE);
338 if (lengthFromHeader != lengthFromChannels) {
339 summary <<
"FE unit: " << uint16_t(iFE) <<
" length in header: " << lengthFromHeader
340 <<
" length from channel lengths: " << lengthFromChannels << std::endl;
351 summary <<
"Address from APVe:" << uint16_t(goldenAddress) << std::endl;
352 summary <<
"Bad FE units:" << std::endl;
357 summary <<
"FE unit: " << uint16_t(iFE)
363 return summary.str();
378 os <<
"FE units with data: " << uint16_t(
nFEUnitsPresent()) << std::endl;
379 os <<
"BE status register flags: ";
386 using namespace sistrip::fedchannelunpacker;
390 case StatusCode::BAD_CHANNEL_LENGTH:
391 return "Channel length is invalid.";
392 case StatusCode::UNORDERED_DATA:
393 return "First strip of new cluster is not greater than last strip of previous cluster.";
394 case StatusCode::BAD_PACKET_CODE:
395 return "Invalid packet code.";
396 case StatusCode::ZERO_PACKET_CODE:
397 return "Invalid packet code 0 for zero-suppressed data.";
bool feDataMissingFlag(const uint8_t internalFEUnitNum) const
bool checkFEUnitLengths() const
bool checkStatusBits(const uint8_t internalFEDChannelNum) const
std::string checkSummary() const override
virtual std::string checkSummary() const
uint8_t apveAddress() const
A container class for generic run and event-related info, information required by the commissioning a...
const uint8_t * getPointerToByteAfterEndOfPayload() const
virtual bool doCorruptBufferChecks() const
bool checkFEPayloadsPresent() const
FEDReadoutMode readoutMode() const
FEDBuffer(const FEDRawData &fedBuffer, const bool allowBadBuffer=false)
uint8_t internalFEDChannelNum(const uint8_t internalFEUnitNum, const uint8_t internalFEUnitChannelNum)
const uint8_t * getPointerToDataAfterTrackerSpecialHeader() const
FEDBufferStatusCode findChannels()
const FEDFEHeader * feHeader() const
std::string toString(fedchannelunpacker::StatusCode status)
bool fePresent_[FEUNITS_PER_FED]
const uint8_t * payloadPointer_
bool fePresent(uint8_t internalFEUnitNum) const
static const uint16_t FEUNITS_PER_FED
bool feEnabled(const uint8_t internalFEUnitNum) const
tuple key
prepare the HTCondor submission files and eventually submit them
FEDHeaderType headerType() const
uint8_t packetCode(bool legacy=false, const uint8_t internalFEDChannelNum=0) const
bool channelGood(const uint8_t internalFEDannelNum, const bool doAPVeCheck) const
std::vector< FEDChannel > channels_
bool checkChannelPacketCodes() const
const uint16_t & feUnit() const
uint8_t nFEUnitsPresent() const
static const uint16_t FEDCH_PER_FEUNIT
std::unique_ptr< FEDFEHeader > feHeader_
bool checkFEUnitAPVAddresses() const
uint8_t getCorrectPacketCode() const
bool checkChannelLengthsMatchBufferLength() const
virtual void print(std::ostream &os) const
static const uint16_t FEDCH_PER_FED
const uint16_t & feChan() const
bool checkAllChannelStatusBits() const
uint16_t calculateFEUnitLength(const uint8_t internalFEUnitNumber) const
bool checkChannelLengths() const
void print(std::ostream &os) const override
bool feGood(const uint8_t internalFEUnitNum) const
FEDStatusRegister fedStatusRegister() const