CMS 3D CMS Logo

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

◆ Trailer() [1/2]

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

Definition at line 44 of file AMC13Spec.h.

44 : data_(data[0]){};

◆ Trailer() [2/2]

amc13::Trailer::Trailer ( unsigned int  blk,
unsigned int  lv1,
unsigned int  bx 
)

Definition at line 21 of file AMC13Spec.cc.

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  }

References BlkNo_mask, BlkNo_shift, l1GtPatternGenerator_cfi::bx, BX_mask, BX_shift, data_, LV1_mask, and LV1_shift.

Member Function Documentation

◆ check()

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.

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  }

References groupFilesInBlocks::block, l1GtPatternGenerator_cfi::bx, BX_mask, TauDecayModes::dec, getBlock(), getBX(), getCRC(), getLV1ID(), and LV1_mask.

◆ getBlock()

unsigned int amc13::Trailer::getBlock ( ) const
inline

Definition at line 48 of file AMC13Spec.h.

48 { return (data_ >> BlkNo_shift) & BlkNo_mask; };

References BlkNo_mask, BlkNo_shift, and data_.

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

◆ getBX()

unsigned int amc13::Trailer::getBX ( ) const
inline

Definition at line 50 of file AMC13Spec.h.

50 { return (data_ >> BX_shift) & BX_mask; };

References BX_mask, BX_shift, and data_.

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

◆ getCRC()

unsigned int amc13::Trailer::getCRC ( ) const
inline

Definition at line 47 of file AMC13Spec.h.

47 { return (data_ >> CRC_shift) & CRC_mask; };

References CRC_mask, CRC_shift, and data_.

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

◆ getLV1ID()

unsigned int amc13::Trailer::getLV1ID ( ) const
inline

Definition at line 49 of file AMC13Spec.h.

49 { return (data_ >> LV1_shift) & LV1_mask; };

References data_, LV1_mask, and LV1_shift.

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

◆ raw()

uint64_t amc13::Trailer::raw ( ) const
inline

Definition at line 52 of file AMC13Spec.h.

52 { return data_; };

References data_.

◆ writeCRC()

void amc13::Trailer::writeCRC ( const uint64_t *  start,
uint64_t *  end 
)
static

Definition at line 40 of file AMC13Spec.cc.

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  }

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

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

Member Data Documentation

◆ BlkNo_mask

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

Definition at line 60 of file AMC13Spec.h.

Referenced by getBlock(), and Trailer().

◆ BlkNo_shift

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

Definition at line 59 of file AMC13Spec.h.

Referenced by getBlock(), and Trailer().

◆ BX_mask

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

Definition at line 64 of file AMC13Spec.h.

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

◆ BX_shift

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

Definition at line 63 of file AMC13Spec.h.

Referenced by getBX(), and Trailer().

◆ CRC_mask

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

Definition at line 58 of file AMC13Spec.h.

Referenced by getCRC(), and writeCRC().

◆ CRC_shift

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

Definition at line 57 of file AMC13Spec.h.

Referenced by getCRC(), and writeCRC().

◆ data_

uint64_t amc13::Trailer::data_
private

Definition at line 66 of file AMC13Spec.h.

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

◆ LV1_mask

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

Definition at line 62 of file AMC13Spec.h.

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

◆ LV1_shift

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

Definition at line 61 of file AMC13Spec.h.

Referenced by getLV1ID(), and Trailer().

amc13::Trailer::BX_shift
static const unsigned int BX_shift
Definition: AMC13Spec.h:63
start
Definition: start.py:1
amc13::Trailer::getBlock
unsigned int getBlock() const
Definition: AMC13Spec.h:48
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
amc13::Trailer::LV1_shift
static const unsigned int LV1_shift
Definition: AMC13Spec.h:61
cms::CRC32Calculator
Definition: CRC32Calculator.h:62
cms::CRC32Calculator::checksum
std::uint32_t checksum()
Definition: CRC32Calculator.h:66
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
amc13::Trailer::BlkNo_shift
static const unsigned int BlkNo_shift
Definition: AMC13Spec.h:59
amc13::Trailer::CRC_shift
static const unsigned int CRC_shift
Definition: AMC13Spec.h:57
mps_fire.end
end
Definition: mps_fire.py:242
amc13::Trailer::getCRC
unsigned int getCRC() const
Definition: AMC13Spec.h:47
amc13::Trailer::LV1_mask
static const unsigned int LV1_mask
Definition: AMC13Spec.h:62
groupFilesInBlocks.block
block
Definition: groupFilesInBlocks.py:150
amc13::Trailer::BlkNo_mask
static const unsigned int BlkNo_mask
Definition: AMC13Spec.h:60
amc13::Trailer::BX_mask
static const unsigned int BX_mask
Definition: AMC13Spec.h:64
amc13::Trailer::getLV1ID
unsigned int getLV1ID() const
Definition: AMC13Spec.h:49
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
amc13::Trailer::getBX
unsigned int getBX() const
Definition: AMC13Spec.h:50
amc13::Trailer::CRC_mask
static const unsigned int CRC_mask
Definition: AMC13Spec.h:58
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
cond::uint64_t
unsigned long long uint64_t
Definition: Time.h:13
TauDecayModes.dec
dec
Definition: TauDecayModes.py:142
amc13::Trailer::data_
uint64_t data_
Definition: AMC13Spec.h:66