CMS 3D CMS Logo

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