CMS 3D CMS Logo

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

◆ Trailer() [1/3]

amc::Trailer::Trailer ( )
inline

Definition at line 104 of file AMCSpec.h.

104 : data_(0){};

◆ Trailer() [2/3]

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

Definition at line 105 of file AMCSpec.h.

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

◆ Trailer() [3/3]

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)) {}

Member Function Documentation

◆ check()

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.

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  }

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

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

◆ getCRC()

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

Definition at line 108 of file AMCSpec.h.

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

References CRC_mask, CRC_shift, and data_.

Referenced by check().

◆ getLV1ID()

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

Definition at line 109 of file AMCSpec.h.

109 { return (data_ >> LV1ID_shift) & LV1ID_mask; };

References data_, LV1ID_mask, and LV1ID_shift.

Referenced by check().

◆ getSize()

unsigned int amc::Trailer::getSize ( ) const
inline

Definition at line 110 of file AMCSpec.h.

110 { return (data_ >> Size_shift) & Size_mask; };

References data_, Size_mask, and Size_shift.

Referenced by check().

◆ raw()

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

Definition at line 112 of file AMCSpec.h.

112 { return data_; }

References data_.

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

◆ writeCRC()

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

Definition at line 94 of file AMCSpec.cc.

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  }

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

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

Member Data Documentation

◆ CRC_mask

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

Definition at line 123 of file AMCSpec.h.

Referenced by getCRC(), and writeCRC().

◆ CRC_shift

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

Definition at line 122 of file AMCSpec.h.

Referenced by getCRC(), and writeCRC().

◆ data_

uint64_t amc::Trailer::data_
private

Definition at line 125 of file AMCSpec.h.

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

◆ LV1ID_mask

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

Definition at line 121 of file AMCSpec.h.

Referenced by check(), and getLV1ID().

◆ LV1ID_shift

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

Definition at line 120 of file AMCSpec.h.

Referenced by getLV1ID().

◆ Size_mask

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

Definition at line 119 of file AMCSpec.h.

Referenced by getSize().

◆ Size_shift

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

Definition at line 118 of file AMCSpec.h.

Referenced by getSize().

amc::Trailer::getCRC
unsigned int getCRC() const
Definition: AMCSpec.h:108
start
Definition: start.py:1
amc::Trailer::data_
uint64_t data_
Definition: AMCSpec.h:125
cms::CRC32Calculator
Definition: CRC32Calculator.h:62
cms::CRC32Calculator::checksum
std::uint32_t checksum()
Definition: CRC32Calculator.h:66
amc::Trailer::Size_mask
static const unsigned int Size_mask
Definition: AMCSpec.h:119
amc::Trailer::CRC_shift
static const unsigned int CRC_shift
Definition: AMCSpec.h:122
end
#define end
Definition: vmac.h:39
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogWarning
Definition: MessageLogger.h:141
amc::Trailer::getSize
unsigned int getSize() const
Definition: AMCSpec.h:110
amc::Trailer::LV1ID_shift
static const unsigned int LV1ID_shift
Definition: AMCSpec.h:120
amc::Trailer::CRC_mask
static const unsigned int CRC_mask
Definition: AMCSpec.h:123
amc::Trailer::LV1ID_mask
static const unsigned int LV1ID_mask
Definition: AMCSpec.h:121
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:143
amc::Trailer::Size_shift
static const unsigned int Size_shift
Definition: AMCSpec.h:118
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
amc::Trailer::getLV1ID
unsigned int getLV1ID() const
Definition: AMCSpec.h:109