1 #ifndef EventFilter_SiStripRawToDigi_SiStripFEDBufferGenerator_H 2 #define EventFilter_SiStripRawToDigi_SiStripFEDBufferGenerator_H 4 #include "boost/cstdint.hpp" 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);
40 const uint16_t&
operator [] (
const size_t sampleNumber)
const;
65 size_t lengthInBytes()
const;
67 const uint8_t*
data()
const;
69 uint16_t getFELength(
const uint8_t internalFEUnitNum)
const;
71 void appendToBuffer(
size_t* pIndexInBuffer,
const uint8_t
value);
72 void appendToBuffer(
size_t* pIndexInBuffer, std::vector<uint8_t>::const_iterator
start, std::vector<uint8_t>::const_iterator finish);
89 void fillChannelBuffer(std::vector<uint8_t>* channelBuffer,
FEDReadoutMode mode, uint8_t packetCode,
92 void fillRawChannelBuffer(std::vector<uint8_t>* channelBuffer,
const uint8_t packetCode,
95 void fillZeroSuppressedChannelBuffer(std::vector<uint8_t>* channelBuffer,
const uint8_t packetCode,
const FEDStripData::ChannelData& data,
const bool channelEnabled)
const;
97 void fillPreMixRawChannelBuffer(std::vector<uint8_t>* channelBuffer,
const FEDStripData::ChannelData& data,
const bool channelEnabled)
const;
110 const uint16_t bxID = 0,
111 const std::vector<bool>& feUnitsEnabled = std::vector<bool>(
FEUNITS_PER_FED,
true),
112 const std::vector<bool>& channelsEnabled = std::vector<bool>(
FEDCH_PER_FED,
true),
118 uint32_t getL1ID()
const;
119 uint16_t getBXID()
const;
132 bool getFEUnitEnabled(
const uint8_t internalFEUnitNumber)
const;
133 bool getChannelEnabled(
const uint8_t internalFEDChannelNumber)
const;
135 FEDBufferGenerator& setChannelEnable(
const uint8_t internalFEDChannelNumber,
const bool enabled);
147 void generateBuffer(
FEDRawData* rawDataObject,
150 uint8_t packetCode)
const;
154 static void fillBuffer(uint8_t* pointerToStartOfBuffer,
161 static size_t bufferSizeInBytes(
const FEDFEHeader& feHeader,
190 return channel(internalFEDChannelNum);
195 return channel(internalFEDChannelNum);
199 const std::pair<uint16_t,uint16_t> medians)
201 data_(numberOfSamples,0),
202 dataIs8Bit_(dataIsAlreadyConvertedTo8Bit)
212 return data_[sampleNumber];
218 return const_cast<uint16_t&
>(
static_cast<const ChannelData&
>(*this)[sampleNumber]);
232 return data_[sampleNumber];
239 return (0xFF & sample);
242 if (sample < 0xFE)
return sample;
243 else if (sample == 0x3FF)
return 0xFF;
255 if (sample < 0x3FF)
return sample;
279 data_[((*pIndexInBuffer)++)^7] = value;
284 for (std::vector<uint8_t>::const_iterator iVal = start; iVal != finish; iVal++) {
285 appendToBuffer(pIndexInBuffer,*iVal);
292 : feUnitsEnabled_(feUnitsEnabled),
293 channelsEnabled_(channelsEnabled)
305 return defaultDAQHeader_.l1ID();
310 return defaultDAQHeader_.bxID();
315 return defaultTrackerSpecialHeader_.readoutMode();
320 return defaultTrackerSpecialHeader_.headerType();
325 return defaultTrackerSpecialHeader_.bufferFormat();
330 return defaultDAQHeader_.eventType();
335 defaultDAQHeader_.
setL1ID(newL1ID);
341 defaultDAQHeader_.
setBXID(newBXID);
365 defaultDAQHeader_.setEventType(newDAQEventType);
371 return defaultDAQHeader_;
376 return defaultDAQTrailer_;
381 return defaultTrackerSpecialHeader_;
386 return *defaultFEHeader_;
398 #endif //ndef EventFilter_SiStripRawToDigi_FEDBufferGenerator_H
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
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_
TrackerSpecialHeader & trackerSpecialHeader()
FEDBufferGenerator & setBufferFormat(const FEDBufferFormat newBufferFormat)
FEDReadoutMode getReadoutMode() const
FEDBufferFormat getBufferFormat() 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_
T * createPayload(const std::string &payloadTypeName)
std::vector< uint16_t > data_
std::pair< uint16_t, uint16_t > getMedians() const
static const uint16_t FEUNITS_PER_FED
FEDDAQTrailer defaultDAQTrailer_
void appendToBuffer(size_t *pIndexInBuffer, const uint8_t value)
FEDBufferGenerator & setDAQEventType(const FEDDAQEventType newDAQEventType)
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
char data[epos_bytes_allocation]
std::vector< bool > feUnitsEnabled_
std::vector< uint16_t > feLengths_
static const uint16_t FEDCH_PER_FED
std::vector< ChannelData > data_
std::pair< uint16_t, uint16_t > medians_
size_t lengthInBytes() const
std::vector< uint8_t > data_
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)