CMS 3D CMS Logo

MissHtUnpacker.cc
Go to the documentation of this file.
3 
4 #include "CaloCollections.h"
5 #include "MissHtUnpacker.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 reset_ = static_cast<CaloCollections*>(coll)->getEtSums();
17  reset_->setBXRange(firstBX, lastBX);
18 
19  LogDebug("L1T") << "nBX = " << nBX << " first BX = " << firstBX << " lastBX = " << lastBX;
20 
21  // Initialise index
22  int unsigned i = 0;
23 
24  // Loop over multiple BX and then number of jets filling jet collection
25  for (int bx = firstBX; bx <= lastBX; bx++) {
26  reset_->resize(bx, 4);
27 
28  uint32_t raw_data0 = block.payload()[i++];
29  uint32_t raw_data1 = block.payload()[i++];
30 
31  /* if (raw_data0 == 0 || raw_data1==0) continue; */
32 
33  uint16_t candbit[2];
34  candbit[0] = raw_data0 & 0xFFFF;
35  candbit[1] = raw_data1 & 0xFFFF;
36 
37  int htmissphi = candbit[0] & 0x1F;
38  int htmiss = (candbit[0] >> 5) & 0x7F;
39  int overflowhtmiss = (candbit[0] >> 12) & 0x1;
40 
42  mht.setHwPt(htmiss);
43  mht.setHwPhi(htmissphi);
44  int flaghtmiss = mht.hwQual();
45  flaghtmiss |= overflowhtmiss;
46  mht.setHwQual(flaghtmiss);
47  LogDebug("L1T") << "MHT: pT " << mht.hwPt() << "is overflow " << overflowhtmiss << std::endl;
48  reset_->set(bx, 1, mht);
49  }
50 
51  return true;
52  }
53  } // namespace stage1
54 } // namespace l1t
55 
constexpr int32_t ceil(float num)
void getBXRange(int nbx, int &first, int &last)
delete x;
Definition: CaloConfig.h:22
bool unpack(const Block &block, UnpackerCollections *coll) override
#define DEFINE_L1T_UNPACKER(type)
#define LogDebug(id)