1 #ifndef EventFilter_SiStripRawToDigi_SiStripFEDBuffer_H 2 #define EventFilter_SiStripRawToDigi_SiStripFEDBuffer_H 4 #include "boost/cstdint.hpp" 28 FEDBuffer(
const uint8_t* fedBuffer,
const uint16_t fedBufferSize,
const bool allowBadBuffer =
false);
30 void print(std::ostream& os)
const override;
33 bool feGood(
const uint8_t internalFEUnitNum)
const;
38 bool fePresent(uint8_t internalFEUnitNum)
const;
41 virtual bool channelGood(
const uint8_t internalFEDannelNum,
const bool doAPVeCheck=
true)
const;
47 virtual bool doChecks(
bool doCRC=
true)
const;
66 bool checkStatusBits(
const uint8_t internalFEUnitNum,
const uint8_t internalChannelNum)
const;
96 uint8_t sampleNumber()
const;
98 uint16_t adcPreMix()
const;
104 FEDZSChannelUnpacker(
const uint8_t*
payload,
const uint16_t channelPayloadOffset,
const int16_t channelPayloadLength,
const uint16_t offsetIncrement=1);
105 void readNewClusterInfo();
106 static void throwBadChannelLength(
const uint16_t length);
107 void throwBadClusterLength();
108 static void throwUnorderedData(
const uint8_t currentStrip,
const uint8_t firstStripOfNewCluster);
126 uint8_t sampleNumber()
const;
127 uint16_t
adc()
const;
128 bool hasData()
const;
132 static void throwBadChannelLength(
const uint16_t length);
147 uint8_t sampleNumber()
const;
148 uint16_t
adc()
const;
149 bool hasData()
const;
154 FEDBSChannelUnpacker(
const uint8_t*
payload,
const uint16_t channelPayloadOffset,
const int16_t channelPayloadLength,
const uint16_t offsetIncrement,
bool useZS);
155 void readNewClusterInfo();
156 static void throwBadChannelLength(
const uint16_t length);
157 static void throwBadWordLength(
const uint16_t word_length);
158 static void throwUnorderedData(
const uint8_t currentStrip,
const uint8_t firstStripOfNewCluster);
199 return feHeader_->checkChannelStatusBits(internalFEDChannelNum);
211 oldWordOffset_(0), currentWordOffset_(0),
212 currentLocalBitOffset_(0),
213 bitOffsetIncrement_(10),
215 channelPayloadOffset_(0), channelPayloadLength_(0),
216 useZS_(
false), valuesLeftInCluster_(0)
235 uint16_t length = channel.
length();
244 uint16_t length = channel.
length();
252 uint16_t length = channel.
length();
281 return ( plusOneBitOffset % BITS_PER_BYTE ) ? ( plusOneWordOffset < nextChanWordOffset ) : ( plusOneWordOffset <= nextChanWordOffset );
308 ++(*this);
return *
this;
326 currentOffset_(channel.
offset()+3),
328 valuesLeft_((channel.length()-3)/2)
358 ++(*this);
return *
this;
366 valuesLeftInCluster_(0),
367 channelPayloadOffset_(0),
368 channelPayloadLength_(0)
385 uint16_t length = channel.
length();
393 uint16_t length = channel.
length();
402 uint16_t length = channel.
length();
447 ++(*this);
return *
this;
458 #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)
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_