CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 {
9  bool
11  {
12 
13  LogDebug("L1T") << "Block ID = " << block.header().getID() << " size = " << block.header().getSize();
14 
15  int nBX, firstBX, lastBX;
16  nBX = int(ceil(block.header().getSize() / 2.));
17  getBXRange(nBX, firstBX, lastBX);
18 
19  auto resHFBitCounts_ = static_cast<CaloCollections*>(coll)->getCaloSpareHFBitCounts();
20  resHFBitCounts_->setBXRange(firstBX, lastBX);
21 
22  auto resHFRingSums_ = static_cast<CaloCollections*>(coll)->getCaloSpareHFRingSums();
23  resHFRingSums_->setBXRange(firstBX, lastBX);
24 
25  LogDebug("L1T") << "nBX = " << nBX << " first BX = " << firstBX << " lastBX = " << lastBX;
26 
27  // Initialise index
28  int unsigned i = 0;
29 
30  // Loop over multiple BX and then number of jets filling jet collection
31  for (int bx=firstBX; bx<=lastBX; bx++){
32  uint32_t raw_data0 = block.payload()[i++];
33  uint32_t raw_data1 = block.payload()[i++];
34 
35  /* if (raw_data0 == 0 || raw_data1==0) continue; */
36 
37  uint16_t candbit[2];
38  candbit[0] = raw_data0 & 0xFFFF;
39  candbit[1] = raw_data1 & 0xFFFF;
40 
41  int hfbitcount=candbit[0] & 0xFFF;
42  int hfringsum=((candbit[0]>>12) & 0x7) | ((candbit[1] & 0x1FF) << 3);
43 
45  hfbc.setHwPt(hfbitcount);
47  LogDebug("L1T") << "hfbc pT " << hfbc.hwPt();
48  resHFBitCounts_->push_back(bx,hfbc);
49 
51  hfrs.setHwPt(hfringsum);
53  LogDebug("L1T") << "hfrs pT " << hfrs.hwPt();
54  resHFRingSums_->push_back(bx,hfrs);
55 
56  }
57 
58  return true;
59 
60  }
61  }
62 }
63 
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
unsigned int getID() const
Definition: Block.h:22
void getBXRange(int nbx, int &first, int &last)
BlockHeader header() const
Definition: Block.h:56
std::vector< uint32_t > payload() const
Definition: Block.h:57
void setType(CaloSpareType type)
Definition: CaloSpare.cc:32
virtual bool unpack(const Block &block, UnpackerCollections *coll) override
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