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-hcx337 Fix a bug for wrong DetID assignment in HCAL - relevenat for Runs 1,2,3,4 #39967

Merged
merged 3 commits into from
Nov 4, 2022
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 @@ -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