CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes
amc13::Trailer Class Reference

#include <AMC13Spec.h>

Public Member Functions

bool check (unsigned int crc, unsigned int block, unsigned int lv1_id, unsigned int bx) const
 
unsigned int getBlock () const
 
unsigned int getBX () const
 
unsigned int getCRC () const
 
unsigned int getLV1ID () const
 
uint64_t raw () const
 
 Trailer (const uint64_t *data)
 
 Trailer (unsigned int blk, unsigned int lv1, unsigned int bx)
 

Static Public Member Functions

static void writeCRC (const uint64_t *start, uint64_t *end)
 

Private Attributes

uint64_t data_
 

Static Private Attributes

static const unsigned int BlkNo_mask = 0xff
 
static const unsigned int BlkNo_shift = 20
 
static const unsigned int BX_mask = 0xfff
 
static const unsigned int BX_shift = 0
 
static const unsigned int CRC_mask = 0xffffffff
 
static const unsigned int CRC_shift = 32
 
static const unsigned int LV1_mask = 0xff
 
static const unsigned int LV1_shift = 12
 

Detailed Description

Definition at line 42 of file AMC13Spec.h.

Constructor & Destructor Documentation

amc13::Trailer::Trailer ( const uint64_t *  data)
inline

Definition at line 44 of file AMC13Spec.h.

44 : data_(data[0]){};
uint64_t data_
Definition: AMC13Spec.h:66
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
amc13::Trailer::Trailer ( unsigned int  blk,
unsigned int  lv1,
unsigned int  bx 
)

Definition at line 21 of file AMC13Spec.cc.

References BlkNo_mask, BlkNo_shift, BX_mask, BX_shift, data_, LV1_mask, and LV1_shift.

21  {
22  data_ = (static_cast<uint64_t>(blk & BlkNo_mask) << BlkNo_shift) |
23  (static_cast<uint64_t>(lv1 & LV1_mask) << LV1_shift) | (static_cast<uint64_t>(bx & BX_mask) << BX_shift);
24  }
static const unsigned int LV1_mask
Definition: AMC13Spec.h:62
static const unsigned int BlkNo_mask
Definition: AMC13Spec.h:60
static const unsigned int BX_mask
Definition: AMC13Spec.h:64
uint64_t data_
Definition: AMC13Spec.h:66
static const unsigned int BX_shift
Definition: AMC13Spec.h:63
unsigned long long uint64_t
Definition: Time.h:13
static const unsigned int LV1_shift
Definition: AMC13Spec.h:61
static const unsigned int BlkNo_shift
Definition: AMC13Spec.h:59

Member Function Documentation

bool amc13::Trailer::check ( unsigned int  crc,
unsigned int  block,
unsigned int  lv1_id,
unsigned int  bx 
) const

Definition at line 26 of file AMC13Spec.cc.

References BX_mask, TauDecayModes::dec, getBlock(), getBX(), getCRC(), getLV1ID(), and LV1_mask.

Referenced by amc13::Packet::parse().

26  {
27  if ((crc != 0 && crc != getCRC()) || block != getBlock() || (lv1_id & LV1_mask) != getLV1ID() ||
28  (bx & BX_mask) != getBX()) {
29  edm::LogWarning("L1T") << "Found AMC13 trailer with:"
30  << "\n\tBX " << getBX() << ", LV1 ID " << getLV1ID() << ", block # " << getBlock()
31  << ", CRC " << std::hex << std::setw(8) << std::setfill('0') << getCRC() << std::dec
32  << "\nBut expected:"
33  << "\n\tBX " << (bx & BX_mask) << ", LV1 ID " << (lv1_id & LV1_mask) << ", block # "
34  << block << ", CRC " << std::hex << std::setw(8) << std::setfill('0') << crc;
35  return false;
36  }
37  return true;
38  }
static const unsigned int LV1_mask
Definition: AMC13Spec.h:62
unsigned int getCRC() const
Definition: AMC13Spec.h:47
static const unsigned int BX_mask
Definition: AMC13Spec.h:64
unsigned int getBX() const
Definition: AMC13Spec.h:50
unsigned int getBlock() const
Definition: AMC13Spec.h:48
unsigned int getLV1ID() const
Definition: AMC13Spec.h:49
Log< level::Warning, false > LogWarning
unsigned int amc13::Trailer::getBlock ( ) const
inline

Definition at line 48 of file AMC13Spec.h.

References BlkNo_mask, BlkNo_shift, and data_.

Referenced by check(), and omtf::OmtfUnpacker::produce().

48 { return (data_ >> BlkNo_shift) & BlkNo_mask; };
static const unsigned int BlkNo_mask
Definition: AMC13Spec.h:60
uint64_t data_
Definition: AMC13Spec.h:66
static const unsigned int BlkNo_shift
Definition: AMC13Spec.h:59
unsigned int amc13::Trailer::getBX ( ) const
inline

Definition at line 50 of file AMC13Spec.h.

References BX_mask, BX_shift, and data_.

Referenced by check(), and omtf::OmtfUnpacker::produce().

50 { return (data_ >> BX_shift) & BX_mask; };
static const unsigned int BX_mask
Definition: AMC13Spec.h:64
uint64_t data_
Definition: AMC13Spec.h:66
static const unsigned int BX_shift
Definition: AMC13Spec.h:63
unsigned int amc13::Trailer::getCRC ( ) const
inline

Definition at line 47 of file AMC13Spec.h.

References CRC_mask, CRC_shift, and data_.

Referenced by check(), and omtf::OmtfUnpacker::produce().

47 { return (data_ >> CRC_shift) & CRC_mask; };
static const unsigned int CRC_mask
Definition: AMC13Spec.h:58
uint64_t data_
Definition: AMC13Spec.h:66
static const unsigned int CRC_shift
Definition: AMC13Spec.h:57
unsigned int amc13::Trailer::getLV1ID ( ) const
inline

Definition at line 49 of file AMC13Spec.h.

References data_, LV1_mask, and LV1_shift.

Referenced by check(), and omtf::OmtfUnpacker::produce().

49 { return (data_ >> LV1_shift) & LV1_mask; };
static const unsigned int LV1_mask
Definition: AMC13Spec.h:62
uint64_t data_
Definition: AMC13Spec.h:66
static const unsigned int LV1_shift
Definition: AMC13Spec.h:61
uint64_t amc13::Trailer::raw ( ) const
inline

Definition at line 52 of file AMC13Spec.h.

References data_.

52 { return data_; };
uint64_t data_
Definition: AMC13Spec.h:66
void amc13::Trailer::writeCRC ( const uint64_t *  start,
uint64_t *  end 
)
static

Definition at line 40 of file AMC13Spec.cc.

References cms::CRC32Calculator::checksum(), CRC_mask, CRC_shift, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by amc13::Packet::write().

40  {
41  std::string dstring(reinterpret_cast<const char*>(start), reinterpret_cast<const char*>(end) + 4);
42  auto crc = cms::CRC32Calculator(dstring).checksum();
43 
44  *end = ((*end) & ~(uint64_t(CRC_mask) << CRC_shift)) | (static_cast<uint64_t>(crc & CRC_mask) << CRC_shift);
45  }
static const unsigned int CRC_mask
Definition: AMC13Spec.h:58
unsigned long long uint64_t
Definition: Time.h:13
string end
Definition: dataset.py:937
static const unsigned int CRC_shift
Definition: AMC13Spec.h:57
std::uint32_t checksum()

Member Data Documentation

const unsigned int amc13::Trailer::BlkNo_mask = 0xff
staticprivate

Definition at line 60 of file AMC13Spec.h.

Referenced by getBlock(), and Trailer().

const unsigned int amc13::Trailer::BlkNo_shift = 20
staticprivate

Definition at line 59 of file AMC13Spec.h.

Referenced by getBlock(), and Trailer().

const unsigned int amc13::Trailer::BX_mask = 0xfff
staticprivate

Definition at line 64 of file AMC13Spec.h.

Referenced by check(), getBX(), and Trailer().

const unsigned int amc13::Trailer::BX_shift = 0
staticprivate

Definition at line 63 of file AMC13Spec.h.

Referenced by getBX(), and Trailer().

const unsigned int amc13::Trailer::CRC_mask = 0xffffffff
staticprivate

Definition at line 58 of file AMC13Spec.h.

Referenced by getCRC(), and writeCRC().

const unsigned int amc13::Trailer::CRC_shift = 32
staticprivate

Definition at line 57 of file AMC13Spec.h.

Referenced by getCRC(), and writeCRC().

uint64_t amc13::Trailer::data_
private

Definition at line 66 of file AMC13Spec.h.

Referenced by getBlock(), getBX(), getCRC(), getLV1ID(), raw(), and Trailer().

const unsigned int amc13::Trailer::LV1_mask = 0xff
staticprivate

Definition at line 62 of file AMC13Spec.h.

Referenced by check(), getLV1ID(), and Trailer().

const unsigned int amc13::Trailer::LV1_shift = 12
staticprivate

Definition at line 61 of file AMC13Spec.h.

Referenced by getLV1ID(), and Trailer().