CMS 3D CMS Logo

HFRingUnpacker.cc
Go to the documentation of this file.
3 
4 #include "CaloCollections.h"
5 #include "HFRingUnpacker.h"
6 
7 namespace l1t {
8  namespace stage1 {
10  LogDebug("L1T") << "Block ID = " << block.header().getID() << " size = " << block.header().getSize();
11 
12  int nBX = int(ceil(block.header().getSize() / 2.));
13 
14  // Find the first and last BXs
15  int firstBX = -(ceil((double)nBX / 2.) - 1);
16  int lastBX;
17  if (nBX % 2 == 0) {
18  lastBX = ceil((double)nBX / 2.) + 1;
19  } else {
20  lastBX = ceil((double)nBX / 2.);
21  }
22 
23  auto resHFBitCounts_ = static_cast<CaloCollections*>(coll)->getCaloSpareHFBitCounts();
24  resHFBitCounts_->setBXRange(firstBX, lastBX);
25 
26  auto resHFRingSums_ = static_cast<CaloCollections*>(coll)->getCaloSpareHFRingSums();
27  resHFRingSums_->setBXRange(firstBX, lastBX);
28 
29  auto reset_ = static_cast<CaloCollections*>(coll)->getEtSums();
30  reset_->setBXRange(firstBX, lastBX);
31 
32  LogDebug("L1T") << "nBX = " << nBX << " first BX = " << firstBX << " lastBX = " << lastBX;
33 
34  // Initialise index
35  int unsigned i = 0;
36 
37  // Loop over multiple BX and then number of jets filling jet collection
38  for (int bx = firstBX; bx < lastBX; bx++) {
39  uint32_t raw_data0 = block.payload()[i++];
40  uint32_t raw_data1 = block.payload()[i++];
41 
42  /* if (raw_data0 == 0 || raw_data1==0) continue; */
43 
44  uint16_t candbit[4];
45  candbit[0] = raw_data0 & 0xFFFF;
46  candbit[1] = (raw_data0 >> 16) & 0xFFFF;
47  candbit[2] = raw_data1 & 0xFFFF;
48  candbit[3] = (raw_data1 >> 16) & 0xFFFF;
49 
50  int hfbitcount = candbit[0] & 0xFFF;
51  int hfringsum = ((candbit[0] >> 12) & 0x7) | ((candbit[2] & 0x1FF) << 3);
52  int htmissphi = candbit[1] & 0x1F;
53  int htmiss = (candbit[1] >> 5) & 0x7F;
54  int overflowhtmiss = (candbit[1] >> 12) & 0x1;
55 
57  hfbc.setHwPt(hfbitcount);
59  LogDebug("L1T") << "hfbc pT " << hfbc.hwPt();
60  resHFBitCounts_->push_back(bx, hfbc);
61 
63  hfrs.setHwPt(hfringsum);
65  LogDebug("L1T") << "hfrs pT " << hfrs.hwPt();
66  resHFRingSums_->push_back(bx, hfrs);
67 
68  l1t::EtSum mht = l1t::EtSum();
69  mht.setHwPt(htmiss);
70  mht.setHwPhi(htmissphi);
72  int flaghtmiss = mht.hwQual();
73  flaghtmiss |= overflowhtmiss;
74  mht.setHwQual(flaghtmiss);
75  LogDebug("L1T") << "MHT: pT " << mht.hwPt() << "is overflow " << overflowhtmiss << std::endl;
76  reset_->push_back(bx, mht);
77  }
78 
79  return true;
80  }
81  } // namespace stage1
82 } // namespace l1t
83 
l1t::EtSum::setType
void setType(EtSumType type)
Definition: EtSum.cc:11
mps_fire.i
i
Definition: mps_fire.py:355
MessageLogger.h
l1t::stage1::HFRingUnpacker::unpack
bool unpack(const Block &block, UnpackerCollections *coll) override
Definition: HFRingUnpacker.cc:9
l1t::L1Candidate::hwQual
int hwQual() const
Definition: L1Candidate.h:38
HFRingUnpacker.h
l1t::CaloSpare
Definition: CaloSpare.h:12
RPCBxOrConfig_cff.firstBX
firstBX
Definition: RPCBxOrConfig_cff.py:5
simKBmtfDigis_cfi.bx
bx
Definition: simKBmtfDigis_cfi.py:55
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
reco::ceil
constexpr int32_t ceil(float num)
Definition: constexpr_cmath.h:7
l1t::L1Candidate::setHwQual
void setHwQual(int qual)
Definition: L1Candidate.h:31
UnpackerFactory.h
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
l1t
delete x;
Definition: CaloConfig.h:22
l1t::EtSum
Definition: EtSum.h:20
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::stage1::HFRingUnpacker
Definition: HFRingUnpacker.h:8
l1t::EtSum::kMissingHt
Definition: EtSum.h:26
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::L1Candidate::setHwPhi
void setHwPhi(int phi)
Definition: L1Candidate.h:30
CaloCollections.h
l1t::Block
Definition: Block.h:54
l1t::CaloSpare::HFRingSum
Definition: CaloSpare.h:14
l1t::CaloSpare::setType
void setType(CaloSpareType type)
Definition: CaloSpare.cc:11