CMS 3D CMS Logo

EcalElectronicsMapping.cc
Go to the documentation of this file.
1 // -*- Mode: C++; c-basic-offset: 8; -*-
6 
9 
12 #include <cassert>
13 #include <sstream>
14 
15 using boost::multi_index_container;
16 using namespace boost::multi_index;
17 
18 // -----------------------------------------------------------------------
19 //
20 // -- Conventions :
21 //
22 // DCCid and TCCid numbering : cf slides of Ph. Gras :
23 // in EE- : DCCid between 1 and 8.
24 // DCCid number 1 covers the range -30 deg < phi < 10 deg.
25 // in EB- : DCCid between 10 and 27.
26 // DCCid number 10 covers the range -10 deg < phi < 10 deg.
27 // in EB+: DCCid between 28 and 45.
28 // DCCid number 28 covers the range -10 deg < phi < 10 deg.
29 // in EE+: DCCid between 46 and 54;
30 // DCCid number 46 covers the range -30 deg < phi < 10 deg.
31 //
32 // SMid : 1-18 correspond to EB+ (SMid 1 corresponds to DCC 28)
33 // 19-36 correspond to EB-
34 //
35 // ------------------------------------------------------------------------
36 
38  // Fill the map (Barrel) for the Laser Monitoring readout numbers :
39  // Each DCC actually corresponds to 2 LMs, ilm and ilm + 1
40 
41  int ilm = MIN_LM_EBM;
42  for (int dcc = MIN_DCCID_EBM; dcc <= MAX_DCCID_EBM; dcc++) {
43  LaserMonitoringMap_EB[dcc] = ilm;
44  ilm += 2;
45  }
46  ilm = MIN_LM_EBP;
47  for (int dcc = MIN_DCCID_EBP; dcc <= MAX_DCCID_EBP; dcc++) {
48  LaserMonitoringMap_EB[dcc] = ilm;
49  ilm += 2;
50  }
51 
52  // Fill the map (EndCap) for the Laser Monitoring readout numbers :
53  // Each DCC corresponds to onr LM, but DCC 8 (LM 80 and 81) and DCC 53 (LM 90 and 91)
54 
55  ilm = MIN_LM_EEM;
56  for (int dcc = MIN_DCCID_EEM; dcc <= MAX_DCCID_EEM; dcc++) {
57  LaserMonitoringMap_EE[dcc] = ilm;
58  ilm += 1;
59  if (dcc == 8)
60  ilm += 1;
61  }
62  ilm = MIN_LM_EEP;
63  for (int dcc = MIN_DCCID_EEP; dcc <= MAX_DCCID_EEP; dcc++) {
64  LaserMonitoringMap_EE[dcc] = ilm;
65  ilm += 1;
66  if (dcc == 53)
67  ilm += 1;
68  }
69 }
70 
72 
73 // SM id, between 1 (phi = -10 deg) and 18 in EB+
74 // between 19 (phi = -10 deg) and 27 in EB-.
75 // returns DCCid, currently between 10 and 27 (EB-), 28 and 45 (EB+).
76 // For the EE case, use getElectronicsId.
77 {
78  int dcc = id.ism();
79  if (id.zside() < 0) {
80  dcc += DCCID_PHI0_EBM - 19;
81  } else {
82  dcc += DCCID_PHI0_EBP - 1;
83  }
84  return dcc;
85 }
86 
88 
89 // SM id, between 1 (phi = -10 deg) and 18 in EB+
90 // between 19 (phi = -10 deg) and 27 in EB-.
91 // returns TCCid, currently between 37 and 54 (EB-), 55 and 72 (EB+).
92 // For the EE case, use getEcalTriggerElectronicsId.
93 {
94  int tcc = id.ism();
95  if (id.zside() < 0) {
96  tcc += TCCID_PHI0_EBM - 19;
97  } else {
98  tcc += TCCID_PHI0_EBP - 1;
99  }
100  return tcc;
101 }
102 
104 
105 // returns the index of a Trigger Tower within its TCC.
106 // This is between 1 and 68 for the Barrel, and between
107 // 1 and 32 to 34 (t.b.c.) for the EndCap.
108 
109 {
110  if (id.subDet() == EcalBarrel) {
111  int ie = id.ietaAbs() - 1;
112  int ip;
113  int phi = id.iphi();
114  phi += 2;
115  if (phi > 72)
116  phi = phi - 72;
117  if (id.zside() < 0) {
118  ip = ((phi - 1) % kEBTowersInPhi) + 1;
119  } else {
120  ip = kEBTowersInPhi - ((phi - 1) % kEBTowersInPhi);
121  }
122 
123  return (ie * kEBTowersInPhi) + ip;
124  } else if (id.subDet() == EcalEndcap) {
125  int ie = id.ietaAbs();
126  bool inner = (ie >= iEEEtaMinInner);
127  if (inner) {
128  ie = ie - iEEEtaMinInner;
129  ie = ie % kEETowersInEtaPerInnerTCC;
130  } else {
131  ie = ie - iEEEtaMinOuter;
132  ie = ie % kEETowersInEtaPerOuterTCC;
133  }
134 
135  int ip = id.iphi();
136  ip = (ip + 1) % (kEETowersInPhiPerQuadrant * 4);
137  // now iphi between 0 and 71,
138  // with iphi=0,1,2,3 in 1st Phi sector
139  ip = ip % kEETowersInPhiPerTCC;
140  int itt = kEETowersInPhiPerTCC * ie + ip + 1;
141  return itt;
142  } else {
143  throw cms::Exception("InvalidDetId") << " Wrong EcalTrigTowerDetId in EcalElectronicsMapping::iTT. ";
144  return 0;
145  }
146 }
147 
149  if (id.subDet() == EcalBarrel) {
150  int phi = id.iphi() + 2;
151  if (phi > 72)
152  phi = phi - 72;
153  int tcc = (phi - 1) / kEBTowersInPhi + 1;
154  if (id.zside() < 0)
155  tcc += 18; // now id is the SMid
156  if (id.zside() < 0) {
157  tcc += TCCID_PHI0_EBM - 19;
158  } else {
159  tcc += TCCID_PHI0_EBP - 1;
160  }
161  return tcc;
162  }
163 
164  else if (id.subDet() == EcalEndcap) {
165  int ie = id.ietaAbs();
166  bool inner = (ie >= iEEEtaMinInner);
167  int ip = id.iphi(); // iphi = 1 corresponds to 0 < phi < 5 degrees
168  ip = (ip + 1) % (kEETowersInPhiPerQuadrant * 4);
169  // now iphi between 0 and 71,
170  // with iphi=0,1,2,3 in 1st Phi sector
171  int Phiindex = ip / 4;
172  if (inner) {
173  if (id.ieta() > 0)
174  Phiindex += TCCID_PHI0_EEP_IN;
175  else
176  Phiindex += TCCID_PHI0_EEM_IN;
177  } else {
178  if (id.ieta() > 0)
179  Phiindex += TCCID_PHI0_EEP_OUT;
180  else
181  Phiindex += TCCID_PHI0_EEM_OUT;
182  }
183  return Phiindex;
184  } else {
185  throw cms::Exception("InvalidDetId") << " Wrong EcalTrigTowerDetId in EcalElectronicsMapping::TCCid.";
186  return 0;
187  }
188 }
189 
191  // This is needed for digitoraw. For a given Trigger Tower,
192  // one needs to know to which FED it gets written.
193 
194  if (id.subDet() == EcalBarrel) {
195  int phi = id.iphi() + 2;
196  if (phi > 72)
197  phi = phi - 72;
198  int dcc = (phi - 1) / kEBTowersInPhi + 1;
199  if (id.zside() < 0)
200  dcc += 18; // now id is the SMid
201  if (id.zside() < 0) {
202  dcc += DCCID_PHI0_EBM - 19;
203  } else {
204  dcc += DCCID_PHI0_EBP - 1;
205  }
206  return dcc;
207  } else if (id.subDet() == EcalEndcap) { //FIXME : yes I need to improve this part of the code...
208  int tccid = TCCid(id);
209  int dcc = 0;
210  int offset = 0;
211  if (tccid >= 73) {
212  tccid = tccid - 72;
213  offset = 45;
214  }
215  if (tccid == 24 || tccid == 25 || tccid == 6 || tccid == 7)
216  dcc = 4;
217  if (tccid == 26 || tccid == 27 || tccid == 8 || tccid == 9)
218  dcc = 5;
219  if (tccid == 28 || tccid == 29 || tccid == 10 || tccid == 11)
220  dcc = 6;
221  if (tccid == 30 || tccid == 31 || tccid == 12 || tccid == 13)
222  dcc = 7;
223  if (tccid == 32 || tccid == 33 || tccid == 14 || tccid == 15)
224  dcc = 8;
225  if (tccid == 34 || tccid == 35 || tccid == 16 || tccid == 17)
226  dcc = 9;
227  if (tccid == 36 || tccid == 19 || tccid == 18 || tccid == 1)
228  dcc = 1;
229  if (tccid == 20 || tccid == 21 || tccid == 2 || tccid == 3)
230  dcc = 2;
231  if (tccid == 22 || tccid == 23 || tccid == 4 || tccid == 5)
232  dcc = 3;
233  dcc += offset;
234  return dcc;
235  } else {
236  throw cms::Exception("InvalidDetId") << " Wrong EcalTrigTowerDetId in EcalElectronicsMapping::DCCid.";
237  return 0;
238  }
239 }
240 
242  // needed for unpacking code.
243 
244  EcalSubdetector sub = subdet(TCCid, TCCMODE);
245  int zIndex = zside(TCCid, TCCMODE);
246 
247  if (sub == EcalBarrel) {
248  int DCCid = 0;
249  int jtower = iTT - 1;
250  if (zIndex > 0)
251  DCCid = TCCid - TCCID_PHI0_EBP + DCCID_PHI0_EBP;
252  else
253  DCCid = TCCid - TCCID_PHI0_EBM + DCCID_PHI0_EBM;
254  int SMid = (zIndex > 0) ? DCCid - 27 : DCCid + 9;
255 
256  int etaTT = jtower / kTowersInPhi + 1; // between 1 and 17
257  int phiTT;
258 
259  if (zIndex > 0)
260  phiTT = (SMid - 1) * kTowersInPhi + (kTowersInPhi - (jtower % kTowersInPhi)) - 1;
261  else
262  phiTT = (SMid - 19) * kTowersInPhi + jtower % kTowersInPhi;
263  phiTT++;
264  phiTT = phiTT - 2;
265  if (phiTT <= 0)
266  phiTT = 72 + phiTT;
267  EcalTrigTowerDetId tdetid(zIndex, EcalBarrel, etaTT, phiTT, EcalTrigTowerDetId::SUBDETIJMODE);
268  return tdetid;
269  }
270 
271  else if (sub == EcalEndcap) {
272  bool EEminus = (zIndex < 0);
273  bool EEplus = (zIndex > 0);
274  if ((!EEminus) && (!EEplus))
275  throw cms::Exception("InvalidDetId") << "EcalElectronicsMapping: Cannot create EcalTrigTowerDetId object. ";
276  int iz = 0;
277  int tcc = TCCid;
278  if (tcc < TCCID_PHI0_EEM_OUT + kTCCinPhi)
279  iz = -1;
280  else if (tcc >= TCCID_PHI0_EEP_OUT)
281  iz = +1;
282 
283  bool inner = false;
284  if (iz < 0 && tcc >= TCCID_PHI0_EEM_IN && tcc < TCCID_PHI0_EEM_IN + kTCCinPhi)
285  inner = true;
286  if (iz > 0 && tcc >= TCCID_PHI0_EEP_IN && tcc < TCCID_PHI0_EEP_IN + kTCCinPhi)
287  inner = true;
288  bool outer = !inner;
289 
290  int ieta = (iTT - 1) / kEETowersInPhiPerTCC;
291  int iphi = (iTT - 1) % kEETowersInPhiPerTCC;
292  if (inner)
293  ieta += iEEEtaMinInner;
294  else
295  ieta += iEEEtaMinOuter;
296  if (iz < 0)
297  ieta = -ieta;
298 
299  int TCC_origin = 0;
300  if (inner && iz < 0)
301  TCC_origin = TCCID_PHI0_EEM_IN;
302  if (outer && iz < 0)
303  TCC_origin = TCCID_PHI0_EEM_OUT;
304  if (inner && iz > 0)
305  TCC_origin = TCCID_PHI0_EEP_IN;
306  if (outer && iz > 0)
307  TCC_origin = TCCID_PHI0_EEP_OUT;
308  tcc = tcc - TCC_origin;
309 
310  iphi += kEETowersInPhiPerTCC * tcc;
311  iphi = (iphi - 2 + 4 * kEETowersInPhiPerQuadrant) % (4 * kEETowersInPhiPerQuadrant) + 1;
312 
313  int tower_i = abs(ieta);
314  int tower_j = iphi;
315 
316  EcalTrigTowerDetId tdetid(zIndex, EcalEndcap, tower_i, tower_j, EcalTrigTowerDetId::SUBDETIJMODE);
317  return tdetid;
318 
319  } else {
320  throw cms::Exception("InvalidDetId") << " Wrong indices in EcalElectronicsMapping::getTrigTowerDetId. TCCid = "
321  << TCCid << " iTT = " << iTT << ".";
322  }
323 }
324 
326  EcalSubdetector subdet = EcalSubdetector(id.subdetId());
327  if (subdet == EcalBarrel) {
328  const EBDetId ebdetid = EBDetId(id);
329 
330  int dcc = DCCid(ebdetid);
331  bool EBPlus = (zside(dcc, DCCMODE) > 0);
332  bool EBMinus = !EBPlus;
333 
334  EcalTrigTowerDetId trigtower = ebdetid.tower();
335  // int tower = trigtower.iTT();
336  int tower = iTT(trigtower);
337 
338  int ieta = EBDetId(id).ietaAbs();
339  int iphi = EBDetId(id).iphi();
340  int strip(0);
341  int channel(0);
342  bool RightTower = rightTower(tower);
343  if (RightTower) {
344  strip = (ieta - 1) % 5;
345  if (strip % 2 == 0) {
346  if (EBMinus)
347  channel = (iphi - 1) % 5;
348  if (EBPlus)
349  channel = 4 - ((iphi - 1) % 5);
350  } else {
351  if (EBMinus)
352  channel = 4 - ((iphi - 1) % 5);
353  if (EBPlus)
354  channel = (iphi - 1) % 5;
355  }
356  } else {
357  strip = 4 - ((ieta - 1) % 5);
358  if (strip % 2 == 0) {
359  if (EBMinus)
360  channel = 4 - ((iphi - 1) % 5);
361  if (EBPlus)
362  channel = (iphi - 1) % 5;
363  } else {
364  if (EBMinus)
365  channel = (iphi - 1) % 5;
366  if (EBPlus)
367  channel = 4 - ((iphi - 1) % 5);
368  }
369  }
370  strip += 1;
371  channel += 1;
372 
374 
375  return elid;
376  } else if (subdet == EcalEndcap) {
377  EcalElectronicsMap_by_DetId::const_iterator it = get<0>(m_items).find(id);
378  if (it == get<0>(m_items).end()) {
379  EcalElectronicsId elid(0);
380  edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non valid id";
381  return elid;
382  }
383  EcalElectronicsId elid = it->elid;
384  return elid;
385  } else {
386  throw cms::Exception("InvalidDetId") << " Wrong DetId in EcalElectronicsMapping::getElectronicsId.";
387  }
388 }
389 
391  EcalSubdetector subdet = EcalSubdetector(id.subdetId());
392 
393  if (subdet == EcalBarrel) {
394  const EcalElectronicsId& elid = getElectronicsId(id);
395  EcalTriggerElectronicsId trelid = getTriggerElectronicsId(elid);
396  return trelid;
397  } else if (subdet == EcalEndcap) {
398  EcalElectronicsMap_by_DetId::const_iterator it = get<0>(m_items).find(id);
399  if (it == get<0>(m_items).end()) {
400  EcalTriggerElectronicsId trelid(0);
401  edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non valid trig id";
402  return trelid;
403  }
404  EcalTriggerElectronicsId trelid = it->trelid;
405  return trelid;
406  } else {
407  throw cms::Exception("InvalidDetId") << " Wrong DetId in EcalElectronicsMapping::getTriggerElectronicsId.";
408  }
409 }
410 
412  EcalSubdetector subdet = id.subdet();
413 
414  if (subdet == EcalBarrel) {
415  int dcc = id.dccId();
416  int tower = id.towerId();
417  int strip = id.stripId();
418  int channel = id.xtalId();
419 
420  int smid = 0;
421  int iphi = 0;
422  bool EBPlus = (id.zside() > 0);
423  bool EBMinus = !EBPlus;
424 
425  if (id.zside() < 0) {
426  smid = dcc + 19 - DCCID_PHI0_EBM;
427  iphi = (smid - 19) * kCrystalsInPhi;
428  iphi += 5 * ((tower - 1) % kTowersInPhi);
429  } else {
430  smid = dcc + 1 - DCCID_PHI0_EBP;
431  iphi = (smid - 1) * kCrystalsInPhi;
432  iphi += 5 * (kTowersInPhi - ((tower - 1) % kTowersInPhi) - 1);
433  }
434  bool RightTower = rightTower(tower);
435  int ieta = 5 * ((tower - 1) / kTowersInPhi) + 1;
436  if (RightTower) {
437  ieta += (strip - 1);
438  if (strip % 2 == 1) {
439  if (EBMinus)
440  iphi += (channel - 1) + 1;
441  if (EBPlus)
442  iphi += (4 - (channel - 1)) + 1;
443  } else {
444  if (EBMinus)
445  iphi += (4 - (channel - 1)) + 1;
446  if (EBPlus)
447  iphi += (channel - 1) + 1;
448  }
449  } else {
450  ieta += 4 - (strip - 1);
451  if (strip % 2 == 1) {
452  if (EBMinus)
453  iphi += (4 - (channel - 1)) + 1;
454  if (EBPlus)
455  iphi += (channel - 1) + 1;
456  } else {
457  if (EBMinus)
458  iphi += (channel - 1) + 1;
459  if (EBPlus)
460  iphi += (4 - (channel - 1)) + 1;
461  }
462  }
463  if (id.zside() < 0)
464  ieta = -ieta;
465 
467  return e;
468  }
469 
470  else if (subdet == EcalEndcap) {
471  EcalElectronicsMap_by_ElectronicsId::const_iterator it = get<1>(m_items).find(id);
472  if (it == (get<1>(m_items).end())) {
473  DetId cell(0);
474  edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non DetId";
475  return cell;
476  }
477  DetId cell = it->cell;
478  return cell;
479  } else
480  throw cms::Exception("InvalidDetId") << "Wrong EcalElectronicsId in EcalElectronicsMapping::getDetId.";
481 }
482 
484  EcalSubdetector subdet = id.subdet();
485 
486  if (subdet == EcalBarrel) {
487  int strip = id.stripId();
488  int xtal = id.xtalId();
489  int tower = id.towerId();
490  int tcc = id.dccId();
491  if (id.zside() < 0) {
492  tcc += TCCID_PHI0_EBM - DCCID_PHI0_EBM;
493  } else {
494  tcc += TCCID_PHI0_EBP - DCCID_PHI0_EBP;
495  }
496  EcalTriggerElectronicsId trelid(tcc, tower, strip, xtal);
497  return trelid;
498 
499  } else if (subdet == EcalEndcap) {
500  EcalElectronicsMap_by_ElectronicsId::const_iterator it = get<1>(m_items).find(id);
501  if (it == get<1>(m_items).end()) {
502  EcalTriggerElectronicsId trelid(0);
503  edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non valid id";
504  return trelid;
505  }
506  EcalTriggerElectronicsId trelid = it->trelid;
507  return trelid;
508  } else
509  throw cms::Exception("InvalidDetId")
510  << "Wrong EcalElectronicsId in EcalElectronicsMapping::getTriggerElectronicsId.";
511 }
512 
514  EcalSubdetector subdet = id.subdet();
515 
516  if (subdet == EcalBarrel) {
517  const EcalElectronicsId& elid = getElectronicsId(id);
518  DetId cell = getDetId(elid);
519  return cell;
520  } else if (subdet == EcalEndcap) {
521  EcalElectronicsMap_by_TriggerElectronicsId::const_iterator it = get<2>(m_items).find(id);
522  if (it == get<2>(m_items).end()) {
523  DetId cell(0);
524  edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non valid DetId";
525  return cell;
526  }
527  DetId cell = it->cell;
528  return cell;
529  } else
530  throw cms::Exception("InvalidDetId") << "Wrong EcalTriggerElectronicsId in EcalElectronicsMapping::getDetId.";
531 }
532 
534  EcalSubdetector subdet = id.subdet();
535 
536  if (subdet == EcalBarrel) {
537  int strip = id.pseudoStripId();
538  int xtal = id.channelId();
539  int tower = id.ttId();
540  int dcc = id.tccId();
541  if (id.zside() < 0) {
542  dcc -= TCCID_PHI0_EBM - DCCID_PHI0_EBM;
543  } else {
544  dcc -= TCCID_PHI0_EBP - DCCID_PHI0_EBP;
545  }
546  EcalElectronicsId elid(dcc, tower, strip, xtal);
547  return elid;
548  } else if (subdet == EcalEndcap) {
549  EcalElectronicsMap_by_TriggerElectronicsId::const_iterator it = get<2>(m_items).find(id);
550  if (it == get<2>(m_items).end()) {
551  EcalElectronicsId elid(0);
552  edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non valid id";
553  return elid;
554  }
555  EcalElectronicsId elid = it->elid;
556  return elid;
557  } else
558  throw cms::Exception("InvalidDetId")
559  << "Wrong EcalTriggerElectronicsId in EcalElectronicsMapping::getElectronicsId.";
560 }
561 
562 std::vector<DetId> EcalElectronicsMapping::dccConstituents(int dccId) const {
563  EcalSubdetector sub = subdet(dccId, DCCMODE);
564  std::vector<DetId> items;
565 
566  if (sub == EcalBarrel) {
567  for (int tower = 1; tower <= kEBTowersPerSM; tower++) {
568  std::vector<DetId> xtals = dccTowerConstituents(dccId, tower);
569  int size = xtals.size();
570  for (int i = 0; i < size; i++) {
571  DetId detid = xtals[i];
572  items.emplace_back(detid);
573  }
574  }
575  return items;
576  } else if (sub == EcalEndcap) {
577  EcalElectronicsMap_by_DccId::const_iterator lb, ub;
578  boost::tuples::tie(lb, ub) = get<3>(m_items).equal_range(dccId);
579  while (lb != ub) {
580  DetId cell = lb->cell;
581  items.emplace_back(cell);
582  ++lb;
583  }
584  return items;
585  } else
586  throw cms::Exception("InvalidDetId") << "Wrong dccId = " << dccId
587  << " in EcalElectronicsMapping::dccConstituents. ";
588 }
589 
590 std::vector<DetId> EcalElectronicsMapping::dccTowerConstituents(int dccId, int tower) const {
591  EcalSubdetector sub = subdet(dccId, DCCMODE);
592  std::vector<DetId> items;
593 
594  if (sub == EcalBarrel) {
595  int iz = zside(dccId, DCCMODE);
596  int smid = 0;
597  int iphi = 0;
598  if (iz < 0) {
599  smid = dccId + 19 - DCCID_PHI0_EBM;
600  iphi = (smid - 19) * kCrystalsInPhi;
601  iphi += 5 * ((tower - 1) % kTowersInPhi);
602  } else {
603  smid = dccId + 1 - DCCID_PHI0_EBP;
604  iphi = (smid - 1) * kCrystalsInPhi;
605  iphi += 5 * (kTowersInPhi - ((tower - 1) % kTowersInPhi) - 1);
606  }
607  int ieta = 5 * ((tower - 1) / kTowersInPhi) + 1;
608  for (int ip = 1; ip <= 5; ip++) {
609  for (int ie = 0; ie <= 4; ie++) {
610  int ieta_xtal = ieta + ie;
611  int iphi_xtal = iphi + ip;
612  if (iz < 0)
613  ieta_xtal = -ieta_xtal;
614  EBDetId ebdetid(ieta_xtal, iphi_xtal, EBDetId::ETAPHIMODE);
615  items.emplace_back(ebdetid);
616  }
617  }
618  return items;
619  }
620 
621  else if (sub == EcalEndcap) {
622  EcalElectronicsMap_by_DccId_and_TowerId::const_iterator lb, ub;
623  boost::tuples::tie(lb, ub) = get<4>(m_items).equal_range(boost::make_tuple(int(dccId), int(tower)));
624  while (lb != ub) {
625  DetId cell = lb->cell;
626  items.emplace_back(cell);
627  ++lb;
628  }
629  return items;
630  } else
631  throw cms::Exception("InvalidDetId") << "Wrong dccId = " << dccId << " tower = " << tower
632  << " in EcalElectronicsMapping::dccTowerConstituents.";
633 }
634 
635 std::vector<DetId> EcalElectronicsMapping::stripConstituents(int dccId, int tower, int strip) const {
636  EcalSubdetector sub = subdet(dccId, DCCMODE);
637  std::vector<DetId> items;
638 
639  if (sub == EcalBarrel) {
640  int iz = zside(dccId, DCCMODE);
641  bool RightTower = rightTower(tower);
642  int smid = 0;
643  int iphi = 0;
644  if (iz < 0) {
645  smid = dccId + 19 - DCCID_PHI0_EBM;
646  iphi = (smid - 19) * kCrystalsInPhi;
647  iphi += 5 * ((tower - 1) % kTowersInPhi);
648  } else {
649  smid = dccId + 1 - DCCID_PHI0_EBP;
650  iphi = (smid - 1) * kCrystalsInPhi;
651  iphi += 5 * (kTowersInPhi - ((tower - 1) % kTowersInPhi) - 1);
652  }
653  int ieta = 5 * ((tower - 1) / kTowersInPhi) + 1;
654  if (RightTower) {
655  ieta += (strip - 1);
656  } else {
657  ieta += 4 - (strip - 1);
658  }
659  for (int ip = 1; ip <= 5; ip++) {
660  int ieta_xtal = ieta;
661  int iphi_xtal = iphi + ip;
662  if (iz < 0)
663  ieta_xtal = -ieta_xtal;
664  EBDetId ebdetid(ieta_xtal, iphi_xtal, EBDetId::ETAPHIMODE);
665  items.emplace_back(ebdetid);
666  }
667 
668  return items;
669  } else {
670  EcalElectronicsMap_by_DccId_TowerId_and_StripId::const_iterator lb, ub;
671  boost::tuples::tie(lb, ub) = get<5>(m_items).equal_range(boost::make_tuple(int(dccId), int(tower), int(strip)));
672  while (lb != ub) {
673  DetId cell = lb->cell;
674  items.emplace_back(cell);
675  ++lb;
676  }
677  return items;
678  }
679 }
680 
681 std::vector<DetId> EcalElectronicsMapping::tccConstituents(int tccId) const {
682  EcalSubdetector sub = subdet(tccId, TCCMODE);
683  std::vector<DetId> items;
684 
685  if (sub == EcalBarrel) {
686  int iz = zside(tccId, TCCMODE);
687  int dccId = tccId;
688  if (iz > 0)
689  dccId = dccId - TCCID_PHI0_EBP + DCCID_PHI0_EBP;
690  else
691  dccId = dccId - TCCID_PHI0_EBM + DCCID_PHI0_EBM;
692  items = dccConstituents(dccId);
693  return items;
694  } else {
695  EcalElectronicsMap_by_TccId::const_iterator lb, ub;
696  boost::tuples::tie(lb, ub) = get<6>(m_items).equal_range(tccId);
697  while (lb != ub) {
698  DetId cell = lb->cell;
699  items.emplace_back(cell);
700  ++lb;
701  }
702  return items;
703  }
704 }
705 
706 std::vector<DetId> EcalElectronicsMapping::ttConstituents(int tccId, int tt) const {
707  EcalSubdetector sub = subdet(tccId, TCCMODE);
708  std::vector<DetId> items;
709 
710  if (sub == EcalBarrel) {
711  int iz = zside(tccId, TCCMODE);
712  int dccId = tccId;
713  if (iz > 0)
714  dccId = dccId - TCCID_PHI0_EBP + DCCID_PHI0_EBP;
715  else
716  dccId = dccId - TCCID_PHI0_EBM + DCCID_PHI0_EBM;
717  items = dccTowerConstituents(dccId, tt);
718  return items;
719  } else {
720  EcalElectronicsMap_by_TccId_and_TtId::const_iterator lb, ub;
721  boost::tuples::tie(lb, ub) = get<7>(m_items).equal_range(boost::make_tuple(int(tccId), int(tt)));
722  while (lb != ub) {
723  DetId cell = lb->cell;
724  items.emplace_back(cell);
725  ++lb;
726  }
727  return items;
728  }
729 }
730 
731 std::vector<DetId> EcalElectronicsMapping::pseudoStripConstituents(int tccId, int tt, int pseudostrip) const {
732  EcalSubdetector sub = subdet(tccId, TCCMODE);
733  std::vector<DetId> items;
734 
735  if (sub == EcalBarrel) {
736  int iz = zside(tccId, TCCMODE);
737  int dccId = tccId;
738  if (iz > 0)
739  dccId = dccId - TCCID_PHI0_EBP + DCCID_PHI0_EBP;
740  else
741  dccId = dccId - TCCID_PHI0_EBM + DCCID_PHI0_EBM;
742  items = stripConstituents(dccId, tt, pseudostrip);
743  return items;
744  } else {
745  EcalElectronicsMap_by_TccId_TtId_and_PseudostripId::const_iterator lb, ub;
746  boost::tuples::tie(lb, ub) = get<8>(m_items).equal_range(boost::make_tuple(int(tccId), int(tt), int(pseudostrip)));
747  while (lb != ub) {
748  DetId cell = lb->cell;
749  items.emplace_back(cell);
750  ++lb;
751  }
752  return items;
753  }
754 }
755 
757  const EcalElectronicsId& elid,
759  m_items.insert(MapItem(cell, elid, tower));
760 }
761 
762 std::pair<int, int> EcalElectronicsMapping::getDCCandSC(EcalScDetId id) const {
763  // pair.first = DCC id
764  // pair.second = DCC_channel
765  // For digi2raw, read the SRflags and write the SR block :
766  // need to find out, for an EcalScDetId, which is the DCC and the DCC_channel
767 
768  std::pair<int, int> ind;
769  EEDetId dum;
770  int ix = id.ix();
771  int iy = id.iy();
772  int zside = id.zside();
773  ix = (ix - 1) * 5 + 1;
774  iy = (iy - 1) * 5 + 1;
775  ix = 5 * (ix / 5) + 1;
776  iy = 5 * (iy / 5) + 1;
777  int ix_c = ix;
778  int iy_c = iy;
779  if (!dum.validDetId(ix_c, iy_c, zside)) {
780  ix_c = ix + 4;
781  iy_c = iy;
782  if (!dum.validDetId(ix_c, iy_c, zside)) {
783  ix_c = ix + 4;
784  iy_c = iy + 4;
785  if (!dum.validDetId(ix_c, iy_c, zside)) {
786  ix_c = ix;
787  iy_c = iy + 4;
788  }
789  }
790  }
791  EEDetId eedetid(ix_c, iy_c, zside, EEDetId::XYMODE);
792  EcalElectronicsId elid = getElectronicsId(eedetid);
793  int Dccid = elid.dccId();
794  int DCC_Channel = elid.towerId();
795  ind.first = Dccid;
796  ind.second = DCC_Channel;
797  return ind;
798 }
799 
800 std::vector<EcalScDetId> EcalElectronicsMapping::getEcalScDetId(int DCCid,
801  int DCC_Channel,
802  bool ignoreSingleCrystal) const {
803  //Debug output switch:
804  const bool debug = false;
805 
806  // For unpacking of ST flags.
807  //result: SCs readout by the DCC channel DCC_channel of DCC DCCid.
808  //Vector of 1 or 2 elements: most of the time there is only
809  //one SC read-out by the DCC channel, but for some channels
810  //there are 2 partial SCs which were grouped.
811  std::vector<EcalScDetId> scDetIds;
812 
813  //There are 4 SCs in each endcap whose one crystal is read out
814  //by a different DCC channel than the others.
815  //Number of crystals of the SC read out by the DCC channel:
816  std::vector<int> nReadoutXtals;
817 
818  std::vector<DetId> xtals = dccTowerConstituents(DCCid, DCC_Channel);
819 
820  if (debug) {
821  std::ostringstream st1;
822  st1 << __FILE__ << ":" << __LINE__ << ": " << xtals.size() << " crystals read out by channel " << DCC_Channel
823  << " of DCC " << DCCid << ": ";
824  for (auto xtal : xtals) {
825  st1 << EEDetId(xtal) << " ";
826  }
827  edm::LogVerbatim("EcalMapping") << st1.str() << "\n";
828  }
829 
830  if (xtals.empty())
831  throw cms::Exception("InvalidDetId") << "EcalElectronicsMapping : can not create EcalScDetId for DCC " << DCCid
832  << " and DCC_Channel " << DCC_Channel << ".";
833 
834  for (auto xtal : xtals) {
835  EEDetId eedetid = xtal;
836  int ix = eedetid.ix();
837  int iy = eedetid.iy();
838  int iz = eedetid.zside();
839  int ix_SC = (ix - 1) / 5 + 1;
840  int iy_SC = (iy - 1) / 5 + 1;
841  //Supercrystal (SC) the crystal belongs to:
842  EcalScDetId scdetid(ix_SC, iy_SC, iz);
843  size_t iSc = 0;
844  //look if the SC was already included:
845  while (iSc < scDetIds.size() && scDetIds[iSc] != scdetid)
846  ++iSc;
847  if (iSc == scDetIds.size()) { //SC not yet included
848  scDetIds.emplace_back(scdetid);
849  nReadoutXtals.emplace_back(1); //crystal counter of the added SC
850  } else { //SC already included
851  ++nReadoutXtals[iSc]; // counting crystals in the SC
852  }
853  }
854 
855  if (ignoreSingleCrystal) {
856  //For simplification, SC read out by two different DCC channels
857  //will be associated to the DCC channel reading most of the crystals,
858  //the other DCC channel which read only one crystal is discarded.
859  //Discards SC with only one crystal read out by the considered,
860  //DCC channel:
861  assert(scDetIds.size() == nReadoutXtals.size());
862  for (size_t iSc = 0; iSc < scDetIds.size(); /*NOOP*/) {
863  if (nReadoutXtals[iSc] <= 1) {
864  if (debug)
865  edm::LogVerbatim("EcalMapping") << "EcalElectronicsMapping::getEcalScDetId: Ignore SC " << scDetIds[iSc]
866  << " whose only one channel is read out by "
867  "the DCC channel (DCC "
868  << DCCid << ", ch " << DCC_Channel << ").\n";
869  scDetIds.erase(scDetIds.begin() + iSc);
870  nReadoutXtals.erase(nReadoutXtals.begin() + iSc);
871  } else {
872  ++iSc; //next SC;
873  }
874  }
875  }
876 
877  return scDetIds;
878 }
879 
881  if (mode == DCCMODE) {
882  if ((dcctcc >= MIN_DCCID_EBM && dcctcc <= MAX_DCCID_EBM) || (dcctcc >= MIN_DCCID_EBP && dcctcc <= MAX_DCCID_EBP))
883  return EcalBarrel;
884  else
885  return EcalEndcap;
886  } else if (mode == TCCMODE) {
887  if ((dcctcc >= MIN_TCCID_EBM && dcctcc <= MAX_TCCID_EBM) || (dcctcc >= MIN_TCCID_EBP && dcctcc <= MAX_TCCID_EBP))
888  return EcalBarrel;
889  else
890  return EcalEndcap;
891  } else
892  throw cms::Exception("InvalidDetId") << " Wrong mode in EcalElectronicsMapping::subdet " << mode << ".";
893 }
894 
895 int EcalElectronicsMapping::zside(int dcctcc, int mode) const {
896  if (mode == DCCMODE) {
897  if (dcctcc >= MIN_DCCID_EBM && dcctcc <= MAX_DCCID_EBM)
898  return -1;
899  if (dcctcc >= MIN_DCCID_EBP && dcctcc <= MAX_DCCID_EBP)
900  return +1;
901  if (dcctcc >= MIN_DCCID_EEM && dcctcc <= MAX_DCCID_EEM)
902  return -1;
903  if (dcctcc >= MIN_DCCID_EEP && dcctcc <= MAX_DCCID_EEP)
904  return +1;
905  } else if (mode == TCCMODE) {
906  if (dcctcc >= MIN_TCCID_EBM && dcctcc <= MAX_TCCID_EBM)
907  return -1;
908  if (dcctcc >= MIN_TCCID_EBP && dcctcc <= MAX_TCCID_EBP)
909  return +1;
910  if (dcctcc >= MIN_TCCID_EEM && dcctcc <= MAX_TCCID_EEM)
911  return -1;
912  if (dcctcc >= MIN_TCCID_EEP && dcctcc <= MAX_TCCID_EEP)
913  return +1;
914  } else {
915  throw cms::Exception("InvalidDetId") << " Wrong mode in EcalElectronicsMapping::zside " << mode << ".";
916  }
917  return 0;
918 }
919 
921  // for EB, two types of tower (LVRB top/bottom)
922 
923  if ((tower > 12 && tower < 21) || (tower > 28 && tower < 37) || (tower > 44 && tower < 53) ||
924  (tower > 60 && tower < 69))
925  return true;
926  else
927  return false;
928 }
929 
931  if (FED >= MIN_DCCID_EEM && FED <= MAX_DCCID_EEM)
932  return MIN_DCCID_EEM;
933  if (FED >= MIN_DCCID_EBM && FED <= MAX_DCCID_EBM)
934  return MIN_DCCID_EBM;
935  if (FED >= MIN_DCCID_EBP && FED <= MAX_DCCID_EBP)
936  return MIN_DCCID_EBP;
937  if (FED >= MIN_DCCID_EEP && FED <= MAX_DCCID_EEP)
938  return MIN_DCCID_EEP;
939  return -1;
940 }
941 
943  std::vector<int> FEDs;
944  GetListofFEDs(region, FEDs);
945  return FEDs;
946 }
948  // for regional unpacking.
949  // get list of FEDs corresponding to a region in (eta,phi)
950 
951  // std::vector<int> FEDs;
952  double radTodeg = 180. / M_PI;
953  ;
954 
955  bool debug = false;
956 
957  double etalow = region.etaLow();
958  double philow = region.phiLow() * radTodeg;
959  if (debug)
960  edm::LogVerbatim("EcalMapping") << " etalow philow " << etalow << " " << philow;
961  int FED_LB = GetFED(etalow, philow); // left, bottom
962 
963  double phihigh = region.phiHigh() * radTodeg;
964  if (debug)
965  edm::LogVerbatim("EcalMapping") << " etalow phihigh " << etalow << " " << phihigh;
966  int FED_LT = GetFED(etalow, phihigh); // left, top
967 
968  int DCC_BoundaryL = DCCBoundary(FED_LB);
969  int deltaL = 18;
970  if (FED_LB < MIN_DCCID_EBM || FED_LB > MAX_DCCID_EBP)
971  deltaL = 9;
972 
973  if (philow < -170 && phihigh > 170) {
974  FED_LB = DCC_BoundaryL;
975  FED_LT = DCC_BoundaryL + deltaL - 1;
976  }
977  if (debug)
978  edm::LogVerbatim("EcalMapping") << " FED_LB FED_LT " << FED_LB << " " << FED_LT;
979 
980  bool dummy = true;
981  int idx = 0;
982  while (dummy) {
983  int iL = (FED_LB - DCC_BoundaryL + idx) % deltaL + DCC_BoundaryL;
984  FEDs.emplace_back(iL);
985  if (debug)
986  edm::LogVerbatim("EcalMapping") << " add fed " << iL;
987  if (iL == FED_LT)
988  break;
989  idx++;
990  }
991 
992  double etahigh = region.etaHigh();
993  int FED_RB = GetFED(etahigh, philow); // right, bottom
994  if (FED_RB == FED_LB)
995  return; // FEDs;
996 
997  int FED_RT = GetFED(etahigh, phihigh); // right, top
998 
999  if (debug)
1000  edm::LogVerbatim("EcalMapping") << "etahigh philow phihigh " << etahigh << " " << philow << " " << phihigh;
1001  int DCC_BoundaryR = DCCBoundary(FED_RB);
1002  int deltaR = 18;
1003  if (FED_RB < MIN_DCCID_EBM || FED_RB > MAX_DCCID_EBP)
1004  deltaR = 9;
1005 
1006  if (philow < -170 && phihigh > 170) {
1007  FED_RB = DCC_BoundaryR;
1008  FED_RT = DCC_BoundaryR + deltaR - 1;
1009  }
1010  if (debug)
1011  edm::LogVerbatim("EcalMapping") << " FED_RB FED_RT " << FED_RB << " " << FED_RT;
1012  idx = 0;
1013  while (dummy) {
1014  int iR = (FED_RB - DCC_BoundaryR + idx) % deltaR + DCC_BoundaryR;
1015  FEDs.emplace_back(iR);
1016  if (debug)
1017  edm::LogVerbatim("EcalMapping") << " add fed " << iR;
1018  if (iR == FED_RT)
1019  break;
1020  idx++;
1021  }
1022 
1023  if (FED_LB >= MIN_DCCID_EBM && FED_LB <= MAX_DCCID_EBM && FED_RB >= MIN_DCCID_EEP && FED_RB <= MAX_DCCID_EEP) {
1024  int minR = FED_LB + 18;
1025  int maxR = FED_LT + 18;
1026  int idx = 0;
1027  while (dummy) {
1028  int iR = (minR - MIN_DCCID_EBP + idx) % 18 + MIN_DCCID_EBP;
1029  FEDs.emplace_back(iR);
1030  if (debug)
1031  edm::LogVerbatim("EcalMapping") << " add fed " << iR;
1032  if (iR == maxR)
1033  break;
1034  idx++;
1035  }
1036  return; // FEDs;
1037  }
1038 
1039  if (FED_LB >= MIN_DCCID_EEM && FED_LB <= MAX_DCCID_EEM && FED_RB >= MIN_DCCID_EBP && FED_RB <= MAX_DCCID_EBP) {
1040  int minL = FED_RB - 18;
1041  int maxL = FED_RT - 18;
1042  int idx = 0;
1043  while (dummy) {
1044  int iL = (minL - MIN_DCCID_EBM + idx) % 18 + MIN_DCCID_EBM;
1045  FEDs.emplace_back(iL);
1046  if (debug)
1047  edm::LogVerbatim("EcalMapping") << " add fed " << iL;
1048  if (iL == maxL)
1049  break;
1050  idx++;
1051  }
1052  return; // FEDs;
1053  }
1054 
1055  if (FED_LB >= MIN_DCCID_EEM && FED_LB <= MAX_DCCID_EEM && FED_RB >= MIN_DCCID_EEP && FED_RB <= MAX_DCCID_EEP) {
1056  int minL = (FED_LB - 1) * 2 + MIN_DCCID_EBM;
1057  if (minL == MIN_DCCID_EBM)
1058  minL = MAX_DCCID_EBM;
1059  else
1060  minL = minL - 1;
1061  int maxL = (FED_LT - 1) * 2 + MIN_DCCID_EBM;
1062  int idx = 0;
1063  while (dummy) {
1064  int iL = (minL - MIN_DCCID_EBM + idx) % 18 + MIN_DCCID_EBM;
1065  FEDs.emplace_back(iL);
1066  if (debug)
1067  edm::LogVerbatim("EcalMapping") << " add fed " << iL;
1068  if (iL == maxL)
1069  break;
1070  idx++;
1071  }
1072  int minR = minL + 18;
1073  int maxR = maxL + 18;
1074  idx = 0;
1075  while (dummy) {
1076  int iR = (minR - MIN_DCCID_EBP + idx) % 18 + MIN_DCCID_EBP;
1077  FEDs.emplace_back(iR);
1078  if (debug)
1079  edm::LogVerbatim("EcalMapping") << " add fed " << iR;
1080  if (iR == maxR)
1081  break;
1082  idx++;
1083  }
1084  }
1085 
1086  return; // FEDs;
1087 }
1088 
1089 int EcalElectronicsMapping::GetFED(double eta, double phi) const {
1090  // for regional unpacking.
1091  // eta is signed, phi is in degrees.
1092 
1093  int DCC_Phi0 = 0;
1094  bool IsBarrel = true;
1095  if (fabs(eta) > 1.479)
1096  IsBarrel = false;
1097  bool Positive = (eta > 0);
1098 
1099  if (IsBarrel && Positive)
1100  DCC_Phi0 = DCCID_PHI0_EBP;
1101  if (IsBarrel && (!Positive))
1102  DCC_Phi0 = DCCID_PHI0_EBM;
1103  if ((!IsBarrel) && Positive)
1104  DCC_Phi0 = MIN_DCCID_EEP;
1105  if ((!IsBarrel) && (!Positive))
1106  DCC_Phi0 = MIN_DCCID_EEM;
1107 
1108  // phi between 0 and 360 deg :
1109  if (phi < 0)
1110  phi += 360;
1111  if (phi > 360.)
1112  phi = 360.;
1113  if (phi < 0)
1114  phi = 0.;
1115 
1116  if (IsBarrel)
1117  phi = phi - 350;
1118  else
1119  phi = phi - 330;
1120  if (phi < 0)
1121  phi += 360;
1122  int iphi = -1;
1123  if (IsBarrel)
1124  iphi = (int)(phi / 20.);
1125  else
1126  iphi = (int)(phi / 40.);
1127 
1128  // edm::LogVerbatim("EcalMapping") << " in GetFED : phi iphi DCC0 " << phi << " " << iphi << " " << DCC_Phi0;
1129 
1130  int DCC = iphi + DCC_Phi0;
1131  // edm::LogVerbatim("EcalMapping") << " eta phi " << eta << " " << " " << phi << " is in FED " << DCC;
1132  return DCC;
1133 }
1134 
1136  // Laser Monitoring readout number.
1137 
1138  EcalSubdetector subdet = EcalSubdetector(id.subdetId());
1139 
1140  if (subdet == EcalBarrel) {
1141  const EBDetId ebdetid = EBDetId(id);
1142  int dccid = DCCid(ebdetid);
1143  std::map<int, int>::const_iterator it = LaserMonitoringMap_EB.find(dccid);
1144  if (it != LaserMonitoringMap_EB.end()) {
1145  int ilm = it->second;
1146  int iETA = ebdetid.ietaSM();
1147  int iPHI = ebdetid.iphiSM();
1148  if (iPHI > 10 && iETA > 5) {
1149  ilm++;
1150  };
1151  return ilm;
1152  } else
1153  throw cms::Exception("InvalidDCCId") << "Wrong DCCId (EB) in EcalElectronicsMapping::getLMNumber.";
1154  }
1155 
1156  else if (subdet == EcalEndcap) {
1158  int dccid = elid.dccId();
1159  EEDetId eedetid = EEDetId(id);
1160  std::map<int, int>::const_iterator it = LaserMonitoringMap_EE.find(dccid);
1161  if (it != LaserMonitoringMap_EB.end()) {
1162  int ilm = it->second;
1163  if (dccid == 8) {
1164  int ix = eedetid.ix();
1165  if (ix > 50)
1166  ilm += 1;
1167  }
1168  if (dccid == 53) {
1169  int ix = eedetid.ix();
1170  if (ix > 50)
1171  ilm += 1;
1172  }
1173  return ilm;
1174  } else
1175  throw cms::Exception("InvalidDCCId") << "Wrong DCCId (EE) in EcalElectronicsMapping::getLMNumber.";
1176  }
1177 
1178  return -1;
1179 }
Log< level::Info, true > LogVerbatim
std::pair< int, int > getDCCandSC(EcalScDetId id) const
std::vector< DetId > pseudoStripConstituents(int tccId, int tt, int pseudostrip) const
Get the constituent detids for this dccId.
int ietaAbs() const
get the absolute value of the crystal ieta
Definition: EBDetId.h:47
int GetFED(double eta, double phi) const
std::vector< int > GetListofFEDs(const RectangularEtaPhiRegion &region) const
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
int iphi() const
get the crystal iphi
Definition: EBDetId.h:51
EcalSubdetector subdet() const
get the subdet
int DCCid(const EBDetId &id) const
returns the DCC of an EBDetId
static const int SUBDETIJMODE
static const int XYMODE
Definition: EEDetId.h:333
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
int ix() const
Definition: EEDetId.h:77
int TCCid(const EBDetId &id) const
returns the TCCid of an EBDetId
int zside(DetId const &)
EcalTriggerElectronicsId getTriggerElectronicsId(const DetId &id) const
Get the trigger electronics id for this det id.
Log< level::Error, false > LogError
int zside(int dcctcc, int mode) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
assert(be >=bs)
EcalSubdetector subdet(int dccid, int mode) const
std::vector< DetId > dccConstituents(int dccId) const
Get the constituent detids for this dccId.
std::vector< DetId > tccConstituents(int tccId) const
Get the constituent detids for this dccId.
void assign(const DetId &cell, const EcalElectronicsId &, const EcalTriggerElectronicsId &tower)
set the association between a DetId and a tower
Definition: TTTypes.h:54
int towerId() const
get the tower id
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
unsigned dccId(DetId const &, EcalElectronicsMapping const *)
EcalTrigTowerDetId getTrigTowerDetId(int TCCid, int iTT) const
Builds a EcalTrigTowerDetID from the TCCid & TriggerTower index in TCC.
static const int ETAPHIMODE
Definition: EBDetId.h:158
EcalSubdetector subdet() const
get the subdet
#define M_PI
std::vector< DetId > dccTowerConstituents(int dccId, int tower) const
Get the constituent detids for this dccId.
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
Definition: DetId.h:17
#define debug
Definition: HDRShower.cc:19
int zside() const
Definition: EEDetId.h:71
uint32_t getElectronicsId(bool zside, uint16_t fedid, uint16_t captureblock, uint16_t econdidx, int cellchip, int cellhalf, int cellseq)
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
int getLMNumber(const DetId &id) const
unsigned tccId(DetId const &, EcalElectronicsMapping const *)
int iTT(const EcalTrigTowerDetId &id) const
returns the index of a Trigger Tower within its TCC.
std::vector< EcalScDetId > getEcalScDetId(int DCCid, int DCC_Channel, bool ignoreSingleCrystal=true) const
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
bool rightTower(int tower) const
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
EcalTrigTowerDetId tower() const
get the HCAL/trigger iphi of this crystal
Definition: EBDetId.h:57
int iphiSM() const
get the crystal iphi (1-20)
Definition: EBDetId.h:73
Wrap a generic EcalTrigTowerDetId to the equivalent one in z+ Quadrant 1 (from 0 < phi < pi/2) ...
EcalSubdetector
int ietaSM() const
get the crystal ieta in the SM convention (1-85)
Definition: EBDetId.h:71
Ecal trigger electronics identification [32:20] Unused (so far) [19:13] TCC id [12:6] TT id [5:3] pse...
std::vector< DetId > stripConstituents(int dccId, int tower, int strip) const
Get the constituent detids for this dccId.
std::vector< DetId > ttConstituents(int tccId, int tt) const
Get the constituent detids for this dccId.
DetId getDetId(const EcalElectronicsId &id) const
Get the detid given an electronicsId.
int iy() const
Definition: EEDetId.h:83