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 97 of file AMCSpec.h.

Constructor & Destructor Documentation

amc::Trailer::Trailer ( )
inline

Definition at line 99 of file AMCSpec.h.

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

Definition at line 100 of file AMCSpec.h.

References findQualityFiles::size.

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

Definition at line 92 of file AMCSpec.cc.

92  :
93  data_(
94  (uint64_t(crc & CRC_mask) << CRC_shift) |
95  (uint64_t(lv1_id & LV1ID_mask) << LV1ID_shift) |
97  )
98  {
99  }
size
Write out results.
static const unsigned int Size_mask
Definition: AMCSpec.h:114
static const unsigned int CRC_mask
Definition: AMCSpec.h:118
uint64_t data_
Definition: AMCSpec.h:120
static const unsigned int CRC_shift
Definition: AMCSpec.h:117
static const unsigned int LV1ID_shift
Definition: AMCSpec.h:115
static const unsigned int LV1ID_mask
Definition: AMCSpec.h:116
unsigned long long uint64_t
Definition: Time.h:15
static const unsigned int Size_shift
Definition: AMCSpec.h:113

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 102 of file AMCSpec.cc.

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

103  {
104  if ( (crc != getCRC() || size != getSize() || (lv1_id & LV1ID_mask) != getLV1ID()) && !mtf7_mode ) {
105  edm::LogWarning("L1T")
106  << "Found AMC trailer with:"
107  << "\n\tLV1 ID " << getLV1ID() << ", size " << getSize()
108  << ", CRC " << std::hex << std::setw(8) << std::setfill('0') << getCRC() << std::dec
109  << "\nBut expected:"
110  << "\n\tLV1 ID " << (lv1_id & LV1ID_mask) << ", size " << size
111  << ", CRC " << std::hex << std::setw(8) << std::setfill('0') << crc;
112  return false;
113  }
114  return true;
115  }
size
Write out results.
unsigned int getLV1ID() const
Definition: AMCSpec.h:104
unsigned int getSize() const
Definition: AMCSpec.h:105
unsigned int getCRC() const
Definition: AMCSpec.h:103
static const unsigned int LV1ID_mask
Definition: AMCSpec.h:116
unsigned int amc::Trailer::getCRC ( ) const
inline

Definition at line 103 of file AMCSpec.h.

References amc::BlockHeader::data_.

Referenced by check().

103 { return (data_ >> CRC_shift) & CRC_mask; };
static const unsigned int CRC_mask
Definition: AMCSpec.h:118
uint64_t data_
Definition: AMCSpec.h:120
static const unsigned int CRC_shift
Definition: AMCSpec.h:117
unsigned int amc::Trailer::getLV1ID ( ) const
inline

Definition at line 104 of file AMCSpec.h.

References amc::BlockHeader::data_.

Referenced by check().

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

Definition at line 105 of file AMCSpec.h.

References amc::BlockHeader::data_, amc::BlockHeader::Size_mask, and amc::BlockHeader::Size_shift.

Referenced by check().

105 { return (data_ >> Size_shift) & Size_mask; };
static const unsigned int Size_mask
Definition: AMCSpec.h:114
uint64_t data_
Definition: AMCSpec.h:120
static const unsigned int Size_shift
Definition: AMCSpec.h:113
uint64_t amc::Trailer::raw ( ) const
inline

Definition at line 107 of file AMCSpec.h.

References trackerTree::check(), amc::BlockHeader::data_, and end.

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

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

Definition at line 118 of file AMCSpec.cc.

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

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

119  {
120  std::string dstring(reinterpret_cast<const char*>(start), reinterpret_cast<const char*>(end) + 4);
121  auto crc = cms::CRC32Calculator(dstring).checksum();
122 
123  *end = ((*end) & ~(uint64_t(CRC_mask) << CRC_shift)) | (static_cast<uint64_t>(crc & CRC_mask) << CRC_shift);
124  }
Definition: start.py:1
static const unsigned int CRC_mask
Definition: AMCSpec.h:118
static const unsigned int CRC_shift
Definition: AMCSpec.h:117
#define end
Definition: vmac.h:39
unsigned long long uint64_t
Definition: Time.h:15
std::uint32_t checksum()

Member Data Documentation

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

Definition at line 118 of file AMCSpec.h.

Referenced by writeCRC().

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

Definition at line 117 of file AMCSpec.h.

Referenced by writeCRC().

uint64_t amc::Trailer::data_
private

Definition at line 120 of file AMCSpec.h.

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

Definition at line 116 of file AMCSpec.h.

Referenced by check().

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

Definition at line 115 of file AMCSpec.h.

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

Definition at line 114 of file AMCSpec.h.

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

Definition at line 113 of file AMCSpec.h.