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;
98 if(!scellsCollection.
isValid()){
100 return StatusCode::FAILURE;
106 for (
const CaloCell* cell : * scellsCollection){
109 int SCprov = (cell)->provenance()&0xFFF;
110 bool isMasked = (SCprov&0x80)==0x80;
112 if (isMasked)
continue;
116 int region = idHelper->
region(ID);
117 float et = 12.5*std::round((cell)->energy()/(12.5*cosh((cell)->
eta())));
118 int pos_neg = idHelper->
pos_neg(ID);
120 if(abs(pos_neg) == 3){
continue; }
125 bool doenergysplit {
false };
139 }
else if (slot <= 4) {
141 }
else if (slot <= 8) {
143 }
else if (slot == 9) {
153 int eta_index = idHelper->
eta(ID);
154 const int phi_index = idHelper->
phi(ID);
155 int prov = (cell)->provenance();
200 case CaloSampling::PreSamplerB: {
break; }
201 case CaloSampling::EMB1: {
202 if(region == 1){ eta_index += 56; }
205 case CaloSampling::EMB2: {
206 if(region == 1){ eta_index += 56; }
209 case CaloSampling::EMB3: {
break; }
210 case CaloSampling::PreSamplerE: { eta_index += 15;
break; }
211 case CaloSampling::EME1: {
212 if(region == 0){ eta_index += 14; }
213 else if (region == 1){ }
214 else if (region == 2){ eta_index += 60; }
215 else if (region == 3){ eta_index += 108; }
216 else if (region == 4){ eta_index += 80; }
217 else if (region == 5){ eta_index += 24; }
220 case CaloSampling::EME2: {
221 if(region == 0){ eta_index += 14; }
222 else if (region == 1){ eta_index += 57; }
225 case CaloSampling::EME3: { eta_index += 15;
break; }
226 case CaloSampling::HEC0:
227 case CaloSampling::HEC1:
228 case CaloSampling::HEC2:
229 case CaloSampling::HEC3: { eta_index += 15;
break; }
234 FindAndConnectTower(my_eTowerContainerRaw,sample,region,layer,pos_neg,eta_index,phi_index,ID,
et,prov,doPrint);
237 return StatusCode::SUCCESS;
252 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
256 bool doenergysplit =
false;
259 bool validcell =
true;
266 int towerID_Modifier = -999999999;
355 case CaloSampling::PreSamplerB: {
362 towereta = eta_index;
363 towerphi = phi_index;
366 if(pos_neg < 0){ towerID_Modifier = 300000; }
367 else if(pos_neg > 0){ towerID_Modifier = 400000; }
371 if(pos_neg < 0){ towerID_Modifier = 100000; }
372 else if(pos_neg > 0){ towerID_Modifier = 200000; }
378 case CaloSampling::EMB1:
379 case CaloSampling::EMB2: {
389 towereta = eta_index / 4;
390 towerphi = phi_index;
391 if(pos_neg < 0){ towerID_Modifier = 100000; }
392 else if(pos_neg > 0){ towerID_Modifier = 200000; }
394 else if (region == 1){
396 towerphi = phi_index;
397 if(pos_neg < 0){ towerID_Modifier = 300000; }
398 else if(pos_neg > 0){ towerID_Modifier = 400000; }
401 ATH_MSG_DEBUG(
"[CaloSampling::EMB1 or CaloSampling::EMB2] -> invalid 'region' value: " << region <<
" (Under investigation) ");
405 case CaloSampling::EMB1: {
406 iCell = (eta_index % 4) + 1;
410 case CaloSampling::EMB2: {
411 if (region == 0) { iCell = (eta_index % 4) + 5; }
412 else if (region == 1){ iCell = 5; }
417 ATH_MSG_DEBUG(
"CaloSampling::EMBX -> invalid sample for assigning iCell value! " << sample <<
" (Under investigation) ");
424 case CaloSampling::EMB3: {
430 towereta = eta_index;
431 towerphi = phi_index;
435 if(pos_neg < 0){ towerID_Modifier = 100000; }
436 else if(pos_neg > 0){ towerID_Modifier = 200000; }
441 case CaloSampling::PreSamplerE: {
447 towereta = eta_index;
448 towerphi = phi_index;
452 if(pos_neg < 0){ towerID_Modifier = 500000; }
453 else if(pos_neg > 0){ towerID_Modifier = 600000; }
457 case CaloSampling::EME1: {
481 towereta = eta_index;
482 towerphi = phi_index;
489 towereta = (eta_index / 4);
490 towerphi = phi_index;
492 iCell = (eta_index % 4) + 1;
498 towereta = (eta_index / 6);
499 towerphi = phi_index;
501 iCell = (eta_index % 6) + 1;
503 if(iCell == 1){ iCell = 1; doenergysplit =
false; }
504 else if( iCell == 2 ){ iCell = 1; doenergysplit =
true; }
505 else if( iCell == 3 ){ iCell = 2; doenergysplit =
false; }
506 else if( iCell == 4 ){ iCell = 3; doenergysplit =
false; }
507 else if( iCell == 5 ){ iCell = 3; doenergysplit =
true; }
508 else if( iCell == 6 ){ iCell = 4; doenergysplit =
false; }
532 towereta = (eta_index / 4);
533 towerphi = phi_index;
535 iCell = (eta_index % 4) + 1;
540 towereta = eta_index ;
541 towerphi = phi_index;
548 ATH_MSG_DEBUG(
"CaloSampling::EME1 -> invalid 'region' value: " << region <<
" (Under investigation) ");
555 if(pos_neg < 0){ towerID_Modifier = 500000; }
556 else if(pos_neg > 0){ towerID_Modifier = 600000; }
558 else if(region == 0){
560 if(pos_neg < 0){ towerID_Modifier = 300000; }
561 else if(pos_neg > 0){ towerID_Modifier = 400000; }
566 case CaloSampling::EME2: {
585 towereta = eta_index;
586 towerphi = phi_index;
594 towereta = (eta_index / 4);
595 towerphi = phi_index;
597 iCell = (eta_index % 4) + 5;
602 ATH_MSG_DEBUG(
"CaloSampling::EME2 -> invalid 'region' value: " << region <<
" (Under investigation) ");
610 if(pos_neg < 0){ towerID_Modifier = 300000; }
611 else if(pos_neg > 0){ towerID_Modifier = 400000; }
614 if( (eta_index / 4) < 15 ){
615 if(pos_neg < 0){ towerID_Modifier = 300000; }
616 else if(pos_neg > 0){ towerID_Modifier = 400000; }
619 if(pos_neg < 0){ towerID_Modifier = 500000; }
620 else if(pos_neg > 0){ towerID_Modifier = 600000; }
626 case CaloSampling::EME3: {
641 towereta = eta_index;
642 towerphi = phi_index;
649 ATH_MSG_DEBUG(
"CaloSampling::EME3 -> invalid 'region' value: " << region <<
" (Under investigation) ");
655 if(pos_neg < 0){ towerID_Modifier = 500000; }
656 else if(pos_neg > 0){ towerID_Modifier = 600000; }
661 case CaloSampling::HEC0:
662 case CaloSampling::HEC1:
663 case CaloSampling::HEC2:
664 case CaloSampling::HEC3: {
673 towereta = eta_index;
674 towerphi = phi_index;
679 case CaloSampling::HEC0: { iCell = 10;
break; }
680 case CaloSampling::HEC1: { iCell = 11;
break; }
681 case CaloSampling::HEC2: { iCell = 12;
break; }
682 case CaloSampling::HEC3: { iCell = 13;
break; }
685 ATH_MSG_DEBUG(
"CaloSampling::HECX -> invalid sample for assigning iCell value! " << sample <<
" (Under investigation) ");
701 if(pos_neg < 0){ towerID_Modifier = 500000; }
702 else if(pos_neg > 0){ towerID_Modifier = 600000; }
706 case CaloSampling::TileBar0:
707 case CaloSampling::TileBar1:
708 case CaloSampling::TileBar2: {
714 case CaloSampling::TileGap1:
715 case CaloSampling::TileGap2:
716 case CaloSampling::TileGap3: {
721 case CaloSampling::TileExt0:
722 case CaloSampling::TileExt1:
723 case CaloSampling::TileExt2: {
728 case CaloSampling::FCAL0:
729 case CaloSampling::FCAL1:
730 case CaloSampling::FCAL2: {
735 case CaloSampling::MINIFCAL0:
736 case CaloSampling::MINIFCAL1:
737 case CaloSampling::MINIFCAL2:
738 case CaloSampling::MINIFCAL3: {
743 case CaloSampling::Unknown: {
749 ATH_MSG_DEBUG(
"\n==== eSuperCellTowerMapper ============ Supercell has invalid CaloSampling value: " << sample <<
" (Needs investigation). Please report this!");
760 if (iETower < 200000 || (iETower > 300000 && iETower < 400000) || (iETower > 500000 && iETower < 600000)) {
763 if (doenergysplit) iCell -= 1;
764 }
else if (layer == 2) {
770 int etaIndex = (iETower%100000)/64;
771 if (iETower > 500000 && etaIndex == 24 && iCell < 5) iCell = 0;
774 PrintCellSpec(sample, layer, region, eta_index, phi_index, pos_neg, iETower, iCell, prov, ID, doenergysplit);
790 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)
793 std::string sampleName =
"";
796 case CaloSampling::PreSamplerB: { sampleName =
"PreSamplerB";
break; }
797 case CaloSampling::EMB1: { sampleName =
"EMB1";
break; }
798 case CaloSampling::EMB2: { sampleName =
"EMB2";
break; }
799 case CaloSampling::EMB3: { sampleName =
"EMB3";
break; }
800 case CaloSampling::PreSamplerE: { sampleName =
"PreSamplerE";
break; }
801 case CaloSampling::EME1: { sampleName =
"EME1";
break; }
802 case CaloSampling::EME2: { sampleName =
"EME2";
break; }
803 case CaloSampling::EME3: { sampleName =
"EME3";
break; }
804 case CaloSampling::HEC0: { sampleName =
"HEC0";
break; }
805 case CaloSampling::HEC1: { sampleName =
"HEC1";
break; }
806 case CaloSampling::HEC2: { sampleName =
"HEC2";
break; }
807 case CaloSampling::HEC3: { sampleName =
"HEC3";
break; }
809 ATH_MSG_DEBUG(
"\n==== eSuperCellTowerMapper ============ Supercell has invalid CaloSampling value: " << sample <<
" (Needs investigation). Please report this!");
815 <<
"\tSample: " << sample
816 <<
"\tLayer: " << layer
817 <<
"\tRegion: " << region
818 <<
"\tEta_Index: " << eta_index
819 <<
"\tPhi_Index: " << phi_index
820 <<
"\tPosNeg: " << pos_neg
821 <<
"\tiETower: " << iETower
822 <<
"\tiCell: " << iCell
823 <<
"\tDoEnergySplit: " << doenergysplit
824 <<
"\tProvenance: " << prov
832 std::string sampleName =
"";
834 case CaloSampling::PreSamplerB: { sampleName =
"PreSamplerB";
break; }
835 case CaloSampling::EMB1: { sampleName =
"EMB1";
break; }
836 case CaloSampling::EMB2: { sampleName =
"EMB2";
break; }
837 case CaloSampling::EMB3: { sampleName =
"EMB3";
break; }
838 case CaloSampling::PreSamplerE: { sampleName =
"PreSamplerE";
break; }
839 case CaloSampling::EME1: { sampleName =
"EME1";
break; }
840 case CaloSampling::EME2: { sampleName =
"EME2";
break; }
841 case CaloSampling::EME3: { sampleName =
"EME3";
break; }
842 case CaloSampling::HEC0: { sampleName =
"HEC0";
break; }
843 case CaloSampling::HEC1: { sampleName =
"HEC1";
break; }
844 case CaloSampling::HEC2: { sampleName =
"HEC2";
break; }
845 case CaloSampling::HEC3: { sampleName =
"HEC3";
break; }
846 case CaloSampling::FCAL0: { sampleName =
"FCAL0";
break; }
847 case CaloSampling::FCAL1: { sampleName =
"FCAL1";
break; }
848 case CaloSampling::FCAL2: { sampleName =
"FCAL2";
break; }
850 ATH_MSG_DEBUG(
"\n==== jSuperCellTowerMapper ============ Supercell has invalid CaloSampling value: " << sample <<
" (Needs investigation). Please report this!");