1 #ifndef EventFilter_SiStripRawToDigi_SiStripFEDBufferGenerator_H
2 #define EventFilter_SiStripRawToDigi_SiStripFEDBufferGenerator_H
4 #include "boost/cstdint.hpp"
24 ChannelData(
bool dataIsAlreadyConvertedTo8Bit,
const size_t numberOfSamples,
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;
36 void setSample(
const uint16_t sampleNumber,
const uint16_t adcValue);
39 const uint16_t&
operator [] (
const size_t sampleNumber)
const;
66 const uint8_t*
data()
const;
68 uint16_t
getFELength(
const uint8_t internalFEUnitNum)
const;
71 void appendToBuffer(
size_t* pIndexInBuffer, std::vector<uint8_t>::const_iterator
start, std::vector<uint8_t>::const_iterator finish);
107 const uint16_t bxID = 0,
108 const std::vector<bool>& feUnitsEnabled = std::vector<bool>(
FEUNITS_PER_FED,
true),
109 const std::vector<bool>& channelsEnabled = std::vector<bool>(
FEDCH_PER_FED,
true),
149 const uint16_t sourceID)
const;
153 static void fillBuffer(uint8_t* pointerToStartOfBuffer,
189 return channel(internalFEDChannelNum);
194 return channel(internalFEDChannelNum);
198 const std::pair<uint16_t,uint16_t> medians)
200 data_(numberOfSamples,0),
201 dataIs8Bit_(dataIsAlreadyConvertedTo8Bit)
211 return data_[sampleNumber];
217 return const_cast<uint16_t&
>(
static_cast<const ChannelData&
>(*this)[sampleNumber]);
231 return data_[sampleNumber];
236 if (dataIs8Bit_)
return (0xFF & getSample(sampleNumber));
238 const uint16_t
sample = getSample(sampleNumber);
239 if (sample < 0xFE)
return sample;
240 else if (sample == 0x3FF)
return 0xFF;
264 data_[((*pIndexInBuffer)++)^7] = value;
269 for (std::vector<uint8_t>::const_iterator iVal = start; iVal != finish; iVal++) {
270 appendToBuffer(pIndexInBuffer,*iVal);
277 : feUnitsEnabled_(feUnitsEnabled),
278 channelsEnabled_(channelsEnabled)
394 #endif //ndef EventFilter_SiStripRawToDigi_FEDBufferGenerator_H
FEDBufferGenerator & setChannelEnables(const std::vector< bool > &channelsEnabled)
FEDDAQHeader defaultDAQHeader_
void fillZeroSuppressedChannelBuffer(std::vector< uint8_t > *channelBuffer, const FEDStripData::ChannelData &data, const bool channelEnabled) const
void setSample(const uint16_t sampleNumber, const uint16_t adcValue)
tuple start
Check for commandline option errors.
void generateBuffer(FEDRawData *rawDataObject, const FEDStripData &data, const uint16_t sourceID) const
void setMedians(const std::pair< uint16_t, uint16_t > values)
FEDBufferGenerator & setReadoutMode(const FEDReadoutMode newReadoutMode)
FEDBufferPayload(const std::vector< std::vector< uint8_t > > &channelBuffers)
static size_t bufferSizeInBytes(const FEDFEHeader &feHeader, const FEDBufferPayload &payload)
void fillClusterData(std::vector< uint8_t > *channelBuffer, const FEDStripData::ChannelData &data) const
FEDStripData(const std::vector< ChannelData > &data)
uint8_t internalFEDChannelNum(const uint8_t internalFEUnitNum, const uint8_t internalFEUnitChannelNum)
std::vector< bool > channelsEnabled_
TrackerSpecialHeader & trackerSpecialHeader()
FEDBufferGenerator & setBufferFormat(const FEDBufferFormat newBufferFormat)
FEDReadoutMode getReadoutMode() const
FEDBufferFormat getBufferFormat() const
ChannelData(bool dataIsAlreadyConvertedTo8Bit, const size_t numberOfSamples, const std::pair< uint16_t, uint16_t > medians=std::make_pair< uint16_t >(0, 0))
FEDDataType getFEDDataType() const
FEDDAQTrailer & daqTrailer()
FEDBufferPayloadCreator(const std::vector< bool > &enabledFEUnits, const std::vector< bool > &enabledChannels)
std::vector< bool > feUnitsEnabled_
std::vector< bool > channelsEnabled_
uint8_t get8BitSample(const uint16_t sampleNumber) const
FEDBufferGenerator & setFEUnitEnables(const std::vector< bool > &feUnitsEnabled)
std::vector< uint16_t > data_
FEDBufferGenerator & setFEDDataType(const FEDDataType newFEDDataType)
std::pair< uint16_t, uint16_t > getMedians() const
static const uint16_t FEUNITS_PER_FED
const uint8_t * data() const
FEDDAQTrailer defaultDAQTrailer_
uint16_t getFELength(const uint8_t internalFEUnitNum) 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 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, const FEDDataType dataType=DATA_TYPE_FAKE)
FEDBufferPayload createPayload(const FEDReadoutMode mode, const FEDStripData &data) const
void fillZeroSuppressedLiteChannelBuffer(std::vector< uint8_t > *channelBuffer, const FEDStripData::ChannelData &data, const bool channelEnabled) const
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
std::auto_ptr< FEDFEHeader > defaultFEHeader_
FEDBufferPayload operator()(const FEDReadoutMode mode, const FEDStripData &data) 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_
void fillChannelBuffer(std::vector< uint8_t > *channelBuffer, const FEDReadoutMode mode, const FEDStripData::ChannelData &data, const bool channelEnabled) const
std::pair< uint16_t, uint16_t > medians_
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_
FEDDAQHeader & daqHeader()
FEDHeaderType getHeaderType() const
uint16_t & operator[](const size_t sampleNumber)