CMS 3D CMS Logo

UCTSummaryCard.cc
Go to the documentation of this file.
1 #include <cmath>
2 #include <cstdint>
3 #include <cstdlib>
4 #include <iomanip>
5 #include <iostream>
6 #include <vector>
7 
8 using namespace std;
9 
10 #include "UCTSummaryCard.hh"
11 #include "UCTObject.hh"
12 #include "UCTLayer1.hh"
13 #include "UCTCrate.hh"
14 #include "UCTCard.hh"
15 #include "UCTRegion.hh"
16 #include "UCTGeometry.hh"
17 #include "UCTLogging.hh"
19 
20 using namespace l1tcalo;
21 
22 UCTSummaryCard::UCTSummaryCard(const std::vector<std::vector<std::vector<uint32_t> > >* l,
23  uint32_t jetSeedIn,
24  uint32_t tauSeedIn,
25  double tauIsolationFactorIn,
26  uint32_t eGammaSeedIn,
27  double eGammaIsolationFactorIn)
28  : pumLUT(l),
29  jetSeed(jetSeedIn),
30  tauSeed(tauSeedIn),
31  tauIsolationFactor(tauIsolationFactorIn),
32  eGammaSeed(tauSeedIn),
33  eGammaIsolationFactor(tauIsolationFactorIn) {
34  UCTGeometry g;
35  sinPhi[0] = 0;
36  cosPhi[0] = 1;
37  for (int iPhi = 1; iPhi <= 72; iPhi++) {
38  sinPhi[iPhi] = sin(g.getUCTTowerPhi(iPhi));
39  cosPhi[iPhi] = cos(g.getUCTTowerPhi(iPhi));
40  }
41 }
42 
43 UCTSummaryCard::~UCTSummaryCard() {
44  for (uint32_t i = 0; i < regions.size(); i++) {
45  if (regions[i] != nullptr)
46  delete regions[i];
47  }
48 }
49 
51  clearEvent();
52  UCTGeometry g;
53  uint32_t etValue = 0;
54  uint32_t htValue = 0;
55  int sumEx = 0;
56  int sumEy = 0;
57  int sumHx = 0;
58  int sumHy = 0;
59  int etaMin = -NRegionsInCard;
60  int etaMax = NRegionsInCard;
61  // Determine pumLevel using only the central regions
62  pumLevel = 0;
63  for (int iEta = etaMin; iEta <= etaMax; iEta++) { // Ranging between -7 to 7
64  if (iEta == 0)
65  continue; // Note that eta == 0 is illegal
66  for (uint32_t iPhi = 0; iPhi < MaxUCTRegionsPhi; iPhi++) { // Note that phi ranges from 0 to 17
67  const UCTRegion* uctRegion = getRegion(iEta, iPhi);
68  uint32_t et = uctRegion->et();
69  if (et > 0)
70  pumLevel++;
71  }
72  }
73  uint32_t totalRegionCount = 2 * etaMax * MaxUCTRegionsPhi;
74  uint32_t pumBinSize = totalRegionCount / pumLUT->size();
75  pumBin = floor(pumLevel / pumBinSize);
76  if (pumBin >= pumLUT->size())
77  pumBin = pumLUT->size() - 1; // Max index
78  // We walk the eta-phi plane looping over all regions.
79  // to make global objects like TotalET, HT, MET, MHT
80  // subtracting pileup along the way
81  // For compact objects we use processRegion(regionIndex)
82  uint32_t pileup = 0;
83  uint32_t et = 0;
84  for (uint32_t side = 0; side < 2; side++) {
85  bool negativeSide = true;
86  if (side == 1)
87  negativeSide = false;
88  for (uint32_t crate = 0; crate < g.getNCrates(); crate++) {
89  for (uint32_t card = 0; card < g.getNCards(); card++) {
90  for (uint32_t region = 0; region < NRegionsInCard; region++) {
91  int iEta = g.getUCTRegionEtaIndex(negativeSide, region);
92  uint32_t iPhi = g.getUCTRegionPhiIndex(crate, card);
93  UCTRegionIndex regionIndex(iEta, iPhi);
94  processRegion(regionIndex);
95  const UCTRegion* uctRegion = getRegion(iEta, iPhi);
96  if (uctRegion == nullptr) {
97  continue;
98  }
99  et = uctRegion->et();
100  uint32_t pileupInRegion = (*pumLUT)[pumBin][side][region];
101  pileup += pileupInRegion;
102  if (pileupInRegion < et)
103  et -= pileupInRegion;
104  else
105  et = 0;
106  UCTTowerIndex hitTower = g.getUCTTowerIndexFromL1CaloRegion(regionIndex, uctRegion->rawData());
107  int hitCaloPhi = hitTower.second;
108  sumEx += ((int)(((double)et) * cosPhi[hitCaloPhi]));
109  sumEy += ((int)(((double)et) * sinPhi[hitCaloPhi]));
110  etValue += et;
111  if (et > 10) {
112  sumHx += ((int)(((double)et) * cosPhi[hitCaloPhi]));
113  sumHy += ((int)(((double)et) * sinPhi[hitCaloPhi]));
114  htValue += et;
115  }
116  }
117  }
118  }
119  }
120  uint32_t metSquare = sumEx * sumEx + sumEy * sumEy;
121  uint32_t metValue = sqrt((double)metSquare);
122  double metPhi = (atan2(sumEy, sumEx) * 180. / 3.1415927) + 180.;
123  int metIPhi = (int)(72. * (metPhi / 360.));
124  uint32_t mhtSquare = sumHx * sumHx + sumHy * sumHy;
125  uint32_t mhtValue = sqrt((double)mhtSquare);
126  double mhtPhi = (atan2(sumHy, sumHx) * 180. / 3.1415927) + 180.;
127  int mhtIPhi = (int)(72. * (mhtPhi / 360.));
128 
129  ET = new UCTObject(UCTObject::ET, etValue, 0, metIPhi, pileup, 0, 0);
130  HT = new UCTObject(UCTObject::HT, htValue, 0, mhtIPhi, pileup, 0, 0);
131  MET = new UCTObject(UCTObject::MET, metValue, 0, metIPhi, pileup, 0, 0);
132  MHT = new UCTObject(UCTObject::MHT, mhtValue, 0, mhtIPhi, pileup, 0, 0);
133 
134  // Then sort the candidates for output usage
135  emObjs.sort();
136  isoEMObjs.sort();
137  tauObjs.sort();
138  isoTauObjs.sort();
139  centralJetObjs.sort();
140  forwardJetObjs.sort();
141  boostedJetObjs.sort();
142  // Cool we never fail :)
143  return true;
144 }
145 
146 bool UCTSummaryCard::processRegion(UCTRegionIndex center) {
147  // We process the region looking at nearest neighbor data
148  // We should never need beyond nearest-neighbor for most
149  // objects - eGamma, tau or jet
150 
151  std::vector<uint32_t> boostedJetTowers;
152  boostedJetTowers.clear();
153  for (size_t iPhi = 0; iPhi < 12; iPhi++) {
154  for (size_t iEta = 0; iEta < 12; iEta++) {
155  boostedJetTowers.push_back(0);
156  }
157  }
158 
159  std::vector<uint32_t> boostedJetRegionET, boostedJetRegionTauVeto;
160  boostedJetRegionET.clear();
161  boostedJetRegionTauVeto.clear();
162  for (size_t i = 0; i < 9; i++) {
163  boostedJetRegionET.push_back(0);
164  boostedJetRegionTauVeto.push_back(0);
165  }
166 
167  UCTGeometryExtended g;
168 
169  const UCTRegion* cRegion = getRegion(center.first, center.second);
170  if (cRegion == nullptr) {
171  return false;
172  }
173 
174  // Central jets do not use HF - note border exclusion
175  bool centralRegion = false;
176  if (cRegion->getRegion() < (NRegionsInCard - 1))
177  centralRegion = true;
178 
179  uint32_t centralET = cRegion->et();
180  uint32_t centralPU = std::min(centralET, (*pumLUT)[pumBin][0][cRegion->getRegion()]);
181  if (!cRegion->isNegativeEta())
182  centralPU = std::min(centralET, (*pumLUT)[pumBin][1][cRegion->getRegion()]);
183  centralET -= centralPU;
184  UCTTowerIndex centralHitTower = g.getUCTTowerIndexFromL1CaloRegion(center, cRegion->rawData());
185  int nTauLike = 0;
186  bool centralIsTauLike = cRegion->isTauLike();
187  if (cRegion->isTauLike())
188  nTauLike++;
189  bool centralIsEGammaLike = cRegion->isEGammaLike();
190  int hitCaloEta = centralHitTower.first;
191  int hitCaloPhi = centralHitTower.second;
192 
193  boostedJetRegionET[4] = centralET;
194  boostedJetRegionTauVeto[4] = cRegion->isTauLike();
195 
196  UCTRegionIndex northIndex = g.getUCTRegionNorth(center);
197  const UCTRegion* northRegion = getRegion(northIndex.first, northIndex.second);
198  uint32_t northET = 0;
199  uint32_t northPU = 0;
200  UCTTowerIndex northHitTower;
201  bool northIsTauLike = false;
202  bool northIsEGammaLike = false;
203  if (northRegion != nullptr) {
204  northET = northRegion->et();
205  northPU = std::min(northET, (*pumLUT)[pumBin][0][northRegion->getRegion()]);
206  if (!northRegion->isNegativeEta())
207  northPU = std::min(northET, (*pumLUT)[pumBin][1][northRegion->getRegion()]);
208  northET -= northPU;
209  northHitTower = g.getUCTTowerIndexFromL1CaloRegion(northIndex, northRegion->rawData());
210  northIsTauLike = northRegion->isTauLike();
211  if (northRegion->isTauLike())
212  nTauLike++;
213  northIsEGammaLike = northRegion->isEGammaLike();
214  boostedJetRegionET[3] = northET;
215  boostedJetRegionTauVeto[3] = northRegion->isTauLike();
216  }
217 
218  UCTRegionIndex southIndex = g.getUCTRegionSouth(center);
219  const UCTRegion* southRegion = getRegion(southIndex.first, southIndex.second);
220  uint32_t southET = 0;
221  uint32_t southPU = 0;
222  UCTTowerIndex southHitTower;
223  bool southIsTauLike = false;
224  bool southIsEGammaLike = false;
225  if (southRegion != nullptr) {
226  southET = southRegion->et();
227  southPU = std::min(southET, (*pumLUT)[pumBin][0][southRegion->getRegion()]);
228  if (!southRegion->isNegativeEta())
229  southPU = std::min(southET, (*pumLUT)[pumBin][1][southRegion->getRegion()]);
230  southET -= southPU;
231  southHitTower = g.getUCTTowerIndexFromL1CaloRegion(southIndex, southRegion->rawData());
232  southIsTauLike = southRegion->isTauLike();
233  if (southRegion->isTauLike())
234  nTauLike++;
235  southIsEGammaLike = southRegion->isEGammaLike();
236  boostedJetRegionET[5] = southET;
237  boostedJetRegionTauVeto[5] = southRegion->isTauLike();
238  }
239 
240  UCTRegionIndex westIndex = g.getUCTRegionWest(center);
241  const UCTRegion* westRegion = getRegion(westIndex.first, westIndex.second);
242  uint32_t westET = 0;
243  uint32_t westPU = 0;
244  UCTTowerIndex westHitTower;
245  bool westIsTauLike = false;
246  bool westIsEGammaLike = false;
247  if (westRegion != nullptr) {
248  westET = westRegion->et();
249  westPU = std::min(westET, (*pumLUT)[pumBin][0][westRegion->getRegion()]);
250  if (!westRegion->isNegativeEta())
251  westPU = std::min(westET, (*pumLUT)[pumBin][1][westRegion->getRegion()]);
252  westET -= westPU;
253  westHitTower = g.getUCTTowerIndexFromL1CaloRegion(westIndex, westRegion->rawData());
254  westIsTauLike = westRegion->isTauLike();
255  if (westRegion->isTauLike())
256  nTauLike++;
257  westIsEGammaLike = westRegion->isEGammaLike();
258  boostedJetRegionET[7] = westET;
259  boostedJetRegionTauVeto[7] = westRegion->isTauLike();
260  }
261 
262  UCTRegionIndex eastIndex = g.getUCTRegionEast(center);
263  const UCTRegion* eastRegion = getRegion(eastIndex.first, eastIndex.second);
264  uint32_t eastET = 0;
265  uint32_t eastPU = 0;
266  UCTTowerIndex eastHitTower;
267  bool eastIsTauLike = false;
268  bool eastIsEGammaLike = false;
269  if (eastRegion != nullptr) {
270  eastET = eastRegion->et();
271  eastPU = std::min(eastET, (*pumLUT)[pumBin][0][eastRegion->getRegion()]);
272  if (!eastRegion->isNegativeEta())
273  eastPU = std::min(eastET, (*pumLUT)[pumBin][1][eastRegion->getRegion()]);
274  eastET -= eastPU;
275  eastHitTower = g.getUCTTowerIndexFromL1CaloRegion(eastIndex, eastRegion->rawData());
276  eastIsTauLike = eastRegion->isTauLike();
277  if (eastRegion->isTauLike())
278  nTauLike++;
279  eastIsEGammaLike = eastRegion->isEGammaLike();
280  boostedJetRegionET[1] = eastET;
281  boostedJetRegionTauVeto[1] = eastRegion->isTauLike();
282  }
283 
284  UCTRegionIndex nwIndex = g.getUCTRegionNW(center);
285  const UCTRegion* nwRegion = getRegion(nwIndex.first, nwIndex.second);
286  uint32_t nwET = 0;
287  uint32_t nwPU = 0;
288  UCTTowerIndex nwHitTower;
289  if (nwRegion != nullptr) {
290  if (nwRegion->isTauLike())
291  nTauLike++;
292  nwET = nwRegion->et();
293  nwPU = std::min(nwET, (*pumLUT)[pumBin][0][nwRegion->getRegion()]);
294  if (!nwRegion->isNegativeEta())
295  nwPU = std::min(nwET, (*pumLUT)[pumBin][1][nwRegion->getRegion()]);
296  nwET -= nwPU;
297  nwHitTower = g.getUCTTowerIndexFromL1CaloRegion(nwIndex, nwRegion->rawData());
298  boostedJetRegionET[6] = nwET;
299  boostedJetRegionTauVeto[6] = nwRegion->isTauLike();
300  }
301 
302  UCTRegionIndex neIndex = g.getUCTRegionNE(center);
303  const UCTRegion* neRegion = getRegion(neIndex.first, neIndex.second);
304  uint32_t neET = 0;
305  uint32_t nePU = 0;
306  UCTTowerIndex neHitTower;
307  if (neRegion != nullptr) {
308  if (neRegion->isTauLike())
309  nTauLike++;
310  neET = neRegion->et();
311  nePU = std::min(neET, (*pumLUT)[pumBin][0][neRegion->getRegion()]);
312  if (!neRegion->isNegativeEta())
313  nePU = std::min(neET, (*pumLUT)[pumBin][1][neRegion->getRegion()]);
314  neET -= nePU;
315  neHitTower = g.getUCTTowerIndexFromL1CaloRegion(neIndex, neRegion->rawData());
316  boostedJetRegionET[0] = neET;
317  boostedJetRegionTauVeto[0] = neRegion->isTauLike();
318  }
319 
320  UCTRegionIndex swIndex = g.getUCTRegionSW(center);
321  const UCTRegion* swRegion = getRegion(swIndex.first, swIndex.second);
322  uint32_t swET = 0;
323  uint32_t swPU = 0;
324  UCTTowerIndex swHitTower;
325  if (swRegion != nullptr) {
326  if (swRegion->isTauLike())
327  nTauLike++;
328  swET = swRegion->et();
329  swPU = std::min(swET, (*pumLUT)[pumBin][0][swRegion->getRegion()]);
330  if (!swRegion->isNegativeEta())
331  swPU = std::min(swET, (*pumLUT)[pumBin][1][swRegion->getRegion()]);
332  swET -= swPU;
333  swHitTower = g.getUCTTowerIndexFromL1CaloRegion(swIndex, swRegion->rawData());
334  boostedJetRegionET[8] = swET;
335  boostedJetRegionTauVeto[8] = swRegion->isTauLike();
336  }
337 
338  UCTRegionIndex seIndex = g.getUCTRegionSE(center);
339  const UCTRegion* seRegion = getRegion(seIndex.first, seIndex.second);
340  uint32_t seET = 0;
341  uint32_t sePU = 0;
342  UCTTowerIndex seHitTower;
343  if (seRegion != nullptr) {
344  if (seRegion->isTauLike())
345  nTauLike++;
346  seET = seRegion->et();
347  sePU = std::min(seET, (*pumLUT)[pumBin][0][seRegion->getRegion()]);
348  if (!seRegion->isNegativeEta())
349  sePU = std::min(seET, (*pumLUT)[pumBin][1][seRegion->getRegion()]);
350  seET -= sePU;
351  seHitTower = g.getUCTTowerIndexFromL1CaloRegion(seIndex, seRegion->rawData());
352  boostedJetRegionET[2] = seET;
353  boostedJetRegionTauVeto[2] = seRegion->isTauLike();
354  }
355 
356  uint32_t et3x3 = centralET + northET + nwET + westET + swET + southET + seET + eastET + neET;
357  if (et3x3 > 0x3FF)
358  et3x3 = 0x3FF; // Peg at 10-bits
359 
360  uint32_t pu3x3 = centralPU + northPU + nwPU + westPU + swPU + southPU + sePU + eastPU + nePU;
361 
362  // Jet - a 3x3 object with center greater than a seed and all neighbors
363  uint32_t jetET = et3x3;
364 
365  if (centralET >= northET && centralET >= nwET && centralET >= westET && centralET >= swET && centralET > southET &&
366  centralET > seET && centralET > eastET && centralET > neET && centralET > jetSeed) {
367  if (centralRegion)
368  centralJetObjs.push_back(new UCTObject(UCTObject::jet, jetET, hitCaloEta, hitCaloPhi, pu3x3, 0, et3x3));
369  else
370  forwardJetObjs.push_back(new UCTObject(UCTObject::jet, jetET, hitCaloEta, hitCaloPhi, pu3x3, 0, et3x3));
371  }
372 
373  auto boostedJet = new UCTObject(UCTObject::jet, jetET, hitCaloEta, hitCaloPhi, pu3x3, 0, et3x3);
374  boostedJet->setNTaus(nTauLike);
375  boostedJet->setBoostedJetRegionET(boostedJetRegionET);
376  boostedJet->setBoostedJetRegionTauVeto(boostedJetRegionTauVeto);
377  boostedJetObjs.push_back(boostedJet);
378 
379  // tau Object - a single region or a 2-region sum, where the neighbor with lower ET is located using matching hit calo towers
380 
381  if (centralRegion && centralIsTauLike && centralET > tauSeed) {
382  uint32_t tauET = centralET;
383  uint32_t tauPU = centralPU;
384  int neighborMatchCount = 0;
385  //check to see if we are on the edge of the calorimeter
386  if (!g.isEdgeTower(centralHitTower)) {
387  //Check to see if the neighbor regions are tau like and if central ET is greater
388  //if region is tau like and a neighbor AND with less energy, set it to 0.
389  if (g.areNeighbors(centralHitTower, northHitTower) && northIsTauLike && centralET >= northET) {
390  tauET += northET;
391  tauPU += northPU;
392  neighborMatchCount++;
393  } else if (g.areNeighbors(centralHitTower, northHitTower) && northIsTauLike && centralET < northET) {
394  tauET = 0;
395  }
396  if (g.areNeighbors(centralHitTower, southHitTower) && southIsTauLike && centralET > southET) {
397  tauET += southET;
398  tauPU += southPU;
399  neighborMatchCount++;
400  } else if (g.areNeighbors(centralHitTower, southHitTower) && southIsTauLike && centralET <= southET) {
401  tauET = 0;
402  }
403  if (g.areNeighbors(centralHitTower, westHitTower) && westIsTauLike && centralET >= westET) {
404  tauET += westET;
405  tauPU += westPU;
406  neighborMatchCount++;
407  } else if (g.areNeighbors(centralHitTower, westHitTower) && westIsTauLike && centralET < westET) {
408  tauET = 0;
409  }
410  if (g.areNeighbors(centralHitTower, eastHitTower) && eastIsTauLike && centralET > eastET) {
411  tauET += eastET;
412  tauPU += eastPU;
413  neighborMatchCount++;
414  } else if (g.areNeighbors(centralHitTower, eastHitTower) && eastIsTauLike && centralET <= eastET) {
415  tauET = 0;
416  }
417  if (neighborMatchCount > 2) {
418  tauET = 0;
419  }
420  }
421  if (tauET != 0) {
422  tauObjs.push_back(new UCTObject(UCTObject::tau, tauET, hitCaloEta, hitCaloPhi, tauPU, 0xDEADBEEF, et3x3));
423  // Subtract footprint
424  uint32_t isolation = 0;
425  if (et3x3 > tauET)
426  isolation = et3x3 - tauET;
427  if (isolation < ((uint32_t)(tauIsolationFactor * (double)tauET))) {
428  isoTauObjs.push_back(new UCTObject(UCTObject::isoTau, tauET, hitCaloEta, hitCaloPhi, pu3x3, isolation, et3x3));
429  }
430  }
431  }
432 
433  // eGamma Object - This is a sad story
434  // eGamma should be in 2-3 contiguous towers, but we have no bandwidth to get a second cluster from cards
435  // so we use essentially the same clustering as for tau, but demand that energy is almost all in the ECAL
436  // pileup subtraction is critical to not overshoot - further this should work better for isolated eGamma
437  // a single region or a 2-region sum, where the neighbor with lower ET is located using matching hit calo towers
438 
439  if (centralRegion && centralIsEGammaLike && centralET > eGammaSeed) {
440  uint32_t eGammaET = centralET;
441  uint32_t eGammaPU = centralPU;
442  int neighborMatchCount = 0;
443  if (!g.isEdgeTower(centralHitTower)) {
444  if (g.areNeighbors(centralHitTower, northHitTower) && northIsEGammaLike && centralET >= northET) {
445  eGammaET += northET;
446  eGammaPU += northPU;
447  neighborMatchCount++;
448  } else if (g.areNeighbors(centralHitTower, northHitTower) && northIsEGammaLike && centralET < northET) {
449  eGammaET = 0;
450  }
451  if (g.areNeighbors(centralHitTower, southHitTower) && southIsEGammaLike && centralET > southET) {
452  eGammaET += southET;
453  eGammaPU += southPU;
454  neighborMatchCount++;
455  } else if (g.areNeighbors(centralHitTower, southHitTower) && southIsEGammaLike && centralET <= southET) {
456  eGammaET = 0;
457  }
458  if (g.areNeighbors(centralHitTower, westHitTower) && westIsEGammaLike && centralET >= westET) {
459  eGammaET += westET;
460  eGammaPU += westPU;
461  neighborMatchCount++;
462  } else if (g.areNeighbors(centralHitTower, westHitTower) && westIsEGammaLike && centralET < westET) {
463  eGammaET = 0;
464  }
465  if (g.areNeighbors(centralHitTower, eastHitTower) && eastIsEGammaLike && centralET > eastET) {
466  eGammaET += eastET;
467  eGammaPU += eastPU;
468  neighborMatchCount++;
469  } else if (g.areNeighbors(centralHitTower, eastHitTower) && eastIsEGammaLike && centralET <= eastET) {
470  eGammaET = 0;
471  }
472  if (neighborMatchCount > 2) {
473  eGammaET = 0;
474  }
475  }
476  if (eGammaET != 0) {
477  emObjs.push_back(new UCTObject(UCTObject::eGamma, eGammaET, hitCaloEta, hitCaloPhi, eGammaPU, 0xDEADBEEF, et3x3));
478  uint32_t isolation = 0;
479  if (et3x3 > eGammaET)
480  isolation = et3x3 - eGammaET;
481  if (isolation < ((uint32_t)(eGammaIsolationFactor * (double)eGammaET))) {
482  isoEMObjs.push_back(
483  new UCTObject(UCTObject::isoEGamma, eGammaET, hitCaloEta, hitCaloPhi, pu3x3, isolation, et3x3));
484  }
485  }
486  }
487 
488  return true;
489 }
490 
491 bool UCTSummaryCard::clearEvent() {
492  emObjs.clear();
493  isoEMObjs.clear();
494  tauObjs.clear();
495  isoTauObjs.clear();
496  centralJetObjs.clear();
497  forwardJetObjs.clear();
498  boostedJetObjs.clear();
499  return true;
500 }
501 
502 bool UCTSummaryCard::clearRegions() {
503  regions.clear();
504  return true;
505 }
506 
507 const UCTRegion* UCTSummaryCard::getRegion(int regionEtaIndex, uint32_t regionPhiIndex) const {
508  if (regionEtaIndex == 0 || (uint32_t)std::abs(regionEtaIndex) > NRegionsInCard ||
509  regionPhiIndex >= MaxUCTRegionsPhi) {
510  return nullptr;
511  }
512  UCTGeometry g;
513  UCTRegionIndex r = UCTRegionIndex(regionEtaIndex, regionPhiIndex);
514  UCTTowerIndex t = g.getUCTTowerIndex(r);
515  uint32_t absCaloEta = std::abs(t.first);
516  uint32_t absCaloPhi = std::abs(t.second);
517  bool negativeEta = false;
518  if (t.first < 0)
519  negativeEta = true;
520  uint32_t nCrate = g.getCrate(absCaloEta, absCaloPhi);
521  uint32_t nCard = g.getCard(absCaloEta, absCaloPhi);
522  uint32_t nRegion = g.getRegion(absCaloEta, absCaloPhi);
523  uint32_t i = ((NCardsInCrate * NRegionsInCard * nCrate) + (NRegionsInCard * nCard) + nRegion) *
524  2; // Correct index for region collection vector of size 3*6*7*2
525  if (!negativeEta)
526  i++;
527  if (i > regions.size()) {
528  edm::LogError("L1TCaloSummary") << "UCTSummaryCard: Incorrect region requested -- bailing" << std::endl;
529  exit(1);
530  }
531  return regions[i];
532 }
533 
534 bool UCTSummaryCard::setRegionData(std::vector<UCTRegion*> inputRegions) {
535  for (long unsigned int i = 0; i < inputRegions.size(); i++) {
536  regions.push_back(inputRegions[i]);
537  }
538  return true;
539 }
540 
541 void UCTSummaryCard::print() {
542  if (cardSummary > 0)
543  edm::LogInfo("L1TCaloSummary") << "UCTSummaryCard: result = " << cardSummary << std::endl;
544 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Log< level::Error, false > LogError
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
T sqrt(T t)
Definition: SSEVec.h:23
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Log< level::Info, false > LogInfo
#define ET
jetInfo getRegion(GCTsupertower_t temp[nSTEta][nSTPhi], float TTseedThreshold)
Definition: HT.h:21
def exit(msg="")
MPlex< T, D1, D2, N > atan2(const MPlex< T, D1, D2, N > &y, const MPlex< T, D1, D2, N > &x)
Definition: Matriplex.h:648