1 #ifndef EventFilter_SiStripRawToDigi_SiStripFEDBufferGenerator_H 2 #define EventFilter_SiStripRawToDigi_SiStripFEDBufferGenerator_H 25 const std::pair<uint16_t, uint16_t> medians = std::make_pair<uint16_t>(0, 0));
29 std::pair<uint16_t, uint16_t>
getMedians()
const;
33 uint16_t
getSample(
const uint16_t sampleNumber)
const;
35 uint8_t
get8BitSample(
const uint16_t sampleNumber, uint16_t nBotBitsToDrop)
const;
37 void setSample(
const uint16_t sampleNumber,
const uint16_t adcValue);
39 uint16_t&
operator[](
const size_t sampleNumber);
40 const uint16_t&
operator[](
const size_t sampleNumber)
const;
68 const uint8_t*
data()
const;
70 uint16_t
getFELength(
const uint8_t internalFEUnitNum)
const;
75 std::vector<uint8_t>::const_iterator
start,
76 std::vector<uint8_t>::const_iterator finish);
97 const bool channelEnabled)
const;
100 const uint8_t packetCode,
102 const bool channelEnabled,
103 const bool reorderData)
const;
106 const uint8_t packetCode,
108 const bool channelEnabled)
const;
111 const bool channelEnabled,
115 const bool channelEnabled)
const;
130 const uint16_t bxID = 0,
131 const std::vector<bool>& feUnitsEnabled = std::vector<bool>(
FEUNITS_PER_FED,
true),
132 const std::vector<bool>& channelsEnabled = std::vector<bool>(
FEDCH_PER_FED,
true),
170 uint8_t packetCode)
const;
175 static void fillBuffer(uint8_t* pointerToStartOfBuffer,
215 const std::pair<uint16_t, uint16_t> medians)
216 : medians_(medians), data_(
numberOfSamples, 0), dataIs8Bit_(dataIsAlreadyConvertedTo8Bit) {}
221 return data_[sampleNumber];
226 return const_cast<uint16_t&
>(std::as_const(*
this)[sampleNumber]);
239 return data_[sampleNumber];
243 uint16_t
sample = getSample(sampleNumber) >> nBotBitsToDrop;
258 return (0xFF & getSample(sampleNumber));
260 const uint16_t
sample = getSample(sampleNumber);
281 std::vector<uint8_t>::const_iterator
start,
282 std::vector<uint8_t>::const_iterator finish) {
283 for (std::vector<uint8_t>::const_iterator iVal =
start; iVal != finish; iVal++) {
284 appendToBuffer(pIndexInBuffer, *iVal);
291 const std::vector<bool>& channelsEnabled)
292 : feUnitsEnabled_(feUnitsEnabled), channelsEnabled_(channelsEnabled) {}
363 #endif //ndef EventFilter_SiStripRawToDigi_FEDBufferGenerator_H FEDBufferGenerator & setChannelEnables(const std::vector< bool > &channelsEnabled)
FEDDAQHeader defaultDAQHeader_
void setSample(const uint16_t sampleNumber, const uint16_t adcValue)
void setMedians(const std::pair< uint16_t, uint16_t > values)
FEDBufferGenerator & setReadoutMode(const FEDReadoutMode newReadoutMode)
uint16_t getSample(const uint16_t sampleNumber) const
bool getChannelEnabled(const uint8_t internalFEDChannelNumber) const
FEDBufferPayload(const std::vector< std::vector< uint8_t > > &channelBuffers)
static size_t bufferSizeInBytes(const FEDFEHeader &feHeader, const FEDBufferPayload &payload)
FEDStripData(const std::vector< ChannelData > &data)
uint8_t internalFEDChannelNum(const uint8_t internalFEUnitNum, const uint8_t internalFEUnitChannelNum)
std::vector< bool > channelsEnabled_
FEDDAQEventType getDAQEventType() const
size_t lengthInBytes() const
void fillClusterDataPreMixMode(std::vector< uint8_t > *channelBuffer, const FEDStripData::ChannelData &data) const
std::pair< uint16_t, uint16_t > getMedians() const
void fillZeroSuppressedChannelBuffer(std::vector< uint8_t > *channelBuffer, const uint8_t packetCode, const FEDStripData::ChannelData &data, const bool channelEnabled) const
TrackerSpecialHeader & trackerSpecialHeader()
FEDBufferGenerator & setBufferFormat(const FEDBufferFormat newBufferFormat)
FEDReadoutMode getReadoutMode() const
void fillClusterData(std::vector< uint8_t > *channelBuffer, uint8_t packetCode, const FEDStripData::ChannelData &data, const FEDReadoutMode mode) const
std::unique_ptr< FEDFEHeader > defaultFEHeader_
ChannelData(bool dataIsAlreadyConvertedTo8Bit, const size_t numberOfSamples, const std::pair< uint16_t, uint16_t > medians=std::make_pair< uint16_t >(0, 0))
FEDDAQTrailer & daqTrailer()
FEDBufferPayloadCreator(const std::vector< bool > &enabledFEUnits, const std::vector< bool > &enabledChannels)
std::vector< bool > feUnitsEnabled_
std::vector< bool > channelsEnabled_
FEDBufferGenerator & setFEUnitEnables(const std::vector< bool > &feUnitsEnabled)
std::vector< uint16_t > data_
static const uint16_t FEUNITS_PER_FED
FEDDAQTrailer defaultDAQTrailer_
const uint8_t * data() const
uint16_t getFELength(const uint8_t internalFEUnitNum) const
FEDBufferPayload operator()(FEDReadoutMode mode, uint8_t packetCode, const FEDStripData &data) const
void appendToBuffer(size_t *pIndexInBuffer, const uint8_t value)
FEDBufferGenerator & setChannelEnable(const uint8_t internalFEDChannelNumber, const bool enabled)
FEDBufferGenerator & setDAQEventType(const FEDDAQEventType newDAQEventType)
void fillPreMixRawChannelBuffer(std::vector< uint8_t > *channelBuffer, const FEDStripData::ChannelData &data, const bool channelEnabled) const
uint16_t get10BitSample(const uint16_t sampleNumber) const
void fillRawChannelBuffer(std::vector< uint8_t > *channelBuffer, const uint8_t packetCode, const FEDStripData::ChannelData &data, const bool channelEnabled, const bool reorderData) const
FEDBufferGenerator(const uint32_t l1ID=0, const uint16_t bxID=0, const std::vector< bool > &feUnitsEnabled=std::vector< bool >(FEUNITS_PER_FED, true), const std::vector< bool > &channelsEnabled=std::vector< bool >(FEDCH_PER_FED, true), const FEDReadoutMode readoutMode=READOUT_MODE_ZERO_SUPPRESSED, const FEDHeaderType headerType=HEADER_TYPE_FULL_DEBUG, const FEDBufferFormat bufferFormat=BUFFER_FORMAT_OLD_SLINK, const FEDDAQEventType evtType=DAQ_EVENT_TYPE_PHYSICS)
static const uint16_t STRIPS_PER_FEDCH
void fillChannelBuffer(std::vector< uint8_t > *channelBuffer, FEDReadoutMode mode, uint8_t packetCode, const FEDStripData::ChannelData &data, const bool channelEnabled) const
FEDBufferGenerator & setHeaderType(const FEDHeaderType newHeaderType)
ChannelData & channel(const uint8_t internalFEDChannelNum)
ChannelData & operator[](const uint8_t internalFEDChannelNum)
FEDBufferGenerator & setL1ID(const uint32_t newL1ID)
void generateBuffer(FEDRawData *rawDataObject, const FEDStripData &data, uint16_t sourceID, uint8_t packetCode) const
FEDBufferFormat getBufferFormat() const
FEDBufferGenerator & setFEUnitEnable(const uint8_t internalFEUnitNumber, const bool enabled)
char data[epos_bytes_allocation]
std::vector< bool > feUnitsEnabled_
std::vector< uint16_t > feLengths_
static const uint16_t FEDCH_PER_FED
static void fillBuffer(uint8_t *pointerToStartOfBuffer, const FEDDAQHeader &daqHeader, const FEDDAQTrailer &daqTrailer, const TrackerSpecialHeader &tkSpecialHeader, const FEDFEHeader &feHeader, const FEDBufferPayload &payload)
std::vector< ChannelData > data_
bool getFEUnitEnabled(const uint8_t internalFEUnitNumber) const
std::vector< uint8_t > data_
void fillZeroSuppressedLiteChannelBuffer(std::vector< uint8_t > *channelBuffer, const FEDStripData::ChannelData &data, const bool channelEnabled, const FEDReadoutMode mode) const
FEDBufferGenerator & setBXID(const uint16_t newBXID)
FEDHeaderType getHeaderType() const
TrackerSpecialHeader defaultTrackerSpecialHeader_
uint8_t get8BitSample(const uint16_t sampleNumber, uint16_t nBotBitsToDrop) const
FEDDAQHeader & daqHeader()
uint16_t & operator[](const size_t sampleNumber)
FEDBufferPayload createPayload(FEDReadoutMode mode, uint8_t packetCode, const FEDStripData &data) const
std::pair< uint16_t, uint16_t > medians_