CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CaloTools.cc
Go to the documentation of this file.
2 
4 
7 
8 const float l1t::CaloTools::kGTEtaLSB = 0.0435;
9 const float l1t::CaloTools::kGTPhiLSB = 0.0435;
10 const float l1t::CaloTools::kGTEtLSB = 0.5;
11 
12 const int64_t l1t::CaloTools::cos_coeff[72] = {
13  1023, 1019, 1007, 988, 961, 927, 886, 838, 784, 723, 658, 587, 512, 432, 350, 265, 178, 89,
14  0, -89, -178, -265, -350, -432, -512, -587, -658, -723, -784, -838, -886, -927, -961, -988, -1007, -1019,
15  -1023, -1019, -1007, -988, -961, -927, -886, -838, -784, -723, -658, -587, -512, -432, -350, -265, -178, -89,
16  0, 89, 178, 265, 350, 432, 511, 587, 658, 723, 784, 838, 886, 927, 961, 988, 1007, 1019};
17 
18 const int64_t l1t::CaloTools::sin_coeff[72] = {
19  0, 89, 178, 265, 350, 432, 512, 587, 658, 723, 784, 838, 886, 927, 961, 988, 1007, 1019,
20  1023, 1019, 1007, 988, 961, 927, 886, 838, 784, 723, 658, 587, 512, 432, 350, 265, 178, 89,
21  0, -89, -178, -265, -350, -432, -512, -587, -658, -723, -784, -838, -886, -927, -961, -988, -1007, -1019,
22  -1023, -1019, -1007, -988, -961, -927, -886, -838, -784, -723, -658, -587, -512, -432, -350, -265, -178, -89};
23 
24 // mapping between sums in emulator and data
26  9, 1, 19, 8, 0, 18, 10, 4, 6, 14, // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
27  28, 24, 13, 27, 23, 15, 5, 7, 22, 12, // 10, 11, 12, 13, 14, 15, 16, 17, 18, 19
28  3, 21, 11, 2, 20, 17, 30, 26, 16, 29, // 20, 21, 22, 23, 24, 25, 26, 27, 28, 29
29  25 // 30, 31
30 };
31 
32 bool l1t::CaloTools::insertTower(std::vector<l1t::CaloTower>& towers, const l1t::CaloTower& tower) {
33  size_t towerIndex = CaloTools::caloTowerHash(tower.hwEta(), tower.hwPhi());
34  if (towers.size() > towerIndex) {
35  towers.at(towerIndex) = tower;
36  return true;
37  } else
38  return false;
39 }
40 
41 //currently implemented as a brute force search but this will hopefully change in the future
42 //with standarising the layout of std::vector<l1t::CaloTower>
43 const l1t::CaloTower& l1t::CaloTools::getTower(const std::vector<l1t::CaloTower>& towers, int iEta, int iPhi) {
44  if (abs(iEta) > CaloTools::kHFEnd)
45  return nullTower_;
46 
47  size_t towerIndex = CaloTools::caloTowerHash(iEta, iPhi);
48  if (towerIndex < towers.size()) {
49  if (towers[towerIndex].hwEta() != iEta ||
50  towers[towerIndex].hwPhi() !=
51  iPhi) { //it failed, this is bad, but we will not log the error due to policy and silently attempt to do a brute force search instead
52  //std::cout <<"error, tower "<<towers[towerIndex].hwEta()<<" "<<towers[towerIndex].hwPhi()<<" does not match "<<iEta<<" "<<iPhi<<" index "<<towerIndex<<" nr towrs "<<towers.size()<<std::endl;
53  for (size_t towerNr = 0; towerNr < towers.size(); towerNr++) {
54  if (towers[towerNr].hwEta() == iEta && towers[towerNr].hwPhi() == iPhi)
55  return towers[towerNr];
56  }
57  } else
58  return towers[towerIndex];
59 
60  } else { // in case the vector of towers do not contain all the towers (towerIndex can be > towers.size())
61  for (size_t towerNr = 0; towerNr < towers.size(); towerNr++) {
62  if (towers[towerNr].hwEta() == iEta && towers[towerNr].hwPhi() == iPhi)
63  return towers[towerNr];
64  }
65  }
66 
67  return nullTower_;
68 }
69 
70 const l1t::CaloCluster& l1t::CaloTools::getCluster(const std::vector<l1t::CaloCluster>& clusters, int iEta, int iPhi) {
71  for (size_t clusterNr = 0; clusterNr < clusters.size(); clusterNr++) {
72  if (clusters[clusterNr].hwEta() == iEta && clusters[clusterNr].hwPhi() == iPhi)
73  return clusters[clusterNr];
74  }
75  return nullCluster_;
76 }
77 
78 //this implimentation has not all the necessary info yet, we need to check the exact HF numbering
79 //(iEta=-28,iPhi=1)=index 0 to (iEta=28,iPhi=72)=index 28*72*2-1
80 //HF then runs after that so -32,1 = 28*72*2
81 size_t l1t::CaloTools::caloTowerHash(int iEta, int iPhi) {
82  if (!isValidIEtaIPhi(iEta, iPhi))
83  return caloTowerHashMax();
84  else {
85  const int absIEta = abs(iEta);
86  if (absIEta > kHFEnd)
87  return kNrTowers;
88  else if (absIEta <= kHBHEEnd) { //HBHE
89  int iEtaNoZero = iEta;
90  if (iEta > 0)
91  iEtaNoZero--;
92  return (iEtaNoZero + kHBHEEnd) * kHBHENrPhi + iPhi - 1;
93  } else { //HF
94  int iEtaIndex = iEta + kHFEnd; //iEta=-32 is 0
95  if (iEta > 0)
96  iEtaIndex = iEta - kHBHEEnd + (kHFEnd - kHBHEEnd) - 1; //but iEta=29 is 4
97  return iEtaIndex * kHFNrPhi + iPhi / kHFPhiSeg + kNrHBHETowers;
98  }
99  }
100 }
101 
102 size_t l1t::CaloTools::caloTowerHashMax() { return kNrTowers; }
103 
104 bool l1t::CaloTools::isValidIEtaIPhi(int iEta, int iPhi) {
105  size_t absIEta = abs(iEta);
106  if (iPhi <= 0 || iPhi > kNPhi)
107  return false;
108  if (absIEta == 0 || absIEta > kHFEnd)
109  return false;
110  //if(absIEta>kHBHEEnd && iPhi%kHFPhiSeg!=1) return false;
111  return true;
112 }
113 
115  int iPhi,
116  const std::vector<l1t::CaloTower>& towers,
117  int localEtaMin,
118  int localEtaMax,
119  int localPhiMin,
120  int localPhiMax,
121  SubDet etMode) {
122  return calHwEtSum(iEta, iPhi, towers, localEtaMin, localEtaMax, localPhiMin, localPhiMax, kHFEnd, etMode);
123 }
124 
126  int iPhi,
127  const std::vector<l1t::CaloTower>& towers,
128  int localEtaMin,
129  int localEtaMax,
130  int localPhiMin,
131  int localPhiMax,
132  int iEtaAbsMax,
133  SubDet etMode) {
134  int hwEtSum = 0;
135  for (int etaNr = localEtaMin; etaNr <= localEtaMax; etaNr++) {
136  for (int phiNr = localPhiMin; phiNr <= localPhiMax; phiNr++) {
137  int towerIEta = l1t::CaloStage2Nav::offsetIEta(iEta, etaNr);
138  int towerIPhi = l1t::CaloStage2Nav::offsetIPhi(iPhi, phiNr);
139  if (abs(towerIEta) <= iEtaAbsMax) {
140  const l1t::CaloTower& tower = getTower(towers, towerIEta, towerIPhi);
141  if (etMode == ECAL)
142  hwEtSum += tower.hwEtEm();
143  else if (etMode == HCAL)
144  hwEtSum += tower.hwEtHad();
145  else if (etMode == CALO)
146  hwEtSum += tower.hwPt();
147  }
148  }
149  }
150  return hwEtSum;
151 }
152 
153 size_t l1t::CaloTools::calNrTowers(int iEtaMin,
154  int iEtaMax,
155  int iPhiMin,
156  int iPhiMax,
157  const std::vector<l1t::CaloTower>& towers,
158  int minHwEt,
159  int maxHwEt,
160  SubDet etMode) {
161  size_t nrTowers = 0;
162  l1t::CaloStage2Nav nav(iEtaMin, iPhiMin);
163  while (nav.currIEta() <= iEtaMax) {
164  bool finishPhi = false;
165  while (!finishPhi) {
166  const l1t::CaloTower& tower =
168  int towerHwEt = 0;
169  if (etMode == ECAL)
170  towerHwEt += tower.hwEtEm();
171  else if (etMode == HCAL)
172  towerHwEt += tower.hwEtHad();
173  else if (etMode == CALO)
174  towerHwEt += tower.hwPt();
175  if (towerHwEt >= minHwEt && towerHwEt <= maxHwEt)
176  nrTowers++;
177  finishPhi = (nav.currIPhi() == iPhiMax);
178  nav.north();
179  }
180  nav.east();
181  nav.resetIPhi();
182  }
183  return nrTowers;
184 }
185 
186 std::pair<float, float> l1t::CaloTools::towerEtaBounds(int ieta) {
187  if (ieta == 0)
188  ieta = 1;
189  if (ieta > kHFEnd)
190  ieta = kHFEnd;
191  if (ieta < (-1 * kHFEnd))
192  ieta = -1 * kHFEnd;
193  //const float towerEtas[33] = {0,0.087,0.174,0.261,0.348,0.435,0.522,0.609,0.696,0.783,0.870,0.957,1.044,1.131,1.218,1.305,1.392,1.479,1.566,1.653,1.740,1.830,1.930,2.043,2.172,2.322,2.5,2.650,3.000,3.5,4.0,4.5,5.0};
194  const float towerEtas[42] = {0, 0.087, 0.174, 0.261, 0.348, 0.435, 0.522, 0.609, 0.696, 0.783, 0.870,
195  0.957, 1.044, 1.131, 1.218, 1.305, 1.392, 1.479, 1.566, 1.653, 1.740, 1.830,
196  1.930, 2.043, 2.172, 2.322, 2.5, 2.650, 2.853, 3.139, 3.314, 3.489, 3.664,
197  3.839, 4.013, 4.191, 4.363, 4.538, 4.716, 4.889, 5.191, 5.191};
198  return std::make_pair(towerEtas[abs(ieta) - 1], towerEtas[abs(ieta)]);
199 }
200 
201 float l1t::CaloTools::towerEta(int ieta) {
202  std::pair<float, float> bounds = towerEtaBounds(ieta);
203  float eta = (bounds.second + bounds.first) / 2.;
204  float sign = ieta > 0 ? 1. : -1.;
205  return sign * eta;
206 }
207 
208 float l1t::CaloTools::towerPhi(int ieta, int iphi) {
209  float phi = (float(iphi) - 0.5) * towerPhiSize(ieta);
210  if (phi > M_PI)
211  phi = phi - (2 * M_PI);
212  return phi;
213 }
214 
216  std::pair<float, float> bounds = towerEtaBounds(ieta);
217  float size = (bounds.second - bounds.first);
218  return size;
219 }
220 
221 float l1t::CaloTools::towerPhiSize(int ieta) { return 2. * M_PI / kNPhi; }
222 
223 // convert from calo ieta to internal MP ieta
224 int l1t::CaloTools::mpEta(int ieta) {
225  if (ieta > kHFBegin)
226  return ieta - 1;
227  else if (ieta < -1 * kHFBegin)
228  return ieta + 1;
229  else
230  return ieta;
231 }
232 
233 // convert from internal MP ieta to calo ieta
234 int l1t::CaloTools::caloEta(int mpEta) {
235  if (mpEta >= kHFBegin)
236  return mpEta + 1;
237  else if (mpEta <= -1 * kHFBegin)
238  return mpEta - 1;
239  else
240  return mpEta;
241 }
242 
243 // convert calorimeter ieta to RCT region index
245  // outside HF
246  if (abs(ieta) > kHFEnd)
247  return (ieta < 0 ? 0 : 21);
248 
249  // inside HBHE
250  if (abs(ieta) <= kHFBegin) {
251  if (ieta < 0)
252  return 11 - ceil(double(abs(ieta) / 4.));
253  else
254  return ceil(double(abs(ieta) / 4.)) + 10;
255  }
256 
257  // in HF
258  if (ieta < 0)
259  return 4 - ceil(double(abs(ieta) - 29) / 4.);
260  else
261  return ceil(double(abs(ieta) - 29) / 4.) + 17;
262 }
263 
264 // convert calorimeter ieta to etaBin16 index
266  int absIEta = abs(ieta);
267 
268  if (absIEta > 0 && absIEta <= 5)
269  return 0;
270  else if (absIEta <= 9)
271  return 1;
272  else if (absIEta <= 13)
273  return 2;
274  else if (absIEta <= 15)
275  return 3;
276  else if (absIEta <= 17)
277  return 4;
278  else if (absIEta <= 19)
279  return 5;
280  else if (absIEta <= 21)
281  return 6;
282  else if (absIEta == 22)
283  return 7;
284  else if (absIEta == 23)
285  return 8;
286  else if (absIEta == 24)
287  return 9;
288  else if (absIEta == 25)
289  return 10;
290  else if (absIEta == 26)
291  return 11;
292  else if (absIEta <= 28)
293  return 12;
294  else if (absIEta <= 32)
295  return 13;
296  else if (absIEta <= 36)
297  return 14;
298  else if (absIEta <= 41)
299  return 15;
300  else
301  return -1; // error
302 }
303 
304 int l1t::CaloTools::gtEta(int ieta) {
305  double eta = towerEta(ieta);
306  return round(eta / kGTEtaLSB);
307 }
308 
309 int l1t::CaloTools::gtPhi(int ieta, int iphi) {
310  double phi = towerPhi(ieta, iphi);
311  if (phi < 0)
312  phi = phi + 2 * M_PI;
313  return round(phi / kGTPhiLSB);
314 }
315 
316 // this conversion is based on GT input definitions in CMS DN-2014/029
319  cand->hwPt() * kGTEtLSB + 1.E-6, cand->hwEta() * kGTEtaLSB, cand->hwPhi() * kGTPhiLSB, 0.);
320 }
321 
323  l1t::EGamma tmpEG(p4Demux(&eg), eg.hwPt(), eg.hwEta(), eg.hwPhi(), eg.hwQual(), eg.hwIso());
324  tmpEG.setTowerIPhi(eg.towerIPhi());
325  tmpEG.setTowerIEta(eg.towerIEta());
326  tmpEG.setRawEt(eg.rawEt());
327  tmpEG.setIsoEt(eg.isoEt());
328  tmpEG.setFootprintEt(eg.footprintEt());
329  tmpEG.setNTT(eg.nTT());
330  tmpEG.setShape(eg.shape());
331  tmpEG.setTowerHoE(eg.towerHoE());
332 
333  return tmpEG;
334 }
335 
337  l1t::Tau tmpTau(p4Demux(&tau), tau.hwPt(), tau.hwEta(), tau.hwPhi(), tau.hwQual(), tau.hwIso());
338  tmpTau.setTowerIPhi(tau.towerIPhi());
339  tmpTau.setTowerIEta(tau.towerIEta());
340  tmpTau.setRawEt(tau.rawEt());
341  tmpTau.setIsoEt(tau.isoEt());
342  tmpTau.setNTT(tau.nTT());
343  tmpTau.setHasEM(tau.hasEM());
344  tmpTau.setIsMerged(tau.isMerged());
345 
346  return tmpTau;
347 }
348 
350  l1t::Jet tmpJet(p4Demux(&jet), jet.hwPt(), jet.hwEta(), jet.hwPhi(), jet.hwQual());
351  tmpJet.setTowerIPhi(jet.towerIPhi());
352  tmpJet.setTowerIEta(jet.towerIEta());
353  tmpJet.setRawEt(jet.rawEt());
354  tmpJet.setSeedEt(jet.seedEt());
355  tmpJet.setPUEt(jet.puEt());
356  tmpJet.setPUDonutEt(0, jet.puDonutEt(0));
357  tmpJet.setPUDonutEt(1, jet.puDonutEt(1));
358  tmpJet.setPUDonutEt(2, jet.puDonutEt(2));
359  tmpJet.setPUDonutEt(3, jet.puDonutEt(3));
360 
361  return tmpJet;
362 }
363 
365  return l1t::EtSum(p4Demux(&etsum), etsum.getType(), etsum.hwPt(), etsum.hwEta(), etsum.hwPhi(), etsum.hwQual());
366 }
367 
368 //
371  cand->hwPt() * 0.5 + 1.E-6, towerEta(cand->hwEta()), towerPhi(cand->hwEta(), cand->hwPhi()), 0.);
372 }
373 
375  l1t::EGamma tmpEG(p4MP(&eg), eg.hwPt(), eg.hwEta(), eg.hwPhi(), eg.hwQual(), eg.hwIso());
376  tmpEG.setTowerIPhi(eg.towerIPhi());
377  tmpEG.setTowerIEta(eg.towerIEta());
378  tmpEG.setRawEt(eg.rawEt());
379  tmpEG.setIsoEt(eg.isoEt());
380  tmpEG.setFootprintEt(eg.footprintEt());
381  tmpEG.setNTT(eg.nTT());
382  tmpEG.setShape(eg.shape());
383  tmpEG.setTowerHoE(eg.towerHoE());
384 
385  return tmpEG;
386 }
387 
389  l1t::Tau tmpTau(p4MP(&tau), tau.hwPt(), tau.hwEta(), tau.hwPhi(), tau.hwQual(), tau.hwIso());
390  tmpTau.setTowerIPhi(tau.towerIPhi());
391  tmpTau.setTowerIEta(tau.towerIEta());
392  tmpTau.setRawEt(tau.rawEt());
393  tmpTau.setIsoEt(tau.isoEt());
394  tmpTau.setNTT(tau.nTT());
395  tmpTau.setHasEM(tau.hasEM());
396  tmpTau.setIsMerged(tau.isMerged());
397 
398  return tmpTau;
399 }
400 
402  l1t::Jet tmpJet(p4MP(&jet), jet.hwPt(), jet.hwEta(), jet.hwPhi(), jet.hwQual());
403  tmpJet.setTowerIPhi(jet.towerIPhi());
404  tmpJet.setTowerIEta(jet.towerIEta());
405  tmpJet.setRawEt(jet.rawEt());
406  tmpJet.setSeedEt(jet.seedEt());
407  tmpJet.setPUEt(jet.puEt());
408  tmpJet.setPUDonutEt(0, jet.puDonutEt(0));
409  tmpJet.setPUDonutEt(1, jet.puDonutEt(1));
410  tmpJet.setPUDonutEt(2, jet.puDonutEt(2));
411  tmpJet.setPUDonutEt(3, jet.puDonutEt(3));
412 
413  return tmpJet;
414 }
415 
417  return l1t::EtSum(p4MP(&etsum), etsum.getType(), etsum.hwPt(), etsum.hwEta(), etsum.hwPhi(), etsum.hwQual());
418 }
419 unsigned int l1t::CaloTools::gloriousDivision(uint32_t aNumerator, uint32_t aDenominator) {
420  static const uint64_t lLut[] = {
421  0, 16777215, 4194304, 1864135, 1048576, 671089, 466034, 342392, 262144, 207126, 167772, 138655, 116508, 99273,
422  85598, 74565, 65536, 58053, 51782, 46474, 41943, 38044, 34664, 31715, 29127, 26844, 24818, 23014,
423  21400, 19949, 18641, 17458, 16384, 15406, 14513, 13696, 12945, 12255, 11619, 11030, 10486, 9980,
424  9511, 9074, 8666, 8285, 7929, 7595, 7282, 6988, 6711, 6450, 6205, 5973, 5754, 5546,
425  5350, 5164, 4987, 4820, 4660, 4509, 4365, 4227, 4096, 3971, 3852, 3737, 3628, 3524,
426  3424, 3328, 3236, 3148, 3064, 2983, 2905, 2830, 2758, 2688, 2621, 2557, 2495, 2435,
427  2378, 2322, 2268, 2217, 2166, 2118, 2071, 2026, 1982, 1940, 1899, 1859, 1820, 1783,
428  1747, 1712, 1678, 1645, 1613, 1581, 1551, 1522, 1493, 1465, 1438, 1412, 1387, 1362,
429  1337, 1314, 1291, 1269, 1247, 1226, 1205, 1185, 1165, 1146, 1127, 1109, 1091, 1074,
430  1057, 1040, 1024, 1008, 993, 978, 963, 948, 934, 921, 907, 894, 881, 868,
431  856, 844, 832, 820, 809, 798, 787, 776, 766, 756, 746, 736, 726, 717,
432  707, 698, 689, 681, 672, 664, 655, 647, 639, 631, 624, 616, 609, 602,
433  594, 587, 581, 574, 567, 561, 554, 548, 542, 536, 530, 524, 518, 512,
434  506, 501, 496, 490, 485, 480, 475, 470, 465, 460, 455, 450, 446, 441,
435  437, 432, 428, 424, 419, 415, 411, 407, 403, 399, 395, 392, 388, 384,
436  380, 377, 373, 370, 366, 363, 360, 356, 353, 350, 347, 344, 340, 337,
437  334, 331, 328, 326, 323, 320, 317, 314, 312, 309, 306, 304, 301, 299,
438  296, 294, 291, 289, 286, 284, 282, 280, 277, 275, 273, 271, 268, 266,
439  264, 262, 260, 258, 256, 254, 252, 250, 248, 246, 244, 243, 241, 239,
440  237, 235, 234, 232, 230, 228, 227, 225, 223, 222, 220, 219, 217, 216,
441  214, 212, 211, 209, 208, 207, 205, 204, 202, 201, 199, 198, 197, 195,
442  194, 193, 191, 190, 189, 188, 186, 185, 184, 183, 182, 180, 179, 178,
443  177, 176, 175, 173, 172, 171, 170, 169, 168, 167, 166, 165, 164, 163,
444  162, 161, 160, 159, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149,
445  149, 148, 147, 146, 145, 144, 143, 143, 142, 141, 140, 139, 139, 138,
446  137, 136, 135, 135, 134, 133, 132, 132, 131, 130, 129, 129, 128, 127,
447  127, 126, 125, 125, 124, 123, 123, 122, 121, 121, 120, 119, 119, 118,
448  117, 117, 116, 116, 115, 114, 114, 113, 113, 112, 111, 111, 110, 110,
449  109, 109, 108, 108, 107, 106, 106, 105, 105, 104, 104, 103, 103, 102,
450  102, 101, 101, 100, 100, 99, 99, 98, 98, 97, 97, 96, 96, 96,
451  95, 95, 94, 94, 93, 93, 92, 92, 92, 91, 91, 90, 90, 89,
452  89, 89, 88, 88, 87, 87, 87, 86, 86, 85, 85, 85, 84, 84,
453  84, 83, 83, 82, 82, 82, 81, 81, 81, 80, 80, 80, 79, 79,
454  79, 78, 78, 78, 77, 77, 77, 76, 76, 76, 75, 75, 75, 74,
455  74, 74, 73, 73, 73, 73, 72, 72, 72, 71, 71, 71, 70, 70,
456  70, 70, 69, 69, 69, 68, 68, 68, 68, 67, 67, 67, 67, 66,
457  66, 66, 66, 65, 65, 65, 65, 64};
458 
459  // Firmware uses 18bit integers - make sure we are in the same range
460  aNumerator &= 0x3FFFF;
461  aDenominator &= 0x3FFFF;
462 
463  // Shift the denominator to optimise the polynomial expansion
464  // I limit the shift to half the denominator size in the firmware to save on resources
465  uint32_t lBitShift(0);
466  for (; lBitShift != 9; ++lBitShift) {
467  if (aDenominator & 0x20000)
468  break; // There is a 1 in the MSB
469  aDenominator <<= 1;
470  }
471 
472  // The magical polynomial expansion Voodoo
473  uint64_t lInverseDenominator(((aDenominator & 0x3FE00) - (aDenominator & 0x001FF)) * (lLut[aDenominator >> 9]));
474 
475  // Save on DSPs by throwing away a bunch of LSBs
476  lInverseDenominator >>= 17;
477 
478  // Multiply the numerator by the inverse denominator
479  uint64_t lResult(aNumerator * lInverseDenominator);
480 
481  // Add two bits to the result, to make the Voodoo below work (saves us having an if-else on the shift direction)
482  lResult <<= 2;
483 
484  // Restore the scale by taking into account the bitshift applied above.
485  // We are now 18 bit left-shifted, so the 18 LSBs are effectively the fractional part...
486 
487  uint32_t aFractional = (lResult >>= (9 - lBitShift)) & 0x3FFFF;
488  // ...and the top 18 bits are the integer part
489 
490  // uint32_t aInteger = ( lResult >>= 18 ) & 0x3FFFF;
491 
492  unsigned int result = aFractional >> 10;
493 
494  return result;
495 
496  // Simples!
497 }
static float towerEta(int ieta)
Definition: CaloTools.cc:201
constexpr int32_t ceil(float num)
static l1t::Tau tauP4MP(l1t::Tau &)
Definition: CaloTools.cc:388
bool hasEM() const
short int towerIEta() const
Definition: EGamma.cc:44
static l1t::EtSum etSumP4MP(l1t::EtSum &)
Definition: CaloTools.cc:416
static bool isValidIEtaIPhi(int iEta, int iPhi)
Definition: CaloTools.cc:104
short int towerIPhi() const
Definition: EGamma.cc:46
static const float kGTPhiLSB
Definition: CaloTools.h:153
static unsigned int gloriousDivision(uint32_t aNumerator, uint32_t aDenominator)
Definition: CaloTools.cc:419
static float towerPhi(int ieta, int iphi)
Definition: CaloTools.cc:208
static int mpEta(int ieta)
Definition: CaloTools.cc:224
static const int64_t cos_coeff[72]
Definition: CaloTools.h:137
static const int emul_to_data_sum_index_map[31]
Definition: CaloTools.h:141
static l1t::EGamma egP4MP(l1t::EGamma &)
Definition: CaloTools.cc:374
static int regionEta(int ieta)
Definition: CaloTools.cc:244
short int rawEt() const
Definition: Tau.h:20
static int offsetIEta(int iEta, int offset)
Definition: CaloStage2Nav.h:45
double sign(double x)
static float towerEtaSize(int ieta)
Definition: CaloTools.cc:215
static int calHwEtSum(int iEta, int iPhi, const std::vector< l1t::CaloTower > &towers, int localEtaMin, int localEtaMax, int localPhiMin, int localPhiMax, SubDet etMode=CALO)
Definition: CaloTools.cc:114
static const float kGTEtaLSB
Definition: CaloTools.h:152
static math::PtEtaPhiMLorentzVector p4MP(l1t::L1Candidate *)
Definition: CaloTools.cc:369
short int shape() const
Definition: EGamma.cc:56
int hwPhi() const
Definition: L1Candidate.h:37
int hwEtEm() const
Definition: CaloTower.cc:37
short int footprintEt() const
Definition: EGamma.cc:52
static int gtPhi(int ieta, int iphi)
Definition: CaloTools.cc:309
static const int64_t sin_coeff[72]
Definition: CaloTools.h:138
short int seedEt() const
static size_t caloTowerHash(int iEta, int iPhi)
Definition: CaloTools.cc:81
tuple result
Definition: mps_fire.py:311
int currIPhi() const
short int towerIEta() const
short int rawEt() const
Definition: EGamma.cc:48
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
int hwIso() const
Definition: L1Candidate.h:39
Definition: Jet.h:20
short int towerHoE() const
Definition: EGamma.cc:58
std::pair< int, int > north()
short int isoEt() const
Definition: EGamma.cc:50
static int offsetIPhi(int iPhi, int offset)
Definition: CaloStage2Nav.h:31
bool isMerged() const
static size_t calNrTowers(int iEtaMin, int iEtaMax, int iPhiMin, int iPhiMax, const std::vector< l1t::CaloTower > &towers, int minHwEt, int maxHwEt, SubDet etMode=CALO)
Definition: CaloTools.cc:153
short int puEt() const
static l1t::EGamma egP4Demux(l1t::EGamma &)
Definition: CaloTools.cc:322
static const int kHFEnd
Definition: CaloTools.h:40
static int gtEta(int ieta)
Definition: CaloTools.cc:304
static const l1t::CaloCluster & getCluster(const std::vector< l1t::CaloCluster > &clusters, int iEta, int iPhi)
Definition: CaloTools.cc:70
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static l1t::Jet jetP4MP(l1t::Jet &)
Definition: CaloTools.cc:401
static l1t::Jet jetP4Demux(l1t::Jet &)
Definition: CaloTools.cc:349
int hwEta() const
Definition: L1Candidate.h:36
std::pair< int, int > east()
int hwQual() const
Definition: L1Candidate.h:38
#define M_PI
short int towerIEta() const
static float towerPhiSize(int ieta)
Definition: CaloTools.cc:221
short int rawEt() const
static l1t::Tau tauP4Demux(l1t::Tau &)
Definition: CaloTools.cc:336
int hwPt() const
Definition: L1Candidate.h:35
unsigned long long uint64_t
Definition: Time.h:13
static std::pair< float, float > towerEtaBounds(int ieta)
Definition: CaloTools.cc:186
static size_t caloTowerHashMax()
Definition: CaloTools.cc:102
static const l1t::CaloTower nullTower_
Definition: CaloTools.h:148
static bool insertTower(std::vector< l1t::CaloTower > &towers, const l1t::CaloTower &tower)
Definition: CaloTools.cc:32
static int caloEta(int ietaMP)
Definition: CaloTools.cc:234
static const l1t::CaloTower & getTower(const std::vector< l1t::CaloTower > &towers, int iEta, int iPhi)
Definition: CaloTools.cc:43
short int towerIPhi() const
static const float kGTEtLSB
Definition: CaloTools.h:154
void setTowerIPhi(short int iphi)
Definition: EGamma.cc:30
void setTowerIPhi(short int iphi)
short int puDonutEt(int i) const
static int bin16Eta(int ieta)
Definition: CaloTools.cc:265
static math::PtEtaPhiMLorentzVector p4Demux(l1t::L1Candidate *)
Definition: CaloTools.cc:317
short int isoEt() const
int hwEtHad() const
Definition: CaloTower.cc:39
short int towerIPhi() const
static const l1t::CaloCluster nullCluster_
Definition: CaloTools.h:150
EtSumType getType() const
Definition: EtSum.cc:13
short int nTT() const
tuple size
Write out results.
static l1t::EtSum etSumP4Demux(l1t::EtSum &)
Definition: CaloTools.cc:364
void setTowerIPhi(short int iphi)
short int nTT() const
Definition: EGamma.cc:54
int currIEta() const