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,
206 return channel(internalFEDChannelNum);
210 return channel(internalFEDChannelNum);
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;
245 return (0xFF & sample);
249 else if (sample == 0x3FF)
258 return (0xFF & getSample(sampleNumber));
260 const uint16_t
sample = getSample(sampleNumber);
277 data_[((*pIndexInBuffer)++) ^ 7] = value;
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)
void fillClusterDataPreMixMode(std::vector< uint8_t > *channelBuffer, const FEDStripData::ChannelData &data) const
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)
FEDBufferPayload operator()(FEDReadoutMode mode, uint8_t packetCode, const FEDStripData &data) 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)
void fillClusterData(std::vector< uint8_t > *channelBuffer, uint8_t packetCode, const FEDStripData::ChannelData &data, const FEDReadoutMode mode) const
std::vector< bool > channelsEnabled_
TrackerSpecialHeader & trackerSpecialHeader()
FEDBufferGenerator & setBufferFormat(const FEDBufferFormat newBufferFormat)
FEDReadoutMode getReadoutMode() const
FEDBufferFormat getBufferFormat() const
void fillZeroSuppressedChannelBuffer(std::vector< uint8_t > *channelBuffer, const uint8_t packetCode, const FEDStripData::ChannelData &data, const bool channelEnabled) 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))
uint16_t get10BitSample(const uint16_t sampleNumber) const
FEDDAQTrailer & daqTrailer()
uint8_t get8BitSample(const uint16_t sampleNumber, uint16_t nBotBitsToDrop) const
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_
std::pair< uint16_t, uint16_t > getMedians() const
static const uint16_t FEUNITS_PER_FED
void fillZeroSuppressedLiteChannelBuffer(std::vector< uint8_t > *channelBuffer, const FEDStripData::ChannelData &data, const bool channelEnabled, const FEDReadoutMode mode) const
const uint8_t * data() const
FEDDAQTrailer defaultDAQTrailer_
uint16_t getFELength(const uint8_t internalFEUnitNum) const
void generateBuffer(FEDRawData *rawDataObject, const FEDStripData &data, uint16_t sourceID, uint8_t packetCode) 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 fillChannelBuffer(std::vector< uint8_t > *channelBuffer, FEDReadoutMode mode, uint8_t packetCode, const FEDStripData::ChannelData &data, const bool channelEnabled) 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
FEDBufferGenerator & setHeaderType(const FEDHeaderType newHeaderType)
ChannelData & channel(const uint8_t internalFEDChannelNum)
ChannelData & operator[](const uint8_t internalFEDChannelNum)
FEDBufferGenerator & setL1ID(const uint32_t newL1ID)
uint16_t getSample(const uint16_t sampleNumber) const
void fillPreMixRawChannelBuffer(std::vector< uint8_t > *channelBuffer, const FEDStripData::ChannelData &data, const bool channelEnabled) const
FEDBufferGenerator & setFEUnitEnable(const uint8_t internalFEUnitNumber, const bool enabled)
bool getFEUnitEnabled(const uint8_t internalFEUnitNumber) const
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_
size_t lengthInBytes() const
std::vector< uint8_t > data_
bool getChannelEnabled(const uint8_t internalFEDChannelNumber) const
FEDDAQEventType getDAQEventType() const
FEDBufferGenerator & setBXID(const uint16_t newBXID)
TrackerSpecialHeader defaultTrackerSpecialHeader_
FEDBufferPayload createPayload(FEDReadoutMode mode, uint8_t packetCode, const FEDStripData &data) const
FEDDAQHeader & daqHeader()
FEDHeaderType getHeaderType() const
uint16_t & operator[](const size_t sampleNumber)
std::pair< uint16_t, uint16_t > medians_