CMS 3D CMS Logo

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

#include <Block.h>

Inheritance diagram for l1t::CTP7Payload:
l1t::Payload

Public Member Functions

 CTP7Payload (const uint32_t *data, const uint32_t *end, amc::Header amcHeader)
 
std::unique_ptr< BlockgetBlock () override
 
BlockHeader getHeader () override
 
unsigned getHeaderSize () const override
 
- 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 Attributes

amc::Header amcHeader_
 
unsigned bx_per_l1a_
 
unsigned calo_bxid_
 
unsigned capId_
 
unsigned six_hcal_feature_bits_
 
unsigned size_
 
unsigned slot7_card_
 

Static Private Attributes

static constexpr unsigned size_mask = 0xff
 
static constexpr unsigned size_shift = 16
 

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 172 of file Block.h.

Constructor & Destructor Documentation

◆ CTP7Payload()

l1t::CTP7Payload::CTP7Payload ( const uint32_t *  data,
const uint32_t *  end,
amc::Header  amcHeader 
)

Definition at line 205 of file Block.cc.

References l1t::Payload::algo_, amcHeader_, bx_per_l1a_, calo_bxid_, capId_, l1t::Payload::data_, amc::Header::getUserData(), l1t::Payload::infra_, six_hcal_feature_bits_, and slot7_card_.

206  : Payload(data, end), amcHeader_(amcHeader) {
207  if (not(*data_ == 0xA110CA7E)) {
208  edm::LogError("L1T") << "CTP7 block with invalid header:" << std::hex << *data_;
209  }
210  ++data_;
211  bx_per_l1a_ = (*data_ >> 16) & 0xff;
212  calo_bxid_ = *data_ & 0xfff;
213  capId_ = 0;
214  six_hcal_feature_bits_ = (*data_ >> 15) & 0x1;
215  slot7_card_ = (*data_ >> 14) & 0x1;
216  if (bx_per_l1a_ > 1) {
217  edm::LogInfo("L1T") << "CTP7 block with multiple bunch crossings:" << bx_per_l1a_;
218  }
220  infra_ = 0;
221  ++data_;
222  }
Log< level::Error, false > LogError
unsigned six_hcal_feature_bits_
Definition: Block.h:188
unsigned capId_
Definition: Block.h:185
unsigned int getUserData() const
Definition: AMCSpec.h:77
unsigned infra_
Definition: Block.h:119
Log< level::Info, false > LogInfo
const uint32_t * data_
Definition: Block.h:115
unsigned calo_bxid_
Definition: Block.h:187
unsigned slot7_card_
Definition: Block.h:189
unsigned bx_per_l1a_
Definition: Block.h:186
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
amc::Header amcHeader_
Definition: Block.h:190
unsigned algo_
Definition: Block.h:118
Payload(const uint32_t *data, const uint32_t *end)
Definition: Block.h:103

Member Function Documentation

◆ getBlock()

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

Reimplemented from l1t::Payload.

Definition at line 236 of file Block.cc.

References bx_per_l1a_, capId_, l1t::Payload::data_, l1t::Payload::end_, getHeader(), getHeaderSize(), RecoTauValidation_cfi::header, LogDebug, and LogTrace.

236  {
237  if (end_ - data_ < getHeaderSize()) {
238  LogDebug("L1T") << "Reached end of payload";
239  return std::unique_ptr<Block>();
240  }
241  if (capId_ > bx_per_l1a_) {
242  edm::LogWarning("L1T") << "CTP7 with more bunch crossings than expected";
243  }
244 
245  auto header = getHeader();
246 
247  if (end_ - data_ < header.getSize()) {
248  edm::LogError("L1T") << "Expecting a block size of " << header.getSize() << " but only " << (end_ - data_)
249  << " words remaining";
250  return std::unique_ptr<Block>();
251  }
252 
253  LogTrace("L1T") << "Creating block with size " << header.getSize();
254 
255  auto res = std::make_unique<Block>(header, data_, data_ + header.getSize());
256  data_ += header.getSize();
257  capId_++;
258  return res;
259  }
unsigned getHeaderSize() const override
Definition: Block.h:175
BlockHeader getHeader() override
Definition: Block.cc:224
Log< level::Error, false > LogError
const uint32_t * end_
Definition: Block.h:116
Definition: Electron.h:6
#define LogTrace(id)
unsigned capId_
Definition: Block.h:185
const uint32_t * data_
Definition: Block.h:115
unsigned bx_per_l1a_
Definition: Block.h:186
Log< level::Warning, false > LogWarning
#define LogDebug(id)

◆ getHeader()

BlockHeader l1t::CTP7Payload::getHeader ( )
overridevirtual

Implements l1t::Payload.

Definition at line 224 of file Block.cc.

References bx_per_l1a_, calo_bxid_, capId_, l1t::CTP7, six_hcal_feature_bits_, and slot7_card_.

Referenced by getBlock().

224  {
225  // only one block type, use dummy id
226  unsigned blockId = 0;
227  // CTP7 header contains number of BX in payload and the bunch crossing ID
228  // Not sure how to map to generic BlockHeader variables, so just packing
229  // it all in flags variable
230  unsigned blockFlags = ((bx_per_l1a_ & 0xf) << 16) | (calo_bxid_ & 0xfff) | ((six_hcal_feature_bits_ & 0x1) << 15) |
231  ((slot7_card_ & 0x1) << 14);
232  unsigned blockSize = (slot7_card_ == 1) ? 6 : ((192 + (int)six_hcal_feature_bits_ * 28) * (int)bx_per_l1a_);
233  return BlockHeader(blockId, blockSize, capId_, blockFlags, CTP7);
234  }
unsigned six_hcal_feature_bits_
Definition: Block.h:188
unsigned capId_
Definition: Block.h:185
unsigned calo_bxid_
Definition: Block.h:187
unsigned slot7_card_
Definition: Block.h:189
unsigned bx_per_l1a_
Definition: Block.h:186

◆ getHeaderSize()

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

Implements l1t::Payload.

Definition at line 175 of file Block.h.

Referenced by getBlock().

175 { return 2; };

Member Data Documentation

◆ amcHeader_

amc::Header l1t::CTP7Payload::amcHeader_
private

Definition at line 190 of file Block.h.

Referenced by CTP7Payload().

◆ bx_per_l1a_

unsigned l1t::CTP7Payload::bx_per_l1a_
private

Definition at line 186 of file Block.h.

Referenced by CTP7Payload(), getBlock(), and getHeader().

◆ calo_bxid_

unsigned l1t::CTP7Payload::calo_bxid_
private

Definition at line 187 of file Block.h.

Referenced by CTP7Payload(), and getHeader().

◆ capId_

unsigned l1t::CTP7Payload::capId_
private

Definition at line 185 of file Block.h.

Referenced by CTP7Payload(), getBlock(), and getHeader().

◆ six_hcal_feature_bits_

unsigned l1t::CTP7Payload::six_hcal_feature_bits_
private

Definition at line 188 of file Block.h.

Referenced by CTP7Payload(), and getHeader().

◆ size_

unsigned l1t::CTP7Payload::size_
private

Definition at line 184 of file Block.h.

◆ size_mask

constexpr unsigned l1t::CTP7Payload::size_mask = 0xff
staticprivate

Definition at line 181 of file Block.h.

◆ size_shift

constexpr unsigned l1t::CTP7Payload::size_shift = 16
staticprivate

Definition at line 182 of file Block.h.

◆ slot7_card_

unsigned l1t::CTP7Payload::slot7_card_
private

Definition at line 189 of file Block.h.

Referenced by CTP7Payload(), and getHeader().