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
 
FEDDataType dataType () 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
 
bool majorityAddressErrorForFEUnit (const uint8_t internalFEUnitNum) const
 
uint8_t nFEUnitsEnabled () 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 535 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 1202 of file SiStripFEDBufferComponents.cc.

References init().

1203  : channels_(FEDCH_PER_FED,FEDChannel(NULL,0,0)),
1204  originalBuffer_(fedBuffer),
1205  bufferSize_(fedBufferSize)
1206  {
1207  init(fedBuffer,fedBufferSize,allowUnrecognizedFormat);
1208  }
#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 1279 of file SiStripFEDBufferComponents.cc.

References orderedBuffer_, and originalBuffer_.

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

Definition at line 1210 of file SiStripFEDBufferComponents.cc.

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

1211  : originalBuffer_(fedBuffer),
1212  bufferSize_(fedBufferSize)
1213  {
1214  init(fedBuffer,fedBufferSize,allowUnrecognizedFormat);
1215  if (fillChannelVector) channels_.assign(FEDCH_PER_FED,FEDChannel(NULL,0,0));
1216  }
#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 1414 of file SiStripFEDBufferComponents.h.

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

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

1415  {
1416  return specialHeader_.bufferFormat();
1417  }
TrackerSpecialHeader specialHeader_
size_t sistrip::FEDBufferBase::bufferSize ( ) const
inline

Definition at line 1364 of file SiStripFEDBufferComponents.h.

References bufferSize_.

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

1365  {
1366  return bufferSize_;
1367  }
uint16_t sistrip::FEDBufferBase::calcCRC ( ) const
inline

Definition at line 1349 of file SiStripFEDBufferComponents.h.

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

Referenced by checkCRC().

1350  {
1352  }
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 1464 of file SiStripFEDBufferComponents.h.

References channels_, and sistrip::internalFEDChannelNum().

Referenced by channel().

1465  {
1467  }
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 1469 of file SiStripFEDBufferComponents.h.

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

1470  {
1471  return channel(internalFEDChannelNum(internalFEUnitNum,internalChannelNum));
1472  }
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 1327 of file SiStripFEDBufferComponents.cc.

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

Referenced by channelGood().

1328  {
1329  const uint8_t feUnit = internalFEDChannelNum/FEDCH_PER_FEUNIT;
1330  return ( !majorityAddressErrorForFEUnit(feUnit) && feEnabled(feUnit) && !feOverflow(feUnit) );
1331  }
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 1459 of file SiStripFEDBufferComponents.h.

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

1460  {
1461  return channelGood(internalFEDChannelNum(internalFEUnitNum,internalChannelNum));
1462  }
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 1512 of file SiStripFEDBufferComponents.h.

References sistrip::APV_MAX_ADDRESS, and apveAddress().

1513  {
1514  return (apveAddress() <= APV_MAX_ADDRESS);
1515  }
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 1542 of file SiStripFEDBufferComponents.h.

References bufferSize(), and daqEventLengthInBytes().

Referenced by checkSummary(), and doDAQHeaderAndTrailerChecks().

1543  {
1544  return (bufferSize() == daqEventLengthInBytes());
1545  }
bool sistrip::FEDBufferBase::checkMajorityAddresses ( ) const

Definition at line 1318 of file SiStripFEDBufferComponents.cc.

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

Referenced by checkSummary().

1319  {
1320  for (uint8_t iFE = 0; iFE < FEUNITS_PER_FED; iFE++) {
1321  if (!feEnabled(iFE)) continue;
1322  if (majorityAddressErrorForFEUnit(iFE)) return false;
1323  }
1324  return true;
1325  }
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 1522 of file SiStripFEDBufferComponents.h.

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

Referenced by checkCRC(), and checkSummary().

1523  {
1524  return !daqTrailer_.slinkCRCError();
1525  }
bool sistrip::FEDBufferBase::checkNoSLinkTransmissionError ( ) const
inline
bool sistrip::FEDBufferBase::checkNoUnexpectedSourceID ( ) const
inline

Definition at line 1532 of file SiStripFEDBufferComponents.h.

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

Referenced by checkSummary(), and doDAQHeaderAndTrailerChecks().

1533  {
1534  return !daqTrailer_.badSourceID();
1535  }
bool sistrip::FEDBufferBase::checkReadoutMode ( ) const
inline
bool sistrip::FEDBufferBase::checkSourceIDs ( ) const

Definition at line 1312 of file SiStripFEDBufferComponents.cc.

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

Referenced by checkSummary(), and doDAQHeaderAndTrailerChecks().

1313  {
1314  return ( (daqSourceID() >= FED_ID_MIN) &&
1315  (daqSourceID() <= FED_ID_MAX) );
1316  }
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 1338 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<<().

1339  {
1340  std::ostringstream summary;
1341  summary << "Check buffer type valid: " << ( checkBufferFormat() ? "passed" : "FAILED" ) << std::endl;
1342  summary << "Check header format valid: " << ( checkHeaderType() ? "passed" : "FAILED" ) << std::endl;
1343  summary << "Check readout mode valid: " << ( checkReadoutMode() ? "passed" : "FAILED" ) << std::endl;
1344  //summary << "Check APVe address valid: " << ( checkAPVEAddressValid() ? "passed" : "FAILED" ) << std::endl;
1345  summary << "Check FE unit majority addresses: " << ( checkMajorityAddresses() ? "passed" : "FAILED" ) << std::endl;
1346  if (!checkMajorityAddresses()) {
1347  summary << "FEs with majority address error: ";
1348  unsigned int badFEs = 0;
1349  for (uint8_t iFE = 0; iFE < FEUNITS_PER_FED; iFE++) {
1350  if (!feEnabled(iFE)) continue;
1351  if (majorityAddressErrorForFEUnit(iFE)) {
1352  summary << uint16_t(iFE) << " ";
1353  badFEs++;
1354  }
1355  }
1356  summary << std::endl;
1357  summary << "Number of FE Units with bad addresses: " << badFEs << std::endl;
1358  }
1359  summary << "Check for FE unit buffer overflows: " << ( checkNoFEOverflows() ? "passed" : "FAILED" ) << std::endl;
1360  if (!checkNoFEOverflows()) {
1361  summary << "FEs which overflowed: ";
1362  unsigned int badFEs = 0;
1363  for (uint8_t iFE = 0; iFE < FEUNITS_PER_FED; iFE++) {
1364  if (feOverflow(iFE)) {
1365  summary << uint16_t(iFE) << " ";
1366  badFEs++;
1367  }
1368  }
1369  summary << std::endl;
1370  summary << "Number of FE Units which overflowed: " << badFEs << std::endl;
1371  }
1372  summary << "Check for S-Link CRC errors: " << ( checkNoSlinkCRCError() ? "passed" : "FAILED" ) << std::endl;
1373  summary << "Check for S-Link transmission error: " << ( checkNoSLinkTransmissionError() ? "passed" : "FAILED" ) << std::endl;
1374  summary << "Check CRC: " << ( checkCRC() ? "passed" : "FAILED" ) << std::endl;
1375  summary << "Check source ID is FED ID: " << ( checkSourceIDs() ? "passed" : "FAILED" ) << std::endl;
1376  summary << "Check for unexpected source ID at FRL: " << ( checkNoUnexpectedSourceID() ? "passed" : "FAILED" ) << std::endl;
1377  summary << "Check there are no extra headers or trailers: " << ( checkNoExtraHeadersOrTrailers() ? "passed" : "FAILED" ) << std::endl;
1378  summary << "Check length from trailer: " << ( checkLengthFromTrailer() ? "passed" : "FAILED" ) << std::endl;
1379  return summary.str();
1380  }
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 1384 of file SiStripFEDBufferComponents.h.

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

Referenced by print().

1385  {
1386  return daqHeader_.bxID();
1387  }
uint16_t sistrip::FEDBufferBase::daqCRC ( ) const
inline

Definition at line 1404 of file SiStripFEDBufferComponents.h.

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

Referenced by checkCRC().

1405  {
1406  return daqTrailer_.crc();
1407  }
uint32_t sistrip::FEDBufferBase::daqEventLengthIn64bitWords ( ) const
inline
uint32_t sistrip::FEDBufferBase::daqEventLengthInBytes ( ) const
inline

Definition at line 1399 of file SiStripFEDBufferComponents.h.

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

Referenced by checkLengthFromTrailer(), and print().

1400  {
1402  }
FEDDAQEventType sistrip::FEDBufferBase::daqEventType ( ) const
inline

Definition at line 1374 of file SiStripFEDBufferComponents.h.

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

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

1375  {
1376  return daqHeader_.eventType();
1377  }
FEDDAQEventType eventType() const
FEDDAQHeader sistrip::FEDBufferBase::daqHeader ( ) const
inline

Definition at line 1354 of file SiStripFEDBufferComponents.h.

References daqHeader_.

1355  {
1356  return daqHeader_;
1357  }
uint32_t sistrip::FEDBufferBase::daqLvl1ID ( ) const
inline

Definition at line 1379 of file SiStripFEDBufferComponents.h.

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

Referenced by print().

1380  {
1381  return daqHeader_.l1ID();
1382  }
uint16_t sistrip::FEDBufferBase::daqSourceID ( ) const
inline

Definition at line 1389 of file SiStripFEDBufferComponents.h.

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

Referenced by checkSourceIDs(), and print().

1390  {
1391  return daqHeader_.sourceID();
1392  }
FEDDAQTrailer sistrip::FEDBufferBase::daqTrailer ( ) const
inline

Definition at line 1359 of file SiStripFEDBufferComponents.h.

References daqTrailer_.

1360  {
1361  return daqTrailer_;
1362  }
FEDTTSBits sistrip::FEDBufferBase::daqTTSState ( ) const
inline

Definition at line 1409 of file SiStripFEDBufferComponents.h.

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

Referenced by print().

1410  {
1411  return daqTrailer_.ttsBits();
1412  }
FEDDataType sistrip::FEDBufferBase::dataType ( ) const
inline

Definition at line 1429 of file SiStripFEDBufferComponents.h.

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

Referenced by print().

1430  {
1431  return specialHeader_.dataType();
1432  }
TrackerSpecialHeader specialHeader_
bool sistrip::FEDBufferBase::doChecks ( ) const
virtual
bool sistrip::FEDBufferBase::doDAQHeaderAndTrailerChecks ( ) const
inline
bool sistrip::FEDBufferBase::doTrackerSpecialHeaderChecks ( ) const
inline

Definition at line 1474 of file SiStripFEDBufferComponents.h.

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

Referenced by doChecks().

1475  {
1476  return ( checkBufferFormat() &&
1477  checkHeaderType() &&
1478  checkReadoutMode() &&
1479  //checkAPVEAddressValid() &&
1480  checkNoFEOverflows() );
1481  }
void sistrip::FEDBufferBase::dump ( std::ostream &  os) const
inline

Definition at line 1339 of file SiStripFEDBufferComponents.h.

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

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

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

Definition at line 1344 of file SiStripFEDBufferComponents.h.

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

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

Definition at line 1454 of file SiStripFEDBufferComponents.h.

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

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

1455  {
1457  }
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 1449 of file SiStripFEDBufferComponents.h.

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

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

1450  {
1451  return specialHeader_.feOverflow(internalFEUnitNum);
1452  }
bool feOverflow(const uint8_t internalFEUnitNum) const
TrackerSpecialHeader specialHeader_
const uint8_t * sistrip::FEDBufferBase::getPointerToByteAfterEndOfPayload ( ) const
inlineprotected

Definition at line 1552 of file SiStripFEDBufferComponents.h.

References bufferSize_, and orderedBuffer_.

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

1553  {
1554  return orderedBuffer_+bufferSize_-8;
1555  }
const uint8_t * sistrip::FEDBufferBase::getPointerToDataAfterTrackerSpecialHeader ( ) const
inlineprotected

Definition at line 1547 of file SiStripFEDBufferComponents.h.

References orderedBuffer_.

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

1548  {
1549  return orderedBuffer_+16;
1550  }
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 1218 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_, edm::hlt::Exception, i, orderedBuffer_, originalBuffer_, specialHeader_, and contentValuesCheck::ss.

Referenced by FEDBufferBase().

1219  {
1220  //min buffer length. DAQ header, DAQ trailer, tracker special header.
1221  static const size_t MIN_BUFFER_SIZE = 8+8+8;
1222  //check size is non zero and data pointer is not NULL
1223  if (!originalBuffer_) throw cms::Exception("FEDBuffer") << "Buffer pointer is NULL.";
1224  if (bufferSize_ < MIN_BUFFER_SIZE) {
1225  std::ostringstream ss;
1226  ss << "Buffer is too small. "
1227  << "Min size is " << MIN_BUFFER_SIZE << ". "
1228  << "Buffer size is " << bufferSize_ << ". ";
1229  throw cms::Exception("FEDBuffer") << ss.str();
1230  }
1231 
1232  //construct tracker special header using second 64 bit word
1233  specialHeader_ = TrackerSpecialHeader(originalBuffer_+8);
1234 
1235  //check the buffer format
1237  if (bufferFormat == BUFFER_FORMAT_INVALID && !allowUnrecognizedFormat) {
1238  std::ostringstream ss;
1239  ss << "Buffer format not recognized. "
1240  << "Tracker special header: " << specialHeader_;
1241  throw cms::Exception("FEDBuffer") << ss.str();
1242  }
1243  //swap the buffer words so that the whole buffer is in slink ordering
1244  if ( (bufferFormat == BUFFER_FORMAT_OLD_VME) || (bufferFormat == BUFFER_FORMAT_NEW) ) {
1245  uint8_t* newBuffer = new uint8_t[bufferSize_];
1246  const uint32_t* originalU32 = reinterpret_cast<const uint32_t*>(originalBuffer_);
1247  const size_t sizeU32 = bufferSize_/4;
1248  uint32_t* newU32 = reinterpret_cast<uint32_t*>(newBuffer);
1249  if (bufferFormat == BUFFER_FORMAT_OLD_VME) {
1250  //swap whole buffer
1251  for (size_t i = 0; i < sizeU32; i+=2) {
1252  newU32[i] = originalU32[i+1];
1253  newU32[i+1] = originalU32[i];
1254  }
1255  }
1256  if (bufferFormat == BUFFER_FORMAT_NEW) {
1257  //copy DAQ header
1258  memcpy(newU32,originalU32,8);
1259  //copy DAQ trailer
1260  memcpy(newU32+sizeU32-2,originalU32+sizeU32-2,8);
1261  //swap the payload
1262  for (size_t i = 2; i < sizeU32-2; i+=2) {
1263  newU32[i] = originalU32[i+1];
1264  newU32[i+1] = originalU32[i];
1265  }
1266  }
1267  orderedBuffer_ = newBuffer;
1268  } //if ( (bufferFormat == BUFFER_FORMAT_OLD_VME) || (bufferFormat == BUFFER_FORMAT_NEW) )
1269  else {
1271  }
1272 
1273  //construct header object at begining of buffer
1274  daqHeader_ = FEDDAQHeader(orderedBuffer_);
1275  //construct trailer object using last 64 bit word of buffer
1276  daqTrailer_ = FEDDAQTrailer(orderedBuffer_+bufferSize_-8);
1277  }
int i
Definition: DBlmapReader.cc:9
TrackerSpecialHeader specialHeader_
FEDBufferFormat bufferFormat() const
bool sistrip::FEDBufferBase::majorityAddressErrorForFEUnit ( const uint8_t  internalFEUnitNum) const
inline
uint8_t sistrip::FEDBufferBase::nFEUnitsEnabled ( ) const

Definition at line 1303 of file SiStripFEDBufferComponents.cc.

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

Referenced by print().

1304  {
1305  uint8_t result = 0;
1306  for (uint8_t iFE = 0; iFE < FEUNITS_PER_FED; iFE++) {
1307  if (feEnabled(iFE)) result++;
1308  }
1309  return result;
1310  }
static const uint16_t FEUNITS_PER_FED
tuple result
Definition: query.py:137
bool feEnabled(const uint8_t internalFEUnitNum) const
void sistrip::FEDBufferBase::print ( std::ostream &  os) const
virtual

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

Definition at line 1285 of file SiStripFEDBufferComponents.cc.

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

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

1286  {
1287  os << "buffer format: " << bufferFormat() << std::endl;
1288  os << "Buffer size: " << bufferSize() << " bytes" << std::endl;
1289  os << "Event length from DAQ trailer: " << daqEventLengthInBytes() << " bytes" << std::endl;
1290  os << "Source ID: " << daqSourceID() << std::endl;
1291  os << "Header type: " << headerType() << std::endl;
1292  os << "Readout mode: " << readoutMode() << std::endl;
1293  os << "Data type: " << dataType() << std::endl;
1294  os << "DAQ event type: " << daqEventType() << std::endl;
1295  os << "TTS state: " << daqTTSState() << std::endl;
1296  os << "L1 ID: " << daqLvl1ID() << std::endl;
1297  os << "BX ID: " << daqBXID() << std::endl;
1298  os << "FED status register flags: "; fedStatusRegister().printFlags(os); os << std::endl;
1299  os << "APVe Address: " << uint16_t(apveAddress()) << std::endl;
1300  os << "Enabled FE units: " << uint16_t(nFEUnitsEnabled()) << std::endl;
1301  }
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 1369 of file SiStripFEDBufferComponents.h.

References specialHeader_.

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

1370  {
1371  return specialHeader_;
1372  }
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 616 of file SiStripFEDBufferComponents.h.

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

TrackerSpecialHeader sistrip::FEDBufferBase::specialHeader_
private