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 | 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 size_
 

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

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(), and l1t::Payload::infra_.

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  if (bx_per_l1a_ > 1) {
215  edm::LogInfo("L1T") << "CTP7 block with multiple bunch crossings:" << bx_per_l1a_;
216  }
218  infra_ = 0;
219  ++data_;
220  }
Log< level::Error, false > LogError
unsigned capId_
Definition: Block.h:185
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 int getUserData() const
Definition: AMCSpec.h:77
unsigned bx_per_l1a_
Definition: Block.h:186
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
string end
Definition: dataset.py:937
amc::Header amcHeader_
Definition: Block.h:188
unsigned algo_
Definition: Block.h:118
Payload(const uint32_t *data, const uint32_t *end)
Definition: Block.h:103

Member Function Documentation

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

Reimplemented from l1t::Payload.

Definition at line 233 of file Block.cc.

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

233  {
234  if (end_ - data_ < getHeaderSize()) {
235  LogDebug("L1T") << "Reached end of payload";
236  return std::unique_ptr<Block>();
237  }
238  if (capId_ > bx_per_l1a_) {
239  edm::LogWarning("L1T") << "CTP7 with more bunch crossings than expected";
240  }
241 
242  auto header = getHeader();
243 
244  if (end_ - data_ < header.getSize()) {
245  edm::LogError("L1T") << "Expecting a block size of " << header.getSize() << " but only " << (end_ - data_)
246  << " words remaining";
247  return std::unique_ptr<Block>();
248  }
249 
250  LogTrace("L1T") << "Creating block with size " << header.getSize();
251 
252  auto res = std::make_unique<Block>(header, data_, data_ + header.getSize());
253  data_ += header.getSize();
254  capId_++;
255  return res;
256  }
unsigned getHeaderSize() const override
Definition: Block.h:175
BlockHeader getHeader() override
Definition: Block.cc:222
Log< level::Error, false > LogError
const uint32_t * end_
Definition: Block.h:116
#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)
BlockHeader l1t::CTP7Payload::getHeader ( )
overridevirtual

Implements l1t::Payload.

Definition at line 222 of file Block.cc.

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

Referenced by getBlock().

222  {
223  // only one block type, use dummy id
224  unsigned blockId = 0;
225  // CTP7 header contains number of BX in payload and the bunch crossing ID
226  // Not sure how to map to generic BlockHeader variables, so just packing
227  // it all in flags variable
228  unsigned blockFlags = ((bx_per_l1a_ & 0xf) << 16) | (calo_bxid_ & 0xfff);
229  unsigned blockSize = 192 * (int)bx_per_l1a_;
230  return BlockHeader(blockId, blockSize, capId_, blockFlags, CTP7);
231  }
unsigned capId_
Definition: Block.h:185
unsigned calo_bxid_
Definition: Block.h:187
unsigned bx_per_l1a_
Definition: Block.h:186
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

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

Definition at line 188 of file Block.h.

Referenced by CTP7Payload().

unsigned l1t::CTP7Payload::bx_per_l1a_
private

Definition at line 186 of file Block.h.

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

unsigned l1t::CTP7Payload::calo_bxid_
private

Definition at line 187 of file Block.h.

Referenced by CTP7Payload(), and getHeader().

unsigned l1t::CTP7Payload::capId_
private

Definition at line 185 of file Block.h.

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

unsigned l1t::CTP7Payload::size_
private

Definition at line 184 of file Block.h.

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

Definition at line 181 of file Block.h.

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

Definition at line 182 of file Block.h.