CMS 3D CMS Logo

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