Skip to content

Commit

Permalink
Merge pull request #39967 from bsunanda/Run3-hcx337
Browse files Browse the repository at this point in the history
Run3-hcx337 Fix a bug for wrong DetID assignment in HCAL - relevenat for Runs 1,2,3,4
  • Loading branch information
cmsbuild authored Nov 4, 2022
2 parents 1393895 + cd61a9f commit 026fdcc
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions Geometry/HcalCommonData/interface/HcalDDDRecConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class HcalDDDRecConstants {
int getTriggerMode() const { return (((hpar->topologyMode) >> 8) & 0xFF); }
std::vector<HcalCellType> HcalCellTypes(HcalSubdetector) const;
bool isBH() const { return hcons.isBH(); }
bool isHE() const { return hcons.isHE(); }
bool isPlan1(const HcalDetId& id) const { return detIdSp_.find(id) != detIdSp_.end(); };
int maxHFDepth(int ieta, int iphi) const { return hcons.maxHFDepth(ieta, iphi); }
bool mergedDepthList29(int ieta, int iphi, int depth) const;
Expand Down
1 change: 1 addition & 0 deletions Geometry/HcalCommonData/interface/HcalDDDSimConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class HcalDDDSimConstants {
std::vector<HcalCellType> HcalCellTypes() const;
std::vector<HcalCellType> HcalCellTypes(const HcalSubdetector&, int ieta = -1, int depth = -1) const;
bool isBH() const { return isBH_; }
bool isHE() const { return (hpar->etaMax[1] > hpar->etaMin[1]); }
const HcalLayerDepthMap* ldMap() const { return &ldmap_; }
int maxHFDepth(const int& ieta, const int& iphi) const;
unsigned int numberOfCells(const HcalSubdetector&) const;
Expand Down
4 changes: 4 additions & 0 deletions SimG4CMS/Calo/interface/HCalSD.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ class HCalSD : public CaloSD, public Observer<const BeginOfJob*> {
std::unique_ptr<HFDarkening> m_HFDarkening;
std::unique_ptr<HcalTestNS> m_HcalTestNS;

static constexpr double maxZ_ = 10000.0;
static constexpr double minRoff_ = -1500.0;
static constexpr double maxRoff_ = 450.0;
static constexpr double slopeHE_ = 0.4;
bool isHF;
bool agingFlagHB, agingFlagHE;
bool useBirk, useLayerWt, useFibreBundle, usePMTHit;
Expand Down
15 changes: 15 additions & 0 deletions SimG4CMS/Calo/src/HCalSD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,21 @@ bool HCalSD::filterHit(CaloG4Hit* aHit, double time) {

uint32_t HCalSD::setDetUnitId(int det, const G4ThreeVector& pos, int depth, int lay = 1) {
uint32_t id = 0;
if (det == 0) {
if (std::abs(pos.z()) > maxZ_) {
det = 5;
} else if (!(hcalConstants_->isHE())) {
det = 3;
} else {
double minR = minRoff_ + slopeHE_ * std::abs(pos.z());
double maxR = maxRoff_ + slopeHE_ * std::abs(pos.z());
det = ((pos.perp() > minR) && (pos.perp() < maxR)) ? 4 : 3;
}
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HcalSim") << "Position " << pos.perp() << ":" << std::abs(pos.z()) << " Limits "
<< !(hcalConstants_->isHE()) << ":" << maxZ_ << " det " << det;
#endif
}
if (numberingFromDDD.get()) {
//get the ID's as eta, phi, depth, ... indices
HcalNumberingFromDDD::HcalID tmp =
Expand Down

0 comments on commit 026fdcc

Please sign in to comment.