CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
sistrip::FEDBufferBase Class Reference

#include <SiStripFEDBufferComponents.h>

Inheritance diagram for sistrip::FEDBufferBase:
sistrip::FEDBuffer sistrip::FEDSpyBuffer

Public Member Functions

uint8_t apveAddress () const
 
FEDBufferFormat bufferFormat () const
 
size_t bufferSize () const
 
uint16_t calcCRC () const
 
const FEDChannelchannel (const uint8_t internalFEDChannelNum) const
 
const FEDChannelchannel (const uint8_t internalFEUnitNum, const uint8_t internalChannelNum) const
 
virtual bool channelGood (const uint8_t internalFEDChannelNum) const
 
bool channelGood (const uint8_t internalFEUnitNum, const uint8_t internalChannelNum) const
 
bool checkAPVEAddressValid () const
 
bool checkBufferFormat () const
 
bool checkCRC () const
 
bool checkHeaderType () const
 
bool checkLengthFromTrailer () const
 
bool checkMajorityAddresses () const
 
bool checkNoExtraHeadersOrTrailers () const
 
bool checkNoFEOverflows () const
 
bool checkNoSlinkCRCError () const
 
bool checkNoSLinkTransmissionError () const
 
bool checkNoUnexpectedSourceID () const
 
bool checkReadoutMode () const
 
bool checkSourceIDs () const
 
virtual std::string checkSummary () const
 
uint16_t daqBXID () const
 
uint16_t daqCRC () const
 
uint32_t daqEventLengthIn64bitWords () const
 
uint32_t daqEventLengthInBytes () const
 
FEDDAQEventType daqEventType () const
 
FEDDAQHeader daqHeader () const
 
uint32_t daqLvl1ID () const
 
uint16_t daqSourceID () const
 
FEDDAQTrailer daqTrailer () const
 
FEDTTSBits daqTTSState () const
 
virtual bool doChecks () const
 
bool doDAQHeaderAndTrailerChecks () const
 
bool doTrackerSpecialHeaderChecks () const
 
void dump (std::ostream &os) const
 
void dumpOriginalBuffer (std::ostream &os) const
 
 FEDBufferBase (const uint8_t *fedBuffer, const size_t fedBufferSize, const bool allowUnrecognizedFormat=false)
 
FEDStatusRegister fedStatusRegister () const
 
bool feEnabled (const uint8_t internalFEUnitNum) const
 
bool feOverflow (const uint8_t internalFEUnitNum) const
 
FEDHeaderType headerType () const
 
FEDLegacyReadoutMode legacyReadoutMode () const
 
bool majorityAddressErrorForFEUnit (const uint8_t internalFEUnitNum) const
 
uint8_t nFEUnitsEnabled () const
 
uint8_t packetCode (bool legacy=false, const uint8_t internalFEDChannelNum=0) const
 
virtual void print (std::ostream &os) const
 
FEDReadoutMode readoutMode () const
 
uint16_t sourceID () const
 
TrackerSpecialHeader trackerSpecialHeader () const
 
virtual ~FEDBufferBase ()
 

Protected Member Functions

 FEDBufferBase (const uint8_t *fedBuffer, const size_t fedBufferSize, const bool allowUnrecognizedFormat, const bool fillChannelVector)
 
const uint8_t * getPointerToByteAfterEndOfPayload () const
 
const uint8_t * getPointerToDataAfterTrackerSpecialHeader () const
 

Protected Attributes

std::vector< FEDChannelchannels_
 

Private Member Functions

void init (const uint8_t *fedBuffer, const size_t fedBufferSize, const bool allowUnrecognizedFormat)
 

Private Attributes

const size_t bufferSize_
 
FEDDAQHeader daqHeader_
 
FEDDAQTrailer daqTrailer_
 
const uint8_t * orderedBuffer_
 
const uint8_t * originalBuffer_
 
TrackerSpecialHeader specialHeader_
 

Detailed Description

Definition at line 567 of file SiStripFEDBufferComponents.h.

Constructor & Destructor Documentation

sistrip::FEDBufferBase::FEDBufferBase ( const uint8_t *  fedBuffer,
const size_t  fedBufferSize,
const bool  allowUnrecognizedFormat = false 
)

Definition at line 1325 of file SiStripFEDBufferComponents.cc.

References init().

1326  : channels_(FEDCH_PER_FED,FEDChannel(nullptr,0,0)),
1327  originalBuffer_(fedBuffer),
1328  bufferSize_(fedBufferSize)
1329  {
1330  init(fedBuffer,fedBufferSize,allowUnrecognizedFormat);
1331  }
std::vector< FEDChannel > channels_
void init(const uint8_t *fedBuffer, const size_t fedBufferSize, const bool allowUnrecognizedFormat)
static const uint16_t FEDCH_PER_FED
sistrip::FEDBufferBase::~FEDBufferBase ( )
virtual

Definition at line 1402 of file SiStripFEDBufferComponents.cc.

References orderedBuffer_, and originalBuffer_.

1403  {
1404  //if the buffer was coppied and swapped then delete the copy
1406  }
sistrip::FEDBufferBase::FEDBufferBase ( const uint8_t *  fedBuffer,
const size_t  fedBufferSize,
const bool  allowUnrecognizedFormat,
const bool  fillChannelVector 
)
protected

Definition at line 1333 of file SiStripFEDBufferComponents.cc.

References channels_, sistrip::FEDCH_PER_FED, and init().

1334  : originalBuffer_(fedBuffer),
1335  bufferSize_(fedBufferSize)
1336  {
1337  init(fedBuffer,fedBufferSize,allowUnrecognizedFormat);
1338  if (fillChannelVector) channels_.assign(FEDCH_PER_FED,FEDChannel(nullptr,0,0));
1339  }
std::vector< FEDChannel > channels_
void init(const uint8_t *fedBuffer, const size_t fedBufferSize, const bool allowUnrecognizedFormat)
static const uint16_t FEDCH_PER_FED

Member Function Documentation

uint8_t sistrip::FEDBufferBase::apveAddress ( ) const
inline
FEDBufferFormat sistrip::FEDBufferBase::bufferFormat ( ) const
inline

Definition at line 1442 of file SiStripFEDBufferComponents.h.

Referenced by init(), and print().

1443  {
1444  return specialHeader_.bufferFormat();
1445  }
TrackerSpecialHeader specialHeader_
size_t sistrip::FEDBufferBase::bufferSize ( ) const
inline

Definition at line 1392 of file SiStripFEDBufferComponents.h.

Referenced by sistrip::FEDSpyBuffer::findChannels(), and print().

1393  {
1394  return bufferSize_;
1395  }
uint16_t sistrip::FEDBufferBase::calcCRC ( ) const
inline

Definition at line 1377 of file SiStripFEDBufferComponents.h.

References sistrip::calculateFEDBufferCRC().

1378  {
1380  }
uint16_t calculateFEDBufferCRC(const uint8_t *buffer, const size_t lengthInBytes)
const FEDChannel & sistrip::FEDBufferBase::channel ( const uint8_t  internalFEDChannelNum) const
inline

Definition at line 1544 of file SiStripFEDBufferComponents.h.

References sistrip::internalFEDChannelNum().

Referenced by sistrip::FEDRawChannelUnpacker::procRawModeUnpacker(), and SiStripClusterizerFromRaw::run().

1545  {
1547  }
uint8_t internalFEDChannelNum(const uint8_t internalFEUnitNum, const uint8_t internalFEUnitChannelNum)
std::vector< FEDChannel > channels_
const FEDChannel & sistrip::FEDBufferBase::channel ( const uint8_t  internalFEUnitNum,
const uint8_t  internalChannelNum 
) const
inline

Definition at line 1549 of file SiStripFEDBufferComponents.h.

References sistrip::internalFEDChannelNum().

1550  {
1551  return channel(internalFEDChannelNum(internalFEUnitNum,internalChannelNum));
1552  }
uint8_t internalFEDChannelNum(const uint8_t internalFEUnitNum, const uint8_t internalFEUnitChannelNum)
const FEDChannel & channel(const uint8_t internalFEDChannelNum) const
bool sistrip::FEDBufferBase::channelGood ( const uint8_t  internalFEDChannelNum) const
virtual

Reimplemented in sistrip::FEDSpyBuffer.

Definition at line 1449 of file SiStripFEDBufferComponents.cc.

References sistrip::FEDCH_PER_FEUNIT, feEnabled(), feOverflow(), and majorityAddressErrorForFEUnit().

1450  {
1451  const uint8_t feUnit = internalFEDChannelNum/FEDCH_PER_FEUNIT;
1452  return ( !majorityAddressErrorForFEUnit(feUnit) && feEnabled(feUnit) && !feOverflow(feUnit) );
1453  }
uint8_t internalFEDChannelNum(const uint8_t internalFEUnitNum, const uint8_t internalFEUnitChannelNum)
bool majorityAddressErrorForFEUnit(const uint8_t internalFEUnitNum) const
bool feEnabled(const uint8_t internalFEUnitNum) const
static const uint16_t FEDCH_PER_FEUNIT
bool feOverflow(const uint8_t internalFEUnitNum) const
bool sistrip::FEDBufferBase::channelGood ( const uint8_t  internalFEUnitNum,
const uint8_t  internalChannelNum 
) const
inline

Definition at line 1539 of file SiStripFEDBufferComponents.h.

References sistrip::internalFEDChannelNum().

1540  {
1541  return channelGood(internalFEDChannelNum(internalFEUnitNum,internalChannelNum));
1542  }
uint8_t internalFEDChannelNum(const uint8_t internalFEUnitNum, const uint8_t internalFEUnitChannelNum)
virtual bool channelGood(const uint8_t internalFEDChannelNum) const
bool sistrip::FEDBufferBase::checkAPVEAddressValid ( ) const
inline

Definition at line 1592 of file SiStripFEDBufferComponents.h.

1593  {
1594  return (apveAddress() <= APV_MAX_ADDRESS);
1595  }
static const uint8_t APV_MAX_ADDRESS
bool sistrip::FEDBufferBase::checkBufferFormat ( ) const
inline

Definition at line 1577 of file SiStripFEDBufferComponents.h.

References sistrip::BUFFER_FORMAT_INVALID.

Referenced by checkSummary().

bool sistrip::FEDBufferBase::checkCRC ( ) const
inline
bool sistrip::FEDBufferBase::checkHeaderType ( ) const
inline

Definition at line 1582 of file SiStripFEDBufferComponents.h.

References sistrip::HEADER_TYPE_INVALID.

Referenced by checkSummary().

bool sistrip::FEDBufferBase::checkLengthFromTrailer ( ) const
inline

Definition at line 1622 of file SiStripFEDBufferComponents.h.

Referenced by checkSummary().

1623  {
1624  return (bufferSize() == daqEventLengthInBytes());
1625  }
bool sistrip::FEDBufferBase::checkMajorityAddresses ( ) const

Definition at line 1440 of file SiStripFEDBufferComponents.cc.

References feEnabled(), sistrip::FEUNITS_PER_FED, and majorityAddressErrorForFEUnit().

Referenced by checkSummary().

1441  {
1442  for (uint8_t iFE = 0; iFE < FEUNITS_PER_FED; iFE++) {
1443  if (!feEnabled(iFE)) continue;
1444  if (majorityAddressErrorForFEUnit(iFE)) return false;
1445  }
1446  return true;
1447  }
bool majorityAddressErrorForFEUnit(const uint8_t internalFEUnitNum) const
static const uint16_t FEUNITS_PER_FED
bool feEnabled(const uint8_t internalFEUnitNum) const
bool sistrip::FEDBufferBase::checkNoExtraHeadersOrTrailers ( ) const
inline

Definition at line 1617 of file SiStripFEDBufferComponents.h.

Referenced by checkSummary().

1618  {
1619  return ( (daqHeader_.boeNibble() == 0x5) && (daqTrailer_.eoeNibble() == 0xA) );
1620  }
bool sistrip::FEDBufferBase::checkNoFEOverflows ( ) const
inline

Definition at line 1597 of file SiStripFEDBufferComponents.h.

Referenced by checkSummary().

1598  {
1600  }
TrackerSpecialHeader specialHeader_
bool sistrip::FEDBufferBase::checkNoSlinkCRCError ( ) const
inline

Definition at line 1602 of file SiStripFEDBufferComponents.h.

Referenced by checkSummary().

1603  {
1604  return !daqTrailer_.slinkCRCError();
1605  }
bool sistrip::FEDBufferBase::checkNoSLinkTransmissionError ( ) const
inline

Definition at line 1607 of file SiStripFEDBufferComponents.h.

Referenced by checkSummary().

1608  {
1610  }
bool sistrip::FEDBufferBase::checkNoUnexpectedSourceID ( ) const
inline

Definition at line 1612 of file SiStripFEDBufferComponents.h.

Referenced by checkSummary().

1613  {
1614  return !daqTrailer_.badSourceID();
1615  }
bool sistrip::FEDBufferBase::checkReadoutMode ( ) const
inline

Definition at line 1587 of file SiStripFEDBufferComponents.h.

References sistrip::READOUT_MODE_INVALID.

Referenced by checkSummary().

bool sistrip::FEDBufferBase::checkSourceIDs ( ) const

Definition at line 1434 of file SiStripFEDBufferComponents.cc.

References daqSourceID(), sistrip::FED_ID_MAX, and sistrip::FED_ID_MIN.

Referenced by checkSummary().

1435  {
1436  return ( (daqSourceID() >= FED_ID_MIN) &&
1437  (daqSourceID() <= FED_ID_MAX) );
1438  }
static const uint16_t FED_ID_MIN
static const uint16_t FED_ID_MAX
std::string sistrip::FEDBufferBase::checkSummary ( ) const
virtual

Reimplemented in sistrip::FEDBuffer.

Definition at line 1460 of file SiStripFEDBufferComponents.cc.

References checkBufferFormat(), checkCRC(), checkHeaderType(), checkLengthFromTrailer(), checkMajorityAddresses(), checkNoExtraHeadersOrTrailers(), checkNoFEOverflows(), checkNoSlinkCRCError(), checkNoSLinkTransmissionError(), checkNoUnexpectedSourceID(), checkReadoutMode(), checkSourceIDs(), feEnabled(), feOverflow(), sistrip::FEUNITS_PER_FED, majorityAddressErrorForFEUnit(), and heppy_report::summary.

Referenced by sistrip::FEDBuffer::checkSummary(), and sistrip::operator<<().

1461  {
1462  std::ostringstream summary;
1463  summary << "Check buffer type valid: " << ( checkBufferFormat() ? "passed" : "FAILED" ) << std::endl;
1464  summary << "Check header format valid: " << ( checkHeaderType() ? "passed" : "FAILED" ) << std::endl;
1465  summary << "Check readout mode valid: " << ( checkReadoutMode() ? "passed" : "FAILED" ) << std::endl;
1466  //summary << "Check APVe address valid: " << ( checkAPVEAddressValid() ? "passed" : "FAILED" ) << std::endl;
1467  summary << "Check FE unit majority addresses: " << ( checkMajorityAddresses() ? "passed" : "FAILED" ) << std::endl;
1468  if (!checkMajorityAddresses()) {
1469  summary << "FEs with majority address error: ";
1470  unsigned int badFEs = 0;
1471  for (uint8_t iFE = 0; iFE < FEUNITS_PER_FED; iFE++) {
1472  if (!feEnabled(iFE)) continue;
1473  if (majorityAddressErrorForFEUnit(iFE)) {
1474  summary << uint16_t(iFE) << " ";
1475  badFEs++;
1476  }
1477  }
1478  summary << std::endl;
1479  summary << "Number of FE Units with bad addresses: " << badFEs << std::endl;
1480  }
1481  summary << "Check for FE unit buffer overflows: " << ( checkNoFEOverflows() ? "passed" : "FAILED" ) << std::endl;
1482  if (!checkNoFEOverflows()) {
1483  summary << "FEs which overflowed: ";
1484  unsigned int badFEs = 0;
1485  for (uint8_t iFE = 0; iFE < FEUNITS_PER_FED; iFE++) {
1486  if (feOverflow(iFE)) {
1487  summary << uint16_t(iFE) << " ";
1488  badFEs++;
1489  }
1490  }
1491  summary << std::endl;
1492  summary << "Number of FE Units which overflowed: " << badFEs << std::endl;
1493  }
1494  summary << "Check for S-Link CRC errors: " << ( checkNoSlinkCRCError() ? "passed" : "FAILED" ) << std::endl;
1495  summary << "Check for S-Link transmission error: " << ( checkNoSLinkTransmissionError() ? "passed" : "FAILED" ) << std::endl;
1496  summary << "Check CRC: " << ( checkCRC() ? "passed" : "FAILED" ) << std::endl;
1497  summary << "Check source ID is FED ID: " << ( checkSourceIDs() ? "passed" : "FAILED" ) << std::endl;
1498  summary << "Check for unexpected source ID at FRL: " << ( checkNoUnexpectedSourceID() ? "passed" : "FAILED" ) << std::endl;
1499  summary << "Check there are no extra headers or trailers: " << ( checkNoExtraHeadersOrTrailers() ? "passed" : "FAILED" ) << std::endl;
1500  summary << "Check length from trailer: " << ( checkLengthFromTrailer() ? "passed" : "FAILED" ) << std::endl;
1501  return summary.str();
1502  }
bool majorityAddressErrorForFEUnit(const uint8_t internalFEUnitNum) const
static const uint16_t FEUNITS_PER_FED
bool feEnabled(const uint8_t internalFEUnitNum) const
bool feOverflow(const uint8_t internalFEUnitNum) const
uint16_t sistrip::FEDBufferBase::daqBXID ( ) const
inline

Definition at line 1412 of file SiStripFEDBufferComponents.h.

Referenced by print().

1413  {
1414  return daqHeader_.bxID();
1415  }
uint16_t sistrip::FEDBufferBase::daqCRC ( ) const
inline

Definition at line 1432 of file SiStripFEDBufferComponents.h.

1433  {
1434  return daqTrailer_.crc();
1435  }
uint32_t sistrip::FEDBufferBase::daqEventLengthIn64bitWords ( ) const
inline

Definition at line 1422 of file SiStripFEDBufferComponents.h.

1423  {
1425  }
uint32_t sistrip::FEDBufferBase::daqEventLengthInBytes ( ) const
inline

Definition at line 1427 of file SiStripFEDBufferComponents.h.

Referenced by print().

1428  {
1430  }
FEDDAQEventType sistrip::FEDBufferBase::daqEventType ( ) const
inline

Definition at line 1402 of file SiStripFEDBufferComponents.h.

Referenced by print(), and sistrip::RawToDigiUnpacker::updateEventSummary().

1403  {
1404  return daqHeader_.eventType();
1405  }
FEDDAQEventType eventType() const
FEDDAQHeader sistrip::FEDBufferBase::daqHeader ( ) const
inline

Definition at line 1382 of file SiStripFEDBufferComponents.h.

Referenced by sistrip::RawToDigiUnpacker::updateEventSummary().

1383  {
1384  return daqHeader_;
1385  }
uint32_t sistrip::FEDBufferBase::daqLvl1ID ( ) const
inline

Definition at line 1407 of file SiStripFEDBufferComponents.h.

Referenced by print().

1408  {
1409  return daqHeader_.l1ID();
1410  }
uint16_t sistrip::FEDBufferBase::daqSourceID ( ) const
inline

Definition at line 1417 of file SiStripFEDBufferComponents.h.

Referenced by checkSourceIDs(), and print().

1418  {
1419  return daqHeader_.sourceID();
1420  }
FEDDAQTrailer sistrip::FEDBufferBase::daqTrailer ( ) const
inline

Definition at line 1387 of file SiStripFEDBufferComponents.h.

1388  {
1389  return daqTrailer_;
1390  }
FEDTTSBits sistrip::FEDBufferBase::daqTTSState ( ) const
inline

Definition at line 1437 of file SiStripFEDBufferComponents.h.

Referenced by print().

1438  {
1439  return daqTrailer_.ttsBits();
1440  }
bool sistrip::FEDBufferBase::doChecks ( ) const
virtual
bool sistrip::FEDBufferBase::doDAQHeaderAndTrailerChecks ( ) const
inline

Definition at line 1563 of file SiStripFEDBufferComponents.h.

Referenced by doChecks().

bool sistrip::FEDBufferBase::doTrackerSpecialHeaderChecks ( ) const
inline

Definition at line 1554 of file SiStripFEDBufferComponents.h.

Referenced by doChecks().

1555  {
1556  return ( checkBufferFormat() &&
1557  checkHeaderType() &&
1558  checkReadoutMode() &&
1559  //checkAPVEAddressValid() &&
1560  checkNoFEOverflows() );
1561  }
void sistrip::FEDBufferBase::dump ( std::ostream &  os) const
inline

Definition at line 1367 of file SiStripFEDBufferComponents.h.

References sistrip::printHex().

Referenced by sistrip::FEDSpyBuffer::delayChipGood().

1368  {
1370  }
void printHex(const void *pointer, const size_t length, std::ostream &os)
void sistrip::FEDBufferBase::dumpOriginalBuffer ( std::ostream &  os) const
inline

Definition at line 1372 of file SiStripFEDBufferComponents.h.

References sistrip::printHex().

1373  {
1375  }
void printHex(const void *pointer, const size_t length, std::ostream &os)
FEDStatusRegister sistrip::FEDBufferBase::fedStatusRegister ( ) const
inline

Definition at line 1534 of file SiStripFEDBufferComponents.h.

Referenced by sistrip::FEDBuffer::FEDBuffer(), and print().

1535  {
1537  }
FEDStatusRegister fedStatusRegister() const
TrackerSpecialHeader specialHeader_
bool sistrip::FEDBufferBase::feEnabled ( const uint8_t  internalFEUnitNum) const
inline
bool sistrip::FEDBufferBase::feOverflow ( const uint8_t  internalFEUnitNum) const
inline

Definition at line 1529 of file SiStripFEDBufferComponents.h.

Referenced by channelGood(), checkSummary(), sistrip::FEDBuffer::feGood(), and sistrip::FEDBuffer::feGoodWithoutAPVEmulatorCheck().

1530  {
1531  return specialHeader_.feOverflow(internalFEUnitNum);
1532  }
bool feOverflow(const uint8_t internalFEUnitNum) const
TrackerSpecialHeader specialHeader_
const uint8_t * sistrip::FEDBufferBase::getPointerToByteAfterEndOfPayload ( ) const
inlineprotected

Definition at line 1632 of file SiStripFEDBufferComponents.h.

Referenced by sistrip::FEDBuffer::FEDBuffer().

1633  {
1634  return orderedBuffer_+bufferSize_-8;
1635  }
const uint8_t * sistrip::FEDBufferBase::getPointerToDataAfterTrackerSpecialHeader ( ) const
inlineprotected

Definition at line 1627 of file SiStripFEDBufferComponents.h.

Referenced by sistrip::FEDBuffer::FEDBuffer(), and sistrip::FEDSpyBuffer::globalRunNumber().

1628  {
1629  return orderedBuffer_+16;
1630  }
FEDHeaderType sistrip::FEDBufferBase::headerType ( ) const
inline
void sistrip::FEDBufferBase::init ( const uint8_t *  fedBuffer,
const size_t  fedBufferSize,
const bool  allowUnrecognizedFormat 
)
private

Definition at line 1341 of file SiStripFEDBufferComponents.cc.

References sistrip::BUFFER_FORMAT_INVALID, sistrip::BUFFER_FORMAT_NEW, sistrip::BUFFER_FORMAT_OLD_VME, sistrip::TrackerSpecialHeader::bufferFormat(), bufferFormat(), bufferSize_, daqHeader_, daqTrailer_, Exception, mps_fire::i, orderedBuffer_, originalBuffer_, and specialHeader_.

Referenced by FEDBufferBase().

1342  {
1343  //min buffer length. DAQ header, DAQ trailer, tracker special header.
1344  static const size_t MIN_BUFFER_SIZE = 8+8+8;
1345  //check size is non zero and data pointer is not NULL
1346  if (!originalBuffer_) throw cms::Exception("FEDBuffer") << "Buffer pointer is NULL.";
1347  if (bufferSize_ < MIN_BUFFER_SIZE) {
1348  std::ostringstream ss;
1349  ss << "Buffer is too small. "
1350  << "Min size is " << MIN_BUFFER_SIZE << ". "
1351  << "Buffer size is " << bufferSize_ << ". ";
1352  throw cms::Exception("FEDBuffer") << ss.str();
1353  }
1354 
1355  //construct tracker special header using second 64 bit word
1356  specialHeader_ = TrackerSpecialHeader(originalBuffer_+8);
1357 
1358  //check the buffer format
1360  if (bufferFormat == BUFFER_FORMAT_INVALID && !allowUnrecognizedFormat) {
1361  std::ostringstream ss;
1362  ss << "Buffer format not recognized. "
1363  << "Tracker special header: " << specialHeader_;
1364  throw cms::Exception("FEDBuffer") << ss.str();
1365  }
1366  //swap the buffer words so that the whole buffer is in slink ordering
1367  if ( (bufferFormat == BUFFER_FORMAT_OLD_VME) || (bufferFormat == BUFFER_FORMAT_NEW) ) {
1368  uint8_t* newBuffer = new uint8_t[bufferSize_];
1369  const uint32_t* originalU32 = reinterpret_cast<const uint32_t*>(originalBuffer_);
1370  const size_t sizeU32 = bufferSize_/4;
1371  uint32_t* newU32 = reinterpret_cast<uint32_t*>(newBuffer);
1372  if (bufferFormat == BUFFER_FORMAT_OLD_VME) {
1373  //swap whole buffer
1374  for (size_t i = 0; i < sizeU32; i+=2) {
1375  newU32[i] = originalU32[i+1];
1376  newU32[i+1] = originalU32[i];
1377  }
1378  }
1379  if (bufferFormat == BUFFER_FORMAT_NEW) {
1380  //copy DAQ header
1381  memcpy(newU32,originalU32,8);
1382  //copy DAQ trailer
1383  memcpy(newU32+sizeU32-2,originalU32+sizeU32-2,8);
1384  //swap the payload
1385  for (size_t i = 2; i < sizeU32-2; i+=2) {
1386  newU32[i] = originalU32[i+1];
1387  newU32[i+1] = originalU32[i];
1388  }
1389  }
1390  orderedBuffer_ = newBuffer;
1391  } //if ( (bufferFormat == BUFFER_FORMAT_OLD_VME) || (bufferFormat == BUFFER_FORMAT_NEW) )
1392  else {
1394  }
1395 
1396  //construct header object at begining of buffer
1397  daqHeader_ = FEDDAQHeader(orderedBuffer_);
1398  //construct trailer object using last 64 bit word of buffer
1399  daqTrailer_ = FEDDAQTrailer(orderedBuffer_+bufferSize_-8);
1400  }
TrackerSpecialHeader specialHeader_
FEDBufferFormat bufferFormat() const
FEDLegacyReadoutMode sistrip::FEDBufferBase::legacyReadoutMode ( ) const
inline

Definition at line 1452 of file SiStripFEDBufferComponents.h.

Referenced by SiStripClusterizerFromRaw::run().

1453  {
1455  }
FEDLegacyReadoutMode legacyReadoutMode() const
TrackerSpecialHeader specialHeader_
bool sistrip::FEDBufferBase::majorityAddressErrorForFEUnit ( const uint8_t  internalFEUnitNum) const
inline

Definition at line 1519 of file SiStripFEDBufferComponents.h.

Referenced by channelGood(), checkMajorityAddresses(), checkSummary(), and sistrip::FEDBuffer::feGood().

1520  {
1521  return (specialHeader_.majorityAddressErrorForFEUnit(internalFEUnitNum) && (specialHeader_.apveAddress() != 0x00));
1522  }
TrackerSpecialHeader specialHeader_
bool majorityAddressErrorForFEUnit(const uint8_t internalFEUnitNum) const
uint8_t sistrip::FEDBufferBase::nFEUnitsEnabled ( ) const

Definition at line 1425 of file SiStripFEDBufferComponents.cc.

References feEnabled(), sistrip::FEUNITS_PER_FED, and mps_fire::result.

Referenced by print().

1426  {
1427  uint8_t result = 0;
1428  for (uint8_t iFE = 0; iFE < FEUNITS_PER_FED; iFE++) {
1429  if (feEnabled(iFE)) result++;
1430  }
1431  return result;
1432  }
static const uint16_t FEUNITS_PER_FED
bool feEnabled(const uint8_t internalFEUnitNum) const
uint8_t sistrip::FEDBufferBase::packetCode ( bool  legacy = false,
const uint8_t  internalFEDChannelNum = 0 
) const
inline

Definition at line 1462 of file SiStripFEDBufferComponents.h.

References ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, sistrip::PACKET_CODE_PROC_RAW, sistrip::PACKET_CODE_SCOPE, sistrip::PACKET_CODE_VIRGIN_RAW, sistrip::PACKET_CODE_ZERO_SUPPRESSED, sistrip::READOUT_MODE_INVALID, sistrip::READOUT_MODE_LEGACY_INVALID, sistrip::READOUT_MODE_LEGACY_PREMIX_RAW, sistrip::READOUT_MODE_LEGACY_PROC_RAW_FAKE, sistrip::READOUT_MODE_LEGACY_PROC_RAW_REAL, sistrip::READOUT_MODE_LEGACY_SCOPE, sistrip::READOUT_MODE_LEGACY_SPY, sistrip::READOUT_MODE_LEGACY_VIRGIN_RAW_FAKE, sistrip::READOUT_MODE_LEGACY_VIRGIN_RAW_REAL, sistrip::READOUT_MODE_LEGACY_ZERO_SUPPRESSED_FAKE, sistrip::READOUT_MODE_LEGACY_ZERO_SUPPRESSED_LITE_FAKE, sistrip::READOUT_MODE_LEGACY_ZERO_SUPPRESSED_LITE_REAL, sistrip::READOUT_MODE_LEGACY_ZERO_SUPPRESSED_REAL, sistrip::READOUT_MODE_PREMIX_RAW, sistrip::READOUT_MODE_PROC_RAW, sistrip::READOUT_MODE_SCOPE, sistrip::READOUT_MODE_SPY, sistrip::READOUT_MODE_VIRGIN_RAW, sistrip::READOUT_MODE_ZERO_SUPPRESSED, sistrip::READOUT_MODE_ZERO_SUPPRESSED_LITE10, sistrip::READOUT_MODE_ZERO_SUPPRESSED_LITE10_CMOVERRIDE, sistrip::READOUT_MODE_ZERO_SUPPRESSED_LITE8, sistrip::READOUT_MODE_ZERO_SUPPRESSED_LITE8_BOTBOT, sistrip::READOUT_MODE_ZERO_SUPPRESSED_LITE8_BOTBOT_CMOVERRIDE, sistrip::READOUT_MODE_ZERO_SUPPRESSED_LITE8_CMOVERRIDE, sistrip::READOUT_MODE_ZERO_SUPPRESSED_LITE8_TOPBOT, and sistrip::READOUT_MODE_ZERO_SUPPRESSED_LITE8_TOPBOT_CMOVERRIDE.

Referenced by sistrip::FEDBuffer::checkChannelPacketCodes(), sistrip::FEDBuffer::checkSummary(), sistrip::FEDChannel::cmMedian(), and sistrip::FEDBuffer::getCorrectPacketCode().

1463  {
1464  if (legacy) {
1466  switch(mode) {
1468  return PACKET_CODE_SCOPE;
1471  return PACKET_CODE_VIRGIN_RAW;
1474  return PACKET_CODE_PROC_RAW;
1483  default:
1484  return 0;
1485  }
1486  } else {
1487  FEDReadoutMode mode = readoutMode();
1488  switch(mode) {
1489  case READOUT_MODE_SCOPE:
1490  return PACKET_CODE_SCOPE;
1493  case READOUT_MODE_PROC_RAW:
1494  return PACKET_CODE_PROC_RAW;
1506  case READOUT_MODE_SPY:
1507  case READOUT_MODE_INVALID:
1508  default:
1509  return 0;
1510  }
1511  }
1512  }
static const uint8_t PACKET_CODE_SCOPE
FEDReadoutMode readoutMode() const
uint8_t internalFEDChannelNum(const uint8_t internalFEUnitNum, const uint8_t internalFEUnitChannelNum)
static const uint8_t PACKET_CODE_ZERO_SUPPRESSED
FEDLegacyReadoutMode legacyReadoutMode() const
const FEDChannel & channel(const uint8_t internalFEDChannelNum) const
static const uint8_t PACKET_CODE_PROC_RAW
static const uint8_t PACKET_CODE_VIRGIN_RAW
void sistrip::FEDBufferBase::print ( std::ostream &  os) const
virtual

Reimplemented in sistrip::FEDSpyBuffer, and sistrip::FEDBuffer.

Definition at line 1408 of file SiStripFEDBufferComponents.cc.

References apveAddress(), bufferFormat(), bufferSize(), daqBXID(), daqEventLengthInBytes(), daqEventType(), daqLvl1ID(), daqSourceID(), daqTTSState(), fedStatusRegister(), headerType(), nFEUnitsEnabled(), sistrip::FEDStatusRegister::printFlags(), and readoutMode().

Referenced by sistrip::operator<<(), sistrip::FEDBuffer::print(), and sistrip::FEDSpyBuffer::print().

1409  {
1410  os << "buffer format: " << bufferFormat() << std::endl;
1411  os << "Buffer size: " << bufferSize() << " bytes" << std::endl;
1412  os << "Event length from DAQ trailer: " << daqEventLengthInBytes() << " bytes" << std::endl;
1413  os << "Source ID: " << daqSourceID() << std::endl;
1414  os << "Header type: " << headerType() << std::endl;
1415  os << "Readout mode: " << readoutMode() << std::endl;
1416  os << "DAQ event type: " << daqEventType() << std::endl;
1417  os << "TTS state: " << daqTTSState() << std::endl;
1418  os << "L1 ID: " << daqLvl1ID() << std::endl;
1419  os << "BX ID: " << daqBXID() << std::endl;
1420  os << "FED status register flags: "; fedStatusRegister().printFlags(os); os << std::endl;
1421  os << "APVe Address: " << uint16_t(apveAddress()) << std::endl;
1422  os << "Enabled FE units: " << uint16_t(nFEUnitsEnabled()) << std::endl;
1423  }
FEDReadoutMode readoutMode() const
void printFlags(std::ostream &os) const
FEDDAQEventType daqEventType() const
FEDHeaderType headerType() const
FEDStatusRegister fedStatusRegister() const
FEDBufferFormat bufferFormat() const
FEDReadoutMode sistrip::FEDBufferBase::readoutMode ( ) const
inline
uint16_t sistrip::FEDBufferBase::sourceID ( ) const
TrackerSpecialHeader sistrip::FEDBufferBase::trackerSpecialHeader ( ) const
inline

Definition at line 1397 of file SiStripFEDBufferComponents.h.

Referenced by sistrip::FEDBuffer::FEDBuffer().

1398  {
1399  return specialHeader_;
1400  }
TrackerSpecialHeader specialHeader_

Member Data Documentation

const size_t sistrip::FEDBufferBase::bufferSize_
private

Definition at line 651 of file SiStripFEDBufferComponents.h.

Referenced by init().

std::vector<FEDChannel> sistrip::FEDBufferBase::channels_
protected
FEDDAQHeader sistrip::FEDBufferBase::daqHeader_
private

Definition at line 652 of file SiStripFEDBufferComponents.h.

Referenced by init().

FEDDAQTrailer sistrip::FEDBufferBase::daqTrailer_
private

Definition at line 653 of file SiStripFEDBufferComponents.h.

Referenced by init().

const uint8_t* sistrip::FEDBufferBase::orderedBuffer_
private

Definition at line 650 of file SiStripFEDBufferComponents.h.

Referenced by init(), and ~FEDBufferBase().

const uint8_t* sistrip::FEDBufferBase::originalBuffer_
private

Definition at line 649 of file SiStripFEDBufferComponents.h.

Referenced by init(), and ~FEDBufferBase().

TrackerSpecialHeader sistrip::FEDBufferBase::specialHeader_
private

Definition at line 654 of file SiStripFEDBufferComponents.h.

Referenced by init().