CMS 3D CMS Logo

EGammaPacker.cc
Go to the documentation of this file.
3 
4 #include "CaloTokens.h"
5 
7 #include "EGammaPacker.h"
8 
9 namespace l1t {
10  namespace stage2 {
13  event.getByToken(static_cast<const CommonTokens*>(toks)->getEGammaToken(), egs);
14 
15  std::vector<uint32_t> load1, load2;
16 
17  int nBx = 0;
18  for (int i = egs->getFirstBX(); i <= egs->getLastBX(); ++i) {
19  for (auto j = egs->begin(i); j != egs->end(i); ++j) {
20  uint32_t packed_eta = abs(j->hwEta()) & 0x7F;
21  if (j->hwEta() < 0) {
22  packed_eta = (128 - packed_eta) | 1 << 7;
23  }
24 
25  uint32_t word = std::min(j->hwPt(), 0x1FF) | packed_eta << 9 | (j->hwPhi() & 0xFF) << 17 |
26  (j->hwIso() & 0x3) << 25 | (j->hwQual() & 0x7) << 27;
27 
28  //Depending on the number, push onto the appropriate link
30  load1.push_back(word);
31  else
32  load2.push_back(word);
33  }
34 
35  // push zeroes if not enough EG; must do this for each BX and each link
36  while (load1.size() - nBx * l1t::stage2::layer2::demux::nOutputFramePerBX <
38  load1.push_back(0);
39  while (load2.size() - nBx * l1t::stage2::layer2::demux::nOutputFramePerBX <
41  load2.push_back(0);
42 
43  nBx++;
44  }
45 
46  return {Block(b1_, load1), Block(b2_, load2)};
47  }
48 
49  } // namespace stage2
50 } // namespace l1t
51 
delete x;
Definition: CaloConfig.h:22
uint64_t word
std::vector< Block > Blocks
Definition: Block.h:99
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Blocks pack(const edm::Event &, const PackerTokens *) override
Definition: EGammaPacker.cc:11
#define DEFINE_L1T_PACKER(type)
Definition: PackerFactory.h:23
Definition: event.py:1