Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run3-hcx344 Try to fix the issue of Layer 0 weight in HCAL in the version 13_0_X - backport of #42083 #42092

Merged
merged 2 commits into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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