CMS 3D CMS Logo

MissHtUnpacker.cc
Go to the documentation of this file.
3 
4 #include "CaloCollections.h"
5 #include "MissHtUnpacker.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 reset_ = static_cast<CaloCollections*>(coll)->getEtSums();
20  reset_->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  reset_->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 htmissphi=candbit[0] & 0x1F;
42  int htmiss=(candbit[0]>>5) & 0x7F;
43  int overflowhtmiss=(candbit[0]>>12) & 0x1;
44 
45  l1t::EtSum mht = l1t::EtSum();
46  mht.setHwPt(htmiss);
47  mht.setHwPhi(htmissphi);
49  int flaghtmiss=mht.hwQual();
50  flaghtmiss|= overflowhtmiss;
51  mht.setHwQual(flaghtmiss);
52  LogDebug("L1T") << "MHT: pT " << mht.hwPt()<<"is overflow "<<overflowhtmiss<<std::endl;
53  reset_->set(bx, 1,mht);
54 
55  }
56 
57  return true;
58 
59  }
60  }
61 }
62 
#define LogDebug(id)
const std::vector< uint32_t > & payload() const
Definition: Block.h:60
unsigned int getID() const
Definition: Block.h:21
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
void setHwPhi(int phi)
Definition: L1Candidate.h:43
JetCorrectorParametersCollection coll
Definition: classes.h:10
int hwPt() const
Definition: L1Candidate.h:48
bool unpack(const Block &block, UnpackerCollections *coll) override
void setHwPt(int pt)
Definition: L1Candidate.h:41
#define DEFINE_L1T_UNPACKER(type)
unsigned int getSize() const
Definition: Block.h:22