CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
l1t::stage1::HFRingUnpacker Class Reference
Inheritance diagram for l1t::stage1::HFRingUnpacker:
l1t::Unpacker

Public Member Functions

virtual bool unpack (const Block &block, UnpackerCollections *coll) override
 

Detailed Description

Definition at line 9 of file HFRingUnpacker.cc.

Member Function Documentation

bool l1t::stage1::HFRingUnpacker::unpack ( const Block block,
UnpackerCollections coll 
)
overridevirtual

Implements l1t::Unpacker.

Definition at line 21 of file HFRingUnpacker.cc.

References coll, l1t::BlockHeader::getID(), l1t::BlockHeader::getSize(), l1t::Block::header(), l1t::CaloSpare::HFBitCount, l1t::CaloSpare::HFRingSum, l1t::L1Candidate::hwPt(), l1t::L1Candidate::hwQual(), i, l1t::EtSum::kMissingHt, LogDebug, l1t::Block::payload(), l1t::L1Candidate::setHwPhi(), l1t::L1Candidate::setHwPt(), l1t::L1Candidate::setHwQual(), l1t::CaloSpare::setType(), and l1t::EtSum::setType().

22  {
23 
24  LogDebug("L1T") << "Block ID = " << block.header().getID() << " size = " << block.header().getSize();
25 
26  int nBX = int(ceil(block.header().getSize() / 2.));
27 
28  // Find the first and last BXs
29  int firstBX = -(ceil((double)nBX/2.)-1);
30  int lastBX;
31  if (nBX % 2 == 0) {
32  lastBX = ceil((double)nBX/2.)+1;
33  } else {
34  lastBX = ceil((double)nBX/2.);
35  }
36 
37  auto resHFBitCounts_ = static_cast<CaloCollections*>(coll)->getCaloSpareHFBitCounts();
38  resHFBitCounts_->setBXRange(firstBX, lastBX);
39 
40  auto resHFRingSums_ = static_cast<CaloCollections*>(coll)->getCaloSpareHFRingSums();
41  resHFRingSums_->setBXRange(firstBX, lastBX);
42 
43  auto reset_ = static_cast<CaloCollections*>(coll)->getEtSums();
44  reset_->setBXRange(firstBX, lastBX);
45 
46  LogDebug("L1T") << "nBX = " << nBX << " first BX = " << firstBX << " lastBX = " << lastBX;
47 
48  // Initialise index
49  int unsigned i = 0;
50 
51  // Loop over multiple BX and then number of jets filling jet collection
52  for (int bx=firstBX; bx<lastBX; bx++){
53  uint32_t raw_data0 = block.payload()[i++];
54  uint32_t raw_data1 = block.payload()[i++];
55 
56  /* if (raw_data0 == 0 || raw_data1==0) continue; */
57 
58  uint16_t candbit[4];
59  candbit[0] = raw_data0 & 0xFFFF;
60  candbit[1] = (raw_data0 >> 16) & 0xFFFF;
61  candbit[2] = raw_data1 & 0xFFFF;
62  candbit[3] = (raw_data1 >> 16) & 0xFFFF;
63 
64  int hfbitcount=candbit[0] & 0xFFF;
65  int hfringsum=((candbit[0]>>12) & 0x7) | ((candbit[2] & 0x1FF) << 3);
66  int htmissphi=candbit[1] & 0x1F;
67  int htmiss=(candbit[1]>>5) & 0x7F;
68  int overflowhtmiss=(candbit[1]>>12) & 0x1;
69 
71  hfbc.setHwPt(hfbitcount);
73  LogDebug("L1T") << "hfbc pT " << hfbc.hwPt();
74  resHFBitCounts_->push_back(bx,hfbc);
75 
77  hfrs.setHwPt(hfringsum);
79  LogDebug("L1T") << "hfrs pT " << hfrs.hwPt();
80  resHFRingSums_->push_back(bx,hfrs);
81 
82  l1t::EtSum mht = l1t::EtSum();
83  mht.setHwPt(htmiss);
84  mht.setHwPhi(htmissphi);
86  int flaghtmiss=mht.hwQual();
87  flaghtmiss|= overflowhtmiss;
88  mht.setHwQual(flaghtmiss);
89  LogDebug("L1T") << "MHT: pT " << mht.hwPt()<<"is overflow "<<overflowhtmiss<<std::endl;
90  reset_->push_back(bx,mht);
91 
92  }
93 
94  return true;
95 
96  }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
void setHwQual(int qual)
Definition: L1Candidate.cc:64
void setType(EtSumType type)
Definition: EtSum.cc:32
void setType(CaloSpareType type)
Definition: CaloSpare.cc:32
int hwQual() const
Definition: L1Candidate.cc:89
void setHwPhi(int phi)
Definition: L1Candidate.cc:54
JetCorrectorParametersCollection coll
Definition: classes.h:10
int hwPt() const
Definition: L1Candidate.cc:69
void setHwPt(int pt)
Definition: L1Candidate.cc:44