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;
66 size_t lengthInBytes()
const;
68 const uint8_t*
data()
const;
70 uint16_t getFELength(
const uint8_t internalFEUnitNum)
const;
73 void appendToBuffer(
size_t* pIndexInBuffer,
const uint8_t
value);
74 void appendToBuffer(
size_t* pIndexInBuffer,
75 std::vector<uint8_t>::const_iterator
start,
76 std::vector<uint8_t>::const_iterator finish);
93 void fillChannelBuffer(std::vector<uint8_t>* channelBuffer,
97 const bool channelEnabled)
const;
99 void fillRawChannelBuffer(std::vector<uint8_t>* channelBuffer,
100 const uint8_t packetCode,
102 const bool channelEnabled,
103 const bool reorderData)
const;
105 void fillZeroSuppressedChannelBuffer(std::vector<uint8_t>* channelBuffer,
106 const uint8_t packetCode,
108 const bool channelEnabled)
const;
109 void fillZeroSuppressedLiteChannelBuffer(std::vector<uint8_t>* channelBuffer,
111 const bool channelEnabled,
113 void fillPreMixRawChannelBuffer(std::vector<uint8_t>* channelBuffer,
115 const bool channelEnabled)
const;
117 void fillClusterData(std::vector<uint8_t>* channelBuffer,
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),
138 uint32_t getL1ID()
const;
139 uint16_t getBXID()
const;
152 bool getFEUnitEnabled(
const uint8_t internalFEUnitNumber)
const;
153 bool getChannelEnabled(
const uint8_t internalFEDChannelNumber)
const;
155 FEDBufferGenerator& setChannelEnable(
const uint8_t internalFEDChannelNumber,
const bool enabled);
167 void generateBuffer(
FEDRawData* rawDataObject,
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&
>(
static_cast<const ChannelData&
>(*this)[sampleNumber]);
239 return data_[sampleNumber];
245 return (0xFF & sample);
249 else if (sample == 0x3FF)
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) {}
307 return defaultTrackerSpecialHeader_.readoutMode();
313 return defaultTrackerSpecialHeader_.bufferFormat();
319 defaultDAQHeader_.
setL1ID(newL1ID);
324 defaultDAQHeader_.
setBXID(newBXID);
344 defaultDAQHeader_.setEventType(newDAQEventType);
363 #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_
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)
std::pair< uint16_t, uint16_t > medians_