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