Skip to content

Commit

Permalink
Merge pull request #42091 from bsunanda/Run3-hcx343
Browse files Browse the repository at this point in the history
Run3-hcx343 Try to fix the issue of Layer 0 weight in HCAL in the version 13_1_X - backport of #42083
  • Loading branch information
cmsbuild authored Jun 28, 2023
2 parents 7871597 + bf27568 commit 29d21c6
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
1 change: 1 addition & 0 deletions Geometry/HcalCommonData/interface/HcalDDDRecConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class HcalDDDRecConstants {
return gcons;
}
}
int findDepth(const int& det, const int& eta, const int& phi, const int& zside, const int& lay) const;
std::vector<int> getDepth(const int& det, const int& phi, const int& zside, const unsigned int& eta) const;
std::vector<int> getDepth(const unsigned int& eta, const bool& extra) const;
int getDepthEta16(const int& det, const int& iphi, const int& zside) const {
Expand Down
3 changes: 1 addition & 2 deletions Geometry/HcalCommonData/interface/HcalHitRelabeller.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ class HcalHitRelabeller {
void setGeometry(const HcalDDDRecConstants*&);
DetId relabel(const uint32_t testId) const;
static DetId relabel(const uint32_t testId, const HcalDDDRecConstants* theRecNumber);

private:
double energyWt(const uint32_t testId) const;

private:
const HcalDDDRecConstants* theRecNumber;
bool neutralDensity_;
};
Expand Down
19 changes: 19 additions & 0 deletions Geometry/HcalCommonData/src/HcalDDDRecConstants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "CLHEP/Units/GlobalSystemOfUnits.h"
#include <algorithm>
#include <cmath>
#include <sstream>

//#define EDM_ML_DEBUG
using namespace geant_units::operators;
Expand All @@ -27,6 +28,24 @@ HcalDDDRecConstants::~HcalDDDRecConstants() {
#endif
}

int HcalDDDRecConstants::findDepth(
const int& det, const int& eta, const int& phi, const int& zside, const int& lay) const {
int depth = hcons.findDepth(det, eta, phi, zside, lay);
if (depth < 0) {
std::vector<int> depths = getDepth(eta, false);
if ((lay > 0) && (lay <= static_cast<int>(depths.size())))
depth = depths[lay - 1];
#ifdef EDM_ML_DEBUG
std::ostringstream st1;
st1 << depths.size() << " depths ";
for (const auto& d : depths)
st1 << ": " << d;
edm::LogVerbatim("HCalGeom") << "HcalDDDRecConstants:: " << st1.str() << " for eta = " << eta << " Depth " << depth;
#endif
}
return depth;
}

std::vector<int> HcalDDDRecConstants::getDepth(const unsigned int& eta, const bool& extra) const {
if (!extra) {
std::vector<HcalParameters::LayerItem>::const_iterator last = hpar->layerGroupEtaRec.begin();
Expand Down
4 changes: 3 additions & 1 deletion Geometry/HcalCommonData/src/HcalHitRelabeller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ double HcalHitRelabeller::energyWt(const uint32_t testId) const {
int det, z, depth, eta, phi, layer;
HcalTestNumbering::unpackHcalIndex(testId, det, z, depth, eta, phi, layer);
int zside = (z == 0) ? (-1) : (1);
double wt = (((det == 1) || (det == 2)) && (depth == 1)) ? theRecNumber->getLayer0Wt(det, phi, zside) : 1.0;
double wt = ((((det == 1) && (layer <= 1)) || ((det == 2) && (layer <= 2))) && (depth == 1))
? theRecNumber->getLayer0Wt(det, phi, zside)
: 1.0;
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HcalSim") << "EnergyWT::det: " << det << " z: " << z << ":" << zside << " depth: " << depth
<< " ieta: " << eta << " iphi: " << phi << " layer: " << layer << " wt " << wt;
Expand Down

0 comments on commit 29d21c6

Please sign in to comment.