CMS 3D CMS Logo

CaloSpareHFUnpacker.cc
Go to the documentation of this file.
3 
4 #include "CaloCollections.h"
5 #include "CaloSpareHFUnpacker.h"
6 
7 namespace l1t {
8  namespace stage1 {
10  LogDebug("L1T") << "Block ID = " << block.header().getID() << " size = " << block.header().getSize();
11 
12  int nBX, firstBX, lastBX;
13  nBX = int(ceil(block.header().getSize() / 2.));
14  getBXRange(nBX, firstBX, lastBX);
15 
16  auto resHFBitCounts_ = static_cast<CaloCollections*>(coll)->getCaloSpareHFBitCounts();
17  resHFBitCounts_->setBXRange(firstBX, lastBX);
18 
19  auto resHFRingSums_ = static_cast<CaloCollections*>(coll)->getCaloSpareHFRingSums();
20  resHFRingSums_->setBXRange(firstBX, lastBX);
21 
22  LogDebug("L1T") << "nBX = " << nBX << " first BX = " << firstBX << " lastBX = " << lastBX;
23 
24  // Initialise index
25  int unsigned i = 0;
26 
27  // Loop over multiple BX and then number of jets filling jet collection
28  for (int bx = firstBX; bx <= lastBX; bx++) {
29  uint32_t raw_data0 = block.payload()[i++];
30  uint32_t raw_data1 = block.payload()[i++];
31 
32  /* if (raw_data0 == 0 || raw_data1==0) continue; */
33 
34  uint16_t candbit[2];
35  candbit[0] = raw_data0 & 0xFFFF;
36  candbit[1] = raw_data1 & 0xFFFF;
37 
38  int hfbitcount = candbit[0] & 0xFFF;
39  int hfringsum = ((candbit[0] >> 12) & 0x7) | ((candbit[1] & 0x1FF) << 3);
40 
42  hfbc.setHwPt(hfbitcount);
44  LogDebug("L1T") << "hfbc pT " << hfbc.hwPt();
45  resHFBitCounts_->push_back(bx, hfbc);
46 
48  hfrs.setHwPt(hfringsum);
50  LogDebug("L1T") << "hfrs pT " << hfrs.hwPt();
51  resHFRingSums_->push_back(bx, hfrs);
52  }
53 
54  return true;
55  }
56  } // namespace stage1
57 } // namespace l1t
58 
constexpr int32_t ceil(float num)
void getBXRange(int nbx, int &first, int &last)
delete x;
Definition: CaloConfig.h:22
void setType(CaloSpareType type)
Definition: CaloSpare.cc:11
bool unpack(const Block &block, UnpackerCollections *coll) override
int hwPt() const
Definition: L1Candidate.h:35
void setHwPt(int pt)
Definition: L1Candidate.h:28
#define DEFINE_L1T_UNPACKER(type)
#define LogDebug(id)