15 using boost::multi_index_container;
16 using namespace boost::multi_index;
44 for (
int dcc=MIN_DCCID_EBM; dcc <= MAX_DCCID_EBM; dcc++) {
45 LaserMonitoringMap_EB[dcc] = ilm;
49 for (
int dcc=MIN_DCCID_EBP; dcc <= MAX_DCCID_EBP; dcc++) {
50 LaserMonitoringMap_EB[dcc] = ilm;
58 for (
int dcc=MIN_DCCID_EEM; dcc <= MAX_DCCID_EEM; dcc++) {
59 LaserMonitoringMap_EE[dcc] = ilm;
61 if (dcc == 8) ilm += 1;
64 for (
int dcc=MIN_DCCID_EEP; dcc <= MAX_DCCID_EEP; dcc++) {
65 LaserMonitoringMap_EE[dcc] = ilm;
67 if (dcc == 53) ilm += 1;
82 dcc += DCCID_PHI0_EBM - 19;
85 dcc += DCCID_PHI0_EBP -1;
100 tcc += TCCID_PHI0_EBM - 19;
103 tcc += TCCID_PHI0_EBP -1;
119 int ie =
id.ietaAbs() -1;
123 if (phi > 72) phi = phi-72;
124 if (
id.zside() < 0) {
125 ip = (( phi -1 ) % kEBTowersInPhi ) + 1;
127 ip = kEBTowersInPhi - ((phi -1 ) % kEBTowersInPhi );
130 return (ie * kEBTowersInPhi) + ip;
133 int ie =
id.ietaAbs();
134 bool inner = (ie >= iEEEtaMinInner);
136 ie = ie - iEEEtaMinInner;
137 ie = ie % kEETowersInEtaPerInnerTCC;
140 ie = ie - iEEEtaMinOuter;
141 ie = ie % kEETowersInEtaPerOuterTCC;
145 ip = (ip + 1) % (kEETowersInPhiPerQuadrant*4);
148 ip = ip % kEETowersInPhiPerTCC;
149 int itt = kEETowersInPhiPerTCC * ie + ip + 1;
153 throw cms::Exception(
"InvalidDetId") <<
" Wrong EcalTrigTowerDetId in EcalElectronicsMapping::iTT. " ;
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;
168 if (
id.zside() < 0) {
169 tcc += TCCID_PHI0_EBM - 19;
172 tcc += TCCID_PHI0_EBP -1;
179 int ie =
id.ietaAbs();
180 bool inner = (ie >= iEEEtaMinInner);
182 ip = (ip + 1) % (kEETowersInPhiPerQuadrant*4);
185 int Phiindex = ip / 4;
187 if (
id.ieta()> 0) Phiindex += TCCID_PHI0_EEP_IN;
188 else Phiindex += TCCID_PHI0_EEM_IN;
191 if (
id.ieta() > 0) Phiindex += TCCID_PHI0_EEP_OUT;
192 else Phiindex += TCCID_PHI0_EEM_OUT;
197 throw cms::Exception(
"InvalidDetId") <<
" Wrong EcalTrigTowerDetId in EcalElectronicsMapping::TCCid.";
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;
215 if (
id.zside() < 0) {
216 dcc += DCCID_PHI0_EBM - 19;
219 dcc += DCCID_PHI0_EBP -1;
225 int tccid = TCCid(
id);
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;
245 throw cms::Exception(
"InvalidDetId") <<
" Wrong EcalTrigTowerDetId in EcalElectronicsMapping::DCCid.";
256 int zIndex = zside(TCCid, TCCMODE);
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;
266 int etaTT = jtower / kTowersInPhi +1;
270 phiTT=(SMid - 1) * kTowersInPhi + (kTowersInPhi -(jtower % kTowersInPhi)) -1;
272 phiTT=(SMid - 19)* kTowersInPhi + jtower % kTowersInPhi;
275 if (phiTT <= 0) phiTT = 72+phiTT;
282 bool EEminus = (zIndex <0);
283 bool EEplus = (zIndex >0);
284 if ( (!EEminus) && (!EEplus) )
286 "EcalElectronicsMapping: Cannot create EcalTrigTowerDetId object. " ;
289 if (tcc < TCCID_PHI0_EEM_OUT+kTCCinPhi) iz = -1;
290 else if (tcc >= TCCID_PHI0_EEP_OUT) iz = +1;
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;
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;
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;
310 iphi += kEETowersInPhiPerTCC * tcc;
311 iphi = (iphi -2 + 4*kEETowersInPhiPerQuadrant) % (4*kEETowersInPhiPerQuadrant) + 1;
313 int tower_i =
abs(ieta);
322 " Wrong indices in EcalElectronicsMapping::getTrigTowerDetId. TCCid = " << TCCid <<
" iTT = " << iTT <<
".";
338 int dcc = DCCid(ebdetid);
339 bool EBPlus = (zside(dcc,DCCMODE) > 0);
340 bool EBMinus = !EBPlus;
344 int tower = iTT(trigtower);
350 bool RightTower = rightTower(tower);
354 if (EBMinus) channel = (iphi-1) %5;
355 if (EBPlus) channel = 4 -( (iphi-1) %5 );
358 if (EBMinus) channel = 4 -( (iphi-1) %5 );
359 if (EBPlus) channel = (iphi-1) %5;
363 strip = 4 - ( (ieta-1)%5 );
365 if (EBMinus) channel = 4 -( (iphi-1) %5 );
366 if (EBPlus) channel = (iphi-1) %5;
369 if (EBMinus) channel = (iphi-1) %5;
370 if (EBPlus) channel = 4 -( (iphi-1) %5 );
381 EcalElectronicsMap_by_DetId::const_iterator it=get<0>(m_items).
find(
id);
382 if(it==get<0>(m_items).
end())
384 edm::LogError(
"EcalElectronicsMapping") <<
"Ecal mapping was asked non valid id";
391 " Wrong DetId in EcalElectronicsMapping::getElectronicsId.";
407 EcalElectronicsMap_by_DetId::const_iterator it=get<0>(m_items).
find(
id);
408 if(it==get<0>(m_items).
end())
410 edm::LogError(
"EcalElectronicsMapping") <<
"Ecal mapping was asked non valid trig id";
417 " Wrong DetId in EcalElectronicsMapping::getTriggerElectronicsId.";
426 int dcc =
id.dccId();
427 int tower =
id.towerId();
428 int strip =
id.stripId();
429 int channel =
id.xtalId();
433 bool EBPlus = (
id.zside() > 0);
434 bool EBMinus = !EBPlus;
436 if (
id.zside() < 0) {
437 smid = dcc + 19 - DCCID_PHI0_EBM;
438 iphi = (smid - 19) * kCrystalsInPhi;
439 iphi += 5 * ( (tower-1) % kTowersInPhi );
442 smid = dcc +1 - DCCID_PHI0_EBP;
443 iphi = (smid - 1) * kCrystalsInPhi;
445 kTowersInPhi - ( (tower-1) % kTowersInPhi ) -1
448 bool RightTower = rightTower(tower);
449 int ieta = 5 * ((tower-1) / kTowersInPhi) + 1;
453 if (EBMinus) iphi += (channel-1) +1;
454 if (EBPlus) iphi += (4 - (channel-1)) +1;
457 if (EBMinus) iphi += (4 - (channel-1)) +1;
458 if (EBPlus) iphi += (channel-1) +1;
462 ieta += 4 - (strip-1);
464 if (EBMinus) iphi += (4 - (channel-1)) +1;
465 if (EBPlus) iphi += (channel-1) +1;
468 if (EBMinus) iphi += (channel-1) +1;
469 if (EBPlus) iphi += (4 - (channel-1)) +1;
472 if (
id.zside() < 0) ieta = -ieta;
479 EcalElectronicsMap_by_ElectronicsId::const_iterator it=get<1>(m_items).
find(
id);
480 if(it==(get<1>(m_items).
end()))
482 edm::LogError(
"EcalElectronicsMapping") <<
"Ecal mapping was asked non DetId";
484 DetId cell = it -> cell;
487 else throw cms::Exception(
"InvalidDetId") <<
"Wrong EcalElectronicsId in EcalElectronicsMapping::getDetId." ;
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;
504 tcc += TCCID_PHI0_EBP - DCCID_PHI0_EBP;
511 EcalElectronicsMap_by_ElectronicsId::const_iterator it=get<1>(m_items).
find(
id);
512 if(it==get<1>(m_items).
end())
514 edm::LogError(
"EcalElectronicsMapping") <<
"Ecal mapping was asked non valid id";
519 else throw cms::Exception(
"InvalidDetId") <<
"Wrong EcalElectronicsId in EcalElectronicsMapping::getTriggerElectronicsId.";
529 DetId cell = getDetId(elid);
533 EcalElectronicsMap_by_TriggerElectronicsId::const_iterator it=get<2>(m_items).
find(
id);
534 if(it==get<2>(m_items).
end())
536 edm::LogError(
"EcalElectronicsMapping") <<
"Ecal mapping was asked non valid DetId";
538 DetId cell = it -> cell;
541 else throw cms::Exception(
"InvalidDetId") <<
"Wrong EcalTriggerElectronicsId in EcalElectronicsMapping::getDetId." ;
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;
559 dcc -= TCCID_PHI0_EBP - DCCID_PHI0_EBP;
565 EcalElectronicsMap_by_TriggerElectronicsId::const_iterator it=get<2>(m_items).
find(
id);
566 if(it==get<2>(m_items).
end())
568 edm::LogError(
"EcalElectronicsMapping") <<
"Ecal mapping was asked non valid id";
573 else throw cms::Exception(
"InvalidDetId") <<
"Wrong EcalTriggerElectronicsId in EcalElectronicsMapping::getElectronicsId.";
582 std::vector<DetId> items;
585 for (
int tower=1; tower <= kEBTowersPerSM; tower++) {
586 std::vector<DetId> xtals = dccTowerConstituents(dccId,tower);
587 int size = xtals.size();
590 items.push_back(detid);
596 EcalElectronicsMap_by_DccId::const_iterator lb,ub;
597 boost::tuples::tie(lb,ub)=get<3>(m_items).equal_range(dccId);
599 DetId cell = lb -> cell;
600 items.push_back(cell);
605 else throw cms::Exception(
"InvalidDetId") <<
"Wrong dccId = " << dccId <<
" in EcalElectronicsMapping::dccConstituents. ";
613 std::vector<DetId> items;
616 int iz = zside(dccId, DCCMODE);
620 smid = dccId + 19 - DCCID_PHI0_EBM;
621 iphi = (smid - 19) * kCrystalsInPhi;
622 iphi += 5 * ( (tower-1) % kTowersInPhi );
625 smid = dccId +1 - DCCID_PHI0_EBP;
626 iphi = (smid - 1) * kCrystalsInPhi;
628 kTowersInPhi - ( (tower-1) % kTowersInPhi ) -1
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;
638 items.push_back(ebdetid);
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)));
648 DetId cell = lb -> cell;
649 items.push_back(cell);
655 "Wrong dccId = " << dccId <<
" tower = " << tower <<
" in EcalElectronicsMapping::dccTowerConstituents.";
663 std::vector<DetId> items;
667 int iz = zside(dccId, DCCMODE);
668 bool RightTower = rightTower(tower);
672 smid = dccId + 19 - DCCID_PHI0_EBM;
673 iphi = (smid - 19) * kCrystalsInPhi;
674 iphi += 5 * ( (tower-1) % kTowersInPhi );
677 smid = dccId +1 - DCCID_PHI0_EBP;
678 iphi = (smid - 1) * kCrystalsInPhi;
680 kTowersInPhi - ( (tower-1) % kTowersInPhi ) -1
683 int ieta = 5 * ((tower-1) / kTowersInPhi) + 1;
688 ieta += 4 - (strip-1);
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;
695 items.push_back(ebdetid);
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)));
704 DetId cell = lb -> cell;
705 items.push_back(cell);
717 std::vector<DetId> items;
720 int iz = zside(tccId,TCCMODE);
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);
728 EcalElectronicsMap_by_TccId::const_iterator lb,ub;
729 boost::tuples::tie(lb,ub)=get<6>(m_items).equal_range(tccId);
731 DetId cell = lb -> cell;
732 items.push_back(cell);
744 std::vector<DetId> items;
747 int iz = zside(tccId,TCCMODE);
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);
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)));
758 DetId cell = lb -> cell;
759 items.push_back(cell);
770 std::vector<DetId> items;
773 int iz = zside(tccId,TCCMODE);
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);
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)));
784 DetId cell = lb -> cell;
785 items.push_back(cell);
794 m_items.insert(
MapItem(cell, elid, tower));
805 std::pair<int,int> ind;
809 int zside =
id.zside();
830 int Dccid = elid.
dccId();
831 int DCC_Channel = elid.
towerId();
833 ind.second = DCC_Channel;
841 const bool debug =
false;
848 std::vector<EcalScDetId> scDetIds;
853 std::vector<int> nReadoutXtals;
855 std::vector<DetId> xtals = dccTowerConstituents(DCCid, DCC_Channel);
858 std::cout << __FILE__ <<
":" << __LINE__ <<
": " << xtals.size()
859 <<
" crystals read out by channel " << DCC_Channel <<
" of DCC "
861 for(
size_t i = 0;
i < xtals.size(); ++
i){
868 "EcalElectronicsMapping : can not create EcalScDetId for DCC " << DCCid <<
869 " and DCC_Channel " << DCC_Channel <<
".";
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;
882 while(iSc < scDetIds.size() && scDetIds[iSc] != scdetid) ++iSc;
883 if(iSc==scDetIds.size()){
884 scDetIds.push_back(scdetid);
885 nReadoutXtals.push_back(1);
887 ++nReadoutXtals[iSc];
891 if(ignoreSingleCrystal){
897 assert(scDetIds.size()==nReadoutXtals.size());
898 for(
size_t iSc = 0; iSc < scDetIds.size(); ){
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);
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;
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;
927 else throw cms::Exception(
"InvalidDetId") <<
" Wrong mode in EcalElectronicsMapping::subdet " << mode <<
".";
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;
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;
945 throw cms::Exception(
"InvalidDetId") <<
" Wrong mode in EcalElectronicsMapping::zside " << mode <<
".";
955 if ((tower>12 && tower<21) || (tower>28 && tower<37) ||
956 (tower>44 && tower<53) || (tower>60 && tower<69))
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;
975 std::vector<int>
FEDs;
976 GetListofFEDs(region, FEDs);
985 double radTodeg = 180. /
Geom::pi();
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);
994 double phihigh = region.
phiHigh() * radTodeg;
995 if (debug)
std::cout <<
" etalow phihigh " << etalow <<
" " << phihigh << std::endl;
996 int FED_LT = GetFED(etalow,phihigh);
998 int DCC_BoundaryL = DCCBoundary(FED_LB);
1000 if (FED_LB < MIN_DCCID_EBM || FED_LB > MAX_DCCID_EBP) deltaL=9;
1002 if (philow < -170 && phihigh > 170) {
1003 FED_LB = DCC_BoundaryL;
1004 FED_LT = DCC_BoundaryL + deltaL -1;
1006 if (debug)
std::cout <<
" FED_LB FED_LT " << FED_LB <<
" " << FED_LT << std::endl;
1013 iL = (FED_LB - DCC_BoundaryL + idx ) % deltaL + DCC_BoundaryL;
1015 if (debug)
std::cout <<
" add fed " << iL << std::endl;
1016 if ( iL == FED_LT)
break;
1020 double etahigh = region.
etaHigh();
1021 int FED_RB = GetFED(etahigh, philow);
1022 if (FED_RB == FED_LB)
return;
1024 int FED_RT = GetFED(etahigh, phihigh);
1026 if (debug)
std::cout <<
"etahigh philow phihigh " << etahigh <<
" " << philow <<
" " << phihigh << std::endl;
1027 int DCC_BoundaryR = DCCBoundary(FED_RB);
1029 if (FED_RB < MIN_DCCID_EBM || FED_RB > MAX_DCCID_EBP) deltaR=9;
1031 if (philow < -170 && phihigh > 170) {
1032 FED_RB = DCC_BoundaryR;
1033 FED_RT = DCC_BoundaryR + deltaR-1;
1035 if (debug)
std::cout <<
" FED_RB FED_RT " << FED_RB <<
" " << FED_RT << std::endl;
1040 iR = (FED_RB - DCC_BoundaryR + idx) % deltaR + DCC_BoundaryR;
1042 if (debug)
std::cout <<
" add fed " << iR << std::endl;
1043 if ( iR == FED_RT)
break;
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;
1055 iR = (minR - MIN_DCCID_EBP + idx) % 18 + MIN_DCCID_EBP;
1057 if (debug)
std::cout <<
" add fed " << iR << std::endl;
1058 if ( iR == maxR)
break;
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;
1071 iL = (minL - MIN_DCCID_EBM + idx) % 18 + MIN_DCCID_EBM;
1073 if (debug)
std::cout <<
" add fed " << iL << std::endl;
1074 if (iL == maxL)
break;
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;
1089 iL = (minL - MIN_DCCID_EBM + idx) % 18 + MIN_DCCID_EBM;
1091 if (debug)
std::cout <<
" add fed " << iL << std::endl;
1092 if (iL == maxL)
break;
1095 int minR = minL + 18;
1096 int maxR = maxL + 18;
1100 iR = (minR - MIN_DCCID_EBP + idx) % 18 + MIN_DCCID_EBP;
1102 if (debug)
std::cout <<
" add fed " << iR << std::endl;
1103 if (iR == maxR)
break;
1118 bool IsBarrel =
true;
1119 if (fabs(eta) > 1.479) IsBarrel =
false;
1120 bool Positive = (eta > 0);
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;
1128 if (phi < 0) phi += 360;
1129 if (phi > 360.) phi = 360. ;
1130 if (phi < 0) phi = 0. ;
1132 if (IsBarrel) phi = phi - 350;
1133 else phi = phi - 330;
1134 if (phi < 0) phi += 360;
1136 if (IsBarrel) iphi = (int)(phi / 20.);
1137 else iphi = (int)(phi / 40.);
1141 int DCC = iphi + DCC_Phi0;
1155 int dccid = DCCid(ebdetid);
1156 std::map<int, int>::const_iterator it = LaserMonitoringMap_EB.find(dccid);
1157 if (it != LaserMonitoringMap_EB.end() ) {
1159 int iETA = ebdetid.
ietaSM();
1160 int iPHI = ebdetid.
iphiSM();
1161 if (iPHI > 10 && iETA>5) {ilm ++; } ;
1164 else throw cms::Exception(
"InvalidDCCId") <<
"Wrong DCCId (EB) in EcalElectronicsMapping::getLMNumber.";
1169 int dccid = elid.
dccId();
1171 std::map<int, int>::const_iterator it = LaserMonitoringMap_EE.find(dccid);
1172 if (it != LaserMonitoringMap_EB.end() ) {
1175 int ix = eedetid.
ix();
1176 if (ix > 50) ilm += 1;
1179 int ix = eedetid.
ix();
1180 if (ix > 50) ilm += 1;
1184 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.
int towerId() const
get the tower id
unsigned dccId(const DetId &)
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)
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
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
std::vector< int > GetListofFEDs(const EcalEtaPhiRegion region) const
EcalTriggerElectronicsId getTriggerElectronicsId(const DetId &id) const
Get the trigger electronics id for this det id.
EcalTrigTowerDetId tower() const
get the HCAL/trigger iphi of this crystal
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
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
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)
unsigned tccId(const DetId &)
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
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...
tuple size
Write out results.
EcalSubdetector subdet() const
get the subdet
std::vector< DetId > dccTowerConstituents(int dccId, int tower) const
Get the constituent detids for this dccId.