#include "Geometry/HcalTowerAlgo/interface/HcalTrigTowerGeometry.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" #include "DataFormats/HcalDetId/interface/HcalTrigTowerDetId.h" #include "Geometry/HcalTowerAlgo/src/HcalHardcodeGeometryData.h" #include std::vector HcalTrigTowerGeometry::towerIds(const HcalDetId & cellId) const { std::vector results; if(cellId.subdet() == HcalForward) { // short fibers don't count if(cellId.depth() == 1) { // first do eta int hfRing = cellId.ietaAbs(); int ieta = firstHFTower(); // find the tower that contains this ring while(hfRing > firstHFRingInTower(ieta+1)) { ++ieta; } ieta *= cellId.zside(); // now for phi // HF towers are quad, 18 in phi. If we're only in double-phi regions of HF, // go two cells per trigger tower int iphi = (cellId.iphi()-1)/4 + 1; // if(cellId.ietaAbs() < theTopology.firstHFQuadPhiRing()) { // iphi = (iphi-1)/4 + 1; // } results.push_back( HcalTrigTowerDetId(ieta, iphi) ); } } else { // the first twenty rings are one-to-one if(cellId.ietaAbs() < theTopology.firstHEDoublePhiRing()) { results.push_back( HcalTrigTowerDetId(cellId.ieta(), cellId.iphi()) ); } else { // the remaining rings are two-to-one in phi int iphi1 = cellId.iphi(); int ieta = cellId.ieta(); // the last eta ring in HE is split. Recombine. if(ieta == theTopology.lastHERing()) --ieta; if(ieta == -theTopology.lastHERing()) ++ieta; results.push_back( HcalTrigTowerDetId(ieta, iphi1) ); results.push_back( HcalTrigTowerDetId(ieta, iphi1+1) ); } } return results; } std::vector HcalTrigTowerGeometry::detIds(const HcalTrigTowerDetId &) const { std::vector results; return results; } int HcalTrigTowerGeometry::hfTowerEtaSize(int ieta) const { int ietaAbs = abs(ieta); assert(ietaAbs >= firstHFTower()); // the first comes from rings 29-32. The rest have 3 rings each return (ietaAbs == firstHFTower()) ? 4 : 3; } int HcalTrigTowerGeometry::firstHFRingInTower(int ietaTower) const { // count up to the correct HF ring int inputTower = abs(ietaTower); int result = theTopology.firstHFRing(); for(int iTower = firstHFTower(); iTower != inputTower; ++iTower) { result += hfTowerEtaSize(iTower); } // negative in, negative out. if(ietaTower < 0) result *= -1; return result; } void HcalTrigTowerGeometry::towerEtaBounds(int ieta, double & eta1, double & eta2) const { int ietaAbs = abs(ieta); if(ietaAbs < firstHFTower()) { eta1 = theHBHEEtaBounds[ietaAbs-1]; eta2 = theHBHEEtaBounds[ieta]; // the last tower is split, so get tower 29, too if(ieta == theTopology.lastHERing()-1) { eta2 = theHBHEEtaBounds[ieta+1]; } } else { // count from 0 int hfIndex = firstHFRingInTower(ietaAbs) - theTopology.firstHFRing(); eta1 = theHFEtaBounds[hfIndex]; eta2 = theHFEtaBounds[hfIndex+ hfTowerEtaSize(ieta)]; } // get the signs right if(ieta < 0) eta1 *= -1; if(ieta < 0) eta2 *= -1; }