12 m_caloHelper(caloId), m_hvlineHelper(hvId), m_electrodeHelper(elId)
27 std::map<HWIdentifier,HWIdentifier>::const_iterator elecIt = m_electrode_hvline_map.find(electrodeId);
28 if(elecIt != m_electrode_hvline_map.end()) {
74 HWIdentifier invalidId = m_hvlineHelper->HVLineId(0,0,0,0);
87 std::map<HWIdentifier,std::vector<HWIdentifier> >::const_iterator elecIt=m_hvline_electrode_map.find(hvlineId);
88 if( elecIt != m_hvline_electrode_map.end()){
89 return (elecIt)->second;
123 if( m_caloHelper->is_em( offId ) ){
124 const int sampl = m_emHelper->sampling( offId );
125 const int bec = m_emHelper->barrel_ec( offId);
129 if( m_caloHelper->is_em_barrel(offId) && sampl != 0 ){
134 if( m_caloHelper->is_em_barrel(offId) && sampl == 0 ){
139 if( m_caloHelper->is_em_endcap(offId) && sampl != 0 ){
144 if( m_caloHelper->is_em_endcap(offId) && sampl == 0 ){
150 else if( m_caloHelper->is_hec( offId ) ){
151 const int bec = m_hecHelper->pos_neg(offId);
158 else if( m_caloHelper->is_fcal( offId ) ){
159 const int bec = m_fcalHelper->pos_neg(offId);
170 const int Module = getCellModule( offId );
171 const int EtaBin = getCellEtaSector( offId );
172 const int PhiBin = getCellPhiSector( offId );
173 const int elecmin = getCellElectrodeMinMax(offId).first;
174 const int elecmax = getCellElectrodeMinMax(offId).second;
187 for(
int ielec=elecmin; ielec<elecmax+1; ielec++){
188 for(
int iGap=0; iGap<iGapMax+1; iGap++){
190 m_electrodeHelper->ElectrodeId(
Detector,
Side,Module,PhiBin,EtaBin,iGap,ielec);
191 electrodeIdVec.push_back(electrodeId);
219 if( m_caloHelper->is_em( offId ) ){
220 const int sampl = m_emHelper->sampling( offId );
221 const int bec = m_emHelper->barrel_ec( offId);
226 if( m_caloHelper->is_em_barrel(offId) && sampl != 0 ){
231 if( m_caloHelper->is_em_barrel(offId) && sampl == 0 ){
236 if( m_caloHelper->is_em_endcap(offId) && sampl != 0 ){
241 if( m_caloHelper->is_em_endcap(offId) && sampl == 0 ){
247 else if( m_caloHelper->is_hec( offId ) ){
248 const int bec = m_hecHelper->pos_neg(offId);
255 else if( m_caloHelper->is_fcal( offId ) ){
256 const int bec = m_fcalHelper->pos_neg(offId);
272 const int Module = getCellModule( offId );
273 const int EtaBin = getCellEtaSector( offId );
274 const int PhiBin = getCellPhiSector( offId );
275 const int elecmin = getCellElectrodeMinMax(offId).first;
276 const int elecmax = getCellElectrodeMinMax(offId).second;
277 for(
int ielec=elecmin; ielec<elecmax+1; ielec++){
289 for(
int iGap=0; iGap<iGapMax+1; iGap++){
292 m_electrodeHelper->ElectrodeId(
Detector,
Side,Module,PhiBin,EtaBin,iGap,ielec);
293 std::map<HWIdentifier,HWIdentifier>::const_iterator elecIt =
294 m_electrode_hvline_map.find(electrodeId);
295 if(elecIt != m_electrode_hvline_map.end()){
323 if( hvlineIdVec.empty() ){
325 hvlineIdVec.push_back(hvlineId);
328 bool foundHvId =
false;
329 std::vector<HWIdentifier>::const_iterator hv = hvlineIdVec.begin();
330 std::vector<HWIdentifier>::const_iterator hvEnd = hvlineIdVec.end();
331 for(; hv!=hvEnd;++hv){
345 if( hvlineId == hvRef ){
352 hvlineIdVec.push_back(hvlineId);
423 if( m_caloHelper->is_em( offId ) ){
424 bec = m_emHelper->barrel_ec(offId);
425 sampling = m_emHelper->sampling(offId);
426 region = m_emHelper->region(offId);
427 phi = m_emHelper->phi(offId);
430 else if( m_caloHelper->is_hec( offId ) ){
431 bec = m_hecHelper->pos_neg(offId)*10;
432 sampling = m_hecHelper->sampling(offId);
433 region = m_hecHelper->region(offId);
434 phi = m_hecHelper->phi(offId);
437 else if( m_caloHelper->is_fcal( offId )){
438 bec = m_fcalHelper->pos_neg(offId)*20;
439 sampling = m_fcalHelper->module(offId);
441 phi = m_fcalHelper->phi(offId);
470 int phi_module=
int(
phi/2);
471 ModuleID = phi_module;
473 else if( sampling == 1 && region == 0 ){
477 int phi_module =
int((
phi+2)/4);
478 if( phi_module == 16 ){
482 ModuleID = phi_module;
485 else if( sampling == 2 || sampling == 3 || (sampling == 1 && region == 1 ) ){
489 int phi_module =
int((
phi+8)/16);
490 if( phi_module == 16 ){
499 else if(
bec == -1 ){
506 int phi_module=
int(
phi/2);
507 if( phi_module <= 15 ){
508 phi_module = 15 - phi_module;
511 phi_module = 47 - phi_module;
513 ModuleID = phi_module;
515 else if( sampling == 1 && region == 0 ){
519 int phi_module =
int((
phi+2)/4);
520 if( phi_module <= 8){
521 phi_module = 8 - phi_module;
524 phi_module = 24 - phi_module;
526 ModuleID = phi_module;
528 else if( sampling == 2 || sampling == 3 || (sampling == 1 && region == 1 ) ){
532 int phi_module =
int((
phi+8)/16);
533 if( phi_module <= 8){
534 phi_module = 8 - phi_module;
537 phi_module = 24 - phi_module;
539 ModuleID = phi_module;
544 else if( abs(
bec) == 2 || abs(
bec) == 3){
564 if( sampling == 0 || sampling == 1 ||
565 (sampling == 2 && abs(
bec) == 3 ) ){
571 int phi_local =
int(
phi/8);
572 ModuleID = phi_local;
574 else if( (sampling == 2 && abs(
bec) == 2) || (sampling == 3 && abs(
bec) == 2)){
580 int phi_local =
int(
phi/32);
581 ModuleID = phi_local;
586 if( sampling == 0 || sampling == 1 ||
587 (sampling == 2 && abs(
bec) == 3 ) ){
594 int phi_local =
int(
phi/8);
595 if( phi_local == 0 ){rev_phi = 3;}
596 if( phi_local == 1 ){rev_phi = 2;}
597 if( phi_local == 2 ){rev_phi = 1;}
598 if( phi_local == 3 ){rev_phi = 0;}
599 if( phi_local == 4 ){rev_phi = 7;}
600 if( phi_local == 5 ){rev_phi = 6;}
601 if( phi_local == 6 ){rev_phi = 5;}
602 if( phi_local == 7 ){rev_phi = 4;}
605 else if( (sampling == 2 && abs(
bec) == 2) || (sampling == 3 && abs(
bec) == 2)){
612 int phi_local =
int(
phi/32);
613 if( phi_local == 0 ){rev_phi = 3;}
614 if( phi_local == 1 ){rev_phi = 2;}
615 if( phi_local == 2 ){rev_phi = 1;}
616 if( phi_local == 3 ){rev_phi = 0;}
617 if( phi_local == 4 ){rev_phi = 7;}
618 if( phi_local == 5 ){rev_phi = 6;}
619 if( phi_local == 6 ){rev_phi = 5;}
620 if( phi_local == 7 ){rev_phi = 4;}
627 else if( abs(
bec) == 20 ){
637 int phi_module=
int(
phi/2);
638 ModuleID = phi_module;
640 else if( region == 1){
646 ModuleID = phi_module;
654 int phi_module=
int(
phi/2);
655 if( phi_module <= 15 ){
656 phi_module = 15 - phi_module;
659 phi_module = 47 - phi_module;
661 ModuleID = phi_module;
663 else if( region == 1){
667 if( phi_module <= 15 ){
668 phi_module = 15 - phi_module;
671 phi_module = 47 - phi_module;
673 ModuleID = phi_module;
693 else if( abs(
bec) == 40 ){
703 else if( sampling == 2 ){
706 else if( sampling == 3){
735 std::string l_version = m_emHelper->dictionaryVersion();
744 if( m_caloHelper->is_em( offId ) ){
745 l_bec = m_emHelper->barrel_ec(offId);
746 sampling = m_emHelper->sampling(offId);
747 region = m_emHelper->region(offId);
748 ieta = m_emHelper->eta(offId);
750 else if( m_caloHelper->is_hec( offId ) ){
751 l_bec = m_hecHelper->pos_neg(offId)*10;
752 sampling = m_hecHelper->sampling(offId);
753 region = m_hecHelper->region(offId);
754 ieta = m_hecHelper->eta(offId);
756 else if( m_caloHelper->is_fcal( offId ) ){
757 l_bec = m_fcalHelper->pos_neg(offId)*20;
758 sampling = m_fcalHelper->module(offId);
767 if( abs(l_bec) == 1 ){
772 if( ieta >= 0 && ieta < 64 ){
775 else if( ieta >=64 && ieta < 128 ){
778 else if( ieta >=128 && ieta < 192 ){
781 else if( ieta >=192 && ieta < 256 ){
784 else if( ieta >=256 && ieta < 320 ){
787 else if( ieta >=320 && ieta < 384 ){
790 else if( ieta >=384 && ieta < 448 ){
794 else if( region == 1){
801 else if( sampling == 2 ){
806 if( ieta >= 0 && ieta < 8 ){
809 else if( ieta >=8 && ieta < 16 ){
812 else if( ieta >=16 && ieta < 24 ){
815 else if( ieta >=24 && ieta < 32 ){
818 else if( ieta >=32 && ieta < 40 ){
821 else if( ieta >=40 && ieta < 48 ){
824 else if( ieta >=48 && ieta < 57 ){
828 else if( region == 1)
837 else if( sampling == 3 ){
842 if( ieta >= 0 && ieta < 4 ){
845 else if( ieta >=4 && ieta < 8 ){
848 else if( ieta >=8 && ieta < 12 ){
851 else if( ieta >=12 && ieta < 16 ){
854 else if( ieta >=16 && ieta < 20 ){
857 else if( ieta >=20 && ieta < 24 ){
860 else if( ieta >=24 && ieta < 28 ){
864 else if( region == 1){
872 else if( sampling == 0 ){
878 if( ieta >= 0 && ieta < 15 ){
881 else if( ieta >=15 && ieta <30 ){
884 else if( ieta >=30 && ieta < 45 ){
887 else if( ieta >=45 && ieta < 61 ){
900 else if( abs(l_bec) == 2 || abs(l_bec) == 3){
909 if( ieta >= 0 && ieta <= 1){
912 else if(ieta >=2 && ieta <= 5){
915 else if(ieta >=6 && ieta <= 9){
918 else if(ieta >=10 && ieta <= 11){
921 else if(ieta >=12 && ieta <= 15){
924 else if(ieta >=16 && ieta <= 19){
928 else if( sampling == 2 && abs(l_bec) == 2 ){
937 else if( region == 1 ){
939 if( ieta >=0 && ieta <= 2){
942 else if( ieta >=3 && ieta <= 6){
945 else if( ieta >=7 && ieta <= 15){
948 else if( ieta >=16 && ieta <= 23){
951 else if( ieta >=24 && ieta <= 27){
954 else if( ieta >=28 && ieta <= 35){
957 else if( ieta >=36 && ieta <= 42){
963 else if( sampling == 2 && abs(l_bec) == 3 ){
969 if( ieta >=0 && ieta <= 2){
972 else if( ieta >=3 && ieta <= 6){
977 else if( sampling == 1 && abs(l_bec) == 3 ){
983 if( ieta >=0 && ieta <= 2){
986 else if( ieta >=3 && ieta <= 6){
991 else if( sampling == 1 && abs(l_bec) == 2 ){
995 if( region == 0 || region == 1)
999 else if( region == 2 ){
1000 if( ieta >= 0 && ieta <= 31)
1005 else if( ieta <= 95) {
1010 else if(region == 3){
1014 else if(region == 4){
1016 if( ieta >=0 && ieta <= 15 ){
1020 else if( ieta >= 16 && ieta <= 47 ){
1024 else if( ieta >= 48 && ieta <= 63 ){
1029 else if( region == 5 ){
1037 else if( abs(l_bec)== 20 ){
1040 if( sampling == 0 ){
1043 else if( sampling == 1){
1046 else if( sampling == 2){
1049 else if( sampling == 3){
1059 else if( abs(l_bec)== 40 ){
1062 if( sampling == 1 ){
1065 else if( sampling == 2 ){
1068 else if( sampling == 3 ){
1114 if( m_caloHelper->is_em( offId ) ){
1115 bec = m_emHelper->barrel_ec(offId);
1116 sampling = m_emHelper->sampling(offId);
1117 region = m_emHelper->region(offId);
1118 phi = m_emHelper->phi(offId);
1120 else if( m_caloHelper->is_hec( offId ) ){
1121 bec = m_hecHelper->pos_neg(offId)*10;
1123 else if( m_caloHelper->is_fcal( offId ) ){
1124 bec = m_fcalHelper->pos_neg(offId)*20;
1142 if( sampling == 0 ){
1148 if( sampling == 1 && region == 0 ){
1153 int phi_local =
int(
phi);
1154 for(
int ift=0; ift<= 15; ift++){
1155 if( phi_local == ift*4 || phi_local == 1+ift*4 ){
1158 if( phi_local == 2+ift*4 || phi_local == 3+ift*4 ){
1163 else if( sampling == 2 || sampling == 3 || (sampling == 1 && region == 1 ) ){
1167 int phi_local =
int(
phi);
1168 for(
int ift=0; ift<= 15; ift++){
1169 for(
int i=0;
i<=7;
i++){
1170 if( phi_local ==
i+ift*16 ){
1174 for(
int i=8;
i<=15;
i++){
1175 if( phi_local ==
i+ift*16 ){
1183 else if(
bec == -1){
1186 if( sampling == 0 ){
1192 if( sampling == 1 && region == 0 ){
1196 int phi_local =
int(
phi);
1197 for(
int ift=0; ift<= 15; ift++){
1198 if( phi_local == ift*4 || phi_local == 1+ift*4 ){
1201 if( phi_local == 2+ift*4 || phi_local == 3+ift*4 ){
1206 else if( sampling == 2 || sampling == 3 || (sampling == 1 && region == 1 ) ){
1208 int phi_local =
int(
phi);
1209 for(
int ift=0; ift<= 15; ift++){
1210 for(
int i=0;
i<=7;
i++){
1211 if( phi_local ==
i+ift*16 ){
1215 for(
int i=8;
i<=15;
i++){
1216 if( phi_local ==
i+ift*16 ){
1225 else if( abs(
bec) == 2 || abs(
bec) == 3 ){
1229 if( sampling == 1 && abs(
bec) == 2 ){
1240 int phi_local =
phi - imod*8;
1241 if( phi_local == 0 || phi_local == 1){
1244 else if( phi_local == 2 || phi_local == 3){
1247 else if( phi_local == 4 || phi_local == 5){
1250 else if( phi_local == 6 || phi_local == 7){
1254 if( sampling == 1 && abs(
bec) == 3 ){
1259 int phi_local =
phi-imod*8;
1260 hvPhi = phi_local+1;
1262 else if( sampling == 2 && abs(
bec) == 3 ){
1268 int phi_local =
phi - imod*8;
1269 hvPhi = phi_local+1;
1271 else if( sampling == 2 && abs(
bec) == 2 ){
1276 int imod = (
phi/32);
1277 int phi_local=
phi-imod*32;
1278 if( phi_local >= 0 && phi_local <= 7 ){
1281 else if( phi_local >= 8 && phi_local <= 15 ){
1284 else if( phi_local >= 16 && phi_local <= 23 ){
1287 else if( phi_local >= 24 && phi_local <= 31 ){
1291 else if( sampling == 3 ){
1296 int imod = (
phi/32);
1297 int phi_local=
phi-imod*32;
1298 if( phi_local >= 0 && phi_local <= 7 ){
1301 else if( phi_local >= 8 && phi_local <= 15 ){
1304 else if( phi_local >= 16 && phi_local <= 23 ){
1307 else if( phi_local >= 24 && phi_local <= 31 ){
1314 if( sampling == 1 && abs(
bec) == 2 ){
1318 int phi_local =
phi-imod*8;
1319 if( phi_local == 0 || phi_local == 1){
1322 else if( phi_local == 2 || phi_local == 3){
1325 else if( phi_local == 4 || phi_local == 5){
1328 else if( phi_local == 6 || phi_local == 7){
1332 if( sampling == 1 && abs(
bec) == 3 ){
1337 int phi_local =
phi - imod*8;
1338 hvPhi = 8-(phi_local);
1340 else if( sampling == 2 && abs(
bec) == 3 ){
1344 int phi_local =
phi-imod*8;
1345 hvPhi = 8-(phi_local);
1347 else if( sampling == 2 && abs(
bec) == 2 ){
1350 int imod = (
phi/32);
1351 int phi_local=
phi-imod*32;
1352 if( phi_local >= 0 && phi_local <= 7 ){
1355 else if( phi_local >= 8 && phi_local <= 15 ){
1358 else if( phi_local >= 16 && phi_local <= 23 ){
1361 else if( phi_local >= 24 && phi_local <= 31 ){
1365 else if( sampling == 3 ){
1368 int imod = (
phi/32);
1369 int phi_local=
phi-imod*32;
1370 if( phi_local >= 0 && phi_local <= 7 ){
1373 else if( phi_local >= 8 && phi_local <= 15 ){
1376 else if( phi_local >= 16 && phi_local <= 23 ){
1379 else if( phi_local >= 24 && phi_local <= 31 ){
1386 else if( abs(
bec)==20){
1392 else if( abs(
bec)==40){
1429 if( m_caloHelper->is_em( offId ) ){
1430 l_bec = m_emHelper->barrel_ec(offId);
1431 l_sampling = m_emHelper->sampling(offId);
1432 l_region = m_emHelper->region(offId);
1434 l_phi = m_emHelper->phi(offId);
1436 else if( m_caloHelper->is_hec( offId ) ){
1437 l_bec = m_hecHelper->pos_neg(offId)*10;
1438 l_sampling = m_hecHelper->sampling(offId);
1439 l_region = m_hecHelper->region(offId);
1441 l_phi = m_hecHelper->phi(offId);
1443 else if( m_caloHelper->is_fcal( offId ) ){
1444 l_bec = m_fcalHelper->pos_neg(offId)*20;
1450 if( abs(l_bec) == 1 )
1454 if( l_sampling == 0 || ( l_sampling == 1 && l_region == 0) ){
1466 int phi_module =
int((l_phi+2)/4);
1467 int phi_local = l_phi+2 - 4*phi_module;
1468 ElecMin = phi_local*16;
1469 ElecMax = ElecMin + 16-1;
1480 if( l_sampling == 0 ){
1486 else if( (l_sampling == 1 && l_region == 1) || l_sampling == 2 || l_sampling == 3 ){
1510 int phi_module =
int((l_phi+8)/16);
1512 int phi_local = l_phi+8 - 16*phi_module;
1513 ElecMin = phi_local * 4;
1514 ElecMax = ElecMin + 4 - 1;
1528 else if( l_bec == -1){
1536 if( l_sampling == 0 || ( l_sampling == 1 && l_region == 0) ){
1549 int phi_module =
int((l_phi+2)/4);
1550 int phi_local = (l_phi+2 - 4*phi_module) ;
1551 ElecMin = 48-phi_local*16;
1552 ElecMax = ElecMin + 16 - 1;
1563 if( l_sampling == 0 ){
1568 else if( (l_sampling == 1 && l_region == 1) || l_sampling == 2 || l_sampling == 3 ){
1593 int phi_module =
int((l_phi+8)/16);
1594 int phi_local = (l_phi+8 - 16*phi_module);
1597 if( phi_module <= 8){
1598 phi_module = 8 - phi_module;
1601 phi_module = 24 - phi_module;
1603 ElecMin = 60-phi_local * 4;
1604 ElecMax = ElecMin + 4 - 1;
1623 else if(abs(l_bec) == 2 || abs(l_bec) == 3){
1629 if( l_sampling == 0 ||
1630 (l_sampling == 1 && l_region >= 0 && l_region <= 5) ){
1648 int phi_module =
int(l_phi/8);
1649 int phi_local = l_phi - 8*phi_module;
1650 ElecMin = phi_local * 12;
1651 ElecMax = ElecMin + 12 - 1;
1664 else if( l_sampling == 2 || l_sampling == 3){
1679 int phi_module =
int(l_phi/32);
1680 int phi_local = l_phi - 32*phi_module;
1681 ElecMin = phi_local*3;
1682 ElecMax = ElecMin+3-1;
1696 else if( l_bec == 3 ){
1700 if( l_sampling == 1 || l_sampling == 2 || l_sampling == 0 ){
1715 int phi_module =
int(l_phi/8);
1716 int phi_local = l_phi - 8*phi_module;
1717 ElecMin = phi_local *4;
1718 ElecMax = ElecMin + 4 - 1;
1731 else if( l_bec == -2 ){
1735 if( l_sampling == 0 || (l_sampling == 1 && l_region >= 0 && l_region <= 5) ){
1753 int phi_module =
int(l_phi/8);
1754 int phi_local = 7 - (l_phi - 8*phi_module);
1755 ElecMin = phi_local * 12;
1756 ElecMax = ElecMin + 12 - 1;
1769 else if( l_sampling == 2 || l_sampling == 3){
1784 int phi_module =
int(l_phi/32);
1785 int phi_local = 31 - (l_phi - 32*phi_module);
1786 ElecMin = phi_local*3;
1787 ElecMax = ElecMin + 3 - 1;
1800 else if( l_bec == -3 ){
1802 if( l_sampling == 1 || l_sampling == 2 || l_sampling == 0 ){
1807 int phi_module =
int(l_phi/8);
1808 int phi_local = l_phi - 8*phi_module;
1809 ElecMin = 28 - phi_local *4;
1810 ElecMax = ElecMin + 4 -1;
1824 else if( abs(l_bec)==20 ){
1833 if( l_sampling == 0){
1851 else if( l_sampling == 1){
1867 else if( l_sampling == 2){
1882 else if( l_sampling == 3){
1894 else if( abs(l_bec)==40 ){
1904 std::pair<int, int> electrodeMinMax( ElecMin, ElecMax);
1905 return electrodeMinMax;