CMS 3D CMS Logo

CaloSpareHFPacker.cc
Go to the documentation of this file.
3 
4 #include "CaloSpareHFPacker.h"
5 #include "CaloTokens.h"
6 
7 namespace l1t {
8  namespace stage1 {
10  edm::Handle<CaloSpareBxCollection> calosparesHFBitCounts;
11  event.getByToken(static_cast<const CaloTokens*>(toks)->getCaloSpareHFBitCountsToken(), calosparesHFBitCounts);
12 
13  edm::Handle<CaloSpareBxCollection> calosparesHFRingSums;
14  event.getByToken(static_cast<const CaloTokens*>(toks)->getCaloSpareHFRingSumsToken(), calosparesHFRingSums);
15 
16  std::vector<uint32_t> load;
17 
18  for (int i = calosparesHFBitCounts->getFirstBX(); i <= calosparesHFBitCounts->getLastBX(); ++i) {
19  int n = 0;
20 
21  int hfbitcount = 0;
22  int hfringsum = 0;
23 
24  for (auto j = calosparesHFBitCounts->begin(i); j != calosparesHFBitCounts->end(i) && n < 2; ++j, ++n) {
25  hfbitcount = std::min(j->hwPt(), 0xFFF);
26  }
27 
28  n = 0;
29 
30  for (auto j = calosparesHFRingSums->begin(i); j != calosparesHFRingSums->end(i) && n < 2; ++j, ++n) {
31  hfringsum = std::min(j->hwPt(), 0xFFF);
32  }
33 
34  uint16_t object[2] = {0, 0};
35 
36  object[0] = hfbitcount | ((hfringsum & 0x7) << 12);
37  object[1] = ((hfringsum >> 3) & 0x1FF) | (0x1) << 10 | (0x1) << 12 | (0x1) << 14;
38 
39  uint32_t word0 = (object[0] & 0xFFFF);
40  uint32_t word1 = (object[1] & 0xFFFF);
41 
42  word0 |= (1 << 15);
43  word1 |= ((i == 0) << 15);
44 
45  load.push_back(word0);
46  load.push_back(word1);
47  }
48 
49  return {Block(97, load)};
50  }
51  } // namespace stage1
52 } // namespace l1t
53 
l1t::Blocks
std::vector< Block > Blocks
Definition: Block.h:99
CaloTokens.h
mps_fire.i
i
Definition: mps_fire.py:428
PackerFactory.h
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
min
T min(T a, T b)
Definition: MathUtil.h:58
CaloSpareHFPacker.h
edm::Handle
Definition: AssociativeIterator.h:50
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
svgfig.load
def load(fileName)
Definition: svgfig.py:547
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
l1t::stage1::CaloSpareHFPacker::pack
Blocks pack(const edm::Event &, const PackerTokens *) override
Definition: CaloSpareHFPacker.cc:9
l1t::stage1::CaloSpareHFPacker
Definition: CaloSpareHFPacker.h:8
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
l1t::Block
Definition: Block.h:70