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::EtSumUnpacker Class Reference
Inheritance diagram for l1t::stage1::EtSumUnpacker:
l1t::Unpacker

Public Member Functions

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

Detailed Description

Definition at line 9 of file EtSumUnpacker.cc.

Member Function Documentation

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

Implements l1t::Unpacker.

Definition at line 21 of file EtSumUnpacker.cc.

References coll, l1t::getBXRange(), l1t::BlockHeader::getID(), l1t::BlockHeader::getSize(), l1t::Block::header(), l1t::L1Candidate::hwPt(), l1t::L1Candidate::hwQual(), i, l1t::EtSum::kTotalEt, l1t::EtSum::kTotalHt, LogDebug, l1t::Block::payload(), l1t::L1Candidate::setHwPt(), l1t::L1Candidate::setHwQual(), and l1t::EtSum::setType().

22  {
23 
24  LogDebug("L1T") << "Block ID = " << block.header().getID() << " size = " << block.header().getSize();
25 
26  int nBX, firstBX, lastBX;
27  nBX = int(ceil(block.header().getSize() / 2.));
28  getBXRange(nBX, firstBX, lastBX);
29 
30  auto res_ = static_cast<CaloCollections*>(coll)->getEtSums();
31  res_->setBXRange(firstBX, lastBX);
32 
33  LogDebug("L1T") << "nBX = " << nBX << " first BX = " << firstBX << " lastBX = " << lastBX;
34 
35  // Initialise index
36  int unsigned i = 0;
37 
38  // Loop over multiple BX and then number of jets filling jet collection
39  for (int bx=firstBX; bx<=lastBX; bx++){
40 
41  res_->resize(bx,4);
42 
43  uint32_t raw_data0 = block.payload()[i++];
44  uint32_t raw_data1 = block.payload()[i++];
45 
46  /* if (raw_data0 == 0 || raw_data1==0) continue; */
47 
48  uint16_t candbit[2];
49  candbit[0] = raw_data0 & 0xFFFF;
50  candbit[1] = raw_data1 & 0xFFFF;
51 
52  int totet=candbit[0] & 0xFFF;
53  int overflowtotet=(candbit[0]>>12) & 0x1;
54  int totht=candbit[1] & 0xFFF;
55  int overflowtotht=(candbit[1]>>12) & 0x1;
56 
57  l1t::EtSum et = l1t::EtSum();
58  et.setHwPt(totet);
60  int flagtotet=et.hwQual();
61  flagtotet|= overflowtotet;
62  et.setHwQual(flagtotet);
63  LogDebug("L1T") << "ET: pT " << et.hwPt()<<"is overflow "<<overflowtotet<<std::endl;
64  res_->set(bx, 2,et);
65 
66  l1t::EtSum ht = l1t::EtSum();
67  ht.setHwPt(totht);
69  int flagtotht=ht.hwQual();
70  flagtotht|= overflowtotht;
71  ht.setHwQual(flagtotht);
72  LogDebug("L1T") << "HT: pT " << ht.hwPt()<<"is overflow "<<overflowtotht<<std::endl;
73  res_->set(bx, 3,ht);
74 
75  }
76 
77  return true;
78 
79  }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
void getBXRange(int nbx, int &first, int &last)
Definition: Unpacker.cc:12
void setHwQual(int qual)
Definition: L1Candidate.cc:64
void setType(EtSumType type)
Definition: EtSum.cc:32
int hwQual() const
Definition: L1Candidate.cc:89
JetCorrectorParametersCollection coll
Definition: classes.h:10
int hwPt() const
Definition: L1Candidate.cc:69
void setHwPt(int pt)
Definition: L1Candidate.cc:44