test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MissHtUnpacker.cc
Go to the documentation of this file.
2 
4 
5 #include "CaloCollections.h"
6 
7 namespace l1t {
8  namespace stage1 {
9  class MissHtUnpacker : public Unpacker {
10  public:
11  virtual bool unpack(const Block& block, UnpackerCollections *coll) override;
12  };
13  }
14 }
15 
16 // Implementation
17 
18 namespace l1t {
19  namespace stage1 {
20  bool
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 reset_ = static_cast<CaloCollections*>(coll)->getEtSums();
31  reset_->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  reset_->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 htmissphi=candbit[0] & 0x1F;
53  int htmiss=(candbit[0]>>5) & 0x7F;
54  int overflowhtmiss=(candbit[0]>>12) & 0x1;
55 
56  l1t::EtSum mht = l1t::EtSum();
57  mht.setHwPt(htmiss);
58  mht.setHwPhi(htmissphi);
60  int flaghtmiss=mht.hwQual();
61  flaghtmiss|= overflowhtmiss;
62  mht.setHwQual(flaghtmiss);
63  LogDebug("L1T") << "MHT: pT " << mht.hwPt()<<"is overflow "<<overflowhtmiss<<std::endl;
64  reset_->set(bx, 1,mht);
65 
66  }
67 
68  return true;
69 
70  }
71  }
72 }
73 
#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)
Definition: Unpacker.cc:14
BlockHeader header() const
Definition: Block.h:56
void setHwQual(int qual)
Definition: L1Candidate.cc:64
std::vector< uint32_t > payload() const
Definition: Block.h:57
void setType(EtSumType type)
Definition: EtSum.cc:32
#define DEFINE_L1T_UNPACKER(type)
Definition: Unpacker.h:31
int hwQual() const
Definition: L1Candidate.cc:89
void setHwPhi(int phi)
Definition: L1Candidate.cc:54
JetCorrectorParametersCollection coll
Definition: classes.h:10
int hwPt() const
Definition: L1Candidate.cc:69
virtual bool unpack(const Block &block, UnpackerCollections *coll) override
void setHwPt(int pt)
Definition: L1Candidate.cc:44
unsigned int getSize() const
Definition: Block.h:23