CMS 3D CMS Logo

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