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 void print(std::ostream& os)
const override;
32 bool feGood(
const uint8_t internalFEUnitNum)
const;
37 bool fePresent(uint8_t internalFEUnitNum)
const;
40 virtual bool channelGood(
const uint8_t internalFEDannelNum,
const bool doAPVeCheck=
true)
const;
46 virtual bool doChecks(
bool doCRC=
true)
const;
65 bool checkStatusBits(
const uint8_t internalFEUnitNum,
const uint8_t internalChannelNum)
const;
95 uint8_t sampleNumber()
const;
97 uint16_t adcPreMix()
const;
103 FEDZSChannelUnpacker(
const uint8_t*
payload,
const uint16_t channelPayloadOffset,
const int16_t channelPayloadLength,
const uint16_t offsetIncrement=1);
104 void readNewClusterInfo();
105 static void throwBadChannelLength(
const uint16_t length);
106 void throwBadClusterLength();
107 static void throwUnorderedData(
const uint8_t currentStrip,
const uint8_t firstStripOfNewCluster);
125 uint8_t sampleNumber()
const;
126 uint16_t
adc()
const;
127 bool hasData()
const;
131 static void throwBadChannelLength(
const uint16_t length);
146 uint8_t sampleNumber()
const;
147 uint16_t
adc()
const;
148 bool hasData()
const;
153 FEDBSChannelUnpacker(
const uint8_t*
payload,
const uint16_t channelPayloadOffset,
const int16_t channelPayloadLength,
const uint16_t offsetIncrement,
bool useZS);
154 void readNewClusterInfo();
155 static void throwBadChannelLength(
const uint16_t length);
156 static void throwBadWordLength(
const uint16_t word_length);
157 static void throwUnorderedData(
const uint8_t currentStrip,
const uint8_t firstStripOfNewCluster);
199 return feHeader_->checkChannelStatusBits(internalFEDChannelNum);
211 oldWordOffset_(0), currentWordOffset_(0),
212 currentBitOffset_(0), currentLocalBitOffset_(0),
213 bitOffsetIncrement_(10),
215 channelPayloadOffset_(0), channelPayloadLength_(0),
216 useZS_(
false), valuesLeftInCluster_(0)
233 uint16_t length = channel.
length();
242 uint16_t length = channel.
length();
250 uint16_t length = channel.
length();
300 ++(*this);
return *
this;
314 currentOffset_(channel.
offset()+3),
316 valuesLeft_((channel.length()-3)/2)
346 ++(*this);
return *
this;
354 valuesLeftInCluster_(0),
355 channelPayloadOffset_(0),
356 channelPayloadLength_(0)
373 uint16_t length = channel.
length();
381 uint16_t length = channel.
length();
390 uint16_t length = channel.
length();
435 ++(*this);
return *
this;
446 #endif //ndef EventFilter_SiStripRawToDigi_SiStripFEDBuffer_H int adc(sample_type sample)
get the ADC sample (12 bits)
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)
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)
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
uint8_t valuesLeftInCluster_
const FEDChannel & channel(const uint8_t internalFEDChannelNum) const
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
std::string checkSummary() const override
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
char data[epos_bytes_allocation]
bool checkAllChannelStatusBits() const
static void throwBadChannelLength(const uint16_t length)
virtual bool channelGood(const uint8_t internalFEDChannelNum) const
uint16_t channelPayloadLength_
uint16_t calculateFEUnitLength(const uint8_t internalFEUnitNumber) const
bool checkChannelLengths() const
bool feGood(const uint8_t internalFEUnitNum) const
FEDBSChannelUnpacker & operator++()
void print(std::ostream &os) const override
bool feOverflow(const uint8_t internalFEUnitNum) const
uint16_t offsetIncrement_