CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripFEDBufferGenerator.cc
Go to the documentation of this file.
3 #include <cstring>
4 #include <stdexcept>
5 
6 namespace sistrip {
7 
8  //FEDStripData
9 
10  FEDStripData::FEDStripData(bool dataIsAlreadyConvertedTo8Bit, const size_t samplesPerChannel)
11  : data_(FEDCH_PER_FED,ChannelData(dataIsAlreadyConvertedTo8Bit,samplesPerChannel))
12  {
13  if (samplesPerChannel > SCOPE_MODE_MAX_SCOPE_LENGTH) {
14  std::ostringstream ss;
15  ss << "Scope length " << samplesPerChannel << " is too long. "
16  << "Max scope length is " << SCOPE_MODE_MAX_SCOPE_LENGTH << ".";
17  throw cms::Exception("FEDBufferGenerator") << ss.str();
18  }
19  }
20 
22  {
23  try {
24  return data_.at(internalFEDChannelNum);
25  } catch (const std::out_of_range&) {
26  std::ostringstream ss;
27  ss << "Channel index out of range. (" << uint16_t(internalFEDChannelNum) << ") "
28  << "Index should be in internal numbering scheme (0-95). ";
29  throw cms::Exception("FEDBufferGenerator") << ss.str();
30  }
31  }
32 
33  void FEDStripData::ChannelData::setSample(const uint16_t sampleNumber, const uint16_t value)
34  {
35  if (value > 0x3FF) {
36  std::ostringstream ss;
37  ss << "Sample value (" << value << ") is too large. Maximum allowed is 1023. ";
38  throw cms::Exception("FEDBufferGenerator") << ss.str();
39  }
40  try {
41  data_.at(sampleNumber) = value;
42  } catch (const std::out_of_range&) {
43  std::ostringstream ss;
44  ss << "Sample index out of range. "
45  << "Requesting sample " << sampleNumber
46  << " when channel has only " << data_.size() << " samples.";
47  throw cms::Exception("FEDBufferGenerator") << ss.str();
48  }
49  }
50 
51  //FEDBufferPayload
52 
53  FEDBufferPayload::FEDBufferPayload(const std::vector< std::vector<uint8_t> >& channelBuffers)
54  {
55  //calculate size of buffer and allocate enough memory
56  uint32_t totalSize = 0;
57  for (uint8_t iFE = 0; iFE < FEUNITS_PER_FED; iFE++) {
58  for (uint8_t iCh = 0; iCh < FEDCH_PER_FEUNIT; iCh++) {
59  totalSize += channelBuffers[iFE*FEDCH_PER_FEUNIT+iCh].size();
60  }
61  //if it does not finish on a 64Bit word boundary then take into account padding
62  if (totalSize%8) {
63  totalSize = ((totalSize/8) + 1)*8;
64  }
65  }
66  data_.resize(totalSize);
67  size_t indexInBuffer = 0;
68  feLengths_.reserve(FEUNITS_PER_FED);
69  //copy channel data into buffer with padding and update lengths
70  for (uint8_t iFE = 0; iFE < FEUNITS_PER_FED; iFE++) {
71  const size_t lengthAtStartOfFEUnit = indexInBuffer;
72  //insert data for FE unit
73  for (uint8_t iCh = 0; iCh < FEDCH_PER_FEUNIT; iCh++) {
74  appendToBuffer(&indexInBuffer,channelBuffers[iFE*FEDCH_PER_FEUNIT+iCh].begin(),channelBuffers[iFE*FEDCH_PER_FEUNIT+iCh].end());
75  }
76  //store length
77  feLengths_.push_back(indexInBuffer-lengthAtStartOfFEUnit);
78  //add padding
79  while (indexInBuffer % 8) appendToBuffer(&indexInBuffer,0);
80  }
81  }
82 
83  const uint8_t* FEDBufferPayload::data() const
84  {
85  //vectors are guarenteed to be contiguous
86  if (lengthInBytes()) return &data_[0];
87  //return NULL if there is no data yet
88  else return NULL;
89  }
90 
91  uint16_t FEDBufferPayload::getFELength(const uint8_t internalFEUnitNum) const
92  {
93  try{
94  return feLengths_.at(internalFEUnitNum);
95  } catch (const std::out_of_range&) {
96  std::ostringstream ss;
97  ss << "Invalid FE unit number " << internalFEUnitNum << ". "
98  << "Number should be in internal numbering scheme (0-7). ";
99  throw cms::Exception("FEDBufferGenerator") << ss.str();
100  }
101  }
102 
104  {
105  std::vector< std::vector<uint8_t> > channelBuffers(FEDCH_PER_FED,std::vector<uint8_t>());
106  for (size_t iCh = 0; iCh < FEDCH_PER_FED; iCh++) {
107  if (!feUnitsEnabled_[iCh/FEDCH_PER_FEUNIT]) continue;
108  fillChannelBuffer(&channelBuffers[iCh],mode,data.channel(iCh),channelsEnabled_[iCh]);
109  }
110  return FEDBufferPayload(channelBuffers);
111  }
112 
113  void FEDBufferPayloadCreator::fillChannelBuffer(std::vector<uint8_t>* channelBuffer, const FEDReadoutMode mode,
114  const FEDStripData::ChannelData& data, const bool channelEnabled) const
115  {
116  switch (mode) {
117  case READOUT_MODE_SCOPE:
118  fillRawChannelBuffer(channelBuffer,PACKET_CODE_SCOPE,data,channelEnabled,false);
119  break;
121  fillRawChannelBuffer(channelBuffer,PACKET_CODE_VIRGIN_RAW,data,channelEnabled,true);
122  break;
124  fillRawChannelBuffer(channelBuffer,PACKET_CODE_PROC_RAW,data,channelEnabled,false);
125  break;
127  //case READOUT_MODE_ZERO_SUPPRESSED_CMOVERRIDE:
128  fillZeroSuppressedChannelBuffer(channelBuffer,data,channelEnabled);
129  break;
138  fillZeroSuppressedLiteChannelBuffer(channelBuffer,data,channelEnabled,mode);
139  break;
141  fillPreMixRawChannelBuffer(channelBuffer,data,channelEnabled);
142  break;
143  default:
144  std::ostringstream ss;
145  ss << "Invalid readout mode " << mode;
146  throw cms::Exception("FEDBufferGenerator") << ss.str();
147  break;
148  }
149  }
150 
151  void FEDBufferPayloadCreator::fillRawChannelBuffer(std::vector<uint8_t>* channelBuffer,
152  const uint8_t packetCode,
154  const bool channelEnabled,
155  const bool reorderData) const
156  {
157  const uint16_t nSamples = data.size();
158  //2 bytes per sample + packet code + 2 bytes for length
159  const uint16_t channelLength = nSamples*2 + 3;
160  channelBuffer->reserve(channelLength);
161  //length (max length is 0xFFF)
162  channelBuffer->push_back( channelLength & 0xFF );
163  channelBuffer->push_back( (channelLength & 0xF00) >> 8 );
164  //packet code
165  channelBuffer->push_back(packetCode);
166  //channel samples
167  for (uint16_t sampleNumber = 0; sampleNumber < nSamples; sampleNumber++) {
168  const uint16_t sampleIndex = ( reorderData ? FEDStripOrdering::physicalOrderForStripInChannel(sampleNumber) : sampleNumber );
169  const uint16_t sampleValue = (channelEnabled ? data.getSample(sampleIndex) : 0);
170  channelBuffer->push_back(sampleValue & 0xFF);
171  channelBuffer->push_back((sampleValue & 0x300) >> 8);
172  }
173  }
174 
175  void FEDBufferPayloadCreator::fillZeroSuppressedChannelBuffer(std::vector<uint8_t>* channelBuffer,
177  const bool channelEnabled) const
178  {
179  channelBuffer->reserve(50);
180  //if channel is disabled then create empty channel header and return
181  if (!channelEnabled) {
182  //min length 7
183  channelBuffer->push_back(7);
184  channelBuffer->push_back(0);
185  //packet code
186  channelBuffer->push_back(PACKET_CODE_ZERO_SUPPRESSED);
187  //4 bytes of medians
188  channelBuffer->insert(channelBuffer->end(),4,0);
189  return;
190  }
191  //if channel is not empty
192  //add space for channel length
193  channelBuffer->push_back(0xFF);
194  channelBuffer->push_back(0xFF);
195  //packet code
196  channelBuffer->push_back(PACKET_CODE_ZERO_SUPPRESSED);
197  //add medians
198  const std::pair<uint16_t,uint16_t> medians = data.getMedians();
199  channelBuffer->push_back(medians.first & 0xFF);
200  channelBuffer->push_back((medians.first & 0x300) >> 8);
201  channelBuffer->push_back(medians.second & 0xFF);
202  channelBuffer->push_back((medians.second & 0x300) >> 8);
203  //clusters
204  fillClusterData(channelBuffer,data,READOUT_MODE_ZERO_SUPPRESSED);
205  //set length
206  const uint16_t length = channelBuffer->size();
207  (*channelBuffer)[0] = (length & 0xFF);
208  (*channelBuffer)[1] = ((length & 0x300) >> 8);
209  }
210 
211  void FEDBufferPayloadCreator::fillZeroSuppressedLiteChannelBuffer(std::vector<uint8_t>* channelBuffer,
213  const bool channelEnabled,
214  const FEDReadoutMode mode) const
215  {
216  channelBuffer->reserve(50);
217  //if channel is disabled then create empty channel header and return
218  if (!channelEnabled) {
219  //min length 2
220  channelBuffer->push_back(2);
221  channelBuffer->push_back(0);
222  return;
223  }
224  //if channel is not empty
225  //add space for channel length
226  channelBuffer->push_back(0xFF);
227  channelBuffer->push_back(0xFF);
228  //clusters
229  fillClusterData(channelBuffer,data,mode);
230  //set fibre length
231  const uint16_t length = channelBuffer->size();
232  (*channelBuffer)[0] = (length & 0xFF);
233  (*channelBuffer)[1] = ((length & 0x300) >> 8);
234  }
235 
236  void FEDBufferPayloadCreator::fillPreMixRawChannelBuffer(std::vector<uint8_t>* channelBuffer,
238  const bool channelEnabled) const
239  {
240  channelBuffer->reserve(50);
241  //if channel is disabled then create empty channel header and return
242  if (!channelEnabled) {
243  //min length 7
244  channelBuffer->push_back(7);
245  channelBuffer->push_back(0);
246  //packet code
247  channelBuffer->push_back(PACKET_CODE_ZERO_SUPPRESSED);
248  //4 bytes of medians
249  channelBuffer->insert(channelBuffer->end(),4,0);
250  return;
251  }
252  //if channel is not empty
253  //add space for channel length
254  channelBuffer->push_back(0xFF); channelBuffer->push_back(0xFF);
255  //packet code
256  channelBuffer->push_back(PACKET_CODE_ZERO_SUPPRESSED);
257  //add medians
258  const std::pair<uint16_t,uint16_t> medians = data.getMedians();
259  channelBuffer->push_back(medians.first & 0xFF);
260  channelBuffer->push_back((medians.first & 0x300) >> 8);
261  channelBuffer->push_back(medians.second & 0xFF);
262  channelBuffer->push_back((medians.second & 0x300) >> 8);
263  //clusters
264  fillClusterDataPreMixMode(channelBuffer,data);
265  //set length
266  const uint16_t length = channelBuffer->size();
267  (*channelBuffer)[0] = (length & 0xFF);
268  (*channelBuffer)[1] = ((length & 0x300) >> 8);
269  }
270 
271  void FEDBufferPayloadCreator::fillClusterData(std::vector<uint8_t>* channelBuffer, const FEDStripData::ChannelData& data, const FEDReadoutMode mode) const
272  {
273  uint16_t clusterSize = 0;
274  const uint16_t nSamples = data.size();
275  uint16_t size;
276  switch (mode) {
279  size = 2; break;
280  default:
281  size = 1; break;
282  }
283  for( uint16_t strip = 0; strip < nSamples; ++strip) {
284  uint16_t adc;
285  switch (mode) {
288  adc = data.get10BitSample(strip); break;
289  default:
290  adc = data.get8BitSample(strip,mode); break;
291  }
292 
293  if(adc) {
294  if( clusterSize==0 || strip == STRIPS_PER_APV ) {
295  if(clusterSize) {
296  *(channelBuffer->end() - size*clusterSize - 1) = clusterSize ;
297  clusterSize = 0;
298  }
299  channelBuffer->push_back(strip);
300  channelBuffer->push_back(0); //clustersize
301  }
302  switch (mode) {
305  channelBuffer->push_back(adc & 0xFF);
306  channelBuffer->push_back((adc & 0x0300) >> 8);
307  break;
308  default:
309  channelBuffer->push_back(adc & 0xFF);
310  break;
311  }
312  ++clusterSize;
313  }
314 
315  else if(clusterSize) {
316  *(channelBuffer->end() - size*clusterSize - 1) = clusterSize ;
317  clusterSize = 0;
318  }
319  }
320  if(clusterSize) *(channelBuffer->end() - size*clusterSize - 1) = clusterSize ;
321  }
322 
323  void FEDBufferPayloadCreator::fillClusterDataPreMixMode(std::vector<uint8_t>* channelBuffer, const FEDStripData::ChannelData& data) const
324  {
325  uint16_t clusterSize = 0;
326  const uint16_t nSamples = data.size();
327  for( uint16_t strip = 0; strip < nSamples; ++strip) {
328  const uint16_t adc = data.get10BitSample(strip);
329 
330  if(adc) {
331  if( clusterSize==0 || strip == STRIPS_PER_APV ) {
332  if(clusterSize) {
333  *(channelBuffer->end() - 2*clusterSize - 1) = clusterSize ;
334  clusterSize = 0;
335  }
336  channelBuffer->push_back(strip);
337  channelBuffer->push_back(0); //clustersize
338  }
339  channelBuffer->push_back(adc & 0xFF);
340  channelBuffer->push_back((adc & 0x0300) >> 8);
341 
342  ++clusterSize;
343  }
344 
345  else if(clusterSize) {
346  *(channelBuffer->end() - 2*clusterSize - 1) = clusterSize ;
347  clusterSize = 0;
348  }
349  }
350  if(clusterSize) {
351  *(channelBuffer->end() - 2*clusterSize - 1) = clusterSize ;
352  }
353  }
354 
355  //FEDBufferGenerator
356 
357  FEDBufferGenerator::FEDBufferGenerator(const uint32_t l1ID, const uint16_t bxID,
358  const std::vector<bool>& feUnitsEnabled, const std::vector<bool>& channelsEnabled,
359  const FEDReadoutMode readoutMode, const FEDHeaderType headerType, const FEDBufferFormat bufferFormat,
360  const FEDDAQEventType evtType)
361  : defaultDAQHeader_(l1ID,bxID,0,evtType),
362  defaultDAQTrailer_(0,0),
363  defaultTrackerSpecialHeader_(bufferFormat,readoutMode,headerType),
364  defaultFEHeader_(FEDFEHeader::newFEHeader(headerType)),
365  feUnitsEnabled_(feUnitsEnabled),
366  channelsEnabled_(channelsEnabled)
367  {
368  if (!defaultFEHeader_.get()) {
369  std::ostringstream ss;
370  ss << "Bad header format: " << headerType;
371  throw cms::Exception("FEDBufferGenerator") << ss.str();
372  }
373  }
374 
375  bool FEDBufferGenerator::getFEUnitEnabled(const uint8_t internalFEUnitNumber) const
376  {
377  try {
378  return feUnitsEnabled_.at(internalFEUnitNumber);
379  } catch (const std::out_of_range&) {
380  std::ostringstream ss;
381  ss << "Invalid FE unit number " << internalFEUnitNumber << ". Should be in internal numbering scheme (0-7)";
382  throw cms::Exception("FEDBufferGenerator") << ss.str();
383  }
384  }
385 
386  bool FEDBufferGenerator::getChannelEnabled(const uint8_t internalFEDChannelNumber) const
387  {
388  try {
389  return channelsEnabled_.at(internalFEDChannelNumber);
390  } catch (const std::out_of_range&) {
391 
392  std::ostringstream ss;
393  ss << "Invalid channel number " << internalFEDChannelNumber << ". "
394  << "Should be in internal numbering scheme (0-95)";
395  throw cms::Exception("FEDBufferGenerator") << ss.str();
396  }
397  }
398 
399  FEDBufferGenerator& FEDBufferGenerator::setFEUnitEnable(const uint8_t internalFEUnitNumber, const bool enabled)
400  {
401  try {
402  feUnitsEnabled_.at(internalFEUnitNumber) = enabled;
403  } catch (const std::out_of_range&) {
404  std::ostringstream ss;
405  ss << "Invalid FE unit number " << internalFEUnitNumber << ". "
406  << "Should be in internal numbering scheme (0-7)";
407  throw cms::Exception("FEDBufferGenerator") << ss.str();
408  }
409  return *this;
410  }
411 
412  FEDBufferGenerator& FEDBufferGenerator::setChannelEnable(const uint8_t internalFEDChannelNumber, const bool enabled)
413  {
414  try {
415  channelsEnabled_.at(internalFEDChannelNumber) = enabled;
416  } catch (const std::out_of_range&) {
417  std::ostringstream ss;
418  ss << "Invalid channel number " << internalFEDChannelNumber << ". "
419  <<"Should be in internal numbering scheme (0-95)";
420  throw cms::Exception("FEDBufferGenerator") << ss.str();
421  }
422  return *this;
423  }
424 
425  FEDBufferGenerator& FEDBufferGenerator::setFEUnitEnables(const std::vector<bool>& feUnitEnables)
426  {
427  if (feUnitEnables.size() != FEUNITS_PER_FED) {
428  std::ostringstream ss;
429  ss << "Setting FE enable vector with vector which is the wrong size. Size is " << feUnitEnables.size()
430  << " it must be " << FEUNITS_PER_FED << "." << std::endl;
431  throw cms::Exception("FEDBufferGenerator") << ss.str();
432  }
433  feUnitsEnabled_ = feUnitEnables;
434  return *this;
435  }
436 
437  FEDBufferGenerator& FEDBufferGenerator::setChannelEnables(const std::vector<bool>& channelEnables)
438  {
439  if (channelEnables.size() != FEDCH_PER_FED) {
440  std::ostringstream ss;
441  ss << "Setting FED channel enable vector with vector which is the wrong size. Size is " << channelEnables.size()
442  << " it must be " << FEDCH_PER_FED << "." << std::endl;
443  throw cms::Exception("FEDBufferGenerator") << ss.str();
444  }
445  channelsEnabled_ = channelEnables;
446  return *this;
447  }
448 
449  void FEDBufferGenerator::generateBuffer(FEDRawData* rawDataObject, const FEDStripData& data, const uint16_t sourceID) const
450  {
451  //deal with disabled FE units and channels properly (FE enables, status bits)
453  std::auto_ptr<FEDFEHeader> fedFeHeader(defaultFEHeader_->clone());
454  for (uint8_t iFE = 0; iFE < FEUNITS_PER_FED; iFE++) {
455  const bool enabled = feUnitsEnabled_[iFE];
456  tkSpecialHeader.setFEEnableForFEUnit(iFE,enabled);
457  if (!enabled) {
458  for (uint8_t iFEUnitChannel = 0; iFEUnitChannel < FEDCH_PER_FEUNIT; iFEUnitChannel++) {
459  fedFeHeader->setChannelStatus(iFE,iFEUnitChannel,FEDChannelStatus(0));
460  }
461  }
462  }
463  for (uint8_t iCh = 0; iCh < FEDCH_PER_FED; iCh++) {
464  if (!channelsEnabled_[iCh]) {
465  fedFeHeader->setChannelStatus(iCh,FEDChannelStatus(0));
466  }
467  }
468  //set the source ID
470  daqHeader.setSourceID(sourceID);
471  //build payload
473  const FEDBufferPayload payload = payloadPacker(getReadoutMode(),data);
474  //fill FE lengths
475  for (uint8_t iFE = 0; iFE < FEUNITS_PER_FED; iFE++) {
476  fedFeHeader->setFEUnitLength(iFE,payload.getFELength(iFE));
477  }
478  //resize buffer
479  rawDataObject->resize(bufferSizeInBytes(*fedFeHeader,payload));
480  //fill buffer
481  fillBuffer(rawDataObject->data(),daqHeader,defaultDAQTrailer_,tkSpecialHeader,*fedFeHeader,payload);
482  }
483 
484  void FEDBufferGenerator::fillBuffer(uint8_t* pointerToStartOfBuffer,
485  const FEDDAQHeader& daqHeader,
486  const FEDDAQTrailer& daqTrailer,
487  const TrackerSpecialHeader& tkSpecialHeader,
488  const FEDFEHeader& feHeader,
489  const FEDBufferPayload& payload)
490  {
491  //set the length in the DAQ trailer
492  const size_t lengthInBytes = bufferSizeInBytes(feHeader,payload);
493  FEDDAQTrailer updatedDAQTrailer(daqTrailer);
494  updatedDAQTrailer.setEventLengthIn64BitWords(lengthInBytes/8);
495  //copy pieces into buffer in order
496  uint8_t* bufferPointer = pointerToStartOfBuffer;
497  memcpy(bufferPointer,daqHeader.data(),8);
498  bufferPointer += 8;
499  memcpy(bufferPointer,tkSpecialHeader.data(),8);
500  bufferPointer += 8;
501  memcpy(bufferPointer,feHeader.data(),feHeader.lengthInBytes());
502  bufferPointer += feHeader.lengthInBytes();
503  memcpy(bufferPointer,payload.data(),payload.lengthInBytes());
504  bufferPointer += payload.lengthInBytes();
505  memcpy(bufferPointer,updatedDAQTrailer.data(),8);
506  //update CRC
507  const uint16_t crc = calculateFEDBufferCRC(pointerToStartOfBuffer,lengthInBytes);
508  updatedDAQTrailer.setCRC(crc);
509  memcpy(bufferPointer,updatedDAQTrailer.data(),8);
510  //word swap if necessary
511  if (tkSpecialHeader.wasSwapped()) {
512  for (size_t i = 0; i < 8; i++) {
513  bufferPointer[i] = bufferPointer[i^4];
514  }
515  }
516  }
517 
518 }
int adc(sample_type sample)
get the ADC sample (12 bits)
static uint8_t physicalOrderForStripInChannel(const uint8_t readoutOrderStripIndexInChannel)
FEDBufferGenerator & setChannelEnables(const std::vector< bool > &channelsEnabled)
void fillClusterDataPreMixMode(std::vector< uint8_t > *channelBuffer, const FEDStripData::ChannelData &data) const
virtual size_t lengthInBytes() const =0
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)
int i
Definition: DBlmapReader.cc:9
void generateBuffer(FEDRawData *rawDataObject, const FEDStripData &data, const uint16_t sourceID) const
static const uint8_t PACKET_CODE_SCOPE
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)
#define NULL
Definition: scimark2.h:8
uint16_t calculateFEDBufferCRC(const uint8_t *buffer, const size_t lengthInBytes)
FEDReadoutMode getReadoutMode() const
const uint8_t * data() const
uint16_t get10BitSample(const uint16_t sampleNumber) const
const uint8_t * data() const
static const uint8_t PACKET_CODE_ZERO_SUPPRESSED
TrackerSpecialHeader & setFEEnableForFEUnit(const uint8_t internalFEUnitNum, const bool enabled)
FEDDAQTrailer & setEventLengthIn64BitWords(const uint32_t eventLengthIn64BitWords)
FEDBufferGenerator & setFEUnitEnables(const std::vector< bool > &feUnitsEnabled)
FEDDAQTrailer & setCRC(const uint16_t crc)
void resize(size_t newsize)
Definition: FEDRawData.cc:32
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
uint16_t getFELength(const uint8_t internalFEUnitNum) const
#define end
Definition: vmac.h:37
FEDBufferGenerator & setChannelEnable(const uint8_t internalFEDChannelNumber, const bool enabled)
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 uint8_t PACKET_CODE_PROC_RAW
ChannelData & channel(const uint8_t internalFEDChannelNum)
static const uint16_t FEDCH_PER_FEUNIT
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
FEDDAQHeader & setSourceID(const uint16_t sourceID)
FEDBufferGenerator & setFEUnitEnable(const uint8_t internalFEUnitNumber, const bool enabled)
virtual const uint8_t * data() const =0
bool getFEUnitEnabled(const uint8_t internalFEUnitNumber) const
#define begin
Definition: vmac.h:30
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
static const uint16_t FEDCH_PER_FED
static const uint16_t STRIPS_PER_APV
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
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
bool getChannelEnabled(const uint8_t internalFEDChannelNumber) const
static const uint16_t SCOPE_MODE_MAX_SCOPE_LENGTH
TrackerSpecialHeader defaultTrackerSpecialHeader_
uint8_t get8BitSample(const uint16_t sampleNumber, const FEDReadoutMode mode) const
tuple size
Write out results.
static const uint8_t PACKET_CODE_VIRGIN_RAW