Skip to content

Commit

Permalink
Backport #39920 to protect against wrong ieta values which happens fo…
Browse files Browse the repository at this point in the history
…r wrong mixing of signal and PU SIM results

Some fix
  • Loading branch information
Sunanda committed Oct 31, 2022
1 parent c3c952c commit 8cf6650
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 3 additions & 2 deletions CondFormats/GeometryObjects/interface/HcalParameters.h
Expand Up @@ -5,8 +5,8 @@

class HcalParameters {
public:
HcalParameters(void) {}
~HcalParameters(void) {}
HcalParameters(void) = default;
~HcalParameters(void) = default;

struct LayerItem {
unsigned int layer;
Expand Down Expand Up @@ -63,6 +63,7 @@ class HcalParameters {
std::vector<LayerItem> layerGroupEtaSim, layerGroupEtaRec;
int topologyMode;

uint32_t etaMaxHBHE() const { return static_cast<uint32_t>(etagroup.size()); }
COND_SERIALIZABLE;
};

Expand Down
7 changes: 6 additions & 1 deletion Geometry/HcalCommonData/src/HcalDDDRecConstants.cc
Expand Up @@ -160,8 +160,13 @@ std::pair<double, double> HcalDDDRecConstants::getEtaPhi(const int& subdet, cons
}

HcalDDDRecConstants::HcalID HcalDDDRecConstants::getHCID(int subdet, int keta, int iphi, int lay, int idepth) const {
int ieta = (keta > 0) ? keta : -keta;
uint32_t ieta = (keta > 0) ? keta : -keta;
int zside = (keta > 0) ? 1 : -1;
if ((ieta > hpar->etaMaxHBHE()) &&
((subdet == static_cast<int>(HcalOuter)) || (subdet == static_cast<int>(HcalBarrel)) ||
(subdet == static_cast<int>(HcalEndcap))))
throw cms::Exception("HcalDDDRecConstants")
<< "getHCID: receives an eta value " << ieta << " outside the limit (1:" << hpar->etaMaxHBHE() << ")";
int eta(ieta), phi(iphi), depth(idepth);
if ((subdet == static_cast<int>(HcalOuter)) ||
((subdet == static_cast<int>(HcalBarrel)) && (lay > maxLayerHB_ + 1))) {
Expand Down

0 comments on commit 8cf6650

Please sign in to comment.