CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
l1t::stage2::EGammaPacker Class Reference

#include <EGammaPacker.h>

Inheritance diagram for l1t::stage2::EGammaPacker:
l1t::Packer l1t::stage2::CaloEGammaPacker l1t::stage2::GTEGammaPacker

Public Member Functions

 EGammaPacker (int b1, int b2)
 
Blocks pack (const edm::Event &, const PackerTokens *) override
 
- Public Member Functions inherited from l1t::Packer
unsigned board ()
 
void setBoard (unsigned board)
 
virtual ~Packer ()=default
 

Public Attributes

int b1_
 
int b2_
 

Detailed Description

Definition at line 8 of file EGammaPacker.h.

Constructor & Destructor Documentation

l1t::stage2::EGammaPacker::EGammaPacker ( int  b1,
int  b2 
)
inline

Definition at line 10 of file EGammaPacker.h.

References pack().

Member Function Documentation

Blocks l1t::stage2::EGammaPacker::pack ( const edm::Event event,
const PackerTokens toks 
)
overridevirtual

Implements l1t::Packer.

Definition at line 12 of file EGammaPacker.cc.

References funct::abs(), b1_, b2_, DEFINE_L1T_PACKER, mps_fire::i, min(), l1t::stage2::layer2::demux::nEGPerLink, and l1t::stage2::layer2::demux::nOutputFramePerBX.

Referenced by pyrootRender.interactiveRender::draw(), and EGammaPacker().

13  {
15  event.getByToken(static_cast<const CommonTokens*>(toks)->getEGammaToken(), egs);
16 
17  std::vector<uint32_t> load1, load2;
18 
19  int nBx = 0;
20  for (int i = egs->getFirstBX(); i <= egs->getLastBX(); ++i) {
21 
22  for (auto j = egs->begin(i); j != egs->end(i); ++j) {
23 
24  uint32_t packed_eta = abs(j->hwEta()) & 0x7F;
25  if (j->hwEta() < 0){
26  packed_eta = (128 - packed_eta) | 1<<7;
27  }
28 
29  uint32_t word = \
30  std::min(j->hwPt(), 0x1FF) |
31  packed_eta << 9 |
32  (j->hwPhi() & 0xFF) << 17 |
33  (j->hwIso() & 0x3) << 25 |
34  (j->hwQual() & 0x7) << 27;
35 
36  //Depending on the number, push onto the appropriate link
37  if ( load1.size() - nBx*l1t::stage2::layer2::demux::nEGPerLink < l1t::stage2::layer2::demux::nEGPerLink) load1.push_back(word);
38  else load2.push_back(word);
39 
40  }
41 
42  // push zeroes if not enough EG; must do this for each BX and each link
45 
46  nBx++;
47 
48  }
49 
50 
51  return {Block(b1_, load1), Block(b2_, load2)};
52 
53  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T min(T a, T b)
Definition: MathUtil.h:58

Member Data Documentation

int l1t::stage2::EGammaPacker::b1_

Definition at line 12 of file EGammaPacker.h.

Referenced by pack().

int l1t::stage2::EGammaPacker::b2_

Definition at line 12 of file EGammaPacker.h.

Referenced by pack().