CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MissEtUnpacker.cc
Go to the documentation of this file.
3 
4 #include "CaloCollections.h"
5 #include "MissEtUnpacker.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 etmiss=candbit[0] & 0xFFF;
42  int overflowetmiss=(candbit[0]>>12) & 0x1;
43  int etmissphi=candbit[1] & 0x7F;
44 
46  met.setHwPt(etmiss);
47  met.setHwPhi(etmissphi);
49  int flagetmiss=met.hwQual();
50  flagetmiss|= overflowetmiss;
51  met.setHwQual(flagetmiss);
52  LogDebug("L1T") << "MET: pT " << met.hwPt()<<"is overflow "<<overflowetmiss<<std::endl;
53  res_->set(bx, 0,met);
54 
55  }
56 
57  return true;
58 
59  }
60  }
61 }
62 
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
unsigned int getID() const
Definition: Block.h:22
void getBXRange(int nbx, int &first, int &last)
virtual bool unpack(const Block &block, UnpackerCollections *coll) override
BlockHeader header() const
Definition: Block.h:56
void setHwQual(int qual)
Definition: L1Candidate.h:44
std::vector< uint32_t > payload() const
Definition: Block.h:57
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
void setHwPt(int pt)
Definition: L1Candidate.h:41
#define DEFINE_L1T_UNPACKER(type)
unsigned int getSize() const
Definition: Block.h:23