16 using boost::multi_index_container;
45 for (
int dcc=MIN_DCCID_EBM; dcc <= MAX_DCCID_EBM; dcc++) {
46 LaserMonitoringMap_EB[dcc] = ilm;
50 for (
int dcc=MIN_DCCID_EBP; dcc <= MAX_DCCID_EBP; dcc++) {
51 LaserMonitoringMap_EB[dcc] = ilm;
59 for (
int dcc=MIN_DCCID_EEM; dcc <= MAX_DCCID_EEM; dcc++) {
60 LaserMonitoringMap_EE[dcc] = ilm;
62 if (dcc == 8) ilm += 1;
65 for (
int dcc=MIN_DCCID_EEP; dcc <= MAX_DCCID_EEP; dcc++) {
66 LaserMonitoringMap_EE[dcc] = ilm;
68 if (dcc == 53) ilm += 1;
83 dcc += DCCID_PHI0_EBM - 19;
86 dcc += DCCID_PHI0_EBP -1;
100 if (
id.
zside() < 0) {
101 tcc += TCCID_PHI0_EBM - 19;
104 tcc += TCCID_PHI0_EBP -1;
120 int ie =
id.ietaAbs() -1;
124 if (phi > 72) phi = phi-72;
125 if (
id.
zside() < 0) {
126 ip = (( phi -1 ) % kEBTowersInPhi ) + 1;
128 ip = kEBTowersInPhi - ((phi -1 ) % kEBTowersInPhi );
131 return (ie * kEBTowersInPhi) + ip;
134 int ie =
id.ietaAbs();
135 bool inner = (ie >= iEEEtaMinInner);
137 ie = ie - iEEEtaMinInner;
138 ie = ie % kEETowersInEtaPerInnerTCC;
141 ie = ie - iEEEtaMinOuter;
142 ie = ie % kEETowersInEtaPerOuterTCC;
146 ip = (ip + 1) % (kEETowersInPhiPerQuadrant*4);
149 ip = ip % kEETowersInPhiPerTCC;
150 int itt = kEETowersInPhiPerTCC * ie + ip + 1;
154 throw cms::Exception(
"InvalidDetId") <<
" Wrong EcalTrigTowerDetId in EcalElectronicsMapping::iTT. " ;
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;
169 if (
id.
zside() < 0) {
170 tcc += TCCID_PHI0_EBM - 19;
173 tcc += TCCID_PHI0_EBP -1;
180 int ie =
id.ietaAbs();
181 bool inner = (ie >= iEEEtaMinInner);
183 ip = (ip + 1) % (kEETowersInPhiPerQuadrant*4);
186 int Phiindex = ip / 4;
188 if (
id.ieta()> 0) Phiindex += TCCID_PHI0_EEP_IN;
189 else Phiindex += TCCID_PHI0_EEM_IN;
192 if (
id.ieta() > 0) Phiindex += TCCID_PHI0_EEP_OUT;
193 else Phiindex += TCCID_PHI0_EEM_OUT;
198 throw cms::Exception(
"InvalidDetId") <<
" Wrong EcalTrigTowerDetId in EcalElectronicsMapping::TCCid.";
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;
216 if (
id.
zside() < 0) {
217 dcc += DCCID_PHI0_EBM - 19;
220 dcc += DCCID_PHI0_EBP -1;
226 int tccid = TCCid(
id);
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;
246 throw cms::Exception(
"InvalidDetId") <<
" Wrong EcalTrigTowerDetId in EcalElectronicsMapping::DCCid.";
257 int zIndex =
zside(TCCid, TCCMODE);
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;
267 int etaTT = jtower / kTowersInPhi +1;
271 phiTT=(SMid - 1) * kTowersInPhi + (kTowersInPhi -(jtower % kTowersInPhi)) -1;
273 phiTT=(SMid - 19)* kTowersInPhi + jtower % kTowersInPhi;
276 if (phiTT <= 0) phiTT = 72+phiTT;
283 bool EEminus = (zIndex <0);
284 bool EEplus = (zIndex >0);
285 if ( (!EEminus) && (!EEplus) )
287 "EcalElectronicsMapping: Cannot create EcalTrigTowerDetId object. " ;
290 if (tcc < TCCID_PHI0_EEM_OUT+kTCCinPhi) iz = -1;
291 else if (tcc >= TCCID_PHI0_EEP_OUT) iz = +1;
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;
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;
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;
311 iphi += kEETowersInPhiPerTCC * tcc;
312 iphi = (iphi -2 + 4*kEETowersInPhiPerQuadrant) % (4*kEETowersInPhiPerQuadrant) + 1;
314 int tower_i =
abs(ieta);
323 " Wrong indices in EcalElectronicsMapping::getTrigTowerDetId. TCCid = " << TCCid <<
" iTT = " << iTT <<
".";
339 int dcc = DCCid(ebdetid);
340 bool EBPlus = (
zside(dcc,DCCMODE) > 0);
341 bool EBMinus = !EBPlus;
345 int tower = iTT(trigtower);
351 bool RightTower = rightTower(tower);
355 if (EBMinus) channel = (iphi-1) %5;
356 if (EBPlus) channel = 4 -( (iphi-1) %5 );
359 if (EBMinus) channel = 4 -( (iphi-1) %5 );
360 if (EBPlus) channel = (iphi-1) %5;
364 strip = 4 - ( (ieta-1)%5 );
366 if (EBMinus) channel = 4 -( (iphi-1) %5 );
367 if (EBPlus) channel = (iphi-1) %5;
370 if (EBMinus) channel = (iphi-1) %5;
371 if (EBPlus) channel = 4 -( (iphi-1) %5 );
382 EcalElectronicsMap_by_DetId::const_iterator it=get<0>(m_items).
find(
id);
383 if(it==get<0>(m_items).
end())
385 edm::LogError(
"EcalElectronicsMapping") <<
"Ecal mapping was asked non valid id";
392 " Wrong DetId in EcalElectronicsMapping::getElectronicsId.";
408 EcalElectronicsMap_by_DetId::const_iterator it=get<0>(m_items).
find(
id);
409 if(it==get<0>(m_items).
end())
411 edm::LogError(
"EcalElectronicsMapping") <<
"Ecal mapping was asked non valid trig id";
418 " Wrong DetId in EcalElectronicsMapping::getTriggerElectronicsId.";
427 int dcc =
id.dccId();
428 int tower =
id.towerId();
429 int strip =
id.stripId();
430 int channel =
id.xtalId();
434 bool EBPlus = (
id.zside() > 0);
435 bool EBMinus = !EBPlus;
437 if (
id.
zside() < 0) {
438 smid = dcc + 19 - DCCID_PHI0_EBM;
439 iphi = (smid - 19) * kCrystalsInPhi;
440 iphi += 5 * ( (tower-1) % kTowersInPhi );
443 smid = dcc +1 - DCCID_PHI0_EBP;
444 iphi = (smid - 1) * kCrystalsInPhi;
446 kTowersInPhi - ( (tower-1) % kTowersInPhi ) -1
449 bool RightTower = rightTower(tower);
450 int ieta = 5 * ((tower-1) / kTowersInPhi) + 1;
454 if (EBMinus) iphi += (channel-1) +1;
455 if (EBPlus) iphi += (4 - (channel-1)) +1;
458 if (EBMinus) iphi += (4 - (channel-1)) +1;
459 if (EBPlus) iphi += (channel-1) +1;
463 ieta += 4 - (strip-1);
465 if (EBMinus) iphi += (4 - (channel-1)) +1;
466 if (EBPlus) iphi += (channel-1) +1;
469 if (EBMinus) iphi += (channel-1) +1;
470 if (EBPlus) iphi += (4 - (channel-1)) +1;
473 if (
id.
zside() < 0) ieta = -ieta;
480 EcalElectronicsMap_by_ElectronicsId::const_iterator it=get<1>(m_items).
find(
id);
481 if(it==(get<1>(m_items).
end()))
483 edm::LogError(
"EcalElectronicsMapping") <<
"Ecal mapping was asked non DetId";
485 DetId cell = it -> cell;
488 else throw cms::Exception(
"InvalidDetId") <<
"Wrong EcalElectronicsId in EcalElectronicsMapping::getDetId." ;
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;
505 tcc += TCCID_PHI0_EBP - DCCID_PHI0_EBP;
512 EcalElectronicsMap_by_ElectronicsId::const_iterator it=get<1>(m_items).
find(
id);
513 if(it==get<1>(m_items).
end())
515 edm::LogError(
"EcalElectronicsMapping") <<
"Ecal mapping was asked non valid id";
520 else throw cms::Exception(
"InvalidDetId") <<
"Wrong EcalElectronicsId in EcalElectronicsMapping::getTriggerElectronicsId.";
530 DetId cell = getDetId(elid);
534 EcalElectronicsMap_by_TriggerElectronicsId::const_iterator it=get<2>(m_items).
find(
id);
535 if(it==get<2>(m_items).
end())
537 edm::LogError(
"EcalElectronicsMapping") <<
"Ecal mapping was asked non valid DetId";
539 DetId cell = it -> cell;
542 else throw cms::Exception(
"InvalidDetId") <<
"Wrong EcalTriggerElectronicsId in EcalElectronicsMapping::getDetId." ;
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;
560 dcc -= TCCID_PHI0_EBP - DCCID_PHI0_EBP;
566 EcalElectronicsMap_by_TriggerElectronicsId::const_iterator it=get<2>(m_items).
find(
id);
567 if(it==get<2>(m_items).
end())
569 edm::LogError(
"EcalElectronicsMapping") <<
"Ecal mapping was asked non valid id";
574 else throw cms::Exception(
"InvalidDetId") <<
"Wrong EcalTriggerElectronicsId in EcalElectronicsMapping::getElectronicsId.";
583 std::vector<DetId>
items;
586 for (
int tower=1; tower <= kEBTowersPerSM; tower++) {
587 std::vector<DetId> xtals = dccTowerConstituents(dccId,tower);
588 int size = xtals.size();
591 items.emplace_back(detid);
597 EcalElectronicsMap_by_DccId::const_iterator lb,ub;
598 boost::tuples::tie(lb,ub)=get<3>(m_items).equal_range(dccId);
600 DetId cell = lb -> cell;
601 items.emplace_back(cell);
606 else throw cms::Exception(
"InvalidDetId") <<
"Wrong dccId = " << dccId <<
" in EcalElectronicsMapping::dccConstituents. ";
614 std::vector<DetId>
items;
617 int iz =
zside(dccId, DCCMODE);
621 smid = dccId + 19 - DCCID_PHI0_EBM;
622 iphi = (smid - 19) * kCrystalsInPhi;
623 iphi += 5 * ( (tower-1) % kTowersInPhi );
626 smid = dccId +1 - DCCID_PHI0_EBP;
627 iphi = (smid - 1) * kCrystalsInPhi;
629 kTowersInPhi - ( (tower-1) % kTowersInPhi ) -1
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;
639 items.emplace_back(ebdetid);
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)));
649 DetId cell = lb -> cell;
650 items.emplace_back(cell);
656 "Wrong dccId = " << dccId <<
" tower = " << tower <<
" in EcalElectronicsMapping::dccTowerConstituents.";
664 std::vector<DetId>
items;
668 int iz =
zside(dccId, DCCMODE);
669 bool RightTower = rightTower(tower);
673 smid = dccId + 19 - DCCID_PHI0_EBM;
674 iphi = (smid - 19) * kCrystalsInPhi;
675 iphi += 5 * ( (tower-1) % kTowersInPhi );
678 smid = dccId +1 - DCCID_PHI0_EBP;
679 iphi = (smid - 1) * kCrystalsInPhi;
681 kTowersInPhi - ( (tower-1) % kTowersInPhi ) -1
684 int ieta = 5 * ((tower-1) / kTowersInPhi) + 1;
689 ieta += 4 - (strip-1);
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;
696 items.emplace_back(ebdetid);
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)));
705 DetId cell = lb -> cell;
706 items.emplace_back(cell);
718 std::vector<DetId>
items;
721 int iz =
zside(tccId,TCCMODE);
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);
729 EcalElectronicsMap_by_TccId::const_iterator lb,ub;
730 boost::tuples::tie(lb,ub)=get<6>(m_items).equal_range(tccId);
732 DetId cell = lb -> cell;
733 items.emplace_back(cell);
745 std::vector<DetId>
items;
748 int iz =
zside(tccId,TCCMODE);
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);
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)));
759 DetId cell = lb -> cell;
760 items.emplace_back(cell);
771 std::vector<DetId>
items;
774 int iz =
zside(tccId,TCCMODE);
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);
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)));
785 DetId cell = lb -> cell;
786 items.emplace_back(cell);
795 m_items.insert(
MapItem(cell, elid, tower));
806 std::pair<int,int> ind;
810 int zside =
id.zside();
831 int Dccid = elid.
dccId();
832 int DCC_Channel = elid.
towerId();
834 ind.second = DCC_Channel;
842 const bool debug =
false;
849 std::vector<EcalScDetId> scDetIds;
854 std::vector<int> nReadoutXtals;
856 std::vector<DetId> xtals = dccTowerConstituents(DCCid, DCC_Channel);
859 std::cout << __FILE__ <<
":" << __LINE__ <<
": " << xtals.size()
860 <<
" crystals read out by channel " << DCC_Channel <<
" of DCC " 862 for(
auto xtal : xtals){
869 "EcalElectronicsMapping : can not create EcalScDetId for DCC " << DCCid <<
870 " and DCC_Channel " << DCC_Channel <<
".";
872 for(
auto xtal : xtals){
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;
883 while(iSc < scDetIds.size() && scDetIds[iSc] != scdetid) ++iSc;
884 if(iSc==scDetIds.size()){
885 scDetIds.emplace_back(scdetid);
886 nReadoutXtals.emplace_back(1);
888 ++nReadoutXtals[iSc];
892 if(ignoreSingleCrystal){
898 assert(scDetIds.size()==nReadoutXtals.size());
899 for(
size_t iSc = 0; iSc < scDetIds.size(); ){
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);
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;
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;
928 else throw cms::Exception(
"InvalidDetId") <<
" Wrong mode in EcalElectronicsMapping::subdet " << mode <<
".";
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;
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;
946 throw cms::Exception(
"InvalidDetId") <<
" Wrong mode in EcalElectronicsMapping::zside " << mode <<
".";
956 if ((tower>12 && tower<21) || (tower>28 && tower<37) ||
957 (tower>44 && tower<53) || (tower>60 && tower<69))
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;
976 std::vector<int> FEDs;
977 GetListofFEDs(region, FEDs);
986 double radTodeg = 180. /
M_PI;;
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);
995 double phihigh = region.
phiHigh() * radTodeg;
996 if (debug)
std::cout <<
" etalow phihigh " << etalow <<
" " << phihigh << std::endl;
997 int FED_LT = GetFED(etalow,phihigh);
999 int DCC_BoundaryL = DCCBoundary(FED_LB);
1001 if (FED_LB < MIN_DCCID_EBM || FED_LB > MAX_DCCID_EBP) deltaL=9;
1003 if (philow < -170 && phihigh > 170) {
1004 FED_LB = DCC_BoundaryL;
1005 FED_LT = DCC_BoundaryL + deltaL -1;
1007 if (debug)
std::cout <<
" FED_LB FED_LT " << FED_LB <<
" " << FED_LT << std::endl;
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;
1019 double etahigh = region.
etaHigh();
1020 int FED_RB = GetFED(etahigh, philow);
1021 if (FED_RB == FED_LB)
return;
1023 int FED_RT = GetFED(etahigh, phihigh);
1025 if (debug)
std::cout <<
"etahigh philow phihigh " << etahigh <<
" " << philow <<
" " << phihigh << std::endl;
1026 int DCC_BoundaryR = DCCBoundary(FED_RB);
1028 if (FED_RB < MIN_DCCID_EBM || FED_RB > MAX_DCCID_EBP) deltaR=9;
1030 if (philow < -170 && phihigh > 170) {
1031 FED_RB = DCC_BoundaryR;
1032 FED_RT = DCC_BoundaryR + deltaR-1;
1034 if (debug)
std::cout <<
" FED_RB FED_RT " << FED_RB <<
" " << FED_RT << std::endl;
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;
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;
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;
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;
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;
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;
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;
1089 int minR = minL + 18;
1090 int maxR = maxL + 18;
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;
1111 bool IsBarrel =
true;
1112 if (fabs(eta) > 1.479) IsBarrel =
false;
1113 bool Positive = (eta > 0);
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;
1121 if (phi < 0) phi += 360;
1122 if (phi > 360.) phi = 360. ;
1123 if (phi < 0) phi = 0. ;
1125 if (IsBarrel) phi = phi - 350;
1126 else phi = phi - 330;
1127 if (phi < 0) phi += 360;
1129 if (IsBarrel) iphi = (
int)(phi / 20.);
1130 else iphi = (
int)(phi / 40.);
1134 int DCC = iphi + DCC_Phi0;
1148 int dccid = DCCid(ebdetid);
1149 std::map<int, int>::const_iterator it = LaserMonitoringMap_EB.find(dccid);
1150 if (it != LaserMonitoringMap_EB.end() ) {
1152 int iETA = ebdetid.
ietaSM();
1153 int iPHI = ebdetid.
iphiSM();
1154 if (iPHI > 10 && iETA>5) {ilm ++; } ;
1157 else throw cms::Exception(
"InvalidDCCId") <<
"Wrong DCCId (EB) in EcalElectronicsMapping::getLMNumber.";
1162 int dccid = elid.
dccId();
1164 std::map<int, int>::const_iterator it = LaserMonitoringMap_EE.find(dccid);
1165 if (it != LaserMonitoringMap_EB.end() ) {
1168 int ix = eedetid.
ix();
1169 if (ix > 50) ilm += 1;
1172 int ix = eedetid.
ix();
1173 if (ix > 50) ilm += 1;
1177 else throw cms::Exception(
"InvalidDCCId") <<
"Wrong DCCId (EE) in EcalElectronicsMapping::getLMNumber.";
int GetFED(double eta, double phi) 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.
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
static const int SUBDETIJMODE
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.
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)
int iphiSM() const
get the crystal iphi (1-20)
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
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
Abs< T >::type abs(const T &t)
EcalTriggerElectronicsId getTriggerElectronicsId(const DetId &id) const
Get the trigger electronics id for this det id.
std::vector< int > GetListofFEDs(const RectangularEtaPhiRegion ®ion) const
EcalTrigTowerDetId tower() const
get the HCAL/trigger iphi of this crystal
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
EcalSubdetector subdet() const
get the subdet
static const int ETAPHIMODE
std::vector< EcalScDetId > getEcalScDetId(int DCCid, int DCC_Channel, bool ignoreSingleCrystal=true) const
double deltaR(double eta1, double eta2, double phi1, double phi2)
bool rightTower(int tower) const
std::vector< DetId > ttConstituents(int tccId, int tt) const
Get the constituent detids for this dccId.
EcalSubdetector subdet(int dccid, int mode) const
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
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)
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.
int getLMNumber(const DetId &id) const
unsigned dccId(DetId const &)
int ietaAbs() const
get the absolute value of the crystal ieta
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.