13 #include "GaudiKernel/MsgStream.h"
25 declareInterface<IgSuperCellTowerMapper>(
this);
39 return StatusCode::SUCCESS;
45 static constexpr
float delta_eta = 0.1;
48 if(!triggerTowerCollection.
isValid()){
50 return StatusCode::FAILURE;
54 for(
auto eachTower : *triggerTowerCollection) {
56 if(std::abs(eachTower->eta())<1.5 && eachTower->sampling()==1) {
58 int tower_iphi = tile_iphi/2;
59 int tile_ieta =
int(std::abs(eachTower->eta())/delta_eta);
60 int tower_ieta = tile_ieta/2;
63 int towerID_Modifier{100000};
66 if (eachTower->eta() > 0) {
68 towerID_Modifier = 200000;
71 if(tower_ieta * etaSign == -7) {
72 towerID_Modifier = 300000;
75 else if (tower_ieta * etaSign == 7) {
76 towerID_Modifier = 400000;
81 if((targetTower = my_gTowerContainerRaw->findTower(towerid)))
84 targetTower->
addET(
static_cast<int>(eachTower->jepET()) * 1000., 1);
87 ATH_MSG_WARNING(
"\n==== gSuperCellTowerMapper ============ Tower id is officially unknown - it will be ignored. (Needs investigation). Please report this!");
91 return StatusCode::SUCCESS;
104 if(!scellsCollection.
isValid()){
106 return StatusCode::FAILURE;
120 const int phi_index = idHelper->
phi(
ID);
122 int prov = (
cell)->provenance();
127 int SCprov = prov&0xFFF;
128 bool isMasked = (SCprov&0x80)==0x80;
138 for (
auto gTower : *my_gTowerContainerRaw)
145 return StatusCode::SUCCESS;
152 LVL1::gTower * tmpTower = my_gTowerContainerRaw->findTower(iGTower);
165 bool validcell =
true;
172 int towerID_Modifier = -999999999;
186 towerphi = phi_index / 2;
191 if(pos_neg < 0){ towerID_Modifier = 300000; }
192 else if(pos_neg > 0){ towerID_Modifier = 400000; }
195 if(pos_neg < 0){ towerID_Modifier = 100000; }
196 else if(pos_neg > 0){ towerID_Modifier = 200000; }
208 towerphi = phi_index / 2;
209 if(pos_neg < 0){ towerID_Modifier = 100000; }
210 else if(pos_neg > 0){ towerID_Modifier = 200000; }
212 else if (region == 1){
214 towerphi = phi_index/2;
215 if(pos_neg < 0){ towerID_Modifier = 300000; }
216 else if(pos_neg > 0){ towerID_Modifier = 400000; }
219 ATH_MSG_DEBUG(
"[CaloSampling::EMB1 or CaloSampling::EMB2] -> invalid 'region' value: " << region <<
" (Under investigation) ");
230 ATH_MSG_DEBUG(
"CaloSampling::EMBX -> invalid sample for assigning iCell value! " <<
sample <<
" (Under investigation) ");
241 towerphi = phi_index/2;
244 if(pos_neg < 0){ towerID_Modifier = 100000; }
245 else if(pos_neg > 0){ towerID_Modifier = 200000; }
256 towerphi = phi_index / 2;
260 if(pos_neg < 0){ towerID_Modifier = 300000; }
261 else if(pos_neg > 0){ towerID_Modifier = 400000; }
263 else if (towereta != 7){
264 if(pos_neg < 0){ towerID_Modifier = 500000; }
265 else if(pos_neg > 0){ towerID_Modifier = 600000; }
278 towerphi = phi_index/2;
286 towerphi = phi_index/2;
294 towerphi = phi_index/2;
301 else {towereta = 11;}
302 towerphi = phi_index/2;
309 towerphi = phi_index/2;
314 ATH_MSG_DEBUG(
"CaloSampling::EME1 -> invalid 'region' value: " << region <<
" (Under investigation) ");
321 if(pos_neg < 0){ towerID_Modifier = 300000; }
322 else if(pos_neg > 0){ towerID_Modifier = 400000; }
324 else if (towereta != 7){
325 if(pos_neg < 0){ towerID_Modifier = 500000; }
326 else if(pos_neg > 0){ towerID_Modifier = 600000; }
338 if(abs(pos_neg) == 2){
340 towerphi = phi_index/2;
342 else if(abs(pos_neg) == 3){
345 towerphi = phi_index;
349 towerphi = phi_index;
353 towerphi = phi_index;
359 if(abs(pos_neg) == 2){
360 towerphi = phi_index/2;
364 else if (
eta_index < 31) {towereta = 10;}
365 else if (
eta_index < 43) {towereta = 11;}
367 else if(abs(pos_neg) == 3){
368 towerphi = phi_index;
375 ATH_MSG_DEBUG(
"CaloSampling::EME2 -> invalid 'region' value: " << region <<
" (Under investigation) ");
382 if(pos_neg < 0){ towerID_Modifier = 300000; }
383 else if(pos_neg > 0){ towerID_Modifier = 400000; }
385 else if (towereta == 12 || towereta == 13 || towereta == 14 || towereta == 15){
386 if(pos_neg < 0){ towerID_Modifier = 700000; }
387 else if(pos_neg > 0){ towerID_Modifier = 800000; }
390 if(pos_neg < 0){ towerID_Modifier = 500000; }
391 else if(pos_neg > 0){ towerID_Modifier = 600000; }
401 if(abs(pos_neg) == 2){
402 towerphi = phi_index/2;
420 else if(abs(pos_neg) == 3){
423 towerphi = phi_index;
427 towerphi = phi_index;
431 towerphi = phi_index;
437 towerphi = phi_index;
442 ATH_MSG_DEBUG(
"CaloSampling::EME3 -> invalid 'region' value: " << region <<
" (Under investigation) ");
449 if(pos_neg < 0){ towerID_Modifier = 300000; }
450 else if(pos_neg > 0){ towerID_Modifier = 400000; }
452 else if (towereta == 12 || towereta == 13 || towereta == 14 || towereta == 15){
453 if(pos_neg < 0){ towerID_Modifier = 700000; }
454 else if(pos_neg > 0){ towerID_Modifier = 800000; }
457 if(pos_neg < 0){ towerID_Modifier = 500000; }
458 else if(pos_neg > 0){ towerID_Modifier = 600000; }
467 if(abs(pos_neg) == 2){
468 towerphi = phi_index/2;
490 if(abs(pos_neg) == 2){
493 towerphi = phi_index;
497 towerphi = phi_index;
501 towerphi = phi_index;
505 towerphi = phi_index;
513 ATH_MSG_DEBUG(
"CaloSampling::HEC0 -> invalid 'region' value: " << region <<
" (Under investigation) ");
522 if(pos_neg < 0){ towerID_Modifier = 300000; }
523 else if(pos_neg > 0){ towerID_Modifier = 400000; }
525 else if (towereta == 12 || towereta == 13 || towereta == 14 || towereta == 15){
526 if(pos_neg < 0){ towerID_Modifier = 700000; }
527 else if(pos_neg > 0){ towerID_Modifier = 800000; }
531 if(pos_neg < 0){ towerID_Modifier = 500000; }
532 else if(pos_neg > 0){ towerID_Modifier = 600000; }
542 ATH_MSG_DEBUG(
"\n==== gSuperCellTowerMapper ============ Supercell is from Tile Barrel - it will be ignored.");
548 ATH_MSG_DEBUG(
"\n==== gSuperCellTowerMapper ============ Supercell is from Tile Gap (ITC and scintillator) - it will be ignored.");
555 ATH_MSG_DEBUG(
"\n==== gSuperCellTowerMapper ============ Supercell is from Tile Extended Barrel - it will be ignored.");
561 towerphi = phi_index;
575 if(pos_neg < 0){ towerID_Modifier = 900000; }
576 else if(pos_neg > 0){ towerID_Modifier = 1000000; }
582 towerphi = phi_index;
596 if(pos_neg < 0){ towerID_Modifier = 900000; }
597 else if(pos_neg > 0){ towerID_Modifier = 1000000; }
603 towerphi = phi_index;
614 if(pos_neg < 0){ towerID_Modifier = 900000; }
615 else if(pos_neg > 0){ towerID_Modifier = 1000000; }
620 case CaloSampling::MINIFCAL0:
621 case CaloSampling::MINIFCAL1:
622 case CaloSampling::MINIFCAL2:
623 case CaloSampling::MINIFCAL3: {
624 ATH_MSG_DEBUG(
"\n==== gSuperCellTowerMapper ============ Supercells is from MiniFCAL - it will be ignored.");
629 ATH_MSG_WARNING(
"\n==== gSuperCellTowerMapper ============ Supercell sampling is officially unknown - it will be ignored. (Needs investigation). Please report this!");
634 ATH_MSG_DEBUG(
"\n==== gSuperCellTowerMapper ============ Supercell has invalid CaloSampling value: " <<
sample <<
" (Needs investigation). Please report this!");
643 PrintCellSpec(
sample, region,
eta_index, phi_index, pos_neg, towereta, towerphi, nphi, towerID_Modifier, iGTower, prov,
ID);
657 return (towerphi + (nphi * towereta));
662 const int eta_index,
const int phi_index,
const int pos_neg,
663 int towereta,
int towerphi,
int nphi,
int towerID_Modifier,
667 std::string sampleName =
"";
696 ATH_MSG_DEBUG(
"\n==== gSuperCellTowerMapper ============ Supercell has invalid CaloSampling value: " <<
sample <<
" (Needs investigation). Please report this!");
703 <<
"\tRegion: " << region
705 <<
"\tPhi_Index: " << phi_index
706 <<
"\tPosNeg: " << pos_neg
707 <<
"\tgTower Eta: " << towereta
708 <<
"\tgTower Phi: " << towerphi
709 <<
"\tgTower nphi: " << nphi
710 <<
"\tgTower modifier: " << towerID_Modifier
711 <<
"\tiGTower: " << iGTower
712 <<
"\tProvenance: " << prov