7 #include "GaudiKernel/MsgStream.h"
25 declareInterface<IeSuperCellTowerMapper>(
this);
40 return StatusCode::SUCCESS;
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;
108 int SCprov = (
cell)->provenance()&0xFFF;
109 bool isMasked = (SCprov&0x80)==0x80;
111 if (isMasked)
continue;
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) {
153 const int phi_index = idHelper->
phi(
ID);
154 int prov = (
cell)->provenance();
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; }
221 else if (region == 1){
eta_index += 57; }
233 FindAndConnectTower(my_eTowerContainerRaw,
sample,region,
layer,pos_neg,
eta_index,phi_index,
ID,
et,prov,doPrint);
236 return StatusCode::SUCCESS;
243 LVL1::eTower * tmpTower = my_eTowerContainerRaw->findTower(iETower);
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;
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; }
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) ");
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) ");
430 towerphi = phi_index;
434 if(pos_neg < 0){ towerID_Modifier = 100000; }
435 else if(pos_neg > 0){ towerID_Modifier = 200000; }
447 towerphi = phi_index;
451 if(pos_neg < 0){ towerID_Modifier = 500000; }
452 else if(pos_neg > 0){ towerID_Modifier = 600000; }
481 towerphi = phi_index;
489 towerphi = phi_index;
498 towerphi = phi_index;
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; }
532 towerphi = phi_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; }
585 towerphi = phi_index;
594 towerphi = phi_index;
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; }
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; }
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; }
673 towerphi = phi_index;
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; }
733 case CaloSampling::MINIFCAL0:
734 case CaloSampling::MINIFCAL1:
735 case CaloSampling::MINIFCAL2:
736 case CaloSampling::MINIFCAL3: {
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);
785 return (towerphi + (64 * towereta));
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)
807 ATH_MSG_DEBUG(
"\n==== eSuperCellTowerMapper ============ Supercell has invalid CaloSampling value: " <<
sample <<
" (Needs investigation). Please report this!");
814 <<
"\tLayer: " <<
layer
815 <<
"\tRegion: " << region
817 <<
"\tPhi_Index: " << phi_index
818 <<
"\tPosNeg: " << pos_neg
819 <<
"\tiETower: " << iETower
820 <<
"\tiCell: " << iCell
821 <<
"\tDoEnergySplit: " << doenergysplit
822 <<
"\tProvenance: " << prov
848 ATH_MSG_DEBUG(
"\n==== jSuperCellTowerMapper ============ Supercell has invalid CaloSampling value: " <<
sample <<
" (Needs investigation). Please report this!");