46 static constexpr float pi_over_32 =
M_PI/32;
49 if(!triggerTowerCollection.
isValid()){
51 return StatusCode::FAILURE;
55 for(
auto eachTower : *triggerTowerCollection) {
56 if(std::abs(eachTower->eta())<1.5 && eachTower->sampling()==1) {
57 int i_phi =
static_cast<int>(eachTower->phi()/pi_over_32);
59 int towerID_Modifier{100000};
60 if (eachTower->eta() > 0) {
62 towerID_Modifier = 200000;
64 int i_eta =
static_cast<int>(eachTower->eta() * 10) * etaSign;
65 if(i_eta * etaSign == -14) {
66 towerID_Modifier = 300000;
67 }
else if (i_eta * etaSign == 14) {
68 towerID_Modifier = 400000;
73 if((targetTower = my_eTowerContainerRaw->findTower(towerid))) {
75 ATH_MSG_WARNING(
"\n==== eSuperCellTowerMapper ============ Hadronic layer energy filled more than once - it will be ignored. (Needs investigation). Please report this!");
77 targetTower->
setET(10,
static_cast<int>(eachTower->cpET()) * 500., 4);
79 ATH_MSG_WARNING(
"\n==== eSuperCellTowerMapper ============ Tower id is officially unknown - it will be ignored. (Needs investigation). Please report this!");
83 return StatusCode::SUCCESS;
97 if(!scellsCollection.
isValid()){
99 return StatusCode::FAILURE;
105 for (
const CaloCell* cell : * scellsCollection){
108 int SCprov = (cell)->provenance()&0xFFF;
109 bool isMasked = (SCprov&0x80)==0x80;
111 if (isMasked)
continue;
116 float et = 12.5*std::round((cell)->energy()/(12.5*cosh((cell)->
eta())));
119 if(abs(pos_neg) == 3){
continue; }
124 bool doenergysplit {
false };
138 }
else if (slot <= 4) {
140 }
else if (slot <= 8) {
142 }
else if (slot == 9) {
152 int eta_index = idHelper->
eta(
ID);
153 const int phi_index = idHelper->
phi(
ID);
154 int prov = (cell)->provenance();
199 case CaloSampling::PreSamplerB: {
break; }
200 case CaloSampling::EMB1: {
201 if(region == 1){ eta_index += 56; }
204 case CaloSampling::EMB2: {
205 if(region == 1){ eta_index += 56; }
208 case CaloSampling::EMB3: {
break; }
209 case CaloSampling::PreSamplerE: { eta_index += 15;
break; }
210 case CaloSampling::EME1: {
211 if(region == 0){ eta_index += 14; }
212 else if (region == 1){ }
213 else if (region == 2){ eta_index += 60; }
214 else if (region == 3){ eta_index += 108; }
215 else if (region == 4){ eta_index += 80; }
216 else if (region == 5){ eta_index += 24; }
219 case CaloSampling::EME2: {
220 if(region == 0){ eta_index += 14; }
221 else if (region == 1){ eta_index += 57; }
224 case CaloSampling::EME3: { eta_index += 15;
break; }
225 case CaloSampling::HEC0:
226 case CaloSampling::HEC1:
227 case CaloSampling::HEC2:
228 case CaloSampling::HEC3: { eta_index += 15;
break; }
233 FindAndConnectTower(my_eTowerContainerRaw,sample,region,layer,pos_neg,eta_index,phi_index,
ID,
et,prov,doPrint);
236 return StatusCode::SUCCESS;
251 int eSuperCellTowerMapper::FindAndConnectTower(std::unique_ptr<eTowerContainer> & my_eTowerContainerRaw,
CaloSampling::CaloSample sample,
const int region,
int layer,
const int pos_neg,
const int eta_index,
const int phi_index,
Identifier ID,
float et,
int prov,
bool doPrint)
const
255 bool doenergysplit =
false;
258 bool validcell =
true;
265 int towerID_Modifier = -999999999;
354 case CaloSampling::PreSamplerB: {
361 towereta = eta_index;
362 towerphi = phi_index;
365 if(pos_neg < 0){ towerID_Modifier = 300000; }
366 else if(pos_neg > 0){ towerID_Modifier = 400000; }
370 if(pos_neg < 0){ towerID_Modifier = 100000; }
371 else if(pos_neg > 0){ towerID_Modifier = 200000; }
377 case CaloSampling::EMB1:
378 case CaloSampling::EMB2: {
388 towereta = eta_index / 4;
389 towerphi = phi_index;
390 if(pos_neg < 0){ towerID_Modifier = 100000; }
391 else if(pos_neg > 0){ towerID_Modifier = 200000; }
393 else if (region == 1){
395 towerphi = phi_index;
396 if(pos_neg < 0){ towerID_Modifier = 300000; }
397 else if(pos_neg > 0){ towerID_Modifier = 400000; }
400 ATH_MSG_DEBUG(
"[CaloSampling::EMB1 or CaloSampling::EMB2] -> invalid 'region' value: " << region <<
" (Under investigation) ");
404 case CaloSampling::EMB1: {
405 iCell = (eta_index % 4) + 1;
409 case CaloSampling::EMB2: {
410 if (region == 0) { iCell = (eta_index % 4) + 5; }
411 else if (region == 1){ iCell = 5; }
416 ATH_MSG_DEBUG(
"CaloSampling::EMBX -> invalid sample for assigning iCell value! " << sample <<
" (Under investigation) ");
423 case CaloSampling::EMB3: {
429 towereta = eta_index;
430 towerphi = phi_index;
434 if(pos_neg < 0){ towerID_Modifier = 100000; }
435 else if(pos_neg > 0){ towerID_Modifier = 200000; }
440 case CaloSampling::PreSamplerE: {
446 towereta = eta_index;
447 towerphi = phi_index;
451 if(pos_neg < 0){ towerID_Modifier = 500000; }
452 else if(pos_neg > 0){ towerID_Modifier = 600000; }
456 case CaloSampling::EME1: {
480 towereta = eta_index;
481 towerphi = phi_index;
488 towereta = (eta_index / 4);
489 towerphi = phi_index;
491 iCell = (eta_index % 4) + 1;
497 towereta = (eta_index / 6);
498 towerphi = phi_index;
500 iCell = (eta_index % 6) + 1;
502 if(iCell == 1){ iCell = 1; doenergysplit =
false; }
503 else if( iCell == 2 ){ iCell = 1; doenergysplit =
true; }
504 else if( iCell == 3 ){ iCell = 2; doenergysplit =
false; }
505 else if( iCell == 4 ){ iCell = 3; doenergysplit =
false; }
506 else if( iCell == 5 ){ iCell = 3; doenergysplit =
true; }
507 else if( iCell == 6 ){ iCell = 4; doenergysplit =
false; }
531 towereta = (eta_index / 4);
532 towerphi = phi_index;
534 iCell = (eta_index % 4) + 1;
539 towereta = eta_index ;
540 towerphi = phi_index;
547 ATH_MSG_DEBUG(
"CaloSampling::EME1 -> invalid 'region' value: " << region <<
" (Under investigation) ");
554 if(pos_neg < 0){ towerID_Modifier = 500000; }
555 else if(pos_neg > 0){ towerID_Modifier = 600000; }
557 else if(region == 0){
559 if(pos_neg < 0){ towerID_Modifier = 300000; }
560 else if(pos_neg > 0){ towerID_Modifier = 400000; }
565 case CaloSampling::EME2: {
584 towereta = eta_index;
585 towerphi = phi_index;
593 towereta = (eta_index / 4);
594 towerphi = phi_index;
596 iCell = (eta_index % 4) + 5;
601 ATH_MSG_DEBUG(
"CaloSampling::EME2 -> invalid 'region' value: " << region <<
" (Under investigation) ");
609 if(pos_neg < 0){ towerID_Modifier = 300000; }
610 else if(pos_neg > 0){ towerID_Modifier = 400000; }
613 if( (eta_index / 4) < 15 ){
614 if(pos_neg < 0){ towerID_Modifier = 300000; }
615 else if(pos_neg > 0){ towerID_Modifier = 400000; }
618 if(pos_neg < 0){ towerID_Modifier = 500000; }
619 else if(pos_neg > 0){ towerID_Modifier = 600000; }
625 case CaloSampling::EME3: {
640 towereta = eta_index;
641 towerphi = phi_index;
648 ATH_MSG_DEBUG(
"CaloSampling::EME3 -> invalid 'region' value: " << region <<
" (Under investigation) ");
654 if(pos_neg < 0){ towerID_Modifier = 500000; }
655 else if(pos_neg > 0){ towerID_Modifier = 600000; }
660 case CaloSampling::HEC0:
661 case CaloSampling::HEC1:
662 case CaloSampling::HEC2:
663 case CaloSampling::HEC3: {
672 towereta = eta_index;
673 towerphi = phi_index;
678 case CaloSampling::HEC0: { iCell = 10;
break; }
679 case CaloSampling::HEC1: { iCell = 11;
break; }
680 case CaloSampling::HEC2: { iCell = 12;
break; }
681 case CaloSampling::HEC3: { iCell = 13;
break; }
683 ATH_MSG_DEBUG(
"CaloSampling::HECX -> invalid sample for assigning iCell value! " << sample <<
" (Under investigation) ");
699 if(pos_neg < 0){ towerID_Modifier = 500000; }
700 else if(pos_neg > 0){ towerID_Modifier = 600000; }
704 case CaloSampling::TileBar0:
705 case CaloSampling::TileBar1:
706 case CaloSampling::TileBar2: {
712 case CaloSampling::TileGap1:
713 case CaloSampling::TileGap2:
714 case CaloSampling::TileGap3: {
719 case CaloSampling::TileExt0:
720 case CaloSampling::TileExt1:
721 case CaloSampling::TileExt2: {
726 case CaloSampling::FCAL0:
727 case CaloSampling::FCAL1:
728 case CaloSampling::FCAL2: {
733 case CaloSampling::MINIFCAL0:
734 case CaloSampling::MINIFCAL1:
735 case CaloSampling::MINIFCAL2:
736 case CaloSampling::MINIFCAL3: {
741 case CaloSampling::Unknown: {
747 ATH_MSG_DEBUG(
"\n==== eSuperCellTowerMapper ============ Supercell has invalid CaloSampling value: " << sample <<
" (Needs investigation). Please report this!");
758 if (iETower < 200000 || (iETower > 300000 && iETower < 400000) || (iETower > 500000 && iETower < 600000)) {
761 if (doenergysplit) iCell -= 1;
762 }
else if (layer == 2) {
768 int etaIndex = (iETower%100000)/64;
769 if (iETower > 500000 && etaIndex == 24 && iCell < 5) iCell = 0;
772 PrintCellSpec(sample, layer, region, eta_index, phi_index, pos_neg, iETower, iCell, prov,
ID, doenergysplit);
788 void eSuperCellTowerMapper::PrintCellSpec(
const CaloSampling::CaloSample sample,
int layer,
const int region,
const int eta_index,
const int phi_index,
const int pos_neg,
int iETower,
int iCell,
int prov,
Identifier ID ,
bool doenergysplit)
791 std::string sampleName =
"";
794 case CaloSampling::PreSamplerB: { sampleName =
"PreSamplerB";
break; }
795 case CaloSampling::EMB1: { sampleName =
"EMB1";
break; }
796 case CaloSampling::EMB2: { sampleName =
"EMB2";
break; }
797 case CaloSampling::EMB3: { sampleName =
"EMB3";
break; }
798 case CaloSampling::PreSamplerE: { sampleName =
"PreSamplerE";
break; }
799 case CaloSampling::EME1: { sampleName =
"EME1";
break; }
800 case CaloSampling::EME2: { sampleName =
"EME2";
break; }
801 case CaloSampling::EME3: { sampleName =
"EME3";
break; }
802 case CaloSampling::HEC0: { sampleName =
"HEC0";
break; }
803 case CaloSampling::HEC1: { sampleName =
"HEC1";
break; }
804 case CaloSampling::HEC2: { sampleName =
"HEC2";
break; }
805 case CaloSampling::HEC3: { sampleName =
"HEC3";
break; }
807 ATH_MSG_DEBUG(
"\n==== eSuperCellTowerMapper ============ Supercell has invalid CaloSampling value: " << sample <<
" (Needs investigation). Please report this!");
813 <<
"\tSample: " << sample
814 <<
"\tLayer: " << layer
815 <<
"\tRegion: " << region
816 <<
"\tEta_Index: " << eta_index
817 <<
"\tPhi_Index: " << phi_index
818 <<
"\tPosNeg: " << pos_neg
819 <<
"\tiETower: " << iETower
820 <<
"\tiCell: " << iCell
821 <<
"\tDoEnergySplit: " << doenergysplit
822 <<
"\tProvenance: " << prov
830 std::string sampleName =
"";
832 case CaloSampling::PreSamplerB: { sampleName =
"PreSamplerB";
break; }
833 case CaloSampling::EMB1: { sampleName =
"EMB1";
break; }
834 case CaloSampling::EMB2: { sampleName =
"EMB2";
break; }
835 case CaloSampling::EMB3: { sampleName =
"EMB3";
break; }
836 case CaloSampling::PreSamplerE: { sampleName =
"PreSamplerE";
break; }
837 case CaloSampling::EME1: { sampleName =
"EME1";
break; }
838 case CaloSampling::EME2: { sampleName =
"EME2";
break; }
839 case CaloSampling::EME3: { sampleName =
"EME3";
break; }
840 case CaloSampling::HEC0: { sampleName =
"HEC0";
break; }
841 case CaloSampling::HEC1: { sampleName =
"HEC1";
break; }
842 case CaloSampling::HEC2: { sampleName =
"HEC2";
break; }
843 case CaloSampling::HEC3: { sampleName =
"HEC3";
break; }
844 case CaloSampling::FCAL0: { sampleName =
"FCAL0";
break; }
845 case CaloSampling::FCAL1: { sampleName =
"FCAL1";
break; }
846 case CaloSampling::FCAL2: { sampleName =
"FCAL2";
break; }
848 ATH_MSG_DEBUG(
"\n==== jSuperCellTowerMapper ============ Supercell has invalid CaloSampling value: " << sample <<
" (Needs investigation). Please report this!");