1 #ifndef EventFilter_SiStripRawToDigi_SiStripFEDBuffer_H
2 #define EventFilter_SiStripRawToDigi_SiStripFEDBuffer_H
4 #include "boost/cstdint.hpp"
27 FEDBuffer(
const uint8_t* fedBuffer,
const uint16_t fedBufferSize,
const bool allowBadBuffer =
false);
29 virtual void print(std::ostream& os)
const;
32 bool feGood(
const uint8_t internalFEUnitNum)
const;
37 bool fePresent(uint8_t internalFEUnitNum)
const;
39 virtual bool channelGood(
const uint8_t internalFEDannelNum,
const bool doAPVeCheck=
true)
const;
44 virtual bool doChecks(
bool doCRC=
true)
const;
63 bool checkStatusBits(
const uint8_t internalFEUnitNum,
const uint8_t internalChannelNum)
const;
101 FEDZSChannelUnpacker(
const uint8_t* payload,
const uint16_t channelPayloadOffset,
const int16_t channelPayloadLength,
const uint16_t offsetIncrement=1);
105 static void throwUnorderedData(
const uint8_t currentStrip,
const uint8_t firstStripOfNewCluster);
124 uint16_t
adc()
const;
145 uint16_t
adc()
const;
151 FEDBSChannelUnpacker(
const uint8_t* payload,
const uint16_t channelPayloadOffset,
const int16_t channelPayloadLength,
const uint16_t offsetIncrement,
bool useZS);
155 static void throwUnorderedData(
const uint8_t currentStrip,
const uint8_t firstStripOfNewCluster);
197 return feHeader_->checkChannelStatusBits(internalFEDChannelNum);
209 oldWordOffset_(0), currentWordOffset_(0),
210 currentBitOffset_(0), currentLocalBitOffset_(0),
211 bitOffsetIncrement_(10),
213 channelPayloadOffset_(0), channelPayloadLength_(0),
214 useZS_(
false), valuesLeftInCluster_(0)
219 oldWordOffset_(0), currentWordOffset_(channelPayloadOffset),
220 currentBitOffset_(0), currentLocalBitOffset_(0),
221 bitOffsetIncrement_(offsetIncrement),
222 channelPayloadOffset_(channelPayloadOffset),
223 channelPayloadLength_(channelPayloadLength),
224 useZS_(useZS), valuesLeftInCluster_(0)
231 uint16_t length = channel.
length();
240 uint16_t length = channel.
length();
248 uint16_t length = channel.
length();
298 ++(*this);
return *
this;
311 : data_(channel.
data()),
312 currentOffset_(channel.
offset()+3),
314 valuesLeft_((channel.length()-3)/2)
344 ++(*this);
return *
this;
352 valuesLeftInCluster_(0),
353 channelPayloadOffset_(0),
354 channelPayloadLength_(0)
359 currentOffset_(channelPayloadOffset),
360 offsetIncrement_(offsetIncrement),
362 valuesLeftInCluster_(0),
363 channelPayloadOffset_(channelPayloadOffset),
364 channelPayloadLength_(channelPayloadLength)
371 uint16_t length = channel.
length();
379 uint16_t length = channel.
length();
388 uint16_t length = channel.
length();
433 ++(*this);
return *
this;
444 #endif //ndef EventFilter_SiStripRawToDigi_SiStripFEDBuffer_H
static FEDRawChannelUnpacker procRawModeUnpacker(const FEDChannel &channel)
virtual bool doChecks() const
std::auto_ptr< FEDFEHeader > feHeader_
static void throwUnorderedData(const uint8_t currentStrip, const uint8_t firstStripOfNewCluster)
bool checkFEUnitLengths() const
static FEDZSChannelUnpacker zeroSuppressedModeUnpacker(const FEDChannel &channel)
bool checkStatusBits(const uint8_t internalFEDChannelNum) const
static void throwBadChannelLength(const uint16_t length)
virtual bool doCorruptBufferChecks() const
static void throwBadWordLength(const uint16_t word_length)
virtual void print(std::ostream &os) const
bool checkFEPayloadsPresent() const
static FEDZSChannelUnpacker preMixRawModeUnpacker(const FEDChannel &channel)
static FEDRawChannelUnpacker scopeModeUnpacker(const FEDChannel &channel)
void readNewClusterInfo()
static FEDRawChannelUnpacker virginRawModeUnpacker(const FEDChannel &channel)
FEDRawChannelUnpacker(const FEDChannel &channel)
uint8_t internalFEDChannelNum(const uint8_t internalFEUnitNum, const uint8_t internalFEUnitChannelNum)
uint16_t currentBitOffset_
static FEDBSChannelUnpacker zeroSuppressedModeUnpacker(const FEDChannel &channel, uint16_t num_bits)
static void throwBadChannelLength(const uint16_t length)
void throwBadClusterLength()
static void throwUnorderedData(const uint8_t currentStrip, const uint8_t firstStripOfNewCluster)
static FEDBSChannelUnpacker zeroSuppressedLiteModeUnpacker(const FEDChannel &channel, uint16_t num_bits)
static FEDBSChannelUnpacker virginRawModeUnpacker(const FEDChannel &channel, uint16_t num_bits)
const FEDFEHeader * feHeader() const
virtual bool channelGood(const uint8_t internalFEDannelNum, const bool doAPVeCheck=true) const
bool feGoodWithoutAPVEmulatorCheck(const uint8_t internalFEUnitNum) const
bool fePresent_[FEUNITS_PER_FED]
void setLegacyMode(bool legacy)
uint8_t sampleNumber() const
uint16_t adcPreMix() const
const uint8_t * payloadPointer_
bool fePresent(uint8_t internalFEUnitNum) const
bool majorityAddressErrorForFEUnit(const uint8_t internalFEUnitNum) const
static const uint16_t FEUNITS_PER_FED
uint8_t sampleNumber() const
uint16_t channelPayloadLength_
uint8_t valuesLeftInCluster_
uint8_t packetCode(bool legacy=false, const uint8_t internalFEDChannelNum=0) const
virtual std::string checkSummary() const
uint8_t valuesLeftInCluster_
uint16_t channelPayloadOffset_
FEDRawChannelUnpacker & operator++()
bool checkChannelPacketCodes() const
void readNewClusterInfo()
uint8_t sampleNumber() const
FEDZSChannelUnpacker & operator++()
static FEDZSChannelUnpacker zeroSuppressedLiteModeUnpacker(const FEDChannel &channel)
uint8_t nFEUnitsPresent() const
uint16_t currentWordOffset_
uint16_t currentLocalBitOffset_
uint16_t bitOffsetIncrement_
uint16_t channelPayloadOffset_
bool checkFEUnitAPVAddresses() const
const uint8_t * data() const
FEDBuffer(const uint8_t *fedBuffer, const uint16_t fedBufferSize, const bool allowBadBuffer=false)
uint8_t getCorrectPacketCode() const
bool checkChannelLengthsMatchBufferLength() const
bool checkAllChannelStatusBits() const
static void throwBadChannelLength(const uint16_t length)
uint16_t channelPayloadLength_
uint16_t calculateFEUnitLength(const uint8_t internalFEUnitNumber) const
bool checkChannelLengths() const
volatile std::atomic< bool > shutdown_flag false
bool feGood(const uint8_t internalFEUnitNum) const
FEDBSChannelUnpacker & operator++()
bool feOverflow(const uint8_t internalFEUnitNum) const
uint16_t offsetIncrement_