48 std::vector<LVL1::EFexEMClusterTool::AlgResult>
 
   54    std::vector<AlgResult> baselineClusters;
 
   55    for (
auto & cluster : looseAlg(scells, TTs, idHelper, tileIDHelper, tileCellCon) ) {
 
   58       cluster.passClusterEnergy = cluster.clusterET >= m_clustET_thresh; 
 
   61       cluster.passREta = cluster.rEta <= m_REta_thresh || 
 
   62                          cluster.clusterET > m_clustET_NoIso_thresh; 
 
   65       cluster.passRHad = cluster.rHad <= m_RHad_thresh || 
 
   66                          cluster.clusterET > m_clustET_NoIso_thresh; 
 
   69       cluster.passWstot = cluster.l1Width < m_L1Width_thresh ||  
 
   70                           std::abs(cluster.eta) > m_eta_dropL1Width || 
 
   71                           cluster.clusterET > m_clustET_NoIso_thresh; 
 
   73       bool passBaseLineSelection = cluster.passClusterEnergy &&
 
   78       if (applyBaselineCuts and not passBaseLineSelection ) {
 
   82       baselineClusters.push_back(cluster);
 
   84    return baselineClusters;
 
   87 std::vector<LVL1::EFexEMClusterTool::AlgResult>
 
   92    std::vector<AlgResult> 
result;
 
   94    std::vector<const CaloCell*> potentialCentres;
 
   95    for (
auto ithCell : *SCs) {
 
   96       if ( !( std::abs(CaloCellET(ithCell, m_nominalDigitization, m_nominalNoise_thresh)) > 0) ) {
 
  100       if (idHelper->
sampling(ithID) != 2) {
 
  104       if (idHelper->
sub_calo(ithID) != 0) {
 
  108       bool inEfexCoverage = 
false;
 
  109       if ( std::abs(idHelper->
pos_neg(ithID)) < 3) {
 
  110          inEfexCoverage = 
true;
 
  113       if (!inEfexCoverage) {
 
  117       if (localMax(SCs, ithCell, idHelper, m_nominalDigitization, m_nominalNoise_thresh)) {
 
  118          potentialCentres.push_back(ithCell);
 
  123    for (
auto ithCell : potentialCentres){
 
  125       for (
auto jthCell : potentialCentres){
 
  126          if (jthCell == ithCell) 
continue;
 
  127          if (!SameTT(ithCell, jthCell, idHelper)) 
continue;
 
  128          float ithEt = CaloCellET(ithCell, m_nominalDigitization, m_nominalNoise_thresh);
 
  129          float jthEt = CaloCellET(jthCell, m_nominalDigitization, m_nominalNoise_thresh);
 
  130          if (ithEt > jthEt) 
continue;
 
  131          if (ithEt == jthEt && ithCell->eta() > jthCell->eta()) 
continue;
 
  135       float clustET = EMClusET(ithCell, m_etaWidth_TDRCluster, m_phiWidth_TDRCluster, SCs, idHelper, m_nominalDigitization, m_nominalNoise_thresh)/1000.;
 
  136       if (clustET < m_clustET_looseAlg_thresh) useSC = 
false; 
 
  141          float ithEta = ithCell->eta();
 
  142          float ithPhi = ithCell->phi();
 
  143          float ithREta = REta( ithCell, m_etaWidth_REtaIsolation_num, m_phiWidth_REtaIsolation_num, m_etaWidth_REtaIsolation_den,
 
  144                                m_phiWidth_REtaIsolation_den, SCs, idHelper, m_nominalDigitization, m_nominalNoise_thresh); 
 
  145          if (!m_use_tileCells) {
 
  146             ithRHad = RHad(ithCell, m_etaEMWidth_RHadIsolation, m_phiEMWidth_RHadIsolation, SCs, TTs, idHelper, m_nominalDigitization, m_nominalNoise_thresh, HadET);
 
  148             ithRHad = RHadTile(ithCell, m_etaEMWidth_RHadIsolation, m_phiEMWidth_RHadIsolation, SCs, idHelper, m_nominalDigitization, m_nominalNoise_thresh, tileIDHelper, tileCellCon, m_tileNoise_tresh, HadET);
 
  151          float ithL1Width    = L1Width( ithCell, m_etaWidth_wstotIsolation, m_phiWidth_wstotIsolation, SCs, 
 
  152                                         idHelper, m_nominalDigitization, m_nominalNoise_thresh);
 
  153          float L2ClusterET33 = L2clusET( ithCell, 3, 3, SCs, idHelper, m_nominalDigitization, m_nominalNoise_thresh)/1
e3;
 
  154          float L2ClusterET37 = L2clusET( ithCell, 7, 3, SCs, idHelper, m_nominalDigitization, m_nominalNoise_thresh)/1
e3;
 
  156          float ithREtaL12{-1};
 
  158             ithREtaL12 = REtaL12(ithCell, m_etaWidth_REtaIsolation_num, m_phiWidth_REtaIsolation_num,
 
  159                                  m_etaWidth_REtaIsolation_den, m_phiWidth_REtaIsolation_den, SCs, idHelper,
 
  160                                  m_nominalDigitization, m_nominalNoise_thresh);
 
  162          result.push_back(
AlgResult{ithEta, ithPhi, clustET, ithREta, ithRHad, ithL1Width, HadET, L2ClusterET33, L2ClusterET37, ithREtaL12});
 
  175    if (inputCell==
nullptr) 
return 0.;
 
  177    if ( m_useProvenance ) {
 
  178       bool correctProv = (inputCell->
provenance() & m_qualBitMask);
 
  179       if (!correctProv) 
return 0.;
 
  182    float inputCell_energy = inputCell->
energy();
 
  183    float inputCell_eta = inputCell->
eta();
 
  184    float inputCell_ET = inputCell_energy / cosh(inputCell_eta);
 
  186    bool allowNegs = 
false;
 
  187    if (digitScale < 0.){
 
  188       digitScale = std::abs(digitScale);
 
  191    if (inputCell_ET==0) 
return 0.;
 
  192    else if (digitScale==0) 
return inputCell_ET;
 
  193    if (allowNegs || inputCell_ET>0.){
 
  195       float posOrNeg = inputCell_ET / std::abs(inputCell_ET);
 
  196       inputCell_ET = std::abs(inputCell_ET);
 
  198       if (digitScale == 0){
 
  199          if (inputCell_ET>digitThreshold) 
return inputCell_ET*posOrNeg;
 
  204          float divET = inputCell_ET / digitScale;
 
  206          float result = digitScale * roundET;
 
  207          if (digitThreshold == 0) 
return result*posOrNeg;
 
  208          else if (
result >= digitThreshold) 
return result*posOrNeg;
 
  219    int phi1 = idHelper->
phi(ID1);
 
  221    int phi2 = idHelper->
phi(ID2);
 
  225    int pn1 = idHelper->
pos_neg(ID1);
 
  226    int pn2 = idHelper->
pos_neg(ID2);
 
  232       int reg1 = idHelper->
region(ID1);
 
  233       int reg2 = idHelper->
region(ID2);
 
  237       int etaDiv1 = idHelper->
eta(ID1)/4;
 
  238       int etaDiv2 = idHelper->
eta(ID2)/4;
 
  239       if (etaDiv1 == etaDiv2) {
 
  247    else if (abs(pn1)==2){
 
  248       int reg1 = idHelper->
region(ID1);
 
  249       int reg2 = idHelper->
region(ID2);
 
  252       if ((reg1 == 0 && reg2 == 1 && 
eta2 < 3 ) || (reg2 == 0 && reg1 == 1 && 
eta1 < 3 )) 
return true;
 
  254          if (reg1 != reg2) 
return false;
 
  255          int etaDiv1 = (idHelper->
eta(ID1) - 3)/4;
 
  256          int etaDiv2 = (idHelper->
eta(ID2) - 3)/4;
 
  257          if (etaDiv1 == etaDiv2) 
return true;
 
  268    return localMax(inputContainer, inputCell, 0, idHelper, digitScale, digitThreshold);
 
  275    if (inputCell == 
nullptr) 
return false;
 
  278    const int sub_calo = idHelper->
sub_calo(inputID);
 
  279    const int pos_neg = idHelper->
pos_neg(inputID);
 
  280    if (!(sub_calo == 0 || sub_calo == 1) || !(abs(pos_neg) < 4)){
 
  284    double seedCandidateEnergy = CaloCellET(inputCell, digitScale, digitThreshold);
 
  285    int nCellsMoreEnergetic = 0;
 
  286    const CaloCell* leftCell = NextEtaCell(inputCell, 
true, inputContainer, idHelper); 
 
  287    if (leftCell != 
nullptr){
 
  288       double leftEnergy = CaloCellET(leftCell, digitScale, 0.);
 
  289       if (leftEnergy>seedCandidateEnergy)  nCellsMoreEnergetic++;
 
  291    const CaloCell* rightCell = NextEtaCell(inputCell, 
false, inputContainer, idHelper); 
 
  292    if (rightCell != 
nullptr){
 
  293       double rightEnergy = CaloCellET(rightCell, digitScale, 0.);
 
  294       if (rightEnergy>=seedCandidateEnergy)  nCellsMoreEnergetic++;
 
  296    const CaloCell* upCell = NextPhiCell(inputCell, 
true, inputContainer, idHelper);
 
  297    if (upCell != 
nullptr){
 
  298       double upEnergy = CaloCellET(upCell, digitScale, 0.);
 
  299       if (upEnergy>=seedCandidateEnergy) nCellsMoreEnergetic++;
 
  301    const CaloCell* downCell = NextPhiCell(inputCell, 
false, inputContainer, idHelper);
 
  302    if (downCell != 
nullptr){
 
  303       double downEnergy = CaloCellET(downCell, digitScale, 0.);
 
  304       if (downEnergy>seedCandidateEnergy) nCellsMoreEnergetic++;
 
  306    if (upCell != 
nullptr){
 
  307       const CaloCell* upRightCell = NextEtaCell(upCell, 
false, inputContainer, idHelper);
 
  308       if (upRightCell != 
nullptr){
 
  309          double upRightEnergy = CaloCellET(upRightCell, digitScale, 0.);
 
  310          if (upRightEnergy>=seedCandidateEnergy) nCellsMoreEnergetic++;
 
  312       const CaloCell* upLeftCell = NextEtaCell(upCell, 
true, inputContainer, idHelper);
 
  313       if (upLeftCell != 
nullptr){
 
  314          double upLeftEnergy = CaloCellET(upLeftCell, digitScale, 0.);
 
  315          if (upLeftEnergy>=seedCandidateEnergy) nCellsMoreEnergetic++;
 
  318    if (downCell != 
nullptr){
 
  319       const CaloCell* downRightCell = NextEtaCell(downCell, 
false, inputContainer, idHelper);
 
  320       if (downRightCell != 
nullptr){
 
  321          double downRightEnergy = CaloCellET(downRightCell, digitScale, 0.);
 
  322          if (downRightEnergy>seedCandidateEnergy) nCellsMoreEnergetic++;
 
  324       const CaloCell* downLeftCell = NextEtaCell(downCell, 
true, inputContainer, idHelper);
 
  325       if (downLeftCell != 
nullptr){
 
  326          double downLeftEnergy = CaloCellET(downLeftCell, digitScale, 0.);
 
  327          if (downLeftEnergy>seedCandidateEnergy) nCellsMoreEnergetic++;
 
  331    if (nCellsMoreEnergetic <= numOthers) 
return true;
 
  338    if (inputCell==
nullptr) 
return;
 
  339    bool alreadyThere = 
false;
 
  340    for (
auto oCell : outputVector){
 
  342       else if (inputCell->
ID() == oCell->ID()) alreadyThere=
true;
 
  344    if (!alreadyThere) outputVector.push_back(inputCell);
 
  352    std::vector<const CaloCell*> fullClus = TDR_Clus(centreCell, etaWidth, 
phiWidth, scells, idHelper, digitScale,digitThresh);
 
  353    double EMcomp = sumVectorET(fullClus, digitScale, digitThresh);  
 
  354    bool EMcheck = checkDig(EMcomp, digitScale, digitThresh);
 
  355    if (!EMcheck) 
ATH_MSG_WARNING ( 
"EMcomp not digitised  " << EMcomp << 
"  " << digitScale << 
"  " << digitThresh);
 
  356    double total = EMcomp;
 
  365    if (etaWidth1 > etaWidth2) 
ATH_MSG_WARNING ( 
"REta: eta1 = " << etaWidth1 << 
", eta2 = " << etaWidth2);
 
  366    if (phiWidth1 > phiWidth2) 
ATH_MSG_WARNING ( 
"Rphi: phi1 = " << phiWidth1 << 
", phi2 = " << phiWidth2);
 
  368    double inner_ET = L2clusET(centreCell, etaWidth1, phiWidth1, scells, idHelper, digitScale, digitThresh);
 
  369    double outer_ET = L2clusET(centreCell, etaWidth2, phiWidth2, scells, idHelper, digitScale, digitThresh);
 
  372    if (inner_ET != 0. && outer_ET==0.) normal_REta = 0.;
 
  373    else if (inner_ET==0.) normal_REta = 0.;
 
  374    else normal_REta = inner_ET / outer_ET;
 
  375    if (normal_REta < 0) normal_REta = 0.;
 
  376    double my_REta = 1-normal_REta;
 
  384    std::vector<const CaloCell*> fullClus = TDR_Clus(centreCell, etaWidth, 
phiWidth, scells, idHelper, digitScale, digitThresh);
 
  385    double EMcomp = sumVectorET(fullClus, digitScale, digitThresh);
 
  386    double HCALcomp = HadronicET(L2cluster(centreCell, m_etaHadWidth_RHadIsolation, m_phiHadWidth_RHadIsolation, scells, idHelper, digitScale, digitThresh), scells, TTContainer, idHelper, digitScale, digitThresh);
 
  387    HadET = HCALcomp/1
e3;
 
  388    double result = HCALcomp/(EMcomp+HCALcomp);
 
  389    if (result < 0. || result > 1.){
 
  391       ATH_MSG_WARNING ( 
"fullClus count = " << fullClus.size() << 
", EMcomp = " << EMcomp << 
", HCALcomp = " << HCALcomp);
 
  399    for (
auto ithCell : tileCellVector){
 
  400       if (ithCell->ID() == inputCell->
ID()) isAlreadyThere = 
true;
 
  402    if (!isAlreadyThere) tileCellVector.push_back(inputCell);
 
  408    if (eIn <= 0) 
return 0.;
 
  409    float eOut = eIn/cosh(etaIn);
 
  410    if (tileNoiseThresh == 0.) 
return eOut;
 
  412       if (eOut > tileNoiseThresh) 
return eOut;
 
  420    float pos_neg = inEta/std::abs(inEta);
 
  425    if (((
int)(std::abs(inEta)*10)) % 2 == 0) isEven = 
true;
 
  428       if (inEta < 0.1) inPos = 0;
 
  429       else if (inEta > 0.8 && inEta < 0.9) inPos = 2;
 
  431          if (isEven) inPos = 0;
 
  437       if (inEta > -0.1) inPos = 1;
 
  438       else if (inEta > -0.9 && inEta < -0.8) inPos = 2;
 
  440          if (isEven) inPos = 1;
 
  452    std::vector<const CaloCell*> L2cells = L2cluster(centreCell, etaWidth, 
phiWidth, scells, idHelper,digitScale, digitThresh);
 
  458    float oldPhi = centreCell->
phi();
 
  460    std::vector<int> offsets;
 
  461    std::vector<const CaloCell*> frontLayerCells;
 
  462    for (
auto ithL2Cell : L2cells){
 
  464       unsigned int oldsize = frontLayerCells.size();
 
  466       fromLayer2toLayer1(scells, ithL2Cell, frontLayerCells, idHelper);
 
  468       unsigned int additions = frontLayerCells.size() - oldsize;
 
  470       float dPhi = std::abs(ithL2Cell->phi() - oldPhi);
 
  474          oldPhi = ithL2Cell->phi();
 
  477       int sign = (ithL2Cell->eta()-centreCell->
eta() > 0 ? 1 : -1);
 
  479       for (
unsigned int adds = 0; adds < additions; ++adds) offsets.push_back(
sign*((
counter+1)/2));
 
  484    float sumET = 0, sumET_Eta2=0;
 
  485    unsigned int cellCount = 0;
 
  490       int offset = (cellCount < offsets.size() ? offsets[cellCount] : -999);
 
  491       if (offset < -2 || offset > 2) {
 
  498       int pos_neg = idHelper->
pos_neg(cellID);
 
  499       int region = idHelper->
region(cellID);
 
  501       bool halfCell = 
false;
 
  505       float ithET = CaloCellET((*ithCell), digitScale, digitThresh);
 
  514          if ((
int)cellCount-1 >= 0 && offsets[cellCount-1] == 
offset) {
 
  515             auto ithPrev = std::prev(ithCell,1);
 
  516             int sign = ((*ithCell)->eta() > (*ithPrev)->eta() ? 1 : -1);
 
  518             if (abs(nextOffset) <= 2) sumET_Eta2 += 0.5*ithET*
pow(nextOffset,2);
 
  522       else if (cellCount+1 < offsets.size() && offsets[cellCount+1] == 
offset) {
 
  524          int sign = ((*ithCell)->eta() > (*ithNext)->eta() ? 1 : -1);
 
  526          if (abs(nextOffset) <= 2) sumET_Eta2 += 0.5*ithET*
pow(nextOffset,2);
 
  538    if (sumET > 0.) 
result = sumET_Eta2/sumET;
 
  546    return sumVectorET(L2cluster(centreCell, etaWidth, 
phiWidth, scells, idHelper, digitScale, digitThresh), digitScale, digitThresh);
 
  554    std::vector<float> outVec;
 
  556    std::vector<const CaloCell*> L2Cells = L2cluster(centreCell, etaWidth, 
phiWidth, scells, idHelper, digitScale, digitThresh);
 
  557    std::vector<const CaloCell*> fullClus = TDR_Clus(centreCell, m_etaHadWidth_RHadIsolation, m_phiHadWidth_RHadIsolation, scells, idHelper, digitScale, digitThresh);
 
  560    if (std::abs(centreCell->
eta()) < 1.57){
 
  561       const int barrel_ec = idHelper->
pos_neg(centreCell->
ID());
 
  563       if (std::abs(barrel_ec) == 2) isOW = 
true;
 
  564       std::vector<double> energyPerLayer = EnergyPerTileLayer(L2Cells, tileCellCon, tileIDHelper, isOW, tileNoiseThresh);
 
  565       if (energyPerLayer.size() > 0){
 
  566          for (
auto ithLayerEnergy : energyPerLayer){
 
  567             HadET += ithLayerEnergy;
 
  572       std::vector<const CaloCell*> HCAL_LAr_vector;
 
  573       for (
auto ithCell : L2Cells){
 
  574          if (std::abs(ithCell->eta()) > 2.5) 
continue; 
 
  575          const CaloCell* tempLArHad = matchingHCAL_LAr(ithCell, scells, idHelper);
 
  576          if (tempLArHad != 
nullptr) HCAL_LAr_vector.push_back(tempLArHad);
 
  578       for (
auto ithSC : HCAL_LAr_vector){
 
  579          HadET += CaloCellET(ithSC, digitScale, digitThresh);
 
  582    HadronicET = HadET/1
e3;
 
  583    double EMcomp = sumVectorET(fullClus, digitScale, digitThresh);
 
  584    double result = HadET/(EMcomp+HadET);
 
  585    if (result < 0. || result > 1.){
 
  587       ATH_MSG_WARNING ( 
"fullClus count = " << fullClus.size() << 
", EMcomp = " << EMcomp << 
", HCALcomp = " << HadET);
 
  596                                      float digitScale, 
float digitThresh)
 const 
  599    if (etaWidth1 > etaWidth2) 
ATH_MSG_WARNING ( 
"REta: eta1 = " << etaWidth1 << 
", eta2 = " << etaWidth2);
 
  600    if (phiWidth1 > phiWidth2) 
ATH_MSG_WARNING ( 
"Rphi: phi1 = " << phiWidth1 << 
", phi2 = " << phiWidth2);
 
  602    double inner_ET = L2clusET(centreCell, etaWidth1, phiWidth1, scells, idHelper, digitScale, digitThresh);
 
  603    double outer_ET = L2clusET(centreCell, etaWidth2, phiWidth2, scells, idHelper, digitScale, digitThresh);
 
  605    std::vector<const CaloCell*> L2cells_inner = L2cluster(centreCell, etaWidth1, phiWidth1, scells, idHelper,digitScale, digitThresh);
 
  606    std::vector<const CaloCell*> L1cells_inner;
 
  607    for (
auto ithL2Cell : L2cells_inner){
 
  608       fromLayer2toLayer1(scells, ithL2Cell, L1cells_inner, idHelper);
 
  610    inner_ET += sumVectorET(L1cells_inner, digitScale, digitThresh);
 
  611    std::vector<const CaloCell*> L2cells_outer = L2cluster(centreCell, etaWidth2, phiWidth2, scells, idHelper,digitScale, digitThresh);
 
  612    std::vector<const CaloCell*> L1cells_outer;
 
  613    for (
auto ithL2Cell : L2cells_outer){
 
  614       fromLayer2toLayer1(scells, ithL2Cell, L1cells_outer, idHelper);
 
  616    outer_ET += sumVectorET(L1cells_outer, digitScale, digitThresh);
 
  619    if (inner_ET != 0. && outer_ET==0.) normal_REta = 0.;
 
  620    else if (inner_ET==0.) normal_REta = 0.;
 
  621    else normal_REta = inner_ET / outer_ET;
 
  622    if (normal_REta < 0) normal_REta = 0.;
 
  623    double my_REta = 1-normal_REta;
 
  631    if (inputCell==
nullptr) 
return;
 
  634    int sampling = idHelper->
sampling(inputID);
 
  635    const int sub_calo = idHelper->
sub_calo(inputID);
 
  636    int pos_neg = idHelper->
pos_neg(inputID);
 
  637    int region = idHelper->
region(inputID);
 
  641    if (sampling != 2) 
return;
 
  643    int outputRegion = region;
 
  645    bool oneCell = 
false; 
 
  647    if ((abs(pos_neg) == 1)&&(region == 0)){
 
  652    else if ((abs(pos_neg) == 1)&&(region == 1)){
 
  667    else if (abs(pos_neg)==2 && region == 0) {
 
  672    else if (abs(pos_neg)==2&&((region==1 && 
eta_index < 2))){
 
  676       pos_neg /= abs(pos_neg);
 
  680    else if (abs(pos_neg)==2&&((region==1 && 
eta_index == 2))){
 
  687    else if (abs(pos_neg)==2&®ion==1 && 
eta_index <= 14){
 
  695    else if (abs(pos_neg) == 2 && region == 1 && 
eta_index <= 22){
 
  719          for (
unsigned int  i = 0; 
i < 2; 
i++){
 
  721             Identifier resultID = idHelper->CaloCell_SuperCell_ID::cell_id(sub_calo, pos_neg, 1, outputRegion, outputEta, 
phi_index);
 
  722             const CaloCell* resultCell = returnCellFromCont(resultID, inputContainer, idHelper);
 
  723             addOnce(resultCell,outputVector);
 
  728    else if (abs(pos_neg)==2 && region == 1 && 
eta_index <= 38){
 
  736    else if (abs(pos_neg)==2 && region == 1 && 
eta_index == 40){
 
  747       Identifier resultID = idHelper->CaloCell_SuperCell_ID::cell_id(sub_calo, pos_neg, 1, outputRegion, outputEta, 
phi_index);
 
  748       const CaloCell* resultCell = returnCellFromCont(resultID, inputContainer, idHelper);
 
  749       addOnce(resultCell,outputVector);
 
  751    ATH_MSG_DEBUG(
"L2->L1: sampling = " << sampling << 
", region = " << region << 
", eta = " << pos_neg*
eta_index<< 
" tracker = " << tracker);
 
  759    if ( inputCell == 
nullptr ) 
return nullptr;
 
  760    const CaloCell* resultCell = 
nullptr;
 
  762    int sampling = idHelper->
sampling(inputID);
 
  763    const int sub_calo = idHelper->
sub_calo(inputID);
 
  764    const int pos_neg = idHelper->
pos_neg(inputID);
 
  765    int region = idHelper->
region(inputID);
 
  768    if (sampling != 2) 
return nullptr;
 
  769    else if (abs(pos_neg)==1 && ((region==0 && 
eta_index>53)||region==1)) 
return nullptr;
 
  770    else if ((abs(pos_neg)==2) && (region == 0 || (region == 1 && 
eta_index < 3))) 
return nullptr;
 
  771    else if (abs(pos_neg)==3) 
return nullptr;
 
  773    int outputRegion = region;
 
  776    if (abs(pos_neg)==1 && region ==0){
 
  778       Identifier resultID = idHelper->CaloCell_SuperCell_ID::cell_id(sub_calo, pos_neg, 3, outputRegion, outputEta, 
phi_index);
 
  779       resultCell = returnCellFromCont(resultID, inputContainer, idHelper);
 
  783    else if (abs(pos_neg)==1 && region ==1) {
 
  784       int output_pos_neg = pos_neg*2;
 
  787          Identifier resultID = idHelper->CaloCell_SuperCell_ID::cell_id(sub_calo, output_pos_neg, 2, outputRegion, outputEta, 
phi_index);
 
  788          resultCell = returnCellFromCont(resultID, inputContainer, idHelper);
 
  792    else if (abs(pos_neg)==2 && region ==1){
 
  795       Identifier resultID = idHelper->CaloCell_SuperCell_ID::cell_id(sub_calo, pos_neg, 3, outputRegion, outputEta, 
phi_index);
 
  796       resultCell = returnCellFromCont(resultID, inputContainer, idHelper);
 
  799    ATH_MSG_DEBUG(
"L2->L3: sampling = " << sampling << 
", region = " << region << 
", eta = " << pos_neg*
eta_index<< 
" tracker = " << tracker);
 
  807    if (inputCell==
nullptr) 
return nullptr;
 
  808    const CaloCell* resultCell = 
nullptr;
 
  810    int sampling = idHelper->
sampling(inputID);
 
  811    const int sub_calo = idHelper->
sub_calo(inputID);
 
  812    const int pos_neg = idHelper->
pos_neg(inputID);
 
  813    int region = idHelper->
region(inputID);
 
  816    if (sampling != 2) 
return nullptr;
 
  817    if (abs(pos_neg)==2 && (eta_index<3 || eta_index>14)) 
return nullptr;
 
  818    if (abs(pos_neg)==3) 
return nullptr;
 
  820    int outputRegion = region;
 
  823    if (abs(pos_neg)==1 && region ==0){
 
  825       Identifier resultID = idHelper->CaloCell_SuperCell_ID::cell_id(sub_calo, pos_neg, 0, outputRegion, outputEta, 
phi_index);
 
  826       resultCell = returnCellFromCont(resultID, inputContainer, idHelper);
 
  828    else if (abs(pos_neg)==1 && region ==1){
 
  829       Identifier resultID = idHelper->CaloCell_SuperCell_ID::cell_id(sub_calo, pos_neg, 0, 0, 14, 
phi_index);
 
  830       resultCell = returnCellFromCont(resultID, inputContainer, idHelper);
 
  832    else if (abs(pos_neg)==2 && region ==1){
 
  835       Identifier resultID = idHelper->CaloCell_SuperCell_ID::cell_id(sub_calo, pos_neg, 0, outputRegion, outputEta, 
phi_index);
 
  836       resultCell = returnCellFromCont(resultID, inputContainer, idHelper); 
 
  841 std::vector<const CaloCell*>
 
  846    std::vector<const CaloCell*> centCells;
 
  847    centCells.push_back(centreCell);
 
  848    const CaloCell* upPhiCell = NextPhiCell(centreCell,
true,scells,idHelper);
 
  849    const CaloCell* downPhiCell = NextPhiCell(centreCell,
false,scells,idHelper);
 
  852    if ( CaloCellET(upPhiCell, digitScale, digitThresh) > CaloCellET(downPhiCell, digitScale, digitThresh)) energeticPhiCell = upPhiCell;
 
  853    else energeticPhiCell = downPhiCell;
 
  854    if (
phiWidth == 2) addOnce(energeticPhiCell, centCells); 
 
  856       addOnce(upPhiCell, centCells); 
 
  857       addOnce(downPhiCell, centCells); 
 
  863    std::vector<const CaloCell*> clusCells;
 
  864    int halfEtaWidth = (etaWidth-1)/2;
 
  865    int backToEta = (2*halfEtaWidth)+1;
 
  866    if (backToEta != etaWidth) {
 
  867       ATH_MSG_DEBUG ( 
"Eta width doesn't match! " << backToEta << 
" -> " << halfEtaWidth << 
" -> " << etaWidth << 
"  " << __LINE__);
 
  869    for (
auto ithCentCell : centCells){
 
  870       addOnce(ithCentCell, clusCells); 
 
  872          const CaloCell* tempRightCell = NextEtaCell(ithCentCell,
true,scells,idHelper);
 
  873          const CaloCell* tempLeftCell = NextEtaCell(ithCentCell,
false,scells,idHelper);
 
  874          addOnce(tempRightCell, clusCells); 
 
  875          addOnce(tempLeftCell, clusCells); 
 
  876          for (
int i = 1; 
i < halfEtaWidth; 
i++){
 
  877             tempRightCell = NextEtaCell(tempRightCell,
true,scells,idHelper);
 
  878             tempLeftCell = NextEtaCell(tempLeftCell,
false,scells,idHelper);
 
  879             addOnce(tempRightCell, clusCells); 
 
  880             addOnce(tempLeftCell, clusCells); 
 
  889                                                  const TileID* tileIDHelper, 
bool isOW, 
float tileNoiseThresh)
 const 
  891    std::vector<double> layerEnergy;
 
  892    if (CellCon==
nullptr) 
return layerEnergy;
 
  893    if (CellCon->
size()==0) 
return layerEnergy;
 
  894    if (inputSCVector.size()==0) 
return layerEnergy;
 
  895    double ELayer0 = 0, ELayer1 = 0, ELayer2 = 0;
 
  896    std::vector<const TileCell*> tileCellVector;
 
  897    for (
auto ithSC : inputSCVector){
 
  898       float ithSCEta = ithSC->eta();
 
  899       float ithSCPhi = ithSC->phi();
 
  900       int matchingCells = 0;
 
  903       for ( ; fCell != lCell; ++fCell){
 
  910          float ithdR = dR(tileCell->
eta(), tileCell->
phi(), ithSCEta, ithSCPhi);
 
  912             float matchingDistance = 0.;
 
  913             if (isOW && (std::abs(ithSCEta) > 1.38 && std::abs(ithSCEta) < 1.42)) matchingDistance = 0.065;
 
  914             else matchingDistance = 0.05;
 
  915             if (ithdR <= matchingDistance){
 
  916                bool isAlreadyThere = 
false;
 
  917                checkTileCell(tileCell, tileCellVector, isAlreadyThere);
 
  918                if (isAlreadyThere) 
continue;
 
  920                if (
layer == 0) ELayer0 += tileCellEnergyCalib(tileCell->
e(), tileCell->
eta(), tileNoiseThresh);
 
  921                if (
layer == 1) ELayer1 += tileCellEnergyCalib(tileCell->
e(), tileCell->
eta(), tileNoiseThresh);
 
  924          else if (
layer == 2){
 
  925             float matchingDistance = 0.;
 
  926             if (std::abs(ithSCEta) > 0.7 && std::abs(ithSCEta) < 0.8) matchingDistance = 0.05;
 
  927             else if (std::abs(ithSCEta) > 0.9 && std::abs(ithSCEta) < 1.0) matchingDistance = 0.05;
 
  928             else matchingDistance = 0.09;
 
  929             if (ithdR < matchingDistance){
 
  930                bool isAlreadyThere = 
false;
 
  931                checkTileCell(tileCell, tileCellVector, isAlreadyThere);
 
  932                if (isAlreadyThere) 
continue;
 
  934                int tempPos = detRelPos(ithSCEta);
 
  941                else if (tempPos == 0) ELayer2 += tileCellEnergyCalib(tileCell->
ene2(), tileCell->
eta(), tileNoiseThresh);
 
  942                else if (tempPos == 1) ELayer2 += tileCellEnergyCalib(tileCell->
ene1(), tileCell->
eta(), tileNoiseThresh);
 
  943                else            ELayer2 += tileCellEnergyCalib(tileCell->
e(),    tileCell->
eta(), tileNoiseThresh);
 
  947       if ((matchingCells > 3 && !isOW) || (matchingCells > 3 && isOW && std::abs(ithSCEta) > 1.42) || (matchingCells > 4 && isOW && std::abs(ithSCEta) < 1.42)){
 
  949          ATH_MSG_WARNING ( 
"Input SC: (eta,phi) = (" << ithSCEta << 
"," << ithSCPhi << 
")");
 
  950          for (
auto cell : tileCellVector){
 
  951             ATH_MSG_WARNING ( 
"Tile cell: (eta,phi) = (" << 
cell->eta() << 
"," << 
cell->phi() << 
")" << 
" dR = " << dR(
cell->eta(), 
cell->phi(), ithSCEta, ithSCPhi) << 
" layer = " << tileIDHelper->
sample(
cell->ID()));
 
  957    layerEnergy = {ELayer0, ELayer1, ELayer2};
 
  964    if (inputTower == 
nullptr){
 
  969       double phi = inputTower->
phi();
 
  979    double phiDif = std::abs(phi1 - phi2);
 
  980    if (phiDif > 
M_PI) phiDif = phiDif - (2*
M_PI);
 
  988    std::vector<const xAOD::TriggerTower*> matchingTTs;
 
  989    if (TTContainer==
nullptr) 
return nullptr;
 
  990    if (TTContainer->
size()==0) 
return nullptr;
 
  991    if (inputCell==
nullptr) 
return nullptr;
 
  992    for (
auto ithTT : *TTContainer){
 
  993       if (ithTT->sampling()==1){
 
  994          float ithTT_eta = ithTT->
eta();
 
  995          float ithTT_phi = TT_phi(ithTT);
 
  996          float ithdR = dR(ithTT_eta, ithTT_phi, inputCell->
eta(), inputCell->
phi());
 
  997          if (ithdR < 0.05) matchingTTs.push_back(ithTT);
 
 1000    if (matchingTTs.size()==1) 
return matchingTTs[0];
 
 1001    else if (matchingTTs.size()!=0){ 
 
 1002       ATH_MSG_WARNING ( 
"More than one matching HCAL TT!!! (Returned Null)");
 
 1010    std::vector<const CaloCell*> matchingCells;
 
 1011    if (inputCell==
nullptr) 
return nullptr;
 
 1012    for (
auto ithSC : *SCContainer){
 
 1014       int ithSub_calo = idHelper->
sub_calo(ithID);
 
 1015       if (ithSub_calo == 1){
 
 1016          double ithdR = dR(inputCell->
eta(), inputCell->
phi(), ithSC->eta(), ithSC->phi());
 
 1017          if (ithdR < 0.05) matchingCells.push_back(ithSC);
 
 1021    if (matchingCells.size()==1)
 
 1022       return matchingCells[0];
 
 1025    if (matchingCells.size()==0){
 
 1027       ATH_MSG_WARNING ( 
"No match betweem LAr ECAL SC and LAr HCAL SC!!! Input coords: " << inputCell->
eta() << 
", " << inputCell->
phi());
 
 1029    } 
else if (matchingCells.size()!=0) {
 
 1031       ATH_MSG_WARNING ( 
"More than one matching LAr HCAL SC!!! (Returned Null)");
 
 1033       for (
auto ithMatch : matchingCells){
 
 1034          ATH_MSG_WARNING ( 
"    " << ithMatch->eta() << 
" x " << ithMatch->phi() << 
", dR = "  
 1035                            << dR(inputCell->
eta(), inputCell->
phi(), ithMatch->eta(), ithMatch->phi()));
 
 1044    if (inputTower == 
nullptr){
 
 1048    else if (inputTower->
cpET() < 0.) {
 
 1051       return 500*inputTower->
cpET();
 
 1055 std::vector<const CaloCell*>
 
 1060    std::vector<const CaloCell*> L2cells = L2cluster(centreCell, etaWidth, 
phiWidth, scells, idHelper, digitScale, digitThresh);
 
 1062    std::vector<const CaloCell*> centCells;
 
 1063    centCells.push_back(centreCell);
 
 1064    const CaloCell* upPhiCell = NextPhiCell(centreCell,
true,scells,idHelper);
 
 1065    const CaloCell* downPhiCell = NextPhiCell(centreCell,
false,scells,idHelper);
 
 1070       if (CaloCellET(upPhiCell, digitScale, digitThresh) > CaloCellET(downPhiCell, digitScale, digitThresh)) energeticPhiCell = upPhiCell;
 
 1071       else energeticPhiCell = downPhiCell;
 
 1072       if (
phiWidth == 2) addOnce(energeticPhiCell, centCells); 
 
 1074          addOnce(upPhiCell, centCells); 
 
 1075          addOnce(downPhiCell, centCells); 
 
 1080    std::vector<const CaloCell*> fullClus;
 
 1082    for (
auto ithL2Cell : L2cells){
 
 1083       fullClus.push_back(ithL2Cell);
 
 1084       fromLayer2toLayer1(scells, ithL2Cell, fullClus, idHelper);
 
 1087    for (
auto ithL2CentCell : centCells){
 
 1088       addOnce( fromLayer2toPS( scells, ithL2CentCell, idHelper),fullClus);
 
 1089       addOnce( fromLayer2toLayer3( scells, ithL2CentCell, idHelper),fullClus);
 
 1098    for (
auto ithCell : inputVector){
 
 1099       if (ithCell!=
nullptr) TotalET += CaloCellET(ithCell, digitScale, digitThreshold);
 
 1107    if (EM_ET == 0 || digitScale == 0) 
return true;
 
 1109       int div = EM_ET / digitScale;
 
 1110       if (div * digitScale == EM_ET) 
return true;
 
 1112          ATH_MSG_WARNING ( 
"ET = " << EM_ET << 
", digitThresh = " << digitThresh << 
" digitScale = " << digitScale << 
" div = " << div << 
" " << 
" -> div * digitScale");
 
 1121                                          float digitScale, 
float digitThresh)
 const 
 1124    std::vector<const CaloCell*> HCAL_LAr_vector;
 
 1125    std::vector<const xAOD::TriggerTower*> HCAL_TT_vector;
 
 1126    for (
auto ithCell : inputVector){
 
 1127       if (std::abs(ithCell->eta())<1.5){
 
 1129          if (tempTT != 
nullptr) HCAL_TT_vector.push_back(tempTT);
 
 1131       else if (std::abs(ithCell->eta())<2.5){
 
 1132          const CaloCell* tempLArHad = matchingHCAL_LAr(ithCell, scells, idHelper);
 
 1133          if (tempLArHad != 
nullptr) HCAL_LAr_vector.push_back(tempLArHad);
 
 1138    for (
auto ithTT : HCAL_TT_vector) {HadET += TT_ET(ithTT);}
 
 1139    for (
auto ithSC : HCAL_LAr_vector) {HadET += CaloCellET(ithSC, digitScale, digitThresh);}
 
 1150    const CaloCell* isCell = cellContainer->
findCell(idHelper->CaloCell_SuperCell_ID::calo_cell_hash(inputID));
 
 1151    if (isCell) 
return isCell;
 
 1152    else return nullptr;
 
 1159    if (inputCell==
nullptr) 
return nullptr;
 
 1161    int ithSub_calo = idHelper->
sub_calo(ithID);
 
 1162    int ithPos_neg = idHelper->
pos_neg(ithID);
 
 1163    const CaloCell* tempCell = 
nullptr;
 
 1165    if (ithSub_calo==0){
 
 1167       if (abs(ithPos_neg)==1) tempCell = NextEtaCell_Barrel(inputCell, upwards, cellContainer, idHelper);
 
 1169       else if (abs(ithPos_neg)==2) tempCell = NextEtaCell_OW(inputCell, upwards, cellContainer, idHelper);
 
 1171       else if (abs(ithPos_neg)==3) tempCell = NextEtaCell_IW(inputCell, upwards, cellContainer, idHelper);
 
 1174          ATH_MSG_WARNING ( 
"Layer 2 cell not passed to specific method at" << inputCell->
eta() << 
" , " << inputCell->
phi());
 
 1191    const int ithEta_index = idHelper->
eta(ithID);
 
 1192    const int ithPhi_index = idHelper->
phi(ithID);
 
 1193    const int ithSampling = idHelper->
sampling(ithID);
 
 1194    const int ithSub_calo = idHelper->
sub_calo(ithID);
 
 1195    const int ithPos_neg = idHelper->
pos_neg(ithID);
 
 1196    const int ithRegion = idHelper->
region(ithID);
 
 1199    int maxEta_index = 0;
 
 1200    int minEta_index = 0;
 
 1202       if (ithSampling == 0) maxEta_index = 14;
 
 1203       else if (ithSampling == 1 || ithSampling == 2) maxEta_index = 55;
 
 1204       else if (ithSampling == 3) maxEta_index = 13;
 
 1207    else if (ithRegion==1){
 
 1208       if (ithSampling == 1) maxEta_index =2;
 
 1209       else if (ithSampling == 2) maxEta_index=0;
 
 1214    int nextEta_index = ithEta_index;
 
 1217    int nextSampling = ithSampling;
 
 1218    int nextSub_calo = ithSub_calo;
 
 1219    int nextPos_neg = ithPos_neg;
 
 1220    int nextRegion = ithRegion;
 
 1224    if (upwards) incrementEta = ithPos_neg;
 
 1225    else incrementEta = -1*ithPos_neg;
 
 1230    if (ithEta_index==minEta_index && incrementEta==-1){
 
 1231       if (ithRegion == 0){
 
 1233          nextPos_neg = ithPos_neg * -1;
 
 1236       else if (ithRegion == 1){
 
 1245    else if ((ithEta_index == maxEta_index) && (incrementEta == 1)) {
 
 1247       if ((ithRegion == 0)&&(ithSampling == 1 || ithSampling == 2)){
 
 1253       else if ((ithRegion == 0)&&(ithSampling == 0)){
 
 1256          nextPos_neg = 2*ithPos_neg;
 
 1260       else if ((ithRegion == 0)&&(ithSampling == 3)){
 
 1264             nextPos_neg = 2*ithPos_neg;
 
 1268       else if ((ithRegion == 1)&&(ithSampling == 1)){
 
 1271          nextPos_neg = 2 * ithPos_neg;
 
 1275       else if ((ithRegion == 1)&&(ithSampling == 2)){
 
 1278          nextPos_neg = 2 * ithPos_neg;
 
 1285       nextEta_index = ithEta_index + incrementEta;
 
 1291    Identifier nextCellID = idHelper->CaloCell_SuperCell_ID::cell_id(nextSub_calo, nextPos_neg, nextSampling, nextRegion, nextEta_index, ithPhi_index);
 
 1292    const CaloCell* nextCell = returnCellFromCont(nextCellID, cellContainer, idHelper);      
 
 1293    if (nextCell == 
nullptr) {
 
 1296       ATH_MSG_DEBUG ( 
"from nextCellID: "<<idHelper->
sub_calo(nextCellID)<<
", "<<idHelper->
pos_neg(nextCellID)<<
", "<<idHelper->
sampling(nextCellID)<<
", "<<idHelper->
region(nextCellID)<<
", "<<idHelper->
eta(nextCellID)<<
", "<<idHelper->
phi(nextCellID)<<
", "<<idHelper->
calo_cell_hash(nextCellID)<<
", "<<nextCellID);            
 
 1300       int IDsample = idHelper->
sampling(nextCell->
ID());
 
 1302       if (IDsample!=ithSampling){
 
 1303          ATH_MSG_DEBUG ( 
"Layer has changed " << 
" tracker = " << tracker);
 
 1304          ATH_MSG_DEBUG ( 
"from nextCellID: "<<idHelper->
sub_calo(nextCellID)<<
", "<<idHelper->
pos_neg(nextCellID)<<
", "<<idHelper->
sampling(nextCellID)<<
", "<<idHelper->
region(nextCellID)<<
", "<<idHelper->
eta(nextCellID)<<
", "<<idHelper->
phi(nextCellID)<<
", "<<idHelper->
calo_cell_hash(nextCellID)<<
", "<<nextCellID);
 
 1309    if (nextCell && (nextCell->
ID() != nextCellID)) 
ATH_MSG_DEBUG ( __LINE__ << 
" does not match");
 
 1318    int ithEta_index = idHelper->
eta(ithID);
 
 1319    const int ithPhi_index = idHelper->
phi(ithID);
 
 1320    const int ithSampling = idHelper->
sampling(ithID);
 
 1321    int ithSub_calo = idHelper->
sub_calo(ithID);
 
 1322    int ithPos_neg = idHelper->
pos_neg(ithID);
 
 1323    int ithRegion = idHelper->
region(ithID);   
 
 1325    int nextEta_index = ithEta_index;
 
 1326    int nextPhi_index = ithPhi_index;
 
 1328    int nextSampling = ithSampling;
 
 1329    int nextSub_calo = ithSub_calo;
 
 1330    int nextPos_neg = ithPos_neg;
 
 1331    int nextRegion = ithRegion;
 
 1333    int maxEta_index = 0;
 
 1334    int minEta_index = 0;
 
 1336    if (ithSampling==0) maxEta_index = 2;
 
 1337    else if (ithSampling==2 && ithRegion==0) maxEta_index = 0;
 
 1338    else if (ithSampling==2 && ithRegion==1) maxEta_index = 42; 
 
 1339    else if (ithSampling==3) maxEta_index=9;
 
 1340    else if (ithSampling==1) {
 
 1368    int ithSide = ithPos_neg / abs(ithPos_neg);
 
 1369    if (upwards) incrementEta = ithSide;
 
 1370    else incrementEta = ithSide * -1;
 
 1373    if (ithEta_index==minEta_index && ithRegion==0 && incrementEta==-1){
 
 1374       nextPos_neg = ithSide;
 
 1375       if (ithSampling==0){
 
 1380       else if (ithSampling==1){
 
 1386       else if (ithSampling==2){
 
 1393       else if (ithSampling==3){
 
 1397          nextPos_neg = ithPos_neg;
 
 1402    else if (ithEta_index==maxEta_index && incrementEta==1){
 
 1404       if (ithSampling==0 || ithSampling==3) 
return nullptr;
 
 1405       else if (ithSampling==2 && ithRegion==0){
 
 1410       else if ((ithSampling==2 && ithRegion==1)||(ithSampling==1 && ithRegion==5)){
 
 1414          nextPhi_index=ithPhi_index/2;
 
 1415          nextPos_neg=3*ithSide;
 
 1418       else if (ithSampling==1 && ithRegion==0){
 
 1424       else if (ithSampling==1){
 
 1425          nextRegion=ithRegion + 1;
 
 1431    else if (ithEta_index==minEta_index && incrementEta==-1){
 
 1435       if (ithSampling==2){
 
 1438          nextPos_neg = ithPos_neg;
 
 1441       else if (ithSampling==1){
 
 1443             nextPos_neg = ithSide;
 
 1451             nextRegion = ithRegion-1;
 
 1452             if (nextRegion==0) {
 
 1456             else if (nextRegion==1) {
 
 1460             else if (nextRegion==2) nextEta_index=11;
 
 1461             else if (nextRegion==3) nextEta_index=7;
 
 1462             else if (nextRegion==4) nextEta_index=15;
 
 1468       nextEta_index = ithEta_index+incrementEta;
 
 1471    Identifier nextCellID = idHelper->CaloCell_SuperCell_ID::cell_id(nextSub_calo, nextPos_neg, nextSampling, nextRegion, nextEta_index, nextPhi_index);
 
 1472    const CaloCell* nextCell = returnCellFromCont(nextCellID, cellContainer, idHelper);
 
 1473    if (nextCell == 
nullptr) {
 
 1476       ATH_MSG_DEBUG ( 
"from nextCellID: "<<idHelper->
sub_calo(nextCellID)<<
", "<<idHelper->
pos_neg(nextCellID)<<
", "<<idHelper->
sampling(nextCellID)<<
", "<<idHelper->
region(nextCellID)<<
", "<<idHelper->
eta(nextCellID)<<
", "<<idHelper->
phi(nextCellID)<<
", "<<idHelper->
calo_cell_hash(nextCellID)<<
", "<<nextCellID);
 
 1477       ATH_MSG_DEBUG ( 
"Increment eta = "<<incrementEta<<
", max_eta = "<<maxEta_index<<
", min_eta = "<<minEta_index);     
 
 1481       int IDsample = idHelper->
sampling(nextCell->
ID());
 
 1482       if (IDsample!=ithSampling){
 
 1483          ATH_MSG_DEBUG ( 
"Layer has changed "<<
" tracker = "<<tracker);
 
 1484          ATH_MSG_DEBUG ( 
"from nextCellID: "<<idHelper->
sub_calo(nextCellID)<<
", "<<idHelper->
pos_neg(nextCellID)<<
", "<<idHelper->
sampling(nextCellID)<<
", "<<idHelper->
region(nextCellID)<<
", "<<idHelper->
eta(nextCellID)<<
", "<<idHelper->
phi(nextCellID)<<
", "<<idHelper->
calo_cell_hash(nextCellID)<<
", "<<nextCellID);
 
 1489    if (nextCell && (nextCell->
ID() != nextCellID)) 
ATH_MSG_DEBUG ( __LINE__<< 
" does not match");
 
 1498    const int ithEta_index = idHelper->
eta(ithID);
 
 1499    const int ithPhi_index = idHelper->
phi(ithID);
 
 1500    const int ithSampling = idHelper->
sampling(ithID);
 
 1501    const int ithSub_calo = idHelper->
sub_calo(ithID);
 
 1502    const int ithPos_neg = idHelper->
pos_neg(ithID);
 
 1503    const int ithRegion = idHelper->
region(ithID);
 
 1506    int nextEta_index = ithEta_index;
 
 1507    int nextPhi_index = ithPhi_index;
 
 1509    int nextSub_calo = ithSub_calo;
 
 1510    int nextPos_neg = ithPos_neg;
 
 1511    int nextRegion = ithRegion;
 
 1514    int maxEta_index = 0;
 
 1515    int minEta_index = 0;
 
 1521    else if (ithRegion!=1) 
ATH_MSG_DEBUG ( 
"ISSUE: " <<__LINE__);
 
 1525    int ithSide = ithPos_neg / abs(ithPos_neg);
 
 1526    if (upwards) incrementEta = ithSide;
 
 1527    else incrementEta = ithSide * -1;
 
 1529    if (ithEta_index==minEta_index&& incrementEta==-1){
 
 1531       if (ithRegion == 0){
 
 1532          nextPos_neg = 2*ithSide;
 
 1533          nextPhi_index=2*ithPhi_index;
 
 1534          if (ithSampling==1){   
 
 1539          else if (ithSampling==2){
 
 1547       else if (ithRegion == 1){
 
 1554    else if (ithEta_index==maxEta_index && incrementEta==1){
 
 1562       else if (ithRegion==1) 
return nullptr; 
 
 1567       nextEta_index=ithEta_index+incrementEta;
 
 1569    Identifier nextCellID = idHelper->CaloCell_SuperCell_ID::cell_id(nextSub_calo, nextPos_neg, ithSampling, nextRegion, nextEta_index, nextPhi_index);
 
 1570    const CaloCell* nextCell = returnCellFromCont(nextCellID, cellContainer, idHelper);
 
 1571    if (nextCell && (nextCell->
ID() != nextCellID)) 
ATH_MSG_DEBUG ( __LINE__<<
" does not match");
 
 1578    if (is64&&input_index<0) 
return input_index+64;
 
 1579    else if (is64&&input_index>63) 
return input_index-64;
 
 1580    else if (!(is64)&&input_index<0) 
return input_index+32;
 
 1581    else if (!(is64)&&input_index>31) 
return input_index-32;
 
 1582    else return input_index;
 
 1589    if (inputCell==
nullptr)
 
 1593    const int ithEta_index = idHelper->
eta(ithID);
 
 1594    const int ithPhi_index = idHelper->
phi(ithID);
 
 1595    const int ithSampling = idHelper->
sampling(ithID);
 
 1596    const int ithSub_calo = idHelper->
sub_calo(ithID);
 
 1597    const int ithPos_neg = idHelper->
pos_neg(ithID);
 
 1598    const int ithRegion = idHelper->
region(ithID);
 
 1601    if (abs(ithPos_neg)==3) is64 = 
false;
 
 1605    if (upwards==
true) incrementPhi=1;
 
 1606    else incrementPhi=-1;
 
 1608    const int nextPhi_index = restrictPhiIndex(ithPhi_index+incrementPhi, is64);
 
 1609    Identifier nextCellID = idHelper->CaloCell_SuperCell_ID::cell_id(ithSub_calo, ithPos_neg, ithSampling, ithRegion, ithEta_index, nextPhi_index);
 
 1610    const CaloCell* nextCell = returnCellFromCont(nextCellID, cellContainer, idHelper);
 
 1611    if (nextCell && (nextCell->
ID() != nextCellID)) 
ATH_MSG_DEBUG ( __LINE__ << 
" does not match");
 
 1612    if (nextCell == 
nullptr) 
ATH_MSG_DEBUG ( 
"Next phi cell is nullptr at " << __LINE__);