12 #include "GaudiKernel/MsgStream.h"
30 declareInterface<IeSuperCellTowerMapper>(
this);
45 return StatusCode::SUCCESS;
51 static constexpr
float pi_over_32 =
M_PI/32;
54 if(!triggerTowerCollection.
isValid()){
56 return StatusCode::FAILURE;
60 for(
auto eachTower : *triggerTowerCollection) {
61 if(std::abs(eachTower->eta())<1.5 && eachTower->sampling()==1) {
62 int i_phi =
int(eachTower->phi()/pi_over_32);
64 int towerID_Modifier{100000};
65 if (eachTower->eta() > 0) {
67 towerID_Modifier = 200000;
69 int i_eta =
int(eachTower->eta() * 10) * etaSign;
70 if(i_eta * etaSign == -14) {
71 towerID_Modifier = 300000;
72 }
else if (i_eta * etaSign == 14) {
73 towerID_Modifier = 400000;
78 if((targetTower = my_eTowerContainerRaw->findTower(towerid))) {
80 ATH_MSG_WARNING(
"\n==== eSuperCellTowerMapper ============ Hadronic layer energy filled more than once - it will be ignored. (Needs investigation). Please report this!");
82 targetTower->
setET(10,
int(eachTower->cpET()) * 500., 4);
84 ATH_MSG_WARNING(
"\n==== eSuperCellTowerMapper ============ Tower id is officially unknown - it will be ignored. (Needs investigation). Please report this!");
88 return StatusCode::SUCCESS;
102 if(!scellsCollection.
isValid()){
104 return StatusCode::FAILURE;
113 int SCprov = (
cell)->provenance()&0xFFF;
114 bool isMasked = (SCprov&0x80)==0x80;
116 if (isMasked)
continue;
124 if(abs(pos_neg) == 3){
continue; }
129 bool doenergysplit {
false };
143 }
else if (slot <= 4) {
145 }
else if (slot <= 8) {
147 }
else if (slot == 9) {
158 const int phi_index = idHelper->
phi(
ID);
159 int prov = (
cell)->provenance();
217 else if (region == 1){ }
218 else if (region == 2){
eta_index += 60; }
219 else if (region == 3){
eta_index += 108; }
220 else if (region == 4){
eta_index += 80; }
221 else if (region == 5){
eta_index += 24; }
226 else if (region == 1){
eta_index += 57; }
238 FindAndConnectTower(my_eTowerContainerRaw,
sample,region,
layer,pos_neg,
eta_index,phi_index,
ID,
et,prov,doPrint);
241 return StatusCode::SUCCESS;
248 LVL1::eTower * tmpTower = my_eTowerContainerRaw->findTower(iETower);
256 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
260 bool doenergysplit =
false;
263 bool validcell =
true;
270 int towerID_Modifier = -999999999;
367 towerphi = phi_index;
370 if(pos_neg < 0){ towerID_Modifier = 300000; }
371 else if(pos_neg > 0){ towerID_Modifier = 400000; }
375 if(pos_neg < 0){ towerID_Modifier = 100000; }
376 else if(pos_neg > 0){ towerID_Modifier = 200000; }
394 towerphi = phi_index;
395 if(pos_neg < 0){ towerID_Modifier = 100000; }
396 else if(pos_neg > 0){ towerID_Modifier = 200000; }
398 else if (region == 1){
400 towerphi = phi_index;
401 if(pos_neg < 0){ towerID_Modifier = 300000; }
402 else if(pos_neg > 0){ towerID_Modifier = 400000; }
405 ATH_MSG_DEBUG(
"[CaloSampling::EMB1 or CaloSampling::EMB2] -> invalid 'region' value: " << region <<
" (Under investigation) ");
415 if (region == 0) { iCell = (
eta_index % 4) + 5; }
416 else if (region == 1){ iCell = 5; }
421 ATH_MSG_DEBUG(
"CaloSampling::EMBX -> invalid sample for assigning iCell value! " <<
sample <<
" (Under investigation) ");
435 towerphi = phi_index;
439 if(pos_neg < 0){ towerID_Modifier = 100000; }
440 else if(pos_neg > 0){ towerID_Modifier = 200000; }
452 towerphi = phi_index;
456 if(pos_neg < 0){ towerID_Modifier = 500000; }
457 else if(pos_neg > 0){ towerID_Modifier = 600000; }
486 towerphi = phi_index;
494 towerphi = phi_index;
503 towerphi = phi_index;
507 if(iCell == 1){ iCell = 1; doenergysplit =
false; }
508 else if( iCell == 2 ){ iCell = 1; doenergysplit =
true; }
509 else if( iCell == 3 ){ iCell = 2; doenergysplit =
false; }
510 else if( iCell == 4 ){ iCell = 3; doenergysplit =
false; }
511 else if( iCell == 5 ){ iCell = 3; doenergysplit =
true; }
512 else if( iCell == 6 ){ iCell = 4; doenergysplit =
false; }
537 towerphi = phi_index;
545 towerphi = phi_index;
552 ATH_MSG_DEBUG(
"CaloSampling::EME1 -> invalid 'region' value: " << region <<
" (Under investigation) ");
559 if(pos_neg < 0){ towerID_Modifier = 500000; }
560 else if(pos_neg > 0){ towerID_Modifier = 600000; }
562 else if(region == 0){
564 if(pos_neg < 0){ towerID_Modifier = 300000; }
565 else if(pos_neg > 0){ towerID_Modifier = 400000; }
590 towerphi = phi_index;
599 towerphi = phi_index;
606 ATH_MSG_DEBUG(
"CaloSampling::EME2 -> invalid 'region' value: " << region <<
" (Under investigation) ");
614 if(pos_neg < 0){ towerID_Modifier = 300000; }
615 else if(pos_neg > 0){ towerID_Modifier = 400000; }
619 if(pos_neg < 0){ towerID_Modifier = 300000; }
620 else if(pos_neg > 0){ towerID_Modifier = 400000; }
623 if(pos_neg < 0){ towerID_Modifier = 500000; }
624 else if(pos_neg > 0){ towerID_Modifier = 600000; }
646 towerphi = phi_index;
653 ATH_MSG_DEBUG(
"CaloSampling::EME3 -> invalid 'region' value: " << region <<
" (Under investigation) ");
659 if(pos_neg < 0){ towerID_Modifier = 500000; }
660 else if(pos_neg > 0){ towerID_Modifier = 600000; }
678 towerphi = phi_index;
688 ATH_MSG_DEBUG(
"CaloSampling::HECX -> invalid sample for assigning iCell value! " <<
sample <<
" (Under investigation) ");
704 if(pos_neg < 0){ towerID_Modifier = 500000; }
705 else if(pos_neg > 0){ towerID_Modifier = 600000; }
738 case CaloSampling::MINIFCAL0:
739 case CaloSampling::MINIFCAL1:
740 case CaloSampling::MINIFCAL2:
741 case CaloSampling::MINIFCAL3: {
752 ATH_MSG_DEBUG(
"\n==== eSuperCellTowerMapper ============ Supercell has invalid CaloSampling value: " <<
sample <<
" (Needs investigation). Please report this!");
763 if (iETower < 200000 || (iETower > 300000 && iETower < 400000) || (iETower > 500000 && iETower < 600000)) {
766 if (doenergysplit) iCell -= 1;
767 }
else if (
layer == 2) {
773 int etaIndex = (iETower%100000)/64;
774 if (iETower > 500000 && etaIndex == 24 && iCell < 5) iCell = 0;
777 PrintCellSpec(
sample,
layer, region,
eta_index, phi_index, pos_neg, iETower, iCell, prov,
ID, doenergysplit);
790 return (towerphi + (64 * towereta));
793 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)
796 std::string sampleName =
"";
812 ATH_MSG_DEBUG(
"\n==== eSuperCellTowerMapper ============ Supercell has invalid CaloSampling value: " <<
sample <<
" (Needs investigation). Please report this!");
819 <<
"\tLayer: " <<
layer
820 <<
"\tRegion: " << region
822 <<
"\tPhi_Index: " << phi_index
823 <<
"\tPosNeg: " << pos_neg
824 <<
"\tiETower: " << iETower
825 <<
"\tiCell: " << iCell
826 <<
"\tDoEnergySplit: " << doenergysplit
827 <<
"\tProvenance: " << prov
835 std::string sampleName =
"";
853 ATH_MSG_DEBUG(
"\n==== jSuperCellTowerMapper ============ Supercell has invalid CaloSampling value: " <<
sample <<
" (Needs investigation). Please report this!");