CMS 3D CMS Logo

EtSumUnpacker_0x10010057.cc
Go to the documentation of this file.
3 
5 
6 #include "L1TObjectCollections.h"
7 
10 
11 namespace l1t {
12 namespace stage2 {
14  {
15  }
16 
17  bool
19  {
20 
21  using namespace l1t::stage2::layer2;
22 
23  LogDebug("L1T") << "Block ID = " << block.header().getID() << " size = " << block.header().getSize();
24 
25  int nBX = int(ceil(block.header().getSize() / demux::nOutputFramePerBX)); // Since there 6 frames per demux output event
26  // expect the first four frames to be the first 4 EtSum objects reported per event (see CMS IN-2013/005)
27 
28  // Find the central, first and last BXs
29  int firstBX = -(ceil((double)nBX/2.)-1);
30  int lastBX;
31  if (nBX % 2 == 0) {
32  lastBX = ceil((double)nBX/2.);
33  } else {
34  lastBX = ceil((double)nBX/2.)-1;
35  }
36 
37  auto res_ = static_cast<L1TObjectCollections*>(coll)->getEtSums(EtSumCopy_);
38  res_->setBXRange(firstBX, lastBX);
39 
40  LogDebug("L1T") << "nBX = " << nBX << " first BX = " << firstBX << " lastBX = " << lastBX;
41 
42  // Loop over multiple BX and fill EtSums collection
43  for (int bx=firstBX; bx<=lastBX; bx++){
44 
45 
46  // ET
47  int iFrame = (bx-firstBX)*demux::nOutputFramePerBX;
48 
49  uint32_t raw_data = block.payload().at(iFrame);
50 
52 
53  et.setHwPt(raw_data & 0xFFF);
55  et.setP4( l1t::CaloTools::p4Demux(&et) );
56 
57  LogDebug("L1T") << "ET: pT " << et.hwPt() << " bx " << bx;
58 
59  res_->push_back(bx,et);
60 
61 
62  // ET EM
63 
64  l1t::EtSum etem = l1t::EtSum();
65 
66  etem.setHwPt( (raw_data >> 12) & 0xFFF);
68  etem.setP4( l1t::CaloTools::p4Demux(&etem) );
69 
70  LogDebug("L1T") << "ETEM: pT " << etem.hwPt() << " bx " << bx;
71 
72  res_->push_back(bx,etem);
73 
74 
75  // MBHFPT0
76 
77  l1t::EtSum mbp0 = l1t::EtSum();
78  mbp0.setHwPt( (raw_data>>28) & 0xf );
80 
81  res_->push_back(bx, mbp0);
82 
83 
84  // HT
85 
86  raw_data = block.payload()[iFrame+1];
87 
88  l1t::EtSum ht = l1t::EtSum();
89 
90  ht.setHwPt(raw_data & 0xFFF);
92  ht.setP4( l1t::CaloTools::p4Demux(&ht) );
93 
94  LogDebug("L1T") << "HT: pT " << ht.hwPt();
95 
96  res_->push_back(bx,ht);
97 
98  //MBHFMT0
99 
100  l1t::EtSum mbm0 = l1t::EtSum();
101  mbm0.setHwPt( (raw_data>>28) & 0xf );
103 
104  res_->push_back(bx, mbm0);
105 
106 
107  // MET (no HF)
108 
109  raw_data = block.payload()[iFrame+2];
110 
112 
113  met.setHwPt(raw_data & 0xFFF);
114  met.setHwPhi((raw_data >> 12) & 0xFF);
116  met.setP4( l1t::CaloTools::p4Demux(&met) );
117 
118  LogDebug("L1T") << "MET: phi " << met.hwPhi() << " pT " << met.hwPt() << " bx " << bx;
119 
120  res_->push_back(bx,met);
121 
122  // MBHFPT1
123 
124  l1t::EtSum mbp1 = l1t::EtSum();
125  mbp1.setHwPt( (raw_data>>28) & 0xf );
127 
128  res_->push_back(bx, mbp1);
129 
130  // ET ASYMM
131 
132  l1t::EtSum etAsym = l1t::EtSum();
133  etAsym.setHwPt( (raw_data>>20) & 0xFF );
134  etAsym.setType( l1t::EtSum::kAsymEt );
135 
136  res_->push_back(bx, etAsym);
137 
138  // MHT
139 
140  raw_data = block.payload()[iFrame+3];
141 
142  l1t::EtSum mht = l1t::EtSum();
143 
144  mht.setHwPt(raw_data & 0xFFF);
145  mht.setHwPhi((raw_data >> 12) & 0xFF);
147  mht.setP4( l1t::CaloTools::p4Demux(&mht) );
148 
149  LogDebug("L1T") << "MHT: phi " << mht.hwPhi() << " pT " << mht.hwPt() << " bx " << bx;
150 
151  res_->push_back(bx,mht);
152 
153  // MBHFMT1
154 
155  l1t::EtSum mbm1 = l1t::EtSum();
156  mbm1.setHwPt( (raw_data>>28) & 0xf );
158 
159  res_->push_back(bx, mbm1);
160 
161  // HT ASYMM
162 
163  l1t::EtSum htAsym = l1t::EtSum();
164  htAsym.setHwPt( (raw_data>>20) & 0xFF );
165  htAsym.setType( l1t::EtSum::kAsymHt );
166 
167  res_->push_back(bx, htAsym);
168 
169 
170  // MET (with HF)
171 
172  raw_data = block.payload()[iFrame+4];
173 
174  l1t::EtSum methf = l1t::EtSum();
175 
176  methf.setHwPt(raw_data & 0xFFF);
177  methf.setHwPhi((raw_data >> 12) & 0xFF);
179  methf.setP4( l1t::CaloTools::p4Demux(&methf) );
180 
181  LogDebug("L1T") << "METHF: phi " << methf.hwPhi() << " pT " << methf.hwPt() << " bx " << bx;
182 
183  res_->push_back(bx,methf);
184 
185  // ETHF ASYMM
186 
187  l1t::EtSum etHFAsym = l1t::EtSum();
188  etHFAsym.setHwPt( (raw_data>>20) & 0xFF );
189  etHFAsym.setType( l1t::EtSum::kAsymEtHF );
190 
191  res_->push_back(bx, etHFAsym);
192 
193  // CENTRALITY LOWER NIB
194 
195  uint32_t centLN = ((raw_data >> 28) & 0xF);
196 
197  // MHT with HF
198 
199  raw_data = block.payload()[iFrame+5];
200 
201  l1t::EtSum mhthf = l1t::EtSum();
202 
203  mhthf.setHwPt(raw_data & 0xFFF);
204  mhthf.setHwPhi((raw_data >> 12) & 0xFF);
206  mhthf.setP4( l1t::CaloTools::p4Demux(&mhthf) );
207 
208  LogDebug("L1T") << "MHThf: phi " << mhthf.hwPhi() << " pT " << mhthf.hwPt() << " bx " << bx;
209 
210  res_->push_back(bx,mhthf);
211 
212  // HTHF ASYMM
213 
214  l1t::EtSum htHFAsym = l1t::EtSum();
215  htHFAsym.setHwPt( (raw_data>>20) & 0xFF );
216  htHFAsym.setType( l1t::EtSum::kAsymHtHF );
217 
218  res_->push_back(bx, htHFAsym);
219 
220 
221  // CENTRALITY UPPER NIB
222 
223  uint32_t centUN = ((raw_data >> 28) & 0xF);
224 
225  l1t::EtSum cent = l1t::EtSum();
226  cent.setHwPt( (centUN << 4) | centLN);
228 
229  res_->push_back(bx, cent);
230 
231  //HI-SUM
232 
233  raw_data = block.payload()[iFrame+1];
234 
235  l1t::EtSum towCount = l1t::EtSum();
236  towCount.setHwPt( (raw_data>>12) & 0x1FFF );
237  towCount.setType( (l1t::EtSum::kTowerCount) );
238  towCount.setP4( l1t::CaloTools::p4Demux(&towCount) );
239 
240  res_->push_back(bx, towCount);
241 
242 
243  }
244 
245  return true;
246  }
247 }
248 }
249 
#define LogDebug(id)
const std::vector< uint32_t > & payload() const
Definition: Block.h:60
unsigned int getID() const
Definition: Block.h:21
const unsigned int nOutputFramePerBX
BlockHeader header() const
Definition: Block.h:59
int hwPhi() const
Definition: L1Candidate.h:50
delete x;
Definition: CaloConfig.h:22
void setType(EtSumType type)
Definition: EtSum.cc:32
void setHwPhi(int phi)
Definition: L1Candidate.h:43
JetCorrectorParametersCollection coll
Definition: classes.h:10
int hwPt() const
Definition: L1Candidate.h:48
met
===> hadronic RAZOR
bool unpack(const Block &block, UnpackerCollections *coll) override
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
static math::PtEtaPhiMLorentzVector p4Demux(l1t::L1Candidate *)
Definition: CaloTools.cc:290
void setP4(const LorentzVector &p4) final
set 4-momentum