47 static constexpr float pi_over_32 =
M_PI/32;
50 if(!triggerTowerCollection.
isValid()){
52 return StatusCode::FAILURE;
56 for(
auto eachTower : *triggerTowerCollection) {
57 if(std::abs(eachTower->eta())<1.5 && eachTower->sampling()==1) {
58 int i_phi =
static_cast<int>(eachTower->phi()/pi_over_32);
60 int towerID_Modifier{100000};
61 if (eachTower->eta() > 0) {
63 towerID_Modifier = 200000;
65 int i_eta =
static_cast<int>(eachTower->eta() * 10) * etaSign;
66 if(i_eta * etaSign == -14) {
67 towerID_Modifier = 300000;
68 }
else if (i_eta * etaSign == 14) {
69 towerID_Modifier = 400000;
74 if((targetTower = my_eTowerContainerRaw->findTower(towerid))) {
76 ATH_MSG_WARNING(
"\n==== eSuperCellTowerMapper ============ Hadronic layer energy filled more than once - it will be ignored. (Needs investigation). Please report this!");
78 targetTower->
setET(10,
static_cast<int>(eachTower->cpET()) * 500., 4);
80 ATH_MSG_WARNING(
"\n==== eSuperCellTowerMapper ============ Tower id is officially unknown - it will be ignored. (Needs investigation). Please report this!");
84 return StatusCode::SUCCESS;
95 if(!scellsCollection.
isValid()){
97 return StatusCode::FAILURE;
103 for (
const CaloCell* cell : * scellsCollection){
106 int SCprov = (cell)->provenance()&0xFFF;
107 bool isMasked = (SCprov&0x80)==0x80;
109 if (isMasked)
continue;
113 int region = idHelper->
region(ID);
114 float et = 12.5*std::round((cell)->energy()/(12.5*cosh((cell)->
eta())));
115 int pos_neg = idHelper->
pos_neg(ID);
117 if(abs(pos_neg) == 3){
continue; }
122 bool doenergysplit {
false };
136 }
else if (slot <= 4) {
138 }
else if (slot <= 8) {
140 }
else if (slot == 9) {
150 int eta_index = idHelper->
eta(ID);
151 const int phi_index = idHelper->
phi(ID);
152 int prov = (cell)->provenance();
197 case CaloSampling::PreSamplerB: {
break; }
198 case CaloSampling::EMB1: {
199 if(region == 1){ eta_index += 56; }
202 case CaloSampling::EMB2: {
203 if(region == 1){ eta_index += 56; }
206 case CaloSampling::EMB3: {
break; }
207 case CaloSampling::PreSamplerE: { eta_index += 15;
break; }
208 case CaloSampling::EME1: {
209 if(region == 0){ eta_index += 14; }
210 else if (region == 1){ }
211 else if (region == 2){ eta_index += 60; }
212 else if (region == 3){ eta_index += 108; }
213 else if (region == 4){ eta_index += 80; }
214 else if (region == 5){ eta_index += 24; }
217 case CaloSampling::EME2: {
218 if(region == 0){ eta_index += 14; }
219 else if (region == 1){ eta_index += 57; }
222 case CaloSampling::EME3: { eta_index += 15;
break; }
223 case CaloSampling::HEC0:
224 case CaloSampling::HEC1:
225 case CaloSampling::HEC2:
226 case CaloSampling::HEC3: { eta_index += 15;
break; }
231 FindAndConnectTower(my_eTowerContainerRaw,sample,region,layer,pos_neg,eta_index,phi_index,ID,
et,prov,doPrint);
234 return StatusCode::SUCCESS;
249 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
253 bool doenergysplit =
false;
256 bool validcell =
true;
263 int towerID_Modifier = -999999999;
352 case CaloSampling::PreSamplerB: {
359 towereta = eta_index;
360 towerphi = phi_index;
363 if(pos_neg < 0){ towerID_Modifier = 300000; }
364 else if(pos_neg > 0){ towerID_Modifier = 400000; }
368 if(pos_neg < 0){ towerID_Modifier = 100000; }
369 else if(pos_neg > 0){ towerID_Modifier = 200000; }
375 case CaloSampling::EMB1:
376 case CaloSampling::EMB2: {
386 towereta = eta_index / 4;
387 towerphi = phi_index;
388 if(pos_neg < 0){ towerID_Modifier = 100000; }
389 else if(pos_neg > 0){ towerID_Modifier = 200000; }
391 else if (region == 1){
393 towerphi = phi_index;
394 if(pos_neg < 0){ towerID_Modifier = 300000; }
395 else if(pos_neg > 0){ towerID_Modifier = 400000; }
398 ATH_MSG_DEBUG(
"[CaloSampling::EMB1 or CaloSampling::EMB2] -> invalid 'region' value: " << region <<
" (Under investigation) ");
402 case CaloSampling::EMB1: {
403 iCell = (eta_index % 4) + 1;
407 case CaloSampling::EMB2: {
408 if (region == 0) { iCell = (eta_index % 4) + 5; }
409 else if (region == 1){ iCell = 5; }
414 ATH_MSG_DEBUG(
"CaloSampling::EMBX -> invalid sample for assigning iCell value! " << sample <<
" (Under investigation) ");
421 case CaloSampling::EMB3: {
427 towereta = eta_index;
428 towerphi = phi_index;
432 if(pos_neg < 0){ towerID_Modifier = 100000; }
433 else if(pos_neg > 0){ towerID_Modifier = 200000; }
438 case CaloSampling::PreSamplerE: {
444 towereta = eta_index;
445 towerphi = phi_index;
449 if(pos_neg < 0){ towerID_Modifier = 500000; }
450 else if(pos_neg > 0){ towerID_Modifier = 600000; }
454 case CaloSampling::EME1: {
478 towereta = eta_index;
479 towerphi = phi_index;
486 towereta = (eta_index / 4);
487 towerphi = phi_index;
489 iCell = (eta_index % 4) + 1;
495 towereta = (eta_index / 6);
496 towerphi = phi_index;
498 iCell = (eta_index % 6) + 1;
500 if(iCell == 1){ iCell = 1; doenergysplit =
false; }
501 else if( iCell == 2 ){ iCell = 1; doenergysplit =
true; }
502 else if( iCell == 3 ){ iCell = 2; doenergysplit =
false; }
503 else if( iCell == 4 ){ iCell = 3; doenergysplit =
false; }
504 else if( iCell == 5 ){ iCell = 3; doenergysplit =
true; }
505 else if( iCell == 6 ){ iCell = 4; doenergysplit =
false; }
529 towereta = (eta_index / 4);
530 towerphi = phi_index;
532 iCell = (eta_index % 4) + 1;
537 towereta = eta_index ;
538 towerphi = phi_index;
545 ATH_MSG_DEBUG(
"CaloSampling::EME1 -> invalid 'region' value: " << region <<
" (Under investigation) ");
552 if(pos_neg < 0){ towerID_Modifier = 500000; }
553 else if(pos_neg > 0){ towerID_Modifier = 600000; }
555 else if(region == 0){
557 if(pos_neg < 0){ towerID_Modifier = 300000; }
558 else if(pos_neg > 0){ towerID_Modifier = 400000; }
563 case CaloSampling::EME2: {
582 towereta = eta_index;
583 towerphi = phi_index;
591 towereta = (eta_index / 4);
592 towerphi = phi_index;
594 iCell = (eta_index % 4) + 5;
599 ATH_MSG_DEBUG(
"CaloSampling::EME2 -> invalid 'region' value: " << region <<
" (Under investigation) ");
607 if(pos_neg < 0){ towerID_Modifier = 300000; }
608 else if(pos_neg > 0){ towerID_Modifier = 400000; }
611 if( (eta_index / 4) < 15 ){
612 if(pos_neg < 0){ towerID_Modifier = 300000; }
613 else if(pos_neg > 0){ towerID_Modifier = 400000; }
616 if(pos_neg < 0){ towerID_Modifier = 500000; }
617 else if(pos_neg > 0){ towerID_Modifier = 600000; }
623 case CaloSampling::EME3: {
638 towereta = eta_index;
639 towerphi = phi_index;
646 ATH_MSG_DEBUG(
"CaloSampling::EME3 -> invalid 'region' value: " << region <<
" (Under investigation) ");
652 if(pos_neg < 0){ towerID_Modifier = 500000; }
653 else if(pos_neg > 0){ towerID_Modifier = 600000; }
658 case CaloSampling::HEC0:
659 case CaloSampling::HEC1:
660 case CaloSampling::HEC2:
661 case CaloSampling::HEC3: {
670 towereta = eta_index;
671 towerphi = phi_index;
676 case CaloSampling::HEC0: { iCell = 10;
break; }
677 case CaloSampling::HEC1: { iCell = 11;
break; }
678 case CaloSampling::HEC2: { iCell = 12;
break; }
679 case CaloSampling::HEC3: { iCell = 13;
break; }
682 ATH_MSG_DEBUG(
"CaloSampling::HECX -> invalid sample for assigning iCell value! " << sample <<
" (Under investigation) ");
698 if(pos_neg < 0){ towerID_Modifier = 500000; }
699 else if(pos_neg > 0){ towerID_Modifier = 600000; }
703 case CaloSampling::TileBar0:
704 case CaloSampling::TileBar1:
705 case CaloSampling::TileBar2: {
711 case CaloSampling::TileGap1:
712 case CaloSampling::TileGap2:
713 case CaloSampling::TileGap3: {
718 case CaloSampling::TileExt0:
719 case CaloSampling::TileExt1:
720 case CaloSampling::TileExt2: {
725 case CaloSampling::FCAL0:
726 case CaloSampling::FCAL1:
727 case CaloSampling::FCAL2: {
732 case CaloSampling::MINIFCAL0:
733 case CaloSampling::MINIFCAL1:
734 case CaloSampling::MINIFCAL2:
735 case CaloSampling::MINIFCAL3: {
740 case CaloSampling::Unknown: {
746 ATH_MSG_DEBUG(
"\n==== eSuperCellTowerMapper ============ Supercell has invalid CaloSampling value: " << sample <<
" (Needs investigation). Please report this!");
757 if (iETower < 200000 || (iETower > 300000 && iETower < 400000) || (iETower > 500000 && iETower < 600000)) {
760 if (doenergysplit) iCell -= 1;
761 }
else if (layer == 2) {
767 int etaIndex = (iETower%100000)/64;
768 if (iETower > 500000 && etaIndex == 24 && iCell < 5) iCell = 0;
771 PrintCellSpec(sample, layer, region, eta_index, phi_index, pos_neg, iETower, iCell, prov, ID, doenergysplit);
787 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)
790 std::string sampleName =
"";
793 case CaloSampling::PreSamplerB: { sampleName =
"PreSamplerB";
break; }
794 case CaloSampling::EMB1: { sampleName =
"EMB1";
break; }
795 case CaloSampling::EMB2: { sampleName =
"EMB2";
break; }
796 case CaloSampling::EMB3: { sampleName =
"EMB3";
break; }
797 case CaloSampling::PreSamplerE: { sampleName =
"PreSamplerE";
break; }
798 case CaloSampling::EME1: { sampleName =
"EME1";
break; }
799 case CaloSampling::EME2: { sampleName =
"EME2";
break; }
800 case CaloSampling::EME3: { sampleName =
"EME3";
break; }
801 case CaloSampling::HEC0: { sampleName =
"HEC0";
break; }
802 case CaloSampling::HEC1: { sampleName =
"HEC1";
break; }
803 case CaloSampling::HEC2: { sampleName =
"HEC2";
break; }
804 case CaloSampling::HEC3: { sampleName =
"HEC3";
break; }
806 ATH_MSG_DEBUG(
"\n==== eSuperCellTowerMapper ============ Supercell has invalid CaloSampling value: " << sample <<
" (Needs investigation). Please report this!");
812 <<
"\tSample: " << sample
813 <<
"\tLayer: " << layer
814 <<
"\tRegion: " << region
815 <<
"\tEta_Index: " << eta_index
816 <<
"\tPhi_Index: " << phi_index
817 <<
"\tPosNeg: " << pos_neg
818 <<
"\tiETower: " << iETower
819 <<
"\tiCell: " << iCell
820 <<
"\tDoEnergySplit: " << doenergysplit
821 <<
"\tProvenance: " << prov
829 std::string sampleName =
"";
831 case CaloSampling::PreSamplerB: { sampleName =
"PreSamplerB";
break; }
832 case CaloSampling::EMB1: { sampleName =
"EMB1";
break; }
833 case CaloSampling::EMB2: { sampleName =
"EMB2";
break; }
834 case CaloSampling::EMB3: { sampleName =
"EMB3";
break; }
835 case CaloSampling::PreSamplerE: { sampleName =
"PreSamplerE";
break; }
836 case CaloSampling::EME1: { sampleName =
"EME1";
break; }
837 case CaloSampling::EME2: { sampleName =
"EME2";
break; }
838 case CaloSampling::EME3: { sampleName =
"EME3";
break; }
839 case CaloSampling::HEC0: { sampleName =
"HEC0";
break; }
840 case CaloSampling::HEC1: { sampleName =
"HEC1";
break; }
841 case CaloSampling::HEC2: { sampleName =
"HEC2";
break; }
842 case CaloSampling::HEC3: { sampleName =
"HEC3";
break; }
843 case CaloSampling::FCAL0: { sampleName =
"FCAL0";
break; }
844 case CaloSampling::FCAL1: { sampleName =
"FCAL1";
break; }
845 case CaloSampling::FCAL2: { sampleName =
"FCAL2";
break; }
847 ATH_MSG_DEBUG(
"\n==== jSuperCellTowerMapper ============ Supercell has invalid CaloSampling value: " << sample <<
" (Needs investigation). Please report this!");