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 
l1t::stage2::CaloJetPacker
Definition: JetPacker.h:19
l1t::stage2::JetPacker::b2_
int b2_
Definition: JetPacker.h:12
l1t::Blocks
std::vector< Block > Blocks
Definition: Block.h:99
l1t::stage2::layer2::demux::nOutputFramePerBX
const unsigned int nOutputFramePerBX
Definition: L1TStage2Layer2Constants.cc:11
CaloTokens.h
mps_fire.i
i
Definition: mps_fire.py:428
PackerFactory.h
JetPacker.h
L1TStage2Layer2Constants.h
min
T min(T a, T b)
Definition: MathUtil.h:58
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
l1t::stage2::layer2::demux::nJetPerLink
const unsigned int nJetPerLink
Definition: L1TStage2Layer2Constants.cc:14
l1t::stage2::JetPacker::b1_
int b1_
Definition: JetPacker.h:12
edm::Handle
Definition: AssociativeIterator.h:50
word
uint64_t word
Definition: CTPPSTotemDataFormatter.cc:29
DEFINE_L1T_PACKER
#define DEFINE_L1T_PACKER(type)
Definition: PackerFactory.h:23
Event.h
l1t
delete x;
Definition: CaloConfig.h:22
l1t::PackerTokens
Definition: PackerTokens.h:10
SiStripSourceConfigTier0_cff.stage2
stage2
Definition: SiStripSourceConfigTier0_cff.py:71
l1t::stage2::JetPacker::pack
Blocks pack(const edm::Event &, const PackerTokens *) override
Definition: JetPacker.cc:11
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
l1t::Block
Definition: Block.h:70
l1t::stage2::GTJetPacker
Definition: JetPacker.h:15