Skip to content

Commit

Permalink
Suggestion from Chris
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunanda committed Oct 8, 2024
1 parent f728e88 commit 3e95ab9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
2 changes: 2 additions & 0 deletions Geometry/CaloTopology/interface/HcalTopology.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ class HcalTopology : public CaloSubdetectorTopology {
HcalDetId idBack(const HcalDetId& id) const { return hcons_->idBack(id); }

private:
bool phase1() const { return ((mode_ == HcalTopologyMode::LHC) || (mode_ == HcalTopologyMode::Run3)); }
bool phase2() const { return ((mode_ == HcalTopologyMode::SLHC) || (mode_ == HcalTopologyMode::Run4)); }
/** Get the neighbors of the given cell with higher absolute ieta */
int incAIEta(const HcalDetId& id, HcalDetId neighbors[2]) const;
/** Get the neighbors of the given cell with lower absolute ieta */
Expand Down
32 changes: 14 additions & 18 deletions Geometry/CaloTopology/src/HcalTopology.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ HcalTopology::HcalTopology(const HcalDDDRecConstants* hcons, const bool mergePos
} else {
nEtaHE_ = (lastHERing_ - firstHERing_ + 1);
}
if ((mode_ == HcalTopologyMode::LHC) || (mode_ == HcalTopologyMode::Run3)) {
if (phase1()) {
topoVersion_ = 0; //DL
HBSize_ = kHBSizePreLS1; // qie-per-fiber * fiber/rm * rm/rbx * rbx/barrel * barrel/hcal
HESize_ = kHESizePreLS1; // qie-per-fiber * fiber/rm * rm/rbx * rbx/endcap * endcap/hcal
HOSize_ = kHOSizePreLS1; // ieta * iphi * 2
HFSize_ = kHFSizePreLS1; // ieta * iphi * depth * 2
CALIBSize_ = kCALIBSizePreLS1;
numberOfShapes_ = 87;
} else if ((mode_ == HcalTopologyMode::SLHC) || (mode_ == HcalTopologyMode::Run4)) { // need to know more eventually
} else if (phase2()) { // need to know more eventually
topoVersion_ = 10;
HBSize_ = nEtaHB_ * IPHI_MAX * maxDepthHB_ * 2;
HESize_ = nEtaHE_ * maxPhiHE_ * maxDepthHE_ * 2;
Expand Down Expand Up @@ -195,14 +195,14 @@ HcalTopology::HcalTopology(HcalTopologyMode::Mode mode,
HFSize_(kHFSizePreLS1),
HTSize_(kHTSizePreLS1),
CALIBSize_(kCALIBSizePreLS1),
numberOfShapes_(((mode == HcalTopologyMode::SLHC) || (mode_ == HcalTopologyMode::Run4)) ? 500 : 87) {
if ((mode_ == HcalTopologyMode::LHC) || (mode_ == HcalTopologyMode::Run3)) {
numberOfShapes_(phase2() ? 500 : 87) {
if (phase1()) {
topoVersion_ = 0; //DL
HBSize_ = kHBSizePreLS1; // qie-per-fiber * fiber/rm * rm/rbx * rbx/barrel * barrel/hcal
HESize_ = kHESizePreLS1; // qie-per-fiber * fiber/rm * rm/rbx * rbx/endcap * endcap/hcal
HOSize_ = kHOSizePreLS1; // ieta * iphi * 2
HFSize_ = kHFSizePreLS1; // phi * eta * depth * pm
} else if ((mode_ == HcalTopologyMode::SLHC) || (mode_ == HcalTopologyMode::Run4)) { // need to know more eventually
} else if (phase2()) { // need to know more eventually
HBSize_ = maxDepthHB * 16 * IPHI_MAX * 2;
HESize_ = maxDepthHE * (29 - 16 + 1) * maxPhiHE_ * 2;
HOSize_ = 15 * IPHI_MAX * 2; // ieta * iphi * 2
Expand Down Expand Up @@ -567,7 +567,7 @@ bool HcalTopology::validRaw(const HcalDetId& id) const {

if (ok) {
if (subdet == HcalBarrel) {
if ((mode_ == HcalTopologyMode::SLHC) || (mode_ == HcalTopologyMode::H2HE) || (mode_ == HcalTopologyMode::Run4)) {
if (phase2() || (mode_ == HcalTopologyMode::H2HE)) {
if ((aieta > lastHBRing()) || (depth > hcons_->getMaxDepth(0, aieta, iphi, zside)) ||
(depth < hcons_->getMinDepth(0, aieta, iphi, zside)))
ok = false;
Expand All @@ -576,7 +576,7 @@ bool HcalTopology::validRaw(const HcalDetId& id) const {
ok = false;
}
} else if (subdet == HcalEndcap) {
if ((mode_ == HcalTopologyMode::SLHC) || (mode_ == HcalTopologyMode::H2HE) || (mode_ == HcalTopologyMode::Run4)) {
if (phase2() || (mode_ == HcalTopologyMode::H2HE)) {
if ((depth > hcons_->getMaxDepth(1, aieta, iphi, zside)) ||
(depth < hcons_->getMinDepth(1, aieta, iphi, zside)) || (aieta < firstHERing()) || (aieta > lastHERing())) {
ok = false;
Expand Down Expand Up @@ -817,7 +817,7 @@ int HcalTopology::decAIEta(const HcalDetId& id, HcalDetId neighbors[2]) const {
void HcalTopology::depthBinInformation(
HcalSubdetector subdet, int etaRing, int iphi, int zside, int& nDepthBins, int& startingBin) const {
if (subdet == HcalBarrel) {
if ((mode_ == HcalTopologyMode::SLHC) || (mode_ == HcalTopologyMode::H2HE) || (mode_ == HcalTopologyMode::Run4)) {
if (phase2() || (mode_ == HcalTopologyMode::H2HE)) {
startingBin = hcons_->getMinDepth(0, etaRing, iphi, zside);
if (etaRing == lastHBRing()) {
nDepthBins = hcons_->getDepthEta16(1, iphi, zside) - startingBin + 1;
Expand All @@ -834,7 +834,7 @@ void HcalTopology::depthBinInformation(
}
}
} else if (subdet == HcalEndcap) {
if ((mode_ == HcalTopologyMode::SLHC) || (mode_ == HcalTopologyMode::H2HE) || (mode_ == HcalTopologyMode::Run4)) {
if (phase2() || (mode_ == HcalTopologyMode::H2HE)) {
if (etaRing == firstHERing()) {
startingBin = hcons_->getDepthEta16(2, iphi, zside);
} else {
Expand Down Expand Up @@ -888,16 +888,14 @@ bool HcalTopology::incrementDepth(HcalDetId& detId) const {
} else if (subdet == HcalBarrel && etaRing == lastHBRing()) {
// overlap
subdet = HcalEndcap;
if ((mode_ == HcalTopologyMode::SLHC) || (mode_ == HcalTopologyMode::H2HE) || (mode_ == HcalTopologyMode::Run4))
if (phase2() || (mode_ == HcalTopologyMode::H2HE))
depth = hcons_->getDepthEta16(2, iphi, zside);
} else if ((subdet == HcalEndcap) && (etaRing == lastHERing() - 1) && (mode_ != HcalTopologyMode::SLHC) &&
(mode_ != HcalTopologyMode::Run4)) {
} else if ((subdet == HcalEndcap) && (etaRing == lastHERing() - 1) && phase2()) {

This comment has been minimized.

Copy link
@Dr15Jones

Dr15Jones Oct 8, 2024

Contributor

Shouldn't this be !phase2() ?

// guard ring HF29 is behind HE 28
subdet = HcalForward;
(ieta > 0) ? ++ieta : --ieta;
depth = 1;
} else if ((subdet == HcalEndcap) && (etaRing == lastHERing()) && (mode_ != HcalTopologyMode::SLHC) &&
(mode_ != HcalTopologyMode::Run4)) {
} else if ((subdet == HcalEndcap) && (etaRing == lastHERing()) && phase2()) {

This comment has been minimized.

Copy link
@Dr15Jones

Dr15Jones Oct 8, 2024

Contributor

Shouldn't this be !phase2() ?

// split cells go to bigger granularity. Ring 29 -> 28
(ieta > 0) ? --ieta : ++ieta;
} else {
Expand Down Expand Up @@ -931,7 +929,7 @@ bool HcalTopology::decrementDepth(HcalDetId& detId) const {
}
}
} else if ((subdet == HcalEndcap) && (etaRing == lastHERing()) && (depth == hcons_->getDepthEta29(iphi, zside, 0)) &&
(mode_ != HcalTopologyMode::SLHC) && (mode_ != HcalTopologyMode::Run4)) {
phase2()) {

This comment has been minimized.

Copy link
@Dr15Jones

Dr15Jones Oct 8, 2024

Contributor

Shouldn't this be !phase2()?

(ieta > 0) ? --ieta : ++ieta;
} else if (depth <= 0) {
if (subdet == HcalForward && etaRing == firstHFRing()) {
Expand Down Expand Up @@ -1133,9 +1131,7 @@ std::pair<double, double> HcalTopology::etaRange(HcalSubdetector subdet, int ket
return std::pair<double, double>(etaTableHF[ii], etaTableHF[ii + 1]);
}
} else {
int ietal = (((mode_ == HcalTopologyMode::LHC) || (mode_ == HcalTopologyMode::Run3)) && ieta == lastHERing_ - 1)
? (ieta + 1)
: ieta;
int ietal = (phase1() && ieta == lastHERing_ - 1) ? (ieta + 1) : ieta;
if ((ietal < (int)(etaTable.size())) && (ieta > 0))
return std::pair<double, double>(etaTable[ieta - 1], etaTable[ietal]);
}
Expand Down

0 comments on commit 3e95ab9

Please sign in to comment.