CMS 3D CMS Logo

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

#include <CaloSpareHFUnpacker.h>

Inheritance diagram for l1t::stage1::CaloSpareHFUnpacker:
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 CaloSpareHFUnpacker.h.

Member Function Documentation

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

Implements l1t::Unpacker.

Definition at line 10 of file CaloSpareHFUnpacker.cc.

References coll, DEFINE_L1T_UNPACKER, l1t::getBXRange(), l1t::BlockHeader::getID(), l1t::BlockHeader::getSize(), l1t::Block::header(), l1t::CaloSpare::HFBitCount, l1t::CaloSpare::HFRingSum, l1t::L1Candidate::hwPt(), mps_fire::i, createfilelist::int, LogDebug, l1t::Block::payload(), l1t::L1Candidate::setHwPt(), and l1t::CaloSpare::setType().

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  }
#define LogDebug(id)
void getBXRange(int nbx, int &first, int &last)
void setType(CaloSpareType type)
Definition: CaloSpare.cc:32
JetCorrectorParametersCollection coll
Definition: classes.h:10
int hwPt() const
Definition: L1Candidate.h:48
void setHwPt(int pt)
Definition: L1Candidate.h:41