diff --git a/Geometry/HcalCommonData/interface/HcalDDDRecConstants.h b/Geometry/HcalCommonData/interface/HcalDDDRecConstants.h index 1f4d3818a957a..1cd7a60e3b103 100644 --- a/Geometry/HcalCommonData/interface/HcalDDDRecConstants.h +++ b/Geometry/HcalCommonData/interface/HcalDDDRecConstants.h @@ -107,6 +107,7 @@ class HcalDDDRecConstants { int getTriggerMode() const { return (((hpar->topologyMode) >> 8) & 0xFF); } std::vector 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; diff --git a/Geometry/HcalCommonData/interface/HcalDDDSimConstants.h b/Geometry/HcalCommonData/interface/HcalDDDSimConstants.h index 84fdb83be9888..3d34e1a754919 100644 --- a/Geometry/HcalCommonData/interface/HcalDDDSimConstants.h +++ b/Geometry/HcalCommonData/interface/HcalDDDSimConstants.h @@ -62,6 +62,7 @@ class HcalDDDSimConstants { std::vector HcalCellTypes() const; std::vector 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; diff --git a/SimG4CMS/Calo/interface/HCalSD.h b/SimG4CMS/Calo/interface/HCalSD.h index a31c78158bd11..1fefbcbb26c72 100644 --- a/SimG4CMS/Calo/interface/HCalSD.h +++ b/SimG4CMS/Calo/interface/HCalSD.h @@ -97,6 +97,10 @@ class HCalSD : public CaloSD, public Observer { std::unique_ptr m_HFDarkening; std::unique_ptr 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; diff --git a/SimG4CMS/Calo/src/HCalSD.cc b/SimG4CMS/Calo/src/HCalSD.cc index f8c9abada8d3f..aff0d17fa2032 100644 --- a/SimG4CMS/Calo/src/HCalSD.cc +++ b/SimG4CMS/Calo/src/HCalSD.cc @@ -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 =