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;
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;
93 uint8_t sampleNumber()
const;
95 uint16_t adcPreMix()
const;
101 FEDZSChannelUnpacker(
const uint8_t*
payload,
const uint16_t channelPayloadOffset,
const int16_t channelPayloadLength,
const uint16_t offsetIncrement=1);
102 void readNewClusterInfo();
103 static void throwBadChannelLength(
const uint16_t length);
104 void throwBadClusterLength();
105 static void throwUnorderedData(
const uint8_t currentStrip,
const uint8_t firstStripOfNewCluster);
123 uint8_t sampleNumber()
const;
124 uint16_t
adc()
const;
125 bool hasData()
const;
129 static void throwBadChannelLength(
const uint16_t length);
144 uint8_t sampleNumber()
const;
145 uint16_t
adc()
const;
146 bool hasData()
const;
151 FEDBSChannelUnpacker(
const uint8_t*
payload,
const uint16_t channelPayloadOffset,
const int16_t channelPayloadLength,
const uint16_t offsetIncrement,
bool useZS);
152 void readNewClusterInfo();
153 static void throwBadChannelLength(
const uint16_t length);
154 static void throwBadWordLength(
const uint16_t word_length);
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)
231 uint16_t length = channel.
length();
240 uint16_t length = channel.
length();
248 uint16_t length = channel.
length();
298 ++(*this);
return *
this;
312 currentOffset_(channel.
offset()+3),
314 valuesLeft_((channel.length()-3)/2)
344 ++(*this);
return *
this;
352 valuesLeftInCluster_(0),
353 channelPayloadOffset_(0),
354 channelPayloadLength_(0)
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 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)
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_