diff --git a/Geometry/HcalCommonData/interface/HcalDDDRecConstants.h b/Geometry/HcalCommonData/interface/HcalDDDRecConstants.h index 1cd7a60e3b103..070152daa23aa 100644 --- a/Geometry/HcalCommonData/interface/HcalDDDRecConstants.h +++ b/Geometry/HcalCommonData/interface/HcalDDDRecConstants.h @@ -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 getDepth(const int& det, const int& phi, const int& zside, const unsigned int& eta) const; std::vector getDepth(const unsigned int& eta, const bool& extra) const; int getDepthEta16(const int& det, const int& iphi, const int& zside) const { diff --git a/Geometry/HcalCommonData/interface/HcalHitRelabeller.h b/Geometry/HcalCommonData/interface/HcalHitRelabeller.h index f4a166dafd891..c13346197a2e2 100644 --- a/Geometry/HcalCommonData/interface/HcalHitRelabeller.h +++ b/Geometry/HcalCommonData/interface/HcalHitRelabeller.h @@ -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_; }; diff --git a/Geometry/HcalCommonData/src/HcalDDDRecConstants.cc b/Geometry/HcalCommonData/src/HcalDDDRecConstants.cc index 773b325b54fce..4ee9d2c6b0d0c 100644 --- a/Geometry/HcalCommonData/src/HcalDDDRecConstants.cc +++ b/Geometry/HcalCommonData/src/HcalDDDRecConstants.cc @@ -7,6 +7,7 @@ #include "CLHEP/Units/GlobalSystemOfUnits.h" #include #include +#include //#define EDM_ML_DEBUG using namespace geant_units::operators; @@ -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 depths = getDepth(eta, false); + if ((lay > 0) && (lay <= static_cast(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 HcalDDDRecConstants::getDepth(const unsigned int& eta, const bool& extra) const { if (!extra) { std::vector::const_iterator last = hpar->layerGroupEtaRec.begin(); diff --git a/Geometry/HcalCommonData/src/HcalHitRelabeller.cc b/Geometry/HcalCommonData/src/HcalHitRelabeller.cc index 34929db5fcaff..41fdc015925ed 100644 --- a/Geometry/HcalCommonData/src/HcalHitRelabeller.cc +++ b/Geometry/HcalCommonData/src/HcalHitRelabeller.cc @@ -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;