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;
37 void setSample(
const uint16_t sampleNumber,
const uint16_t adcValue);
40 const uint16_t&
operator [] (
const size_t sampleNumber)
const;
67 const uint8_t*
data()
const;
69 uint16_t
getFELength(
const uint8_t internalFEUnitNum)
const;
72 void appendToBuffer(
size_t* pIndexInBuffer, std::vector<uint8_t>::const_iterator
start, std::vector<uint8_t>::const_iterator finish);
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),
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 uint16_t
sample = getSample(sampleNumber);
245 sample = (sample>>1);
249 sample = (sample>>2);
252 throw cms::Exception(
"FEDBufferGenerator") <<
"Invalid readout mode requested for 8-bit sample retrieval";
255 return (0xFF & sample);
258 if (sample < 0xFE)
return sample;
259 else if (sample == 0x3FF)
return 0xFF;
267 return (0xFF & getSample(sampleNumber));
270 const uint16_t
sample = getSample(sampleNumber);
271 if (sample < 0x3FF)
return sample;
295 data_[((*pIndexInBuffer)++)^7] = value;
300 for (std::vector<uint8_t>::const_iterator iVal = start; iVal != finish; iVal++) {
301 appendToBuffer(pIndexInBuffer,*iVal);
308 : feUnitsEnabled_(feUnitsEnabled),
309 channelsEnabled_(channelsEnabled)
414 #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 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)
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))
uint16_t get10BitSample(const uint16_t sampleNumber) const
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_
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 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
void fillClusterData(std::vector< uint8_t > *channelBuffer, const FEDStripData::ChannelData &data, const FEDReadoutMode mode) const
FEDBufferPayload createPayload(const FEDReadoutMode mode, const FEDStripData &data) 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
std::auto_ptr< FEDFEHeader > defaultFEHeader_
void fillPreMixRawChannelBuffer(std::vector< uint8_t > *channelBuffer, const FEDStripData::ChannelData &data, const bool channelEnabled) const
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
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_
uint8_t get8BitSample(const uint16_t sampleNumber, const FEDReadoutMode mode) const
FEDDAQHeader & daqHeader()
FEDHeaderType getHeaderType() const
uint16_t & operator[](const size_t sampleNumber)