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 
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
l1t::CaloSpare
Definition: CaloSpare.h:12
RPCBxOrConfig_cff.firstBX
firstBX
Definition: RPCBxOrConfig_cff.py:5
l1t::stage1::CaloSpareHFUnpacker
Definition: CaloSpareHFUnpacker.h:8
CaloSpareHFUnpacker.h
reco::ceil
constexpr int32_t ceil(float num)
Definition: constexpr_cmath.h:7
l1t::stage1::CaloSpareHFUnpacker::unpack
bool unpack(const Block &block, UnpackerCollections *coll) override
Definition: CaloSpareHFUnpacker.cc:9
UnpackerFactory.h
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
l1t
delete x;
Definition: CaloConfig.h:22
createfilelist.int
int
Definition: createfilelist.py:10
l1t::L1Candidate::setHwPt
void setHwPt(int pt)
Definition: L1Candidate.h:28
groupFilesInBlocks.block
block
Definition: groupFilesInBlocks.py:150
l1t::UnpackerCollections
Definition: UnpackerCollections.h:9
l1t::L1Candidate::hwPt
int hwPt() const
Definition: L1Candidate.h:35
RPCBxOrConfig_cff.lastBX
lastBX
Definition: RPCBxOrConfig_cff.py:4
l1t::CaloSpare::HFBitCount
Definition: CaloSpare.h:14
DEFINE_L1T_UNPACKER
#define DEFINE_L1T_UNPACKER(type)
Definition: UnpackerFactory.h:23
l1t::getBXRange
void getBXRange(int nbx, int &first, int &last)
Definition: UnpackerFactory.cc:12
CaloCollections.h
l1t::Block
Definition: Block.h:70
l1t::CaloSpare::HFRingSum
Definition: CaloSpare.h:14
l1t::CaloSpare::setType
void setType(CaloSpareType type)
Definition: CaloSpare.cc:11