CMS 3D CMS Logo

List of all members | Public Member Functions
l1t::stage1::HFRingUnpacker Class Reference

#include <HFRingUnpacker.h>

Inheritance diagram for l1t::stage1::HFRingUnpacker:
l1t::Unpacker

Public Member Functions

bool unpack (const Block &block, UnpackerCollections *coll) override
 
- Public Member Functions inherited from l1t::Unpacker
unsigned int getAlgoVersion ()
 
void setAlgoVersion (const unsigned int version)
 
 Unpacker ()
 
virtual ~Unpacker ()=default
 

Detailed Description

Definition at line 8 of file HFRingUnpacker.h.

Member Function Documentation

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

Implements l1t::Unpacker.

Definition at line 10 of file HFRingUnpacker.cc.

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

11  {
12 
13  LogDebug("L1T") << "Block ID = " << block.header().getID() << " size = " << block.header().getSize();
14 
15  int nBX = int(ceil(block.header().getSize() / 2.));
16 
17  // Find the first and last BXs
18  int firstBX = -(ceil((double)nBX/2.)-1);
19  int lastBX;
20  if (nBX % 2 == 0) {
21  lastBX = ceil((double)nBX/2.)+1;
22  } else {
23  lastBX = ceil((double)nBX/2.);
24  }
25 
26  auto resHFBitCounts_ = static_cast<CaloCollections*>(coll)->getCaloSpareHFBitCounts();
27  resHFBitCounts_->setBXRange(firstBX, lastBX);
28 
29  auto resHFRingSums_ = static_cast<CaloCollections*>(coll)->getCaloSpareHFRingSums();
30  resHFRingSums_->setBXRange(firstBX, lastBX);
31 
32  auto reset_ = static_cast<CaloCollections*>(coll)->getEtSums();
33  reset_->setBXRange(firstBX, lastBX);
34 
35  LogDebug("L1T") << "nBX = " << nBX << " first BX = " << firstBX << " lastBX = " << lastBX;
36 
37  // Initialise index
38  int unsigned i = 0;
39 
40  // Loop over multiple BX and then number of jets filling jet collection
41  for (int bx=firstBX; bx<lastBX; bx++){
42  uint32_t raw_data0 = block.payload()[i++];
43  uint32_t raw_data1 = block.payload()[i++];
44 
45  /* if (raw_data0 == 0 || raw_data1==0) continue; */
46 
47  uint16_t candbit[4];
48  candbit[0] = raw_data0 & 0xFFFF;
49  candbit[1] = (raw_data0 >> 16) & 0xFFFF;
50  candbit[2] = raw_data1 & 0xFFFF;
51  candbit[3] = (raw_data1 >> 16) & 0xFFFF;
52 
53  int hfbitcount=candbit[0] & 0xFFF;
54  int hfringsum=((candbit[0]>>12) & 0x7) | ((candbit[2] & 0x1FF) << 3);
55  int htmissphi=candbit[1] & 0x1F;
56  int htmiss=(candbit[1]>>5) & 0x7F;
57  int overflowhtmiss=(candbit[1]>>12) & 0x1;
58 
60  hfbc.setHwPt(hfbitcount);
62  LogDebug("L1T") << "hfbc pT " << hfbc.hwPt();
63  resHFBitCounts_->push_back(bx,hfbc);
64 
66  hfrs.setHwPt(hfringsum);
68  LogDebug("L1T") << "hfrs pT " << hfrs.hwPt();
69  resHFRingSums_->push_back(bx,hfrs);
70 
71  l1t::EtSum mht = l1t::EtSum();
72  mht.setHwPt(htmiss);
73  mht.setHwPhi(htmissphi);
75  int flaghtmiss=mht.hwQual();
76  flaghtmiss|= overflowhtmiss;
77  mht.setHwQual(flaghtmiss);
78  LogDebug("L1T") << "MHT: pT " << mht.hwPt()<<"is overflow "<<overflowhtmiss<<std::endl;
79  reset_->push_back(bx,mht);
80 
81  }
82 
83  return true;
84 
85  }
#define LogDebug(id)
void setHwQual(int qual)
Definition: L1Candidate.h:44
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