CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 566 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 1274 of file SiStripFEDBufferComponents.cc.

References init().

1275  : channels_(FEDCH_PER_FED,FEDChannel(NULL,0,0)),
1276  originalBuffer_(fedBuffer),
1277  bufferSize_(fedBufferSize)
1278  {
1279  init(fedBuffer,fedBufferSize,allowUnrecognizedFormat);
1280  }
#define NULL
Definition: scimark2.h:8
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 1351 of file SiStripFEDBufferComponents.cc.

References orderedBuffer_, and originalBuffer_.

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

Definition at line 1282 of file SiStripFEDBufferComponents.cc.

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

1283  : originalBuffer_(fedBuffer),
1284  bufferSize_(fedBufferSize)
1285  {
1286  init(fedBuffer,fedBufferSize,allowUnrecognizedFormat);
1287  if (fillChannelVector) channels_.assign(FEDCH_PER_FED,FEDChannel(NULL,0,0));
1288  }
#define NULL
Definition: scimark2.h:8
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 1441 of file SiStripFEDBufferComponents.h.

References sistrip::TrackerSpecialHeader::bufferFormat(), and specialHeader_.

Referenced by checkBufferFormat(), init(), and print().

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

Definition at line 1391 of file SiStripFEDBufferComponents.h.

References bufferSize_.

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

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

Definition at line 1376 of file SiStripFEDBufferComponents.h.

References bufferSize_, sistrip::calculateFEDBufferCRC(), and orderedBuffer_.

Referenced by checkCRC().

1377  {
1379  }
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 1546 of file SiStripFEDBufferComponents.h.

References channels_, and sistrip::internalFEDChannelNum().

Referenced by channel(), and packetCode().

1547  {
1549  }
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 1551 of file SiStripFEDBufferComponents.h.

References channel(), and sistrip::internalFEDChannelNum().

1552  {
1553  return channel(internalFEDChannelNum(internalFEUnitNum,internalChannelNum));
1554  }
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 1398 of file SiStripFEDBufferComponents.cc.

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

Referenced by channelGood().

1399  {
1400  const uint8_t feUnit = internalFEDChannelNum/FEDCH_PER_FEUNIT;
1401  return ( !majorityAddressErrorForFEUnit(feUnit) && feEnabled(feUnit) && !feOverflow(feUnit) );
1402  }
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 1541 of file SiStripFEDBufferComponents.h.

References channelGood(), and sistrip::internalFEDChannelNum().

1542  {
1543  return channelGood(internalFEDChannelNum(internalFEUnitNum,internalChannelNum));
1544  }
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 1594 of file SiStripFEDBufferComponents.h.

References sistrip::APV_MAX_ADDRESS, and apveAddress().

1595  {
1596  return (apveAddress() <= APV_MAX_ADDRESS);
1597  }
static const uint8_t APV_MAX_ADDRESS
bool sistrip::FEDBufferBase::checkBufferFormat ( ) const
inline
bool sistrip::FEDBufferBase::checkCRC ( ) const
inline
bool sistrip::FEDBufferBase::checkHeaderType ( ) const
inline
bool sistrip::FEDBufferBase::checkLengthFromTrailer ( ) const
inline

Definition at line 1624 of file SiStripFEDBufferComponents.h.

References bufferSize(), and daqEventLengthInBytes().

Referenced by checkSummary(), and doDAQHeaderAndTrailerChecks().

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

Definition at line 1389 of file SiStripFEDBufferComponents.cc.

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

Referenced by checkSummary().

1390  {
1391  for (uint8_t iFE = 0; iFE < FEUNITS_PER_FED; iFE++) {
1392  if (!feEnabled(iFE)) continue;
1393  if (majorityAddressErrorForFEUnit(iFE)) return false;
1394  }
1395  return true;
1396  }
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
bool sistrip::FEDBufferBase::checkNoFEOverflows ( ) const
inline
bool sistrip::FEDBufferBase::checkNoSlinkCRCError ( ) const
inline

Definition at line 1604 of file SiStripFEDBufferComponents.h.

References daqTrailer_, and sistrip::FEDDAQTrailer::slinkCRCError().

Referenced by checkCRC(), and checkSummary().

1605  {
1606  return !daqTrailer_.slinkCRCError();
1607  }
bool sistrip::FEDBufferBase::checkNoSLinkTransmissionError ( ) const
inline
bool sistrip::FEDBufferBase::checkNoUnexpectedSourceID ( ) const
inline

Definition at line 1614 of file SiStripFEDBufferComponents.h.

References sistrip::FEDDAQTrailer::badSourceID(), and daqTrailer_.

Referenced by checkSummary(), and doDAQHeaderAndTrailerChecks().

1615  {
1616  return !daqTrailer_.badSourceID();
1617  }
bool sistrip::FEDBufferBase::checkReadoutMode ( ) const
inline
bool sistrip::FEDBufferBase::checkSourceIDs ( ) const

Definition at line 1383 of file SiStripFEDBufferComponents.cc.

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

Referenced by checkSummary(), and doDAQHeaderAndTrailerChecks().

1384  {
1385  return ( (daqSourceID() >= FED_ID_MIN) &&
1386  (daqSourceID() <= FED_ID_MAX) );
1387  }
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 1409 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 edmLumisInFiles::summary.

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

1410  {
1411  std::ostringstream summary;
1412  summary << "Check buffer type valid: " << ( checkBufferFormat() ? "passed" : "FAILED" ) << std::endl;
1413  summary << "Check header format valid: " << ( checkHeaderType() ? "passed" : "FAILED" ) << std::endl;
1414  summary << "Check readout mode valid: " << ( checkReadoutMode() ? "passed" : "FAILED" ) << std::endl;
1415  //summary << "Check APVe address valid: " << ( checkAPVEAddressValid() ? "passed" : "FAILED" ) << std::endl;
1416  summary << "Check FE unit majority addresses: " << ( checkMajorityAddresses() ? "passed" : "FAILED" ) << std::endl;
1417  if (!checkMajorityAddresses()) {
1418  summary << "FEs with majority address error: ";
1419  unsigned int badFEs = 0;
1420  for (uint8_t iFE = 0; iFE < FEUNITS_PER_FED; iFE++) {
1421  if (!feEnabled(iFE)) continue;
1422  if (majorityAddressErrorForFEUnit(iFE)) {
1423  summary << uint16_t(iFE) << " ";
1424  badFEs++;
1425  }
1426  }
1427  summary << std::endl;
1428  summary << "Number of FE Units with bad addresses: " << badFEs << std::endl;
1429  }
1430  summary << "Check for FE unit buffer overflows: " << ( checkNoFEOverflows() ? "passed" : "FAILED" ) << std::endl;
1431  if (!checkNoFEOverflows()) {
1432  summary << "FEs which overflowed: ";
1433  unsigned int badFEs = 0;
1434  for (uint8_t iFE = 0; iFE < FEUNITS_PER_FED; iFE++) {
1435  if (feOverflow(iFE)) {
1436  summary << uint16_t(iFE) << " ";
1437  badFEs++;
1438  }
1439  }
1440  summary << std::endl;
1441  summary << "Number of FE Units which overflowed: " << badFEs << std::endl;
1442  }
1443  summary << "Check for S-Link CRC errors: " << ( checkNoSlinkCRCError() ? "passed" : "FAILED" ) << std::endl;
1444  summary << "Check for S-Link transmission error: " << ( checkNoSLinkTransmissionError() ? "passed" : "FAILED" ) << std::endl;
1445  summary << "Check CRC: " << ( checkCRC() ? "passed" : "FAILED" ) << std::endl;
1446  summary << "Check source ID is FED ID: " << ( checkSourceIDs() ? "passed" : "FAILED" ) << std::endl;
1447  summary << "Check for unexpected source ID at FRL: " << ( checkNoUnexpectedSourceID() ? "passed" : "FAILED" ) << std::endl;
1448  summary << "Check there are no extra headers or trailers: " << ( checkNoExtraHeadersOrTrailers() ? "passed" : "FAILED" ) << std::endl;
1449  summary << "Check length from trailer: " << ( checkLengthFromTrailer() ? "passed" : "FAILED" ) << std::endl;
1450  return summary.str();
1451  }
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 1411 of file SiStripFEDBufferComponents.h.

References sistrip::FEDDAQHeader::bxID(), and daqHeader_.

Referenced by print().

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

Definition at line 1431 of file SiStripFEDBufferComponents.h.

References sistrip::FEDDAQTrailer::crc(), and daqTrailer_.

Referenced by checkCRC().

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

Definition at line 1426 of file SiStripFEDBufferComponents.h.

References daqTrailer_, and sistrip::FEDDAQTrailer::eventLengthInBytes().

Referenced by checkLengthFromTrailer(), and print().

1427  {
1429  }
FEDDAQEventType sistrip::FEDBufferBase::daqEventType ( ) const
inline

Definition at line 1401 of file SiStripFEDBufferComponents.h.

References daqHeader_, and sistrip::FEDDAQHeader::eventType().

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

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

Definition at line 1381 of file SiStripFEDBufferComponents.h.

References daqHeader_.

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

Definition at line 1406 of file SiStripFEDBufferComponents.h.

References daqHeader_, and sistrip::FEDDAQHeader::l1ID().

Referenced by print().

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

Definition at line 1416 of file SiStripFEDBufferComponents.h.

References daqHeader_, and sistrip::FEDDAQHeader::sourceID().

Referenced by checkSourceIDs(), and print().

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

Definition at line 1386 of file SiStripFEDBufferComponents.h.

References daqTrailer_.

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

Definition at line 1436 of file SiStripFEDBufferComponents.h.

References daqTrailer_, and sistrip::FEDDAQTrailer::ttsBits().

Referenced by print().

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

Definition at line 1556 of file SiStripFEDBufferComponents.h.

References checkBufferFormat(), checkHeaderType(), checkNoFEOverflows(), and checkReadoutMode().

Referenced by doChecks().

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

Definition at line 1366 of file SiStripFEDBufferComponents.h.

References bufferSize_, orderedBuffer_, and sistrip::printHex().

Referenced by SiStripFEDDumpPlugin::analyze(), and sistrip::FEDSpyBuffer::delayChipGood().

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

Definition at line 1371 of file SiStripFEDBufferComponents.h.

References bufferSize_, originalBuffer_, and sistrip::printHex().

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

Definition at line 1536 of file SiStripFEDBufferComponents.h.

References sistrip::TrackerSpecialHeader::fedStatusRegister(), and specialHeader_.

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

1537  {
1539  }
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 1531 of file SiStripFEDBufferComponents.h.

References sistrip::TrackerSpecialHeader::feOverflow(), and specialHeader_.

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

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

Definition at line 1634 of file SiStripFEDBufferComponents.h.

References bufferSize_, and orderedBuffer_.

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

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

Definition at line 1629 of file SiStripFEDBufferComponents.h.

References orderedBuffer_.

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

1630  {
1631  return orderedBuffer_+16;
1632  }
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 1290 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, i, orderedBuffer_, originalBuffer_, specialHeader_, and contentValuesCheck::ss.

Referenced by FEDBufferBase().

1291  {
1292  //min buffer length. DAQ header, DAQ trailer, tracker special header.
1293  static const size_t MIN_BUFFER_SIZE = 8+8+8;
1294  //check size is non zero and data pointer is not NULL
1295  if (!originalBuffer_) throw cms::Exception("FEDBuffer") << "Buffer pointer is NULL.";
1296  if (bufferSize_ < MIN_BUFFER_SIZE) {
1297  std::ostringstream ss;
1298  ss << "Buffer is too small. "
1299  << "Min size is " << MIN_BUFFER_SIZE << ". "
1300  << "Buffer size is " << bufferSize_ << ". ";
1301  throw cms::Exception("FEDBuffer") << ss.str();
1302  }
1303 
1304  //construct tracker special header using second 64 bit word
1305  specialHeader_ = TrackerSpecialHeader(originalBuffer_+8);
1306 
1307  //check the buffer format
1309  if (bufferFormat == BUFFER_FORMAT_INVALID && !allowUnrecognizedFormat) {
1310  std::ostringstream ss;
1311  ss << "Buffer format not recognized. "
1312  << "Tracker special header: " << specialHeader_;
1313  throw cms::Exception("FEDBuffer") << ss.str();
1314  }
1315  //swap the buffer words so that the whole buffer is in slink ordering
1316  if ( (bufferFormat == BUFFER_FORMAT_OLD_VME) || (bufferFormat == BUFFER_FORMAT_NEW) ) {
1317  uint8_t* newBuffer = new uint8_t[bufferSize_];
1318  const uint32_t* originalU32 = reinterpret_cast<const uint32_t*>(originalBuffer_);
1319  const size_t sizeU32 = bufferSize_/4;
1320  uint32_t* newU32 = reinterpret_cast<uint32_t*>(newBuffer);
1321  if (bufferFormat == BUFFER_FORMAT_OLD_VME) {
1322  //swap whole buffer
1323  for (size_t i = 0; i < sizeU32; i+=2) {
1324  newU32[i] = originalU32[i+1];
1325  newU32[i+1] = originalU32[i];
1326  }
1327  }
1328  if (bufferFormat == BUFFER_FORMAT_NEW) {
1329  //copy DAQ header
1330  memcpy(newU32,originalU32,8);
1331  //copy DAQ trailer
1332  memcpy(newU32+sizeU32-2,originalU32+sizeU32-2,8);
1333  //swap the payload
1334  for (size_t i = 2; i < sizeU32-2; i+=2) {
1335  newU32[i] = originalU32[i+1];
1336  newU32[i+1] = originalU32[i];
1337  }
1338  }
1339  orderedBuffer_ = newBuffer;
1340  } //if ( (bufferFormat == BUFFER_FORMAT_OLD_VME) || (bufferFormat == BUFFER_FORMAT_NEW) )
1341  else {
1343  }
1344 
1345  //construct header object at begining of buffer
1346  daqHeader_ = FEDDAQHeader(orderedBuffer_);
1347  //construct trailer object using last 64 bit word of buffer
1348  daqTrailer_ = FEDDAQTrailer(orderedBuffer_+bufferSize_-8);
1349  }
int i
Definition: DBlmapReader.cc:9
TrackerSpecialHeader specialHeader_
FEDBufferFormat bufferFormat() const
FEDLegacyReadoutMode sistrip::FEDBufferBase::legacyReadoutMode ( ) const
inline

Definition at line 1451 of file SiStripFEDBufferComponents.h.

References sistrip::TrackerSpecialHeader::legacyReadoutMode(), and specialHeader_.

Referenced by packetCode().

1452  {
1454  }
FEDLegacyReadoutMode legacyReadoutMode() const
TrackerSpecialHeader specialHeader_
bool sistrip::FEDBufferBase::majorityAddressErrorForFEUnit ( const uint8_t  internalFEUnitNum) const
inline
uint8_t sistrip::FEDBufferBase::nFEUnitsEnabled ( ) const

Definition at line 1374 of file SiStripFEDBufferComponents.cc.

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

Referenced by print().

1375  {
1376  uint8_t result = 0;
1377  for (uint8_t iFE = 0; iFE < FEUNITS_PER_FED; iFE++) {
1378  if (feEnabled(iFE)) result++;
1379  }
1380  return result;
1381  }
tuple result
Definition: mps_fire.py:83
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 1461 of file SiStripFEDBufferComponents.h.

References channel(), legacyReadoutMode(), alignBH_cfg::mode, sistrip::PACKET_CODE_PROC_RAW, sistrip::PACKET_CODE_SCOPE, sistrip::PACKET_CODE_VIRGIN_RAW, sistrip::PACKET_CODE_ZERO_SUPPRESSED, sistrip::PACKET_CODE_ZERO_SUPPRESSED_LITE10, sistrip::PACKET_CODE_ZERO_SUPPRESSED_LITE8_BOTBOT, sistrip::PACKET_CODE_ZERO_SUPPRESSED_LITE8_TOPBOT, sistrip::FEDChannel::packetCode(), 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, sistrip::READOUT_MODE_ZERO_SUPPRESSED_LITE8_TOPBOT_CMOVERRIDE, and readoutMode().

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

1462  {
1463  if (legacy) {
1465  switch(mode) {
1467  return PACKET_CODE_SCOPE;
1470  return PACKET_CODE_VIRGIN_RAW;
1473  return PACKET_CODE_PROC_RAW;
1482  default:
1483  return 0;
1484  }
1485  } else {
1486  FEDReadoutMode mode = readoutMode();
1487  switch(mode) {
1488  case READOUT_MODE_SCOPE:
1489  return PACKET_CODE_SCOPE;
1492  case READOUT_MODE_PROC_RAW:
1493  return PACKET_CODE_PROC_RAW;
1508  case READOUT_MODE_SPY:
1509  case READOUT_MODE_INVALID:
1510  default:
1511  return 0;
1512  }
1513  }
1514  }
static const uint8_t PACKET_CODE_ZERO_SUPPRESSED_LITE8_BOTBOT
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_LITE10
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_ZERO_SUPPRESSED_LITE8_TOPBOT
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 1357 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().

1358  {
1359  os << "buffer format: " << bufferFormat() << std::endl;
1360  os << "Buffer size: " << bufferSize() << " bytes" << std::endl;
1361  os << "Event length from DAQ trailer: " << daqEventLengthInBytes() << " bytes" << std::endl;
1362  os << "Source ID: " << daqSourceID() << std::endl;
1363  os << "Header type: " << headerType() << std::endl;
1364  os << "Readout mode: " << readoutMode() << std::endl;
1365  os << "DAQ event type: " << daqEventType() << std::endl;
1366  os << "TTS state: " << daqTTSState() << std::endl;
1367  os << "L1 ID: " << daqLvl1ID() << std::endl;
1368  os << "BX ID: " << daqBXID() << std::endl;
1369  os << "FED status register flags: "; fedStatusRegister().printFlags(os); os << std::endl;
1370  os << "APVe Address: " << uint16_t(apveAddress()) << std::endl;
1371  os << "Enabled FE units: " << uint16_t(nFEUnitsEnabled()) << std::endl;
1372  }
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 1396 of file SiStripFEDBufferComponents.h.

References specialHeader_.

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

1397  {
1398  return specialHeader_;
1399  }
TrackerSpecialHeader specialHeader_

Member Data Documentation

const size_t sistrip::FEDBufferBase::bufferSize_
private
std::vector<FEDChannel> sistrip::FEDBufferBase::channels_
protected
FEDDAQHeader sistrip::FEDBufferBase::daqHeader_
private
FEDDAQTrailer sistrip::FEDBufferBase::daqTrailer_
private
const uint8_t* sistrip::FEDBufferBase::orderedBuffer_
private
const uint8_t* sistrip::FEDBufferBase::originalBuffer_
private

Definition at line 648 of file SiStripFEDBufferComponents.h.

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

TrackerSpecialHeader sistrip::FEDBufferBase::specialHeader_
private