Skip to content

Commit

Permalink
Backport cms-sw#39920 to protect against wrong ieta values which happ…
Browse files Browse the repository at this point in the history
…ens for wrong mixing of signal and PU SIM results
  • Loading branch information
Sunanda committed Oct 29, 2022
1 parent c3c952c commit b131be5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 3 additions & 2 deletions CondFormats/GeometryObjects/interface/HcalParameters.h
Original file line number Diff line number Diff line change
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
8 changes: 7 additions & 1 deletion Geometry/HcalCommonData/src/HcalDDDRecConstants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ HcalDDDRecConstants::~HcalDDDRecConstants() {
}

std::vector<int> HcalDDDRecConstants::getDepth(const unsigned int& eta, const bool& extra) const {
if (eta > hpar->etaMaxHBHE())
throw cms::Exception("HcalDDDRecConstants")
<< "getDepth: receives an eta value " << eta << " outside the limit (1:" << hpar->etaMaxHBHE() << ")";
if (!extra) {
std::vector<HcalParameters::LayerItem>::const_iterator last = hpar->layerGroupEtaRec.begin();
for (std::vector<HcalParameters::LayerItem>::const_iterator it = hpar->layerGroupEtaRec.begin();
Expand Down Expand Up @@ -160,8 +163,11 @@ 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())
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 b131be5

Please sign in to comment.