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 {
9  Blocks
11  {
12  edm::Handle<CaloSpareBxCollection> calosparesHFBitCounts;
13  event.getByToken(static_cast<const CaloTokens*>(toks)->getCaloSpareHFBitCountsToken(), calosparesHFBitCounts);
14 
15  edm::Handle<CaloSpareBxCollection> calosparesHFRingSums;
16  event.getByToken(static_cast<const CaloTokens*>(toks)->getCaloSpareHFRingSumsToken(), calosparesHFRingSums);
17 
18  std::vector<uint32_t> load;
19 
20  for (int i = calosparesHFBitCounts->getFirstBX(); i <= calosparesHFBitCounts->getLastBX(); ++i) {
21  int n = 0;
22 
23  int hfbitcount=0;
24  int hfringsum=0;
25 
26  for (auto j = calosparesHFBitCounts->begin(i); j != calosparesHFBitCounts->end(i) && n < 2; ++j, ++n) {
27  hfbitcount=std::min(j->hwPt(),0xFFF);
28  }
29 
30  n=0;
31 
32  for (auto j = calosparesHFRingSums->begin(i); j != calosparesHFRingSums->end(i) && n < 2; ++j, ++n) {
33  hfringsum=std::min(j->hwPt(),0xFFF);
34  }
35 
36  uint16_t object[2]={0,0};
37 
38  object[0]=hfbitcount|((hfringsum & 0x7) << 12);
39  object[1]=((hfringsum>>3) & 0x1FF) |(0x1)<<10 | (0x1)<<12 | (0x1)<<14;
40 
41  uint32_t word0=(object[0] & 0xFFFF);
42  uint32_t word1=(object[1] & 0xFFFF);
43 
44  word0 |= (1 << 15);
45  word1 |= ((i == 0) << 15);
46 
47  load.push_back(word0);
48  load.push_back(word1);
49  }
50 
51  return {Block(97, load)};
52  }
53  }
54 }
55 
int i
Definition: DBlmapReader.cc:9
delete x;
Definition: CaloConfig.h:22
virtual Blocks pack(const edm::Event &, const PackerTokens *) override
std::vector< Block > Blocks
Definition: Block.h:68
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
def load(fileName)
Definition: svgfig.py:546
Definition: event.py:1