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

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:82
amc13::Trailer::Trailer ( unsigned int  blk,
unsigned int  lv1,
unsigned int  bx 
)

Definition at line 27 of file AMC13Spec.cc.

References amc13::Header::data_.

28  {
29  data_ =
30  (static_cast<uint64_t>(blk & BlkNo_mask) << BlkNo_shift) |
31  (static_cast<uint64_t>(lv1 & LV1_mask) << LV1_shift) |
32  (static_cast<uint64_t>(bx & BX_mask) << BX_shift);
33  }
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:15
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 36 of file AMC13Spec.cc.

References TauDecayModes::dec.

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

37  {
38  if ((crc != 0 && crc != getCRC()) || block != getBlock() || (lv1_id & LV1_mask) != getLV1ID() || (bx & BX_mask) != getBX()) {
39  edm::LogWarning("L1T")
40  << "Found AMC13 trailer with:"
41  << "\n\tBX " << getBX() << ", LV1 ID " << getLV1ID() << ", block # " << getBlock()
42  << ", CRC " << std::hex << std::setw(8) << std::setfill('0') << getCRC() << std::dec
43  << "\nBut expected:"
44  << "\n\tBX " << (bx & BX_mask) << ", LV1 ID " << (lv1_id & LV1_mask) << ", block # " << block
45  << ", CRC " << std::hex << std::setw(8) << std::setfill('0') << crc;
46  return false;
47  }
48  return true;
49  }
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
unsigned int amc13::Trailer::getBlock ( ) const
inline

Definition at line 48 of file AMC13Spec.h.

Referenced by 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.

Referenced by 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.

Referenced by 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.

Referenced by 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 groupFilesInBlocks::block, edm::check(), and end.

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 52 of file AMC13Spec.cc.

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

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

53  {
54  std::string dstring(reinterpret_cast<const char*>(start), reinterpret_cast<const char*>(end) + 4);
55  auto crc = cms::CRC32Calculator(dstring).checksum();
56 
57  *end = ((*end) & ~(uint64_t(CRC_mask) << CRC_shift)) | (static_cast<uint64_t>(crc & CRC_mask) << CRC_shift);
58  }
Definition: start.py:1
static const unsigned int CRC_mask
Definition: AMC13Spec.h:58
#define end
Definition: vmac.h:39
unsigned long long uint64_t
Definition: Time.h:15
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.

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

Definition at line 59 of file AMC13Spec.h.

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

Definition at line 64 of file AMC13Spec.h.

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

Definition at line 63 of file AMC13Spec.h.

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

Definition at line 58 of file AMC13Spec.h.

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

Definition at line 57 of file AMC13Spec.h.

uint64_t amc13::Trailer::data_
private

Definition at line 66 of file AMC13Spec.h.

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

Definition at line 62 of file AMC13Spec.h.

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

Definition at line 61 of file AMC13Spec.h.