Skip to content

Commit

Permalink
Merge pull request #2983 from bsunanda/Phase0-Hcal01
Browse files Browse the repository at this point in the history
Geometry/CaloTopology -- Allow decrement in depth
  • Loading branch information
nclopezo committed Mar 27, 2014
2 parents 0953499 + 05b7b1f commit b4906fb
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 8 deletions.
2 changes: 2 additions & 0 deletions Geometry/CaloTopology/interface/HcalTopology.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ class HcalTopology : public CaloSubdetectorTopology {
bool decIPhi(const HcalDetId& id, HcalDetId &neighbor) const;
/** Get the detector behind this one */
bool incrementDepth(HcalDetId& id) const;
/** Get the detector in front of this one */
bool decrementDepth(HcalDetId& id) const;

int firstHBRing() const {return firstHBRing_;}
int lastHBRing() const {return lastHBRing_;}
Expand Down
51 changes: 43 additions & 8 deletions Geometry/CaloTopology/src/HcalTopology.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,19 +138,19 @@ std::vector<DetId> HcalTopology::south(const DetId& id) const {

std::vector<DetId> HcalTopology::up(const DetId& id) const {
HcalDetId neighbor = id;
//A.N.
// incrementDepth(neighbor);
std::vector<DetId> vNeighborsDetId;
if(incrementDepth(neighbor))
{
if(incrementDepth(neighbor)) {
vNeighborsDetId.push_back(neighbor);
}
return vNeighborsDetId;
}

std::vector<DetId> HcalTopology::down(const DetId& id) const {
std::cout << "HcalTopology::down() not yet implemented" << std::endl;
HcalDetId neighbor = id;
std::vector<DetId> vNeighborsDetId;
if (decrementDepth(neighbor)) {
vNeighborsDetId.push_back(neighbor);
}
return vNeighborsDetId;
}

Expand Down Expand Up @@ -522,12 +522,47 @@ bool HcalTopology::incrementDepth(HcalDetId & detId) const
}
}
detId = HcalDetId(subdet, ieta, detId.iphi(), depth);
//A.N.
// assert(validRaw(detId));
return validRaw(detId);
//A.N. return true;
}

bool HcalTopology::decrementDepth(HcalDetId & detId) const {
HcalSubdetector subdet = detId.subdet();
int ieta = detId.ieta();
int etaRing = detId.ietaAbs();
int depth = detId.depth();
int nDepthBins, startingBin;
depthBinInformation(subdet, etaRing, nDepthBins, startingBin);

// see if the new depth bin exists
--depth;
if (subdet == HcalOuter) {
subdet = HcalBarrel;
if (mode_==HcalTopologyMode::SLHC || mode_==HcalTopologyMode::H2HE) {
depth = maxDepthHB_;
} else {
depth = (etaRing<=14) ? 1 : 2;
}
} else if (subdet == HcalEndcap && etaRing == firstHERing()) {
subdet = HcalBarrel;
depth = 2;
} else if (subdet == HcalEndcap && etaRing == lastHERing() && depth == 2 &&
mode_ != HcalTopologyMode::SLHC) {
(ieta > 0) ? --ieta : ++ieta;
} else if (depth <= 0) {
if (subdet == HcalForward && etaRing == firstHFRing()) {
// overlap
subdet = HcalEndcap;
etaRing= lastHERing()-1;
ieta = (ieta > 0) ? etaRing : -etaRing;
} else {
// no more chances
detId = HcalDetId();
return false;
}
}
detId = HcalDetId(subdet, ieta, detId.iphi(), depth);
return validRaw(detId);
}

int HcalTopology::nPhiBins(int etaRing) const {
int lastPhiBin=singlePhiBins_;
Expand Down

0 comments on commit b4906fb

Please sign in to comment.