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