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
amc::Trailer Class Reference

#include <AMCSpec.h>

Public Member Functions

bool check (unsigned int crc, unsigned int lv1_id, unsigned int size, bool mtf7_mode=false) const
 
unsigned int getCRC () const
 
unsigned int getLV1ID () const
 
unsigned int getSize () const
 
uint64_t raw () const
 
 Trailer ()
 
 Trailer (const uint64_t *data)
 
 Trailer (unsigned int crc, unsigned int lv1_id, unsigned int size)
 

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 CRC_mask = 0xffffffff
 
static const unsigned int CRC_shift = 32
 
static const unsigned int LV1ID_mask = 0xff
 
static const unsigned int LV1ID_shift = 24
 
static const unsigned int Size_mask = 0xfffff
 
static const unsigned int Size_shift = 0
 

Detailed Description

Definition at line 102 of file AMCSpec.h.

Constructor & Destructor Documentation

amc::Trailer::Trailer ( )
inline

Definition at line 104 of file AMCSpec.h.

104 : data_(0){};
uint64_t data_
Definition: AMCSpec.h:125
amc::Trailer::Trailer ( const uint64_t *  data)
inline

Definition at line 105 of file AMCSpec.h.

105 : data_(data[0]){};
uint64_t data_
Definition: AMCSpec.h:125
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
amc::Trailer::Trailer ( unsigned int  crc,
unsigned int  lv1_id,
unsigned int  size 
)

Definition at line 78 of file AMCSpec.cc.

79  : data_((uint64_t(crc & CRC_mask) << CRC_shift) | (uint64_t(lv1_id & LV1ID_mask) << LV1ID_shift) |
80  (uint64_t(size & Size_mask) << Size_shift)) {}
static const unsigned int Size_mask
Definition: AMCSpec.h:119
static const unsigned int CRC_mask
Definition: AMCSpec.h:123
uint64_t data_
Definition: AMCSpec.h:125
static const unsigned int CRC_shift
Definition: AMCSpec.h:122
static const unsigned int LV1ID_shift
Definition: AMCSpec.h:120
static const unsigned int LV1ID_mask
Definition: AMCSpec.h:121
unsigned long long uint64_t
Definition: Time.h:13
static const unsigned int Size_shift
Definition: AMCSpec.h:118
tuple size
Write out results.

Member Function Documentation

bool amc::Trailer::check ( unsigned int  crc,
unsigned int  lv1_id,
unsigned int  size,
bool  mtf7_mode = false 
) const

Definition at line 82 of file AMCSpec.cc.

References TauDecayModes::dec, getCRC(), getLV1ID(), getSize(), and LV1ID_mask.

82  {
83  if ((crc != getCRC() || size != getSize() || (lv1_id & LV1ID_mask) != getLV1ID()) && !mtf7_mode) {
84  edm::LogWarning("L1T") << "Found AMC trailer with:"
85  << "\n\tLV1 ID " << getLV1ID() << ", size " << getSize() << ", CRC " << std::hex
86  << std::setw(8) << std::setfill('0') << getCRC() << std::dec << "\nBut expected:"
87  << "\n\tLV1 ID " << (lv1_id & LV1ID_mask) << ", size " << size << ", CRC " << std::hex
88  << std::setw(8) << std::setfill('0') << crc;
89  return false;
90  }
91  return true;
92  }
unsigned int getLV1ID() const
Definition: AMCSpec.h:109
unsigned int getSize() const
Definition: AMCSpec.h:110
unsigned int getCRC() const
Definition: AMCSpec.h:108
static const unsigned int LV1ID_mask
Definition: AMCSpec.h:121
Log< level::Warning, false > LogWarning
tuple size
Write out results.
unsigned int amc::Trailer::getCRC ( ) const
inline

Definition at line 108 of file AMCSpec.h.

References CRC_mask, CRC_shift, and data_.

Referenced by check().

108 { return (data_ >> CRC_shift) & CRC_mask; };
static const unsigned int CRC_mask
Definition: AMCSpec.h:123
uint64_t data_
Definition: AMCSpec.h:125
static const unsigned int CRC_shift
Definition: AMCSpec.h:122
unsigned int amc::Trailer::getLV1ID ( ) const
inline

Definition at line 109 of file AMCSpec.h.

References data_, LV1ID_mask, and LV1ID_shift.

Referenced by check().

109 { return (data_ >> LV1ID_shift) & LV1ID_mask; };
uint64_t data_
Definition: AMCSpec.h:125
static const unsigned int LV1ID_shift
Definition: AMCSpec.h:120
static const unsigned int LV1ID_mask
Definition: AMCSpec.h:121
unsigned int amc::Trailer::getSize ( ) const
inline

Definition at line 110 of file AMCSpec.h.

References data_, Size_mask, and Size_shift.

Referenced by check().

110 { return (data_ >> Size_shift) & Size_mask; };
static const unsigned int Size_mask
Definition: AMCSpec.h:119
uint64_t data_
Definition: AMCSpec.h:125
static const unsigned int Size_shift
Definition: AMCSpec.h:118
uint64_t amc::Trailer::raw ( ) const
inline

Definition at line 112 of file AMCSpec.h.

References data_.

Referenced by amc::Packet::Packet().

112 { return data_; }
uint64_t data_
Definition: AMCSpec.h:125
void amc::Trailer::writeCRC ( const uint64_t *  start,
uint64_t *  end 
)
static

Definition at line 94 of file AMCSpec.cc.

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

Referenced by amc::Packet::Packet().

94  {
95  std::string dstring(reinterpret_cast<const char *>(start), reinterpret_cast<const char *>(end) + 4);
96  auto crc = cms::CRC32Calculator(dstring).checksum();
97 
98  *end = ((*end) & ~(uint64_t(CRC_mask) << CRC_shift)) | (static_cast<uint64_t>(crc & CRC_mask) << CRC_shift);
99  }
static const unsigned int CRC_mask
Definition: AMCSpec.h:123
static const unsigned int CRC_shift
Definition: AMCSpec.h:122
unsigned long long uint64_t
Definition: Time.h:13
string end
Definition: dataset.py:937
std::uint32_t checksum()

Member Data Documentation

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

Definition at line 123 of file AMCSpec.h.

Referenced by getCRC(), and writeCRC().

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

Definition at line 122 of file AMCSpec.h.

Referenced by getCRC(), and writeCRC().

uint64_t amc::Trailer::data_
private

Definition at line 125 of file AMCSpec.h.

Referenced by getCRC(), getLV1ID(), getSize(), and raw().

const unsigned int amc::Trailer::LV1ID_mask = 0xff
staticprivate

Definition at line 121 of file AMCSpec.h.

Referenced by check(), and getLV1ID().

const unsigned int amc::Trailer::LV1ID_shift = 24
staticprivate

Definition at line 120 of file AMCSpec.h.

Referenced by getLV1ID().

const unsigned int amc::Trailer::Size_mask = 0xfffff
staticprivate

Definition at line 119 of file AMCSpec.h.

Referenced by getSize().

const unsigned int amc::Trailer::Size_shift = 0
staticprivate

Definition at line 118 of file AMCSpec.h.

Referenced by getSize().