Skip to content

Commit

Permalink
Code check
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunanda committed Oct 14, 2024
1 parent 6ce276c commit 1283dba
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 17 deletions.
12 changes: 9 additions & 3 deletions Geometry/CaloTopology/interface/HcalTopology.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,14 @@ class HcalTopology : public CaloSubdetectorTopology {

private:
bool phase1() const { return ((mode_ == HcalTopologyMode::LHC) || (mode_ == HcalTopologyMode::H2HE)); }
bool phase1A() const { return ((mode_ == HcalTopologyMode::LHC) || (mode_ == HcalTopologyMode::Run2A) || (mode_ == HcalTopologyMode::H2) || (mode_ == HcalTopologyMode::H2HE)); }
bool phase1B() const { return ((mode_ == HcalTopologyMode::Run2B) || (mode_ == HcalTopologyMode::Run2C) || (mode_ == HcalTopologyMode::Run3) || (mode_ == HcalTopologyMode::SLHC)); }
bool phase1A() const {
return ((mode_ == HcalTopologyMode::LHC) || (mode_ == HcalTopologyMode::Run2A) || (mode_ == HcalTopologyMode::H2) ||
(mode_ == HcalTopologyMode::H2HE));
}
bool phase1B() const {
return ((mode_ == HcalTopologyMode::Run2B) || (mode_ == HcalTopologyMode::Run2C) ||
(mode_ == HcalTopologyMode::Run3) || (mode_ == HcalTopologyMode::SLHC));
}
bool phase2() const { return ((mode_ == HcalTopologyMode::Run4)); }
/** Get the neighbors of the given cell with higher absolute ieta */
int incAIEta(const HcalDetId& id, HcalDetId neighbors[2]) const;
Expand All @@ -179,7 +185,7 @@ class HcalTopology : public CaloSubdetectorTopology {

/** Is this a valid cell id, ignoring the exclusion list */
bool validDetIdPreLS1(const HcalDetId& id) const;
bool validRaw(const HcalDetId& id, const bool debug=false) const;
bool validRaw(const HcalDetId& id, const bool debug = false) const;
unsigned int detId2denseIdPreLS1(const DetId& id) const;
bool isExcluded(const HcalDetId& id) const;

Expand Down
31 changes: 19 additions & 12 deletions Geometry/CaloTopology/src/HcalTopology.cc
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ HcalTopology::HcalTopology(const HcalDDDRecConstants* hcons, const bool mergePos

// Now redfine some of the sizes
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HCalGeom") << "Redefined sizes could be for HB:" << ncells(HcalBarrel) << " HE:" << ncells(HcalEndcap) << " HF: " << ncells(HcalForward);
edm::LogVerbatim("HCalGeom") << "Redefined sizes could be for HB:" << ncells(HcalBarrel)
<< " HE:" << ncells(HcalEndcap) << " HF: " << ncells(HcalForward);
#endif
}

Expand Down Expand Up @@ -495,7 +496,7 @@ bool HcalTopology::validDetIdPreLS1(const HcalDetId& id) const {
/** Is this a valid cell id? */
bool HcalTopology::validRaw(const HcalDetId& id,
#ifdef EDM_ML_DEBUG
const bool debug) const {
const bool debug) const {
#else
const bool) const {
#endif
Expand Down Expand Up @@ -568,7 +569,13 @@ bool HcalTopology::validRaw(const HcalDetId& id,
}
#ifdef EDM_ML_DEBUG
if (debug)
edm::LogVerbatim("HCalGeom") << "HcalValdRaw ID: " << subdet << ":" << aieta << ":" << depth << ":" << iphi << ":" << zside << " Mode " << mode_ << ":" << phase1() << ":" << phase1A() << ":" << phase1B() << ":" << phase2() << " Limits HB " << lastHBRing() << " HE " << firstHERing() << ":" << lastHERing() << ":" << firstHEDoublePhiRing() << ":" << firstHEQuadPhiRing() << " Depth " << hcons_->getMaxDepth(0, aieta, iphi, zside) << ":" << hcons_->getMinDepth(0, aieta, iphi, zside) << ":" << hcons_->getDepthEta16(2, iphi, zside) << " OK " << ok;
edm::LogVerbatim("HCalGeom") << "HcalValdRaw ID: " << subdet << ":" << aieta << ":" << depth << ":" << iphi << ":"
<< zside << " Mode " << mode_ << ":" << phase1() << ":" << phase1A() << ":"
<< phase1B() << ":" << phase2() << " Limits HB " << lastHBRing() << " HE "
<< firstHERing() << ":" << lastHERing() << ":" << firstHEDoublePhiRing() << ":"
<< firstHEQuadPhiRing() << " Depth " << hcons_->getMaxDepth(0, aieta, iphi, zside)
<< ":" << hcons_->getMinDepth(0, aieta, iphi, zside) << ":"
<< hcons_->getDepthEta16(2, iphi, zside) << " OK " << ok;
#endif
return ok;
}
Expand Down Expand Up @@ -836,13 +843,13 @@ bool HcalTopology::incrementDepth(HcalDetId& detId) const {
depth = 4;
} else if (subdet == HcalBarrel && etaRing == lastHBRing()) {
// overlap
if (phase2()) { // No more chance
detId = HcalDetId();
return false;
if (phase2()) { // No more chance
detId = HcalDetId();
return false;
} else {
subdet = HcalEndcap;
if (phase1B())
depth = hcons_->getDepthEta16(2, iphi, zside);
subdet = HcalEndcap;
if (phase1B())
depth = hcons_->getDepthEta16(2, iphi, zside);
}
} else if ((subdet == HcalEndcap) && (etaRing == lastHERing() - 1) && !phase1B()) {
// guard ring HF29 is behind HE 28
Expand Down Expand Up @@ -1650,9 +1657,9 @@ unsigned int HcalTopology::ncells(int subdet) const {
for (int eta = -maxEta_; eta <= maxEta_; eta++) {
for (unsigned int phi = 1; phi <= maxPhi_; phi++) {
for (int depth = 1; depth <= 7; depth++) {
HcalDetId cell((HcalSubdetector)subdet, eta, phi, depth);
if (validRaw(cell, true))
++ncell;
HcalDetId cell((HcalSubdetector)subdet, eta, phi, depth);
if (validRaw(cell, true))
++ncell;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Geometry/CaloTopology/test/HcalTopologyTester.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ void HcalTopologyTester::doTest(const HcalTopology& topology) {
<< " Calib: " << topology.getCALIBSize() << " Overall: " << topology.ncells();
std::vector<std::string> dets = {"HB", "HE", "HO", "HF"};
for (int det = 1; det <= 4; ++det)
edm::LogVerbatim("HCalGeom") << "Valid cells for " << dets[det-1] << " = " << topology.ncells(det);
edm::LogVerbatim("HCalGeom") << "Valid cells for " << dets[det - 1] << " = " << topology.ncells(det);

// First test on movements along eta/phi directions
edm::LogVerbatim("HCalGeom") << "\nTest on movements along eta/phi directions"
<< "\n==========================================";
Expand Down

0 comments on commit 1283dba

Please sign in to comment.