CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Static Private Attributes
l1t::MTF7Payload Class Reference

#include <Block.h>

Inheritance diagram for l1t::MTF7Payload:
l1t::Payload

Public Member Functions

std::unique_ptr< BlockgetBlock () override
 
BlockHeader getHeader () override
 
unsigned getHeaderSize () const override
 
 MTF7Payload (const uint32_t *data, const uint32_t *end)
 
- Public Member Functions inherited from l1t::Payload
virtual unsigned getAlgorithmFWVersion () const
 
virtual unsigned getInfrastructureFWVersion () const
 
 Payload (const uint32_t *data, const uint32_t *end)
 
virtual ~Payload ()
 

Private Member Functions

int count (unsigned int pattern, unsigned int length) const
 
bool valid (unsigned int pattern) const
 

Static Private Attributes

static const std::vector< unsigned int > block_patterns_
 bit patterns of the first bits (of 16bit words) More...
 
static constexpr unsigned counter_size = 4
 
static constexpr unsigned DAQ_PAYLOAD_OFFSET = 4
 Start of the EMTF DAQ payload, in number of 64-bit words. More...
 
static constexpr unsigned GE11_MAX_PER_BX = 112
 Maximum number of GE1/1 words per MTF7 payload per bx: 7 GE1/1 links, 2 layers, 8 clusters. More...
 
static constexpr unsigned GE21_MAX_PER_BX = 0
 TODO: Maximum number of GE2/1 words per MTF7 payload per bx: ?? GE2/1 links, 2 layers, ?? clusters. More...
 
static constexpr unsigned header_size = 12
 
static constexpr unsigned max_block_length_ = 3
 maximum of the block length (64bits) More...
 
static constexpr unsigned MAX_BX_PER_PAYLOAD = 8
 Maximum number of BX per MTF7 payload. More...
 
static constexpr unsigned ME0_MAX_PER_BX = 0
 TODO: Maximum number of ME0 words per MTF7 payload per bx: ?? ME0 links, ?? layers, ?? clusters. More...
 
static constexpr unsigned ME_MAX_PER_BX = 108
 Maximum number of CSC words per MTF7 payload per bx: 9 links/sectors, 6 stations, 2 LCTs. More...
 
static constexpr unsigned PAYLOAD_MAX_SIZE
 Maximum number of 64-bit words in the EMTF payload. More...
 
static constexpr unsigned RPC_MAX_PER_BX = 84
 Maximum number of RPC words per MTF7 payload per bx: 7 links/sectors, 6 stations, 2 segments. More...
 
static constexpr unsigned SP_MAX_PER_BX = 6
 Maximum number of SPz words per MTF7 payload per bx: 3 tracks, 2 words per track. More...
 
static constexpr unsigned trailer_size = 8
 

Additional Inherited Members

- Protected Attributes inherited from l1t::Payload
unsigned algo_
 
const uint32_t * data_
 
const uint32_t * end_
 
unsigned infra_
 

Detailed Description

Definition at line 129 of file Block.h.

Constructor & Destructor Documentation

◆ MTF7Payload()

l1t::MTF7Payload::MTF7Payload ( const uint32_t *  data,
const uint32_t *  end 
)

Definition at line 111 of file Block.cc.

111  : Payload(data, end) {
112  const uint16_t* data16 = reinterpret_cast<const uint16_t*>(data);
113  const uint16_t* end16 = reinterpret_cast<const uint16_t*>(end);
114 
115  if (end16 - data16 < header_size + counter_size + trailer_size) {
116  edm::LogError("L1T") << "MTF7 payload smaller than allowed!";
117  data_ = end_;
118  } else if ( // Check bits for EMTF Event Record Header
119  ((data16[0] >> 12) != 0x9) || ((data16[1] >> 12) != 0x9) || ((data16[2] >> 12) != 0x9) ||
120  ((data16[3] >> 12) != 0x9) || ((data16[4] >> 12) != 0xA) || ((data16[5] >> 12) != 0xA) ||
121  ((data16[6] >> 12) != 0xA) || ((data16[7] >> 12) != 0xA) || ((data16[8] >> 15) != 0x1) ||
122  ((data16[9] >> 15) != 0x0) || ((data16[10] >> 15) != 0x0) || ((data16[11] >> 15) != 0x0)) {
123  edm::LogError("L1T") << "MTF7 payload has invalid header!";
124  data_ = end_;
125  } else if ( // Check bits for EMTF MPC Link Errors
126  ((data16[12] >> 15) != 0) || ((data16[13] >> 15) != 1) || ((data16[14] >> 15) != 0) ||
127  ((data16[15] >> 15) != 0)) {
128  edm::LogError("L1T") << "MTF7 payload has invalid counter block!";
129  data_ = end_;
130  }
131 
132  // Check bits for EMTF Event Record Trailer, get firmware version
133  algo_ = 0; // Firmware version
134 
135  // Start after always present Counters block
136  for (unsigned i = DAQ_PAYLOAD_OFFSET; i < PAYLOAD_MAX_SIZE; i++) {
137  if (((data16[4 * i + 0] >> 12) == 0xF) && ((data16[4 * i + 1] >> 12) == 0xF) &&
138  ((data16[4 * i + 2] >> 12) == 0xF) && ((data16[4 * i + 3] >> 12) == 0xF) &&
139  ((data16[4 * i + 4] >> 12) == 0xE) && ((data16[4 * i + 5] >> 12) == 0xE) &&
140  ((data16[4 * i + 6] >> 12) == 0xE) &&
141  ((data16[4 * i + 7] >> 12) == 0xE)) { // Indicators for the Trailer block
142  algo_ = (((data16[4 * i + 2] >> 4) & 0x3F) << 9); // Year (6 bits)
143  algo_ |= (((data16[4 * i + 2] >> 0) & 0x0F) << 5); // Month (4 bits)
144  algo_ |= (((data16[4 * i + 4] >> 0) & 0x1F) << 0); // Day (5 bits)
145  break;
146  }
147  }
148  if (algo_ == 0) {
149  edm::LogError("L1T") << "MTF7 payload has no valid EMTF firmware version!";
150  data_ = end_;
151  }
152  }

References l1t::Payload::algo_, counter_size, DAQ_PAYLOAD_OFFSET, data, l1t::Payload::data_, mps_fire::end, l1t::Payload::end_, header_size, mps_fire::i, PAYLOAD_MAX_SIZE, trailer_size, and testProducerWithPsetDescEmpty_cfi::x1.

Member Function Documentation

◆ count()

int l1t::MTF7Payload::count ( unsigned int  pattern,
unsigned int  length 
) const
private

Definition at line 154 of file Block.cc.

154  {
155  unsigned int mask = 0;
156  for (; length > 0; length--)
157  mask = (mask << 4) | 0xf;
158 
159  int count = 0;
160  for (const auto& p : block_patterns_)
161  count += (p & mask) == pattern;
162  return count;
163  }

References block_patterns_, AlCaHLTBitMon_ParallelJobs::p, and topSingleLeptonDQM_PU_cfi::pattern.

Referenced by getBlock().

◆ getBlock()

std::unique_ptr< Block > l1t::MTF7Payload::getBlock ( )
overridevirtual

Reimplemented from l1t::Payload.

Definition at line 173 of file Block.cc.

173  {
174  if (end_ - data_ < 2)
175  return std::unique_ptr<Block>();
176 
177  const uint16_t* data16 = reinterpret_cast<const uint16_t*>(data_);
178  const uint16_t* end16 = reinterpret_cast<const uint16_t*>(end_);
179 
180  // Read in blocks equivalent to 64 bit words, trying to match the
181  // pattern of first bits to what is deemed valid.
182  std::vector<uint32_t> payload;
183  unsigned int pattern = 0;
184  unsigned int i = 0;
185  for (; i < max_block_length_ and data16 + (i + 1) * 4 <= end16; ++i) {
186  for (int j = 0; j < 4; ++j) {
187  auto n = i * 4 + j;
188  pattern |= (data16[n] >> 15) << n;
189  payload.push_back(data16[n]);
190  }
191 
192  if (count(pattern, i + 1) == 1 and valid(pattern))
193  break;
194  }
195 
196  if (not valid(pattern)) {
197  edm::LogWarning("L1T") << "MTF7 block with unrecognized id 0x" << std::hex << pattern;
198  return std::unique_ptr<Block>();
199  }
200 
201  data_ += (i + 1) * 2;
202  return std::make_unique<Block>(pattern, payload, 0, MTF7);
203  }

References count(), l1t::Payload::data_, l1t::Payload::end_, mps_fire::i, dqmiolumiharvest::j, max_block_length_, l1t::MTF7, dqmiodumpmetadata::n, topSingleLeptonDQM_PU_cfi::pattern, jets_cff::payload, and valid().

◆ getHeader()

BlockHeader l1t::MTF7Payload::getHeader ( )
inlineoverridevirtual

Implements l1t::Payload.

Definition at line 134 of file Block.h.

134 { return BlockHeader(nullptr); };

◆ getHeaderSize()

unsigned l1t::MTF7Payload::getHeaderSize ( ) const
inlineoverridevirtual

Implements l1t::Payload.

Definition at line 133 of file Block.h.

133 { return 0; };

◆ valid()

bool l1t::MTF7Payload::valid ( unsigned int  pattern) const
private

Definition at line 165 of file Block.cc.

165  {
166  for (const auto& p : block_patterns_) {
167  if (p == pattern)
168  return true;
169  }
170  return false;
171  }

References block_patterns_, AlCaHLTBitMon_ParallelJobs::p, and topSingleLeptonDQM_PU_cfi::pattern.

Referenced by getBlock().

Member Data Documentation

◆ block_patterns_

const std::vector< unsigned int > l1t::MTF7Payload::block_patterns_
staticprivate
Initial value:

bit patterns of the first bits (of 16bit words)

Definition at line 166 of file Block.h.

Referenced by count(), and valid().

◆ counter_size

constexpr unsigned l1t::MTF7Payload::counter_size = 4
staticconstexprprivate

Definition at line 140 of file Block.h.

Referenced by MTF7Payload().

◆ DAQ_PAYLOAD_OFFSET

constexpr unsigned l1t::MTF7Payload::DAQ_PAYLOAD_OFFSET = 4
staticconstexprprivate

Start of the EMTF DAQ payload, in number of 64-bit words.

Definition at line 144 of file Block.h.

Referenced by MTF7Payload().

◆ GE11_MAX_PER_BX

constexpr unsigned l1t::MTF7Payload::GE11_MAX_PER_BX = 112
staticconstexprprivate

Maximum number of GE1/1 words per MTF7 payload per bx: 7 GE1/1 links, 2 layers, 8 clusters.

Definition at line 152 of file Block.h.

◆ GE21_MAX_PER_BX

constexpr unsigned l1t::MTF7Payload::GE21_MAX_PER_BX = 0
staticconstexprprivate

TODO: Maximum number of GE2/1 words per MTF7 payload per bx: ?? GE2/1 links, 2 layers, ?? clusters.

Definition at line 154 of file Block.h.

◆ header_size

constexpr unsigned l1t::MTF7Payload::header_size = 12
staticconstexprprivate

Definition at line 139 of file Block.h.

Referenced by MTF7Payload().

◆ max_block_length_

constexpr unsigned l1t::MTF7Payload::max_block_length_ = 3
staticconstexprprivate

maximum of the block length (64bits)

Definition at line 165 of file Block.h.

Referenced by getBlock().

◆ MAX_BX_PER_PAYLOAD

constexpr unsigned l1t::MTF7Payload::MAX_BX_PER_PAYLOAD = 8
staticconstexprprivate

Maximum number of BX per MTF7 payload.

Definition at line 146 of file Block.h.

◆ ME0_MAX_PER_BX

constexpr unsigned l1t::MTF7Payload::ME0_MAX_PER_BX = 0
staticconstexprprivate

TODO: Maximum number of ME0 words per MTF7 payload per bx: ?? ME0 links, ?? layers, ?? clusters.

Definition at line 156 of file Block.h.

◆ ME_MAX_PER_BX

constexpr unsigned l1t::MTF7Payload::ME_MAX_PER_BX = 108
staticconstexprprivate

Maximum number of CSC words per MTF7 payload per bx: 9 links/sectors, 6 stations, 2 LCTs.

Definition at line 148 of file Block.h.

◆ PAYLOAD_MAX_SIZE

constexpr unsigned l1t::MTF7Payload::PAYLOAD_MAX_SIZE
staticconstexprprivate
Initial value:

Maximum number of 64-bit words in the EMTF payload.

Definition at line 160 of file Block.h.

Referenced by MTF7Payload().

◆ RPC_MAX_PER_BX

constexpr unsigned l1t::MTF7Payload::RPC_MAX_PER_BX = 84
staticconstexprprivate

Maximum number of RPC words per MTF7 payload per bx: 7 links/sectors, 6 stations, 2 segments.

Definition at line 150 of file Block.h.

◆ SP_MAX_PER_BX

constexpr unsigned l1t::MTF7Payload::SP_MAX_PER_BX = 6
staticconstexprprivate

Maximum number of SPz words per MTF7 payload per bx: 3 tracks, 2 words per track.

Definition at line 158 of file Block.h.

◆ trailer_size

constexpr unsigned l1t::MTF7Payload::trailer_size = 8
staticconstexprprivate

Definition at line 141 of file Block.h.

Referenced by MTF7Payload().

l1t::mtf7::RPC
RPC Data Record : block->header().getID() = 4.
Definition: Block.h:20
l1t::mtf7::ME0
ME0 Data Record : block->header().getID() = 6.
Definition: Block.h:23
mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
l1t::MTF7Payload::ME0_MAX_PER_BX
static constexpr unsigned ME0_MAX_PER_BX
TODO: Maximum number of ME0 words per MTF7 payload per bx: ?? ME0 links, ?? layers,...
Definition: Block.h:156
l1t::MTF7Payload::PAYLOAD_MAX_SIZE
static constexpr unsigned PAYLOAD_MAX_SIZE
Maximum number of 64-bit words in the EMTF payload.
Definition: Block.h:160
l1t::mtf7::CnBlk
Block of Counters : block->header().getID() = 2.
Definition: Block.h:18
l1t::MTF7Payload::GE21_MAX_PER_BX
static constexpr unsigned GE21_MAX_PER_BX
TODO: Maximum number of GE2/1 words per MTF7 payload per bx: ?? GE2/1 links, 2 layers,...
Definition: Block.h:154
l1t::MTF7Payload::trailer_size
static constexpr unsigned trailer_size
Definition: Block.h:141
l1t::Payload::end_
const uint32_t * end_
Definition: Block.h:116
l1t::MTF7Payload::block_patterns_
static const std::vector< unsigned int > block_patterns_
bit patterns of the first bits (of 16bit words)
Definition: Block.h:166
l1t::Payload::Payload
Payload(const uint32_t *data, const uint32_t *end)
Definition: Block.h:103
l1t::MTF7Payload::counter_size
static constexpr unsigned counter_size
Definition: Block.h:140
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
l1t::mtf7::ME
ME Data Record : block->header().getID() = 3.
Definition: Block.h:19
l1t::MTF7Payload::ME_MAX_PER_BX
static constexpr unsigned ME_MAX_PER_BX
Maximum number of CSC words per MTF7 payload per bx: 9 links/sectors, 6 stations, 2 LCTs.
Definition: Block.h:148
mps_fire.end
end
Definition: mps_fire.py:242
l1t::MTF7Payload::DAQ_PAYLOAD_OFFSET
static constexpr unsigned DAQ_PAYLOAD_OFFSET
Start of the EMTF DAQ payload, in number of 64-bit words.
Definition: Block.h:144
l1t::MTF7Payload::count
int count(unsigned int pattern, unsigned int length) const
Definition: Block.cc:154
jets_cff.payload
payload
Definition: jets_cff.py:32
l1t::mtf7::GEM
GEM Data Record : block->header().getID() = 7.
Definition: Block.h:21
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
l1t::MTF7Payload::max_block_length_
static constexpr unsigned max_block_length_
maximum of the block length (64bits)
Definition: Block.h:165
topSingleLeptonDQM_PU_cfi.pattern
pattern
Definition: topSingleLeptonDQM_PU_cfi.py:39
l1t::MTF7Payload::valid
bool valid(unsigned int pattern) const
Definition: Block.cc:165
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
l1t::MTF7Payload::MAX_BX_PER_PAYLOAD
static constexpr unsigned MAX_BX_PER_PAYLOAD
Maximum number of BX per MTF7 payload.
Definition: Block.h:146
l1t::MTF7
Definition: Block.h:11
l1t::MTF7Payload::RPC_MAX_PER_BX
static constexpr unsigned RPC_MAX_PER_BX
Maximum number of RPC words per MTF7 payload per bx: 7 links/sectors, 6 stations, 2 segments.
Definition: Block.h:150
l1t::MTF7Payload::header_size
static constexpr unsigned header_size
Definition: Block.h:139
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
l1t::Payload::data_
const uint32_t * data_
Definition: Block.h:115
l1t::MTF7Payload::GE11_MAX_PER_BX
static constexpr unsigned GE11_MAX_PER_BX
Maximum number of GE1/1 words per MTF7 payload per bx: 7 GE1/1 links, 2 layers, 8 clusters.
Definition: Block.h:152
l1t::mtf7::SPOut
SP Output Data Record : block->header().getID() = 101.
Definition: Block.h:24
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
l1t::mtf7::EvHd
Event Record Header : block->header().getID() = 511.
Definition: Block.h:17
l1t::MTF7Payload::SP_MAX_PER_BX
static constexpr unsigned SP_MAX_PER_BX
Maximum number of SPz words per MTF7 payload per bx: 3 tracks, 2 words per track.
Definition: Block.h:158
l1t::mtf7::EvTr
Event Record Trailer : block->header().getID() = 255.
Definition: Block.h:25
l1t::Payload::algo_
unsigned algo_
Definition: Block.h:118