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 {
11  Blocks
13  {
15  event.getByToken(static_cast<const CommonTokens*>(toks)->getJetToken(), jets);
16 
17  std::vector<uint32_t> load1, load2;
18 
19  // loop over BX
20  int nBx=0;
21  for (int i = jets->getFirstBX(); i <= jets->getLastBX(); ++i) {
22 
23  // get jets from this BX
24  for (auto j = jets->begin(i); j != jets->end(i); ++j ) {
25 
26  uint32_t packed_eta = abs(j->hwEta()) & 0x7F;
27  if (j->hwEta() < 0){
28  packed_eta = (128 - packed_eta) | 1<<7;
29  }
30 
31  uint32_t word = \
32  std::min(j->hwPt(), 0x7FF) |
33  packed_eta << 11 |
34  (j->hwPhi() & 0xFF) << 19 |
35  (j->hwQual() & 0x7) << 27;
36 
37  // Depending on the number, push onto appropriate link
38  if (load1.size() - nBx*l1t::stage2::layer2::demux::nJetPerLink < l1t::stage2::layer2::demux::nJetPerLink) load1.push_back(word);
39  else load2.push_back(word);
40 
41  }
42 
43 
44  // push zeroes if jets are missing must do this for each BX and each link
47 
48  nBx++;
49 
50  }
51 
52 
53 
54  return {Block(b1_, load1), Block(b2_, load2)};
55  }
56 }
57 }
58 
int i
Definition: DBlmapReader.cc:9
delete x;
Definition: CaloConfig.h:22
virtual Blocks pack(const edm::Event &, const PackerTokens *) override
Definition: JetPacker.cc:12
vector< PseudoJet > jets
std::vector< Block > Blocks
Definition: Block.h:68
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
T min(T a, T b)
Definition: MathUtil.h:58
#define DEFINE_L1T_PACKER(type)
Definition: PackerFactory.h:22
Definition: event.py:1