CMS 3D CMS Logo

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