CMS 3D CMS Logo

EtSumUnpacker.cc
Go to the documentation of this file.
3 
4 #include "CaloCollections.h"
5 #include "EtSumUnpacker.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 res_ = static_cast<CaloCollections*>(coll)->getEtSums();
20  res_->setBXRange(firstBX, lastBX);
21 
22  LogDebug("L1T") << "nBX = " << nBX << " first BX = " << firstBX << " lastBX = " << lastBX;
23 
24  // Initialise index
25  int unsigned i = 0;
26 
27  // Loop over multiple BX and then number of jets filling jet collection
28  for (int bx=firstBX; bx<=lastBX; bx++){
29 
30  res_->resize(bx,4);
31 
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 totet=candbit[0] & 0xFFF;
42  int overflowtotet=(candbit[0]>>12) & 0x1;
43  int totht=candbit[1] & 0xFFF;
44  int overflowtotht=(candbit[1]>>12) & 0x1;
45 
47  et.setHwPt(totet);
49  int flagtotet=et.hwQual();
50  flagtotet|= overflowtotet;
51  et.setHwQual(flagtotet);
52  LogDebug("L1T") << "ET: pT " << et.hwPt()<<"is overflow "<<overflowtotet<<std::endl;
53  res_->set(bx, 2,et);
54 
55  l1t::EtSum ht = l1t::EtSum();
56  ht.setHwPt(totht);
58  int flagtotht=ht.hwQual();
59  flagtotht|= overflowtotht;
60  ht.setHwQual(flagtotht);
61  LogDebug("L1T") << "HT: pT " << ht.hwPt()<<"is overflow "<<overflowtotht<<std::endl;
62  res_->set(bx, 3,ht);
63 
64  }
65 
66  return true;
67 
68  }
69  }
70 }
71 
#define LogDebug(id)
const std::vector< uint32_t > & payload() const
Definition: Block.h:60
unsigned int getID() const
Definition: Block.h:21
bool unpack(const Block &block, UnpackerCollections *coll) override
void getBXRange(int nbx, int &first, int &last)
BlockHeader header() const
Definition: Block.h:59
void setHwQual(int qual)
Definition: L1Candidate.h:44
delete x;
Definition: CaloConfig.h:22
void setType(EtSumType type)
Definition: EtSum.cc:32
int hwQual() const
Definition: L1Candidate.h:51
JetCorrectorParametersCollection coll
Definition: classes.h:10
int hwPt() const
Definition: L1Candidate.h:48
et
define resolution functions of each parameter
void setHwPt(int pt)
Definition: L1Candidate.h:41
#define DEFINE_L1T_UNPACKER(type)
unsigned int getSize() const
Definition: Block.h:22