From 743b5e107d006d393b02167d512caaa917ae207a Mon Sep 17 00:00:00 2001 From: Sunanda Date: Sat, 22 Jun 2024 05:21:49 +0200 Subject: [PATCH 1/2] Give correct names of some of the variables and correct their implementation in the HGCal Geometry --- .../ForwardDetId/interface/HGCSiliconDetId.h | 30 +++---- .../interface/HGCalTriggerDetId.h | 7 +- .../ForwardDetId/src/HGCalTriggerDetId.cc | 8 +- .../HGCalCommonData/interface/HGCalTypes.h | 10 +-- .../src/HGCalCalibrationCell.cc | 2 +- .../HGCalCommonData/src/HGCalDDDConstants.cc | 69 ++++++++-------- .../HGCalCommonData/src/HGCalWaferType.cc | 14 ++-- .../HGCalCommonData/test/HGCalConvert.cpp | 30 +++---- .../HGCalGeometry/test/HGCGeomAnalyzer.cc | 8 +- .../geometries/HGCalTriggerGeometryV9Imp2.cc | 4 +- .../geometries/HGCalTriggerGeometryV9Imp3.cc | 4 +- SimG4CMS/Calo/plugins/HGCalTestGuardRing.cc | 10 +-- SimG4CMS/Calo/src/HGCalNumberingScheme.cc | 2 +- .../plugins/HGCalSimHitValidation.cc | 12 +-- .../HGCalValidation/test/HGCalCellHitSum.cc | 78 +++++++++---------- .../HGCalValidation/test/HGCalMTRecoStudy.cc | 12 +-- 16 files changed, 153 insertions(+), 147 deletions(-) diff --git a/DataFormats/ForwardDetId/interface/HGCSiliconDetId.h b/DataFormats/ForwardDetId/interface/HGCSiliconDetId.h index 0894769356cd1..3d1682d5f4680 100644 --- a/DataFormats/ForwardDetId/interface/HGCSiliconDetId.h +++ b/DataFormats/ForwardDetId/interface/HGCSiliconDetId.h @@ -15,15 +15,15 @@ [19:19] sign of v (0:+v; 1:-v) (v=0 is at the center of beam line) [20:24] layer number [25:25] z-side (0 for +z; 1 for -z) - [26:27] Type (0 fine divisions of wafer with 120 mum thick silicon - 1 coarse divisions of wafer with 200 mum thick silicon - 2 coarse divisions of wafer with 300 mum thick silicon - 3 fine divisions of wafer with 200 mum thick silicon) + [26:27] Type (0 high density wafer with depltetion thickness of 120 mum + 1 low density wafer with depletion thickness of 200 mum + 2 low density wafer with depletion thickness of 300 mum + 3 high density wafer with depletion thickness of 200 mum) [28:31] Detector type (HGCalEE or HGCalHSi) */ class HGCSiliconDetId : public DetId { public: - enum waferType { HGCalFine = 0, HGCalCoarseThin = 1, HGCalCoarseThick = 2, HGCalFineThick = 3 }; + enum waferType { HGCalHD120 = 0, HGCalLD200 = 1, HGCalLD300 = 2, HGCalHD200 = 3 }; static constexpr int32_t HGCalHighDensityN = 12; static constexpr int32_t HGCalLowDensityN = 8; static constexpr int32_t HGCalFineTrigger = 3; @@ -95,11 +95,11 @@ class HGCSiliconDetId : public DetId { /// get the type constexpr int32_t type() const { return (id_ >> kHGCalTypeOffset) & kHGCalTypeMask; } - constexpr bool lowDensity() const { return ((type() == HGCalCoarseThin) || (type() == HGCalCoarseThick)); } - constexpr bool highDensity() const { return ((type() == HGCalFine) || (type() == HGCalFineThick)); } + constexpr bool lowDensity() const { return ((type() == HGCalLD200) || (type() == HGCalLD300)); } + constexpr bool highDensity() const { return ((type() == HGCalHD120) || (type() == HGCalHD200)); } constexpr int32_t depletion() const { - return ((type() == HGCalFine) ? HGCal0Depletion - : ((type() == HGCalCoarseThick) ? HGCal2Depletion : HGCal1Depletion)); + return ((type() == HGCalHD120) ? HGCal0Depletion + : ((type() == HGCalLD300) ? HGCal2Depletion : HGCal1Depletion)); } /// get the z-side of the cell (1/-1) @@ -113,11 +113,11 @@ class HGCSiliconDetId : public DetId { constexpr int32_t cellV() const { return (id_ >> kHGCalCellVOffset) & kHGCalCellVMask; } constexpr std::pair cellUV() const { return std::pair(cellU(), cellV()); } constexpr int32_t cellX() const { - int32_t N = ((type() == HGCalFine) || (type() == HGCalFineThick)) ? HGCalHighDensityN : HGCalLowDensityN; + int32_t N = ((type() == HGCalHD120) || (type() == HGCalHD200)) ? HGCalHighDensityN : HGCalLowDensityN; return (3 * (cellV() - N) + 2); } constexpr int32_t cellY() const { - int32_t N = ((type() == HGCalFine) || (type() == HGCalFineThick)) ? HGCalHighDensityN : HGCalLowDensityN; + int32_t N = ((type() == HGCalHD120) || (type() == HGCalHD200)) ? HGCalHighDensityN : HGCalLowDensityN; return (2 * cellU() - (N + cellV())); } constexpr std::pair cellXY() const { return std::pair(cellX(), cellY()); } @@ -148,15 +148,15 @@ class HGCSiliconDetId : public DetId { // get trigger cell u,v constexpr int32_t triggerCellU() const { - int32_t N = ((type() == HGCalFine) || (type() == HGCalFineThick)) ? HGCalHighDensityN : HGCalLowDensityN; - int32_t NT = ((type() == HGCalFine) || (type() == HGCalFineThick)) ? HGCalFineTrigger : HGCalCoarseTrigger; + int32_t N = ((type() == HGCalHD120) || (type() == HGCalHD200)) ? HGCalHighDensityN : HGCalLowDensityN; + int32_t NT = ((type() == HGCalHD120) || (type() == HGCalHD200)) ? HGCalFineTrigger : HGCalCoarseTrigger; return (cellU() >= N && cellV() >= N) ? cellU() / NT : ((cellU() < N && cellU() <= cellV()) ? cellU() / NT : (1 + (cellU() - (cellV() % NT + 1)) / NT)); } constexpr int32_t triggerCellV() const { - int32_t N = ((type() == HGCalFine) || (type() == HGCalFineThick)) ? HGCalHighDensityN : HGCalLowDensityN; - int32_t NT = ((type() == HGCalFine) || (type() == HGCalFineThick)) ? HGCalFineTrigger : HGCalCoarseTrigger; + int32_t N = ((type() == HGCalHD120) || (type() == HGCalHD200)) ? HGCalHighDensityN : HGCalLowDensityN; + int32_t NT = ((type() == HGCalHD120) || (type() == HGCalHD200)) ? HGCalFineTrigger : HGCalCoarseTrigger; return (cellU() >= N && cellV() >= N) ? cellV() / NT : ((cellU() < N && cellU() <= cellV()) ? ((cellV() - cellU()) / NT + cellU() / NT) : cellV() / NT); diff --git a/DataFormats/ForwardDetId/interface/HGCalTriggerDetId.h b/DataFormats/ForwardDetId/interface/HGCalTriggerDetId.h index a8a5d919150c7..18ab43f6b77a4 100644 --- a/DataFormats/ForwardDetId/interface/HGCalTriggerDetId.h +++ b/DataFormats/ForwardDetId/interface/HGCalTriggerDetId.h @@ -15,9 +15,10 @@ [13:16] abs(v) of the wafer (v-axis points 60-degree wrt x-axis) [17:17] sign of v (0:+v; 1:-v) (v=0 is at the center of beam line) [18:22] layer number - [23:24] Type (0 fine divisions of wafer with 120 mum thick silicon - 1 coarse divisions of wafer with 200 mum thick silicon - 2 coarse divisions of wafer with 300 mum thick silicon) + [23:24] Type (0 high density wafer with depltetion thickness of 120 mum + 1 low density wafer with depletion thickness of 200 mum + 2 low density wafer with depletion thickness of 300 mum + 3 high density wafer with depletion thickness of 200 mum) [25:26] Subdetector Type (HGCalEETrigger/HGCalHSiTrigger) [27:27] z-side (0 for +z; 1 for -z) [28:31] Detector type (HGCalTrigger) diff --git a/DataFormats/ForwardDetId/src/HGCalTriggerDetId.cc b/DataFormats/ForwardDetId/src/HGCalTriggerDetId.cc index 7bd9061b5681e..356388231255f 100644 --- a/DataFormats/ForwardDetId/src/HGCalTriggerDetId.cc +++ b/DataFormats/ForwardDetId/src/HGCalTriggerDetId.cc @@ -48,7 +48,7 @@ HGCalTriggerDetId& HGCalTriggerDetId::operator=(const DetId& gen) { int HGCalTriggerDetId::triggerCellX() const { int nT = - (type() == HGCSiliconDetId::HGCalFine) ? HGCSiliconDetId::HGCalFineTrigger : HGCSiliconDetId::HGCalCoarseTrigger; + ((type() == HGCSiliconDetId::HGCalHD120) || (type() == HGCSiliconDetId::HGCalHD200)) ? HGCSiliconDetId::HGCalFineTrigger : HGCSiliconDetId::HGCalCoarseTrigger; int N = nT * HGCalTriggerCell; std::vector vc = cellV(); int x(0); @@ -60,7 +60,7 @@ int HGCalTriggerDetId::triggerCellX() const { int HGCalTriggerDetId::triggerCellY() const { int nT = - (type() == HGCSiliconDetId::HGCalFine) ? HGCSiliconDetId::HGCalFineTrigger : HGCSiliconDetId::HGCalCoarseTrigger; + ((type() == HGCSiliconDetId::HGCalHD120) || (type() == HGCSiliconDetId::HGCalHD200)) ? HGCSiliconDetId::HGCalFineTrigger : HGCSiliconDetId::HGCalCoarseTrigger; int N = nT * HGCalTriggerCell; std::vector uc = cellU(); std::vector vc = cellV(); @@ -74,7 +74,7 @@ int HGCalTriggerDetId::triggerCellY() const { std::vector HGCalTriggerDetId::cellU() const { std::vector uc; int nT = - (type() == HGCSiliconDetId::HGCalFine) ? HGCSiliconDetId::HGCalFineTrigger : HGCSiliconDetId::HGCalCoarseTrigger; + ((type() == HGCSiliconDetId::HGCalHD120) || (type() == HGCSiliconDetId::HGCalHD200)) ? HGCSiliconDetId::HGCalFineTrigger : HGCSiliconDetId::HGCalCoarseTrigger; if ((triggerCellU() >= HGCalTriggerCell) && (triggerCellV() >= HGCalTriggerCell)) { int u0 = nT * triggerCellU(); for (int i = 0; i < nT; ++i) { @@ -104,7 +104,7 @@ std::vector HGCalTriggerDetId::cellU() const { std::vector HGCalTriggerDetId::cellV() const { std::vector vc; int nT = - (type() == HGCSiliconDetId::HGCalFine) ? HGCSiliconDetId::HGCalFineTrigger : HGCSiliconDetId::HGCalCoarseTrigger; + ((type() == HGCSiliconDetId::HGCalHD120) || (type() == HGCSiliconDetId::HGCalHD200)) ? HGCSiliconDetId::HGCalFineTrigger : HGCSiliconDetId::HGCalCoarseTrigger; if ((triggerCellU() >= HGCalTriggerCell) && (triggerCellV() >= HGCalTriggerCell)) { int v0 = nT * triggerCellV(); for (int i = 0; i < nT; ++i) { diff --git a/Geometry/HGCalCommonData/interface/HGCalTypes.h b/Geometry/HGCalCommonData/interface/HGCalTypes.h index d8393326a7602..4b61e93f04642 100644 --- a/Geometry/HGCalCommonData/interface/HGCalTypes.h +++ b/Geometry/HGCalCommonData/interface/HGCalTypes.h @@ -27,10 +27,10 @@ class HGCalTypes { static constexpr int32_t WaferCenterR = 6; static constexpr int32_t WaferTypeUndefined = -1; - static constexpr int32_t WaferFineThin = 0; - static constexpr int32_t WaferCoarseThin = 1; - static constexpr int32_t WaferCoarseThick = 2; - static constexpr int32_t WaferFineThick = 3; + static constexpr int32_t WaferHD120 = 0; + static constexpr int32_t WaferLD200 = 1; + static constexpr int32_t WaferLD300 = 2; + static constexpr int32_t WaferHD200 = 3; static constexpr int32_t WaferFull = 0; static constexpr int32_t WaferFive = 1; @@ -137,7 +137,7 @@ class HGCalTypes { static constexpr int32_t layerFrontBack(int32_t layerOrient) { return ((layerOrient == WaferCenterB) ? 1 : -1); } static constexpr int32_t waferFrontBack(int32_t index) { return ((index == 0) ? -1 : 1); } // LD vs HD and Fullvs Partial wafer - static constexpr bool waferHD(int32_t type) { return ((type == WaferFineThin) || (type == WaferFineThick)); } + static constexpr bool waferHD(int32_t type) { return ((type == WaferHD120) || (type == WaferHD200)); } static constexpr bool waferFull(int32_t type) { return (type == WaferFull); } private: diff --git a/Geometry/HGCalCommonData/src/HGCalCalibrationCell.cc b/Geometry/HGCalCommonData/src/HGCalCalibrationCell.cc index de01ec5009adc..49e3283b2a092 100644 --- a/Geometry/HGCalCommonData/src/HGCalCalibrationCell.cc +++ b/Geometry/HGCalCommonData/src/HGCalCalibrationCell.cc @@ -39,7 +39,7 @@ HGCalCalibrationCell::HGCalCalibrationCell(const HGCalDDDConstants* cons) : cons int HGCalCalibrationCell::findCell( int zside, int layer, int waferU, int waferV, int cellUV, const std::pair& xy) const { const auto& info = cons_->waferInfo(layer, waferU, waferV); - int ld = (info.type == HGCalTypes::WaferFineThin) ? 1 : 0; + int ld = ((info.type == HGCalTypes::WaferHD120) ||(info.type == HGCalTypes::WaferHD200)) ? 1 : 0; int part = (info.part == HGCalTypes::WaferFull) ? 1 : 0; int indx = 2 * ld + part; #ifdef EDM_ML_DEBUG diff --git a/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc b/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc index 472473f58f5aa..fd4d132016f2c 100644 --- a/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc +++ b/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc @@ -311,13 +311,13 @@ bool HGCalDDDConstants::cellInLayer(int waferU, int waferV, int cellU, int cellV } else if (mode_ == HGCalGeometryMode::Hexagon8Module) { int indx = HGCalWaferIndex::waferIndex(lay, waferU, waferV); auto ktr = hgpar_->waferInfoMap_.find(indx); - int thck(HGCalTypes::WaferFineThin), part(HGCalTypes::WaferFull), rotn(HGCalTypes::WaferOrient0); + int thck(HGCalTypes::WaferHD120), part(HGCalTypes::WaferFull), rotn(HGCalTypes::WaferOrient0); if (ktr != hgpar_->waferInfoMap_.end()) { thck = (ktr->second).type; part = (ktr->second).part; rotn = (ktr->second).orient; } - int ncell = (thck == HGCalTypes::WaferFineThin) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_; + int ncell = ((thck == HGCalTypes::WaferHD120) || (thck == HGCalTypes::WaferHD200)) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_; return HGCalWaferMask::goodCell(cellU, cellV, ncell, part, rotn); } else if (waferHexagon8() || waferHexagon6()) { const auto& xy = @@ -355,7 +355,7 @@ double HGCalDDDConstants::cellSizeHex(int type) const { int32_t HGCalDDDConstants::cellType(int type, int cellU, int cellV, int iz, int fwdBack, int orient) const { int placement = (orient < 0) ? HGCalCell::cellPlacementOld : HGCalCell::cellPlacementIndex(iz, fwdBack, orient); - int ncell = (type == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_; + int ncell = ((type == HGCSiliconDetId::HGCalHD120) || (type == HGCSiliconDetId::HGCalHD200)) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_; auto cellType = HGCalCell::cellType(cellU, cellV, ncell, placement); return cellType.first; } @@ -464,7 +464,7 @@ HGCalParameters::hgtrap HGCalDDDConstants::getModule(unsigned int indx, bool hex << ":" << (hgpar_->waferPosX_).size() << ":" << (hgpar_->waferPosY_).size() << " ***** ERROR *****"; unsigned int type = - ((indx < hgpar_->waferTypeL_.size()) ? hgpar_->waferTypeL_[indx] - 1 : HGCSiliconDetId::HGCalCoarseThick); + ((indx < hgpar_->waferTypeL_.size()) ? hgpar_->waferTypeL_[indx] - 1 : HGCSiliconDetId::HGCalLD300); mytr = hgpar_->getModule(type, reco); } else { mytr = hgpar_->getModule(indx, reco); @@ -563,7 +563,7 @@ double HGCalDDDConstants::guardRingOffset(bool reco) const { bool HGCalDDDConstants::isHalfCell(int waferType, int cell) const { if (waferType < 1 || cell < 0) return false; - return waferType == 2 ? hgpar_->cellCoarseHalf_[cell] : hgpar_->cellFineHalf_[cell]; + return ((waferType == HGCalTypes::WaferLD200) || (waferType == HGCalTypes::WaferLD300)) ? hgpar_->cellCoarseHalf_[cell] : hgpar_->cellFineHalf_[cell]; } bool HGCalDDDConstants::isValidHex(int lay, int mod, int cell, bool reco) const { @@ -588,9 +588,7 @@ bool HGCalDDDConstants::isValidHex(int lay, int mod, int cell, bool reco) const if (mod >= static_cast(hgpar_->waferTypeT_.size())) edm::LogWarning("HGCalGeom") << "Module no. out of bound for " << mod << " to be compared with " << (hgpar_->waferTypeT_).size() << " ***** ERROR *****"; - cellmax = ((hgpar_->waferTypeT_[mod] - 1 == HGCSiliconDetId::HGCalFine) - ? static_cast(hgpar_->cellFineX_.size()) - : static_cast(hgpar_->cellCoarseX_.size())); + cellmax = (((hgpar_->waferTypeT_[mod] - 1) == HGCSiliconDetId::HGCalHD120) || ((hgpar_->waferTypeT_[mod] - 1) == HGCSiliconDetId::HGCalHD200)) ? static_cast(hgpar_->cellFineX_.size()) : static_cast(hgpar_->cellCoarseX_.size()); result = (cell >= 0 && cell <= cellmax); } else { result = isValidCell(lay_idx, mod, cell); @@ -688,7 +686,7 @@ bool HGCalDDDConstants::isValidHex8(int layer, int modU, int modV, int cellU, in int indx = HGCalWaferIndex::waferIndex(layer, modU, modV); auto itr = hgpar_->typesInLayers_.find(indx); int type = hgpar_->waferTypeL_[itr->second]; - int N = ((hgpar_->waferTypeL_[itr->second] == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_); + int N = (((hgpar_->waferTypeL_[itr->second] == HGCalTypes::WaferHD120) || (hgpar_->waferTypeL_[itr->second] == HGCalTypes::WaferHD200)) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_); #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants::isValidHex8:Cell " << cellU << ":" << cellV << ":" << N << " Tests " << (cellU >= 0) << ":" << (cellU < 2 * N) << ":" << (cellV >= 0) << ":" @@ -806,7 +804,7 @@ std::pair HGCalDDDConstants::locateCell(int cell, int lay, int typ #ifdef EDM_ML_DEBUG float x0(x), y0(y); #endif - if (hgpar_->waferTypeT_[type] - 1 == HGCSiliconDetId::HGCalFine) { + if ((hgpar_->waferTypeT_[type] - 1 == HGCSiliconDetId::HGCalHD120) || (hgpar_->waferTypeT_[type] - 1 == HGCSiliconDetId::HGCalHD200)) { x += hgpar_->cellFineX_[cell]; y += hgpar_->cellFineY_[cell]; } else { @@ -855,7 +853,7 @@ std::pair HGCalDDDConstants::locateCell( << " Position " << x << ":" << y; } else { int kndx = cellV * 100 + cellU; - if (type == 0) { + if ((type == HGCSiliconDetId::HGCalHD120) || (type == HGCSiliconDetId::HGCalHD200)) { auto jtr = hgpar_->cellFineIndex_.find(kndx); if (jtr != hgpar_->cellFineIndex_.end()) { x = hgpar_->cellFineX_[jtr->second]; @@ -917,7 +915,7 @@ std::pair HGCalDDDConstants::locateCell(const HGCScintillatorDetId std::pair HGCalDDDConstants::locateCellHex(int cell, int wafer, bool reco) const { float x(0), y(0); - if (hgpar_->waferTypeT_[wafer] - 1 == HGCSiliconDetId::HGCalFine) { + if ((hgpar_->waferTypeT_[wafer] - 1 == HGCSiliconDetId::HGCalHD120) || (hgpar_->waferTypeT_[wafer] - 1 == HGCSiliconDetId::HGCalHD200)) { x = hgpar_->cellFineX_[cell]; y = hgpar_->cellFineY_[cell]; } else { @@ -1042,8 +1040,7 @@ int HGCalDDDConstants::maxCells(int lay, bool reco) const { unsigned int cells(0); for (unsigned int k = 0; k < hgpar_->waferTypeT_.size(); ++k) { if (waferInLayerTest(k, index.first, hgpar_->defineFull_)) { - unsigned int cell = (hgpar_->waferTypeT_[k] - 1 == HGCSiliconDetId::HGCalFine) ? (hgpar_->cellFineX_.size()) - : (hgpar_->cellCoarseX_.size()); + unsigned int cell = (((hgpar_->waferTypeT_[k] - 1) == HGCSiliconDetId::HGCalHD120) || ((hgpar_->waferTypeT_[k] - 1) == HGCSiliconDetId::HGCalHD200)) ? (hgpar_->cellFineX_.size()) : (hgpar_->cellCoarseX_.size()); if (cell > cells) cells = cell; } @@ -1055,9 +1052,9 @@ int HGCalDDDConstants::maxCells(int lay, bool reco) const { if (waferInLayerTest(k, index.first, hgpar_->defineFull_)) { auto itr = hgpar_->typesInLayers_.find(HGCalWaferIndex::waferIndex( lay, HGCalWaferIndex::waferU(hgpar_->waferCopy_[k]), HGCalWaferIndex::waferV(hgpar_->waferCopy_[k]))); - int type = ((itr == hgpar_->typesInLayers_.end()) ? HGCSiliconDetId::HGCalCoarseThick + int type = ((itr == hgpar_->typesInLayers_.end()) ? HGCSiliconDetId::HGCalLD300 : hgpar_->waferTypeL_[itr->second]); - int N = (type == HGCSiliconDetId::HGCalFine) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_; + int N = ((type == HGCSiliconDetId::HGCalHD120) || (type == HGCSiliconDetId::HGCalHD200)) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_; cells = std::max(cells, 3 * N * N); } } @@ -1091,7 +1088,17 @@ int HGCalDDDConstants::maxRows(int lay, bool reco) const { int HGCalDDDConstants::modifyUV(int uv, int type1, int type2) const { // Modify u/v for transition of type1 to type2 - return (((type1 == type2) || (type1 * type2 != 0)) ? uv : ((type1 == 0) ? (2 * uv + 1) / 3 : (3 * uv) / 2)); + int uvx(uv); + if (type1 != type2) { + if ((type1 == HGCSiliconDetId::HGCalHD120) || (type1 == HGCSiliconDetId::HGCalHD200)) { + if ((type2 == HGCSiliconDetId::HGCalLD200) || (type2 == HGCSiliconDetId::HGCalLD300)) + uvx = (2 * uv + 1) / 3; + } else { + if ((type2 == HGCSiliconDetId::HGCalHD120) || (type2 == HGCSiliconDetId::HGCalHD200)) + uvx = (3 * uv) / 2; + } + } + return uvx; } int HGCalDDDConstants::modules(int lay, bool reco) const { @@ -1144,9 +1151,7 @@ std::vector HGCalDDDConstants::numberCells(int lay, bool reco) const { if (waferHexagon6()) { for (unsigned int k = 0; k < hgpar_->waferTypeT_.size(); ++k) { if (waferInLayerTest(k, i, hgpar_->defineFull_)) { - unsigned int cell = (hgpar_->waferTypeT_[k] - 1 == HGCSiliconDetId::HGCalFine) - ? (hgpar_->cellFineX_.size()) - : (hgpar_->cellCoarseX_.size()); + unsigned int cell = (((hgpar_->waferTypeT_[k] - 1) == HGCSiliconDetId::HGCalHD120) || ((hgpar_->waferTypeT_[k] - 1) == HGCSiliconDetId::HGCalHD200)) ? (hgpar_->cellFineX_.size()) : (hgpar_->cellCoarseX_.size()); ncell.emplace_back(static_cast(cell)); } } @@ -1171,7 +1176,7 @@ std::vector HGCalDDDConstants::numberCells(int lay, bool reco) const { int HGCalDDDConstants::numberCellsHexagon(int wafer) const { if (wafer >= 0 && wafer < static_cast(hgpar_->waferTypeT_.size())) { - if (hgpar_->waferTypeT_[wafer] - 1 == HGCSiliconDetId::HGCalFine) + if (((hgpar_->waferTypeT_[wafer] - 1) == HGCSiliconDetId::HGCalHD120) || ((hgpar_->waferTypeT_[wafer] - 1) == HGCSiliconDetId::HGCalHD200)) return static_cast(hgpar_->cellFineX_.size()); else return static_cast(hgpar_->cellCoarseX_.size()); @@ -1183,8 +1188,8 @@ int HGCalDDDConstants::numberCellsHexagon(int wafer) const { int HGCalDDDConstants::numberCellsHexagon(int lay, int waferU, int waferV, bool flag) const { auto itr = hgpar_->typesInLayers_.find(HGCalWaferIndex::waferIndex(lay, waferU, waferV)); int type = - ((itr == hgpar_->typesInLayers_.end()) ? HGCSiliconDetId::HGCalCoarseThick : hgpar_->waferTypeL_[itr->second]); - int N = (type == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_; + ((itr == hgpar_->typesInLayers_.end()) ? HGCSiliconDetId::HGCalLD300 : hgpar_->waferTypeL_[itr->second]); + int N = ((type == HGCSiliconDetId::HGCalHD120) || (type == HGCSiliconDetId::HGCalHD200)) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_; if (flag) return (3 * N * N); else @@ -1432,7 +1437,7 @@ void HGCalDDDConstants::waferFromPosition(const double x, const double y, int& w } } if (wafer < size_) { - if (celltyp - 1 == HGCSiliconDetId::HGCalFine) + if ((celltyp - 1 == HGCSiliconDetId::HGCalHD120) || (celltyp - 1 == HGCSiliconDetId::HGCalHD200)) icell = cellHex( xx, yy, 0.5 * HGCalParameters::k_ScaleFromDDD * hgpar_->cellSize_[0], hgpar_->cellFineX_, hgpar_->cellFineY_); else @@ -1537,7 +1542,7 @@ void HGCalDDDConstants::waferFromPosition(const double x, << HGCalWaferType::getCassette(index, hgpar_->waferInfoMap_); } else { auto itr = hgpar_->typesInLayers_.find(HGCalWaferIndex::waferIndex(layer, waferU, waferV)); - celltype = ((itr == hgpar_->typesInLayers_.end()) ? HGCSiliconDetId::HGCalCoarseThick + celltype = ((itr == hgpar_->typesInLayers_.end()) ? HGCSiliconDetId::HGCalLD300 : hgpar_->waferTypeL_[itr->second]); } if (debug) @@ -1583,7 +1588,7 @@ void HGCalDDDConstants::waferFromPosition(const double x, << HGCalWaferType::getCassette(index, hgpar_->waferInfoMap_); } else { auto itr = hgpar_->typesInLayers_.find(HGCalWaferIndex::waferIndex(layer, waferU, waferV)); - celltype = ((itr == hgpar_->typesInLayers_.end()) ? HGCSiliconDetId::HGCalCoarseThick + celltype = ((itr == hgpar_->typesInLayers_.end()) ? HGCSiliconDetId::HGCalLD300 : hgpar_->waferTypeL_[itr->second]); } xx -= (dx0 + hgpar_->waferPosX_[k]); @@ -1607,7 +1612,7 @@ void HGCalDDDConstants::waferFromPosition(const double x, } } cellHex(xx, yy, celltype, place, part, cellU, cellV, extend, debug); - wt = (((celltype < 2) && (hgpar_->useSimWt_ > 0)) ? (hgpar_->cellThickness_[celltype] / hgpar_->waferThick_) : 1.0); + wt = ((((celltype == HGCSiliconDetId::HGCalHD120) || (celltype == HGCSiliconDetId::HGCalHD200)) && (hgpar_->useSimWt_ > 0)) ? (hgpar_->cellThickness_[celltype] / hgpar_->waferThick_) : 1.0); } else { cellU = cellV = 2 * hgpar_->nCellsFine_; wt = 1.0; @@ -1789,7 +1794,7 @@ int HGCalDDDConstants::waferType(DetId const& id, bool fromFile) const { } int HGCalDDDConstants::waferType(int layer, int waferU, int waferV, bool fromFile) const { - int type(HGCSiliconDetId::HGCalCoarseThick); + int type(HGCSiliconDetId::HGCalLD300); if (waferHexagon8()) { if (fromFile && (waferFileSize() > 0)) { auto itr = hgpar_->waferInfoMap_.find(HGCalWaferIndex::waferIndex(layer, waferU, waferV)); @@ -1945,7 +1950,7 @@ void HGCalDDDConstants::cellHex( cellU = uv.first; cellV = uv.second; } else { - int ncell = (cellType == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_; + int ncell = ((cellType == HGCSiliconDetId::HGCalHD120) || (cellType == HGCSiliconDetId::HGCalHD200)) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_; double delY = 2 * rmax_ / (3 * ncell); double delX = 0.5 * delY * sqrt3_; double delYT = (extend) ? (2 * rmaxT_ / (3 * ncell)) : delY; @@ -2036,7 +2041,7 @@ bool HGCalDDDConstants::isValidCell(int lay, int wafer, int cell) const { // Works for options HGCalHexagon/HGCalHexagonFull double x = hgpar_->waferPosX_[wafer]; double y = hgpar_->waferPosY_[wafer]; - if (hgpar_->waferTypeT_[wafer] - 1 == HGCSiliconDetId::HGCalFine) { + if (((hgpar_->waferTypeT_[wafer] - 1) == HGCSiliconDetId::HGCalHD120) || ((hgpar_->waferTypeT_[wafer] - 1) == HGCSiliconDetId::HGCalHD200)) { x += hgpar_->cellFineX_[cell]; y += hgpar_->cellFineY_[cell]; } else { @@ -2071,7 +2076,7 @@ bool HGCalDDDConstants::isValidCell8(int lay, int waferU, int waferV, int cellU, } else { float x(0), y(0); int kndx = cellV * 100 + cellU; - if (type == 0) { + if ((type == HGCSiliconDetId::HGCalHD120) || (type == HGCSiliconDetId::HGCalHD200)) { auto ktr = hgpar_->cellFineIndex_.find(kndx); if (ktr != hgpar_->cellFineIndex_.end()) { x = hgpar_->cellFineX_[ktr->second]; @@ -2109,7 +2114,7 @@ bool HGCalDDDConstants::isValidCell8(int lay, int waferU, int waferV, int cellU, << " from Radius Limits"; #endif if (result && waferHexagon8File()) { - int N = (type == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_; + int N = ((type == HGCSiliconDetId::HGCalHD120) || (type == HGCSiliconDetId::HGCalHD200)) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_; result = HGCalWaferMask::goodCell(cellU, cellV, N, partn.first, partn.second); #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "Input " << lay << ":" << waferU << ":" << waferV << ":" << cellU << ":" << cellV diff --git a/Geometry/HGCalCommonData/src/HGCalWaferType.cc b/Geometry/HGCalCommonData/src/HGCalWaferType.cc index 028c85847a2b1..5c3c281f7f422 100644 --- a/Geometry/HGCalCommonData/src/HGCalWaferType.cc +++ b/Geometry/HGCalCommonData/src/HGCalWaferType.cc @@ -87,20 +87,20 @@ int HGCalWaferType::getType(double xpos, double ypos, double zpos) { double fracArea(0); if (choice_ == 1) { if (fine.size() >= cutValue_) - type = HGCSiliconDetId::HGCalFine; + type = HGCSiliconDetId::HGCalHD120; else if (coarse.size() >= cutValue_) - type = HGCSiliconDetId::HGCalCoarseThin; + type = HGCSiliconDetId::HGCalLD200; else - type = HGCSiliconDetId::HGCalCoarseThick; + type = HGCSiliconDetId::HGCalLD300; } else { if (fine.size() >= 4) - type = HGCSiliconDetId::HGCalFine; + type = HGCSiliconDetId::HGCalHD120; else if (coarse.size() >= 4 && fine.size() <= 1) - type = HGCSiliconDetId::HGCalCoarseThin; + type = HGCSiliconDetId::HGCalLD200; else if (coarse.size() < 2 && fine.empty()) - type = HGCSiliconDetId::HGCalCoarseThick; + type = HGCSiliconDetId::HGCalLD300; else if (!fine.empty()) - type = -1; + type = HGCSiliconDetId::HGCalHD200; if (type <= -1) { unsigned int kmax = (type == -1) ? fine.size() : coarse.size(); std::vector xcn, ycn; diff --git a/Geometry/HGCalCommonData/test/HGCalConvert.cpp b/Geometry/HGCalCommonData/test/HGCalConvert.cpp index d54c7a11aaf63..a3b04313e7ce8 100644 --- a/Geometry/HGCalCommonData/test/HGCalConvert.cpp +++ b/Geometry/HGCalCommonData/test/HGCalConvert.cpp @@ -508,10 +508,10 @@ void ConvertSiliconV1::convert( //First read in all records char buffer[1024]; std::string thick[4] = {"h120", "l200", "l300", "h200"}; - int addType[4] = {HGCalTypes::WaferFineThin, - HGCalTypes::WaferCoarseThin, - HGCalTypes::WaferCoarseThick, - HGCalTypes::WaferFineThick}; + int addType[4] = {HGCalTypes::WaferHD120, + HGCalTypes::WaferLD200, + HGCalTypes::WaferLD300, + HGCalTypes::WaferHD200}; const int partTypeH[6] = {HGCalTypes::WaferFull, HGCalTypes::WaferHalf2, HGCalTypes::WaferChopTwoM, @@ -566,7 +566,7 @@ void ConvertSiliconV1::convert( int thck = static_cast(std::find(thick, thick + 4, items[2]) - thick); int part = std::atoi(items[1].c_str()); if ((thck < 4) && (part >= 0)) { - if ((addType[thck] == HGCalTypes::WaferFineThin) || (addType[thck] == HGCalTypes::WaferFineThick)) + if ((addType[thck] == HGCalTypes::WaferHD120) || (addType[thck] == HGCalTypes::WaferHD200)) part = partTypeH[part]; else part = partTypeL[part]; @@ -713,10 +713,10 @@ void ConvertSiliconV2::convert( char buffer[1024]; const int thksize = 4; std::string thick[thksize] = {"h120", "l200", "l300", "h200"}; - int addType[thksize] = {HGCalTypes::WaferFineThin, - HGCalTypes::WaferCoarseThin, - HGCalTypes::WaferCoarseThick, - HGCalTypes::WaferFineThick}; + int addType[thksize] = {HGCalTypes::WaferHD120, + HGCalTypes::WaferLD200, + HGCalTypes::WaferLD300, + HGCalTypes::WaferHD200}; const int partTypeH[6] = {HGCalTypes::WaferFull, HGCalTypes::WaferHDTop, HGCalTypes::WaferHDBottom, @@ -776,7 +776,7 @@ void ConvertSiliconV2::convert( int thck = static_cast(std::find(thick, thick + thksize, items[2]) - thick); int part = std::atoi(items[1].c_str()); if ((thck <= thksize) && (part >= 0)) { - if ((addType[thck] == HGCalTypes::WaferFineThin) || (addType[thck] == HGCalTypes::WaferFineThick)) + if ((addType[thck] == HGCalTypes::WaferHD120) || (addType[thck] == HGCalTypes::WaferHD200)) part = partTypeH[part]; else part = partTypeL[part]; @@ -1910,10 +1910,10 @@ void ConvertNoseV0::convert( char buffer[1024]; const int thksize = 4; std::string thick[thksize] = {"h120", "l200", "l300", "h200"}; - int addType[thksize] = {HGCalTypes::WaferFineThin, - HGCalTypes::WaferCoarseThin, - HGCalTypes::WaferCoarseThick, - HGCalTypes::WaferFineThick}; + int addType[thksize] = {HGCalTypes::WaferHD120, + HGCalTypes::WaferLD200, + HGCalTypes::WaferLD300, + HGCalTypes::WaferHD200}; const int partTypeH[6] = {HGCalTypes::WaferFull, HGCalTypes::WaferHDTop, HGCalTypes::WaferHDBottom, @@ -1975,7 +1975,7 @@ void ConvertNoseV0::convert( int thck = static_cast(std::find(thick, thick + thksize, items[2]) - thick); int part = std::atoi(items[1].c_str()); if ((thck <= thksize) && (part >= 0)) { - if ((addType[thck] == HGCalTypes::WaferFineThin) || (addType[thck] == HGCalTypes::WaferFineThick)) + if ((addType[thck] == HGCalTypes::WaferHD120) || (addType[thck] == HGCalTypes::WaferHD200)) part = partTypeH[part]; else part = partTypeL[part]; diff --git a/Geometry/HGCalGeometry/test/HGCGeomAnalyzer.cc b/Geometry/HGCalGeometry/test/HGCGeomAnalyzer.cc index 4d021da4bc18d..f0ecd20877135 100644 --- a/Geometry/HGCalGeometry/test/HGCGeomAnalyzer.cc +++ b/Geometry/HGCalGeometry/test/HGCGeomAnalyzer.cc @@ -157,10 +157,10 @@ void HGCGeomAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup &e << rInVec.eta() << std::setw(15) << rOutVec.y() << std::setw(15) << rOutVec.eta() << std::setw(15); if (d != DetId::HGCalHSc) { - boundaries << typeRadMap[ilay][HGCSiliconDetId::waferType::HGCalCoarseThin].begin()->first << std::setw(15) - << typeRadMap[ilay][HGCSiliconDetId::waferType::HGCalCoarseThin].begin()->second << std::setw(15) - << typeRadMap[ilay][HGCSiliconDetId::waferType::HGCalCoarseThick].begin()->first << std::setw(15) - << typeRadMap[ilay][HGCSiliconDetId::waferType::HGCalCoarseThick].begin()->second << std::setw(15); + boundaries << typeRadMap[ilay][HGCSiliconDetId::waferType::HGCalLD200].begin()->first << std::setw(15) + << typeRadMap[ilay][HGCSiliconDetId::waferType::HGCalLD200].begin()->second << std::setw(15) + << typeRadMap[ilay][HGCSiliconDetId::waferType::HGCalLD300].begin()->first << std::setw(15) + << typeRadMap[ilay][HGCSiliconDetId::waferType::HGCalLD300].begin()->second << std::setw(15); } boundaries << "\n"; } diff --git a/L1Trigger/L1THGCal/plugins/geometries/HGCalTriggerGeometryV9Imp2.cc b/L1Trigger/L1THGCal/plugins/geometries/HGCalTriggerGeometryV9Imp2.cc index 0443224073ae7..dc16cb7529e1e 100644 --- a/L1Trigger/L1THGCal/plugins/geometries/HGCalTriggerGeometryV9Imp2.cc +++ b/L1Trigger/L1THGCal/plugins/geometries/HGCalTriggerGeometryV9Imp2.cc @@ -424,7 +424,7 @@ HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp2::getTriggerCellsFr : HGCalTriggerSubdetector::HGCalHSiTrigger); unsigned layer = module_si_id.layer(); unsigned wafer_type = detIdWaferType(det, layer, waferu, waferv); - int nroc = (wafer_type == HGCSiliconDetId::HGCalFine ? 6 : 3); + int nroc = (((wafer_type == HGCSiliconDetId::HGCalHD120) || (wafer_type == HGCSiliconDetId::HGCalHD200)) ? 6 : 3); // Loop on ROCs in wafer for (int roc = 1; roc <= nroc; roc++) { // loop on TCs in ROC @@ -488,7 +488,7 @@ HGCalTriggerGeometryBase::geom_ordered_set HGCalTriggerGeometryV9Imp2::getOrdere : HGCalTriggerSubdetector::HGCalHSiTrigger); unsigned layer = module_si_id.layer(); unsigned wafer_type = detIdWaferType(det, layer, waferu, waferv); - int nroc = (wafer_type == HGCSiliconDetId::HGCalFine ? 6 : 3); + int nroc = (((wafer_type == HGCSiliconDetId::HGCalHD120) || (wafer_type == HGCSiliconDetId::HGCalHD200)) ? 6 : 3); // Loop on ROCs in wafer for (int roc = 1; roc <= nroc; roc++) { // loop on TCs in ROC diff --git a/L1Trigger/L1THGCal/plugins/geometries/HGCalTriggerGeometryV9Imp3.cc b/L1Trigger/L1THGCal/plugins/geometries/HGCalTriggerGeometryV9Imp3.cc index a39fd3b28045c..4ea615e094650 100644 --- a/L1Trigger/L1THGCal/plugins/geometries/HGCalTriggerGeometryV9Imp3.cc +++ b/L1Trigger/L1THGCal/plugins/geometries/HGCalTriggerGeometryV9Imp3.cc @@ -437,7 +437,7 @@ HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp3::getTriggerCellsFr DetId::Detector det = (subdet == HGCalTriggerSubdetector::HGCalEETrigger ? DetId::HGCalEE : DetId::HGCalHSi); unsigned wafer_type = detIdWaferType(det, layer, moduleU, moduleV); - int nroc = (wafer_type == HGCSiliconDetId::HGCalFine ? 6 : 3); + int nroc = (((wafer_type == HGCSiliconDetId::HGCalHD120) || (wafer_type == HGCSiliconDetId::HGCalHD200)) ? 6 : 3); // Loop on ROCs in wafer for (int roc = 1; roc <= nroc; roc++) { // loop on TCs in ROC @@ -515,7 +515,7 @@ HGCalTriggerGeometryBase::geom_ordered_set HGCalTriggerGeometryV9Imp3::getOrdere DetId::Detector det = (subdet == HGCalTriggerSubdetector::HGCalEETrigger ? DetId::HGCalEE : DetId::HGCalHSi); unsigned wafer_type = detIdWaferType(det, layer, moduleU, moduleV); - int nroc = (wafer_type == HGCSiliconDetId::HGCalFine ? 6 : 3); + int nroc = (((wafer_type == HGCSiliconDetId::HGCalHD120) || (wafer_type == HGCSiliconDetId::HGCalHD200)) ? 6 : 3); // Loop on ROCs in wafer for (int roc = 1; roc <= nroc; roc++) { // loop on TCs in ROC diff --git a/SimG4CMS/Calo/plugins/HGCalTestGuardRing.cc b/SimG4CMS/Calo/plugins/HGCalTestGuardRing.cc index 056d5f05d9698..a45225ce42976 100644 --- a/SimG4CMS/Calo/plugins/HGCalTestGuardRing.cc +++ b/SimG4CMS/Calo/plugins/HGCalTestGuardRing.cc @@ -62,10 +62,10 @@ HGCalTestGuardRing::HGCalTestGuardRing(const edm::ParameterSet& ps) << " for wafers read from file " << waferFile_; if (!waferFile_.empty()) { std::string thick[4] = {"h120", "l200", "l300", "h200"}; - int addType[4] = {HGCalTypes::WaferFineThin, - HGCalTypes::WaferCoarseThin, - HGCalTypes::WaferCoarseThick, - HGCalTypes::WaferFineThick}; + int addType[4] = {HGCalTypes::WaferHD120, + HGCalTypes::WaferLD200, + HGCalTypes::WaferLD300, + HGCalTypes::WaferHD200}; const int partTypeH[6] = {HGCalTypes::WaferFull, HGCalTypes::WaferHalf2, HGCalTypes::WaferChopTwoM, @@ -98,7 +98,7 @@ HGCalTestGuardRing::HGCalTestGuardRing(const edm::ParameterSet& ps) int orient = std::atoi(items[5].c_str()); int part = std::atoi(items[1].c_str()); if (part >= 0) { - if (type == HGCalTypes::WaferFineThin) + if ((type == HGCalTypes::WaferHD120) || (type == HGCalTypes::WaferHD200)) part = partTypeH[part]; else part = partTypeL[part]; diff --git a/SimG4CMS/Calo/src/HGCalNumberingScheme.cc b/SimG4CMS/Calo/src/HGCalNumberingScheme.cc index e976aa57de6b7..58fe1d2ebe8cf 100644 --- a/SimG4CMS/Calo/src/HGCalNumberingScheme.cc +++ b/SimG4CMS/Calo/src/HGCalNumberingScheme.cc @@ -136,7 +136,7 @@ uint32_t HGCalNumberingScheme::getUnitID(int layer, int module, int cell, int iz << HGCalWaferIndex::waferIndex(layer, waferU, waferV, false) << ":" << module << ":" << cell << " has a type mismatch " << waferType << ":" << type; #endif - if (type != HGCSiliconDetId::HGCalCoarseThick) + if (type != HGCSiliconDetId::HGCalLD300) waferType = type; } } diff --git a/Validation/HGCalValidation/plugins/HGCalSimHitValidation.cc b/Validation/HGCalValidation/plugins/HGCalSimHitValidation.cc index 8b942f0ee5c1e..630bda3d9bccd 100644 --- a/Validation/HGCalValidation/plugins/HGCalSimHitValidation.cc +++ b/Validation/HGCalValidation/plugins/HGCalSimHitValidation.cc @@ -334,19 +334,19 @@ void HGCalSimHitValidation::fillMuonTomoHistos(int partialType, std::pairFill(edep); if (partialType > 0) energyPWF_.at(ilayer)->Fill(edep); } - if (hinfo.type == HGCSiliconDetId::HGCalCoarseThin) { + if (hinfo.type == HGCSiliconDetId::HGCalLD200) { if (partialType == 0) energyFWCN_.at(ilayer)->Fill(edep); if (partialType > 0) energyPWCN_.at(ilayer)->Fill(edep); } - if (hinfo.type == HGCSiliconDetId::HGCalCoarseThick) { + if (hinfo.type == HGCSiliconDetId::HGCalLD300) { if (partialType == 0) energyFWCK_.at(ilayer)->Fill(edep); if (partialType > 0) @@ -355,13 +355,13 @@ void HGCalSimHitValidation::fillMuonTomoHistos(int partialType, std::pairFill(x, y); - if (hinfo.type == HGCSiliconDetId::HGCalCoarseThin) + if (hinfo.type == HGCSiliconDetId::HGCalLD200) hitXYFWCN_.at(ilayer)->Fill(x, y); - if (hinfo.type == HGCSiliconDetId::HGCalCoarseThick) + if (hinfo.type == HGCSiliconDetId::HGCalLD300) hitXYFWCK_.at(ilayer)->Fill(x, y); } //is Silicon diff --git a/Validation/HGCalValidation/test/HGCalCellHitSum.cc b/Validation/HGCalValidation/test/HGCalCellHitSum.cc index 00d6a3a344f04..09bb9f72530b4 100644 --- a/Validation/HGCalValidation/test/HGCalCellHitSum.cc +++ b/Validation/HGCalValidation/test/HGCalCellHitSum.cc @@ -1145,21 +1145,21 @@ void HGCalCellHitSum::analyze(const edm::Event &iEvent, const edm::EventSetup &i HGCSiliconDetId id(itHit->id()); if (name_ == "HGCalEESensitive") { hELossEE->Fill(convertGeVToKeV(itHit->energy())); - if (id.type() == HGCSiliconDetId::HGCalFine) + if (id.type() == HGCSiliconDetId::HGCalHD120) hELossEEF->Fill(convertGeVToKeV(itHit->energy())); //in keV - if (id.type() == HGCSiliconDetId::HGCalCoarseThin) + if (id.type() == HGCSiliconDetId::HGCalLD200) hELossEECN->Fill(convertGeVToKeV(itHit->energy())); //in keV - if (id.type() == HGCSiliconDetId::HGCalCoarseThick) + if (id.type() == HGCSiliconDetId::HGCalLD300) hELossEECK->Fill(convertGeVToKeV(itHit->energy())); //in keV } if (name_ == "HGCalHESiliconSensitive") { hELossHEF->Fill(convertGeVToKeV(itHit->energy())); - if (id.type() == HGCSiliconDetId::HGCalFine) + if (id.type() == HGCSiliconDetId::HGCalHD120) hELossHEFF->Fill(convertGeVToKeV(itHit->energy())); //in keV - if (id.type() == HGCSiliconDetId::HGCalCoarseThin) + if (id.type() == HGCSiliconDetId::HGCalLD200) hELossHEFCN->Fill(convertGeVToKeV(itHit->energy())); //in keV - if (id.type() == HGCSiliconDetId::HGCalCoarseThick) + if (id.type() == HGCSiliconDetId::HGCalLD300) hELossHEFCK->Fill(convertGeVToKeV(itHit->energy())); //in keV } } @@ -1270,21 +1270,21 @@ void HGCalCellHitSum::analyze(const edm::Event &iEvent, const edm::EventSetup &i if (name_ == "HGCalEESensitive") { hYZhitsEE->Fill(TMath::Abs(global2.z()), TMath::Abs(global2.y())); - if (id.type() == HGCSiliconDetId::HGCalFine) + if (id.type() == HGCSiliconDetId::HGCalHD120) hYZhitsEEF->Fill(TMath::Abs(global2.z()), TMath::Abs(global2.y())); - if (id.type() == HGCSiliconDetId::HGCalCoarseThin) + if (id.type() == HGCSiliconDetId::HGCalLD200) hYZhitsEECN->Fill(TMath::Abs(global2.z()), TMath::Abs(global2.y())); - if (id.type() == HGCSiliconDetId::HGCalCoarseThick) + if (id.type() == HGCSiliconDetId::HGCalLD300) hYZhitsEECK->Fill(TMath::Abs(global2.z()), TMath::Abs(global2.y())); } if (name_ == "HGCalHESiliconSensitive") { hYZhitsHEF->Fill(TMath::Abs(global2.z()), TMath::Abs(global2.y())); - if (id.type() == HGCSiliconDetId::HGCalFine) + if (id.type() == HGCSiliconDetId::HGCalHD120) hYZhitsHEFF->Fill(TMath::Abs(global2.z()), TMath::Abs(global2.y())); - if (id.type() == HGCSiliconDetId::HGCalCoarseThin) + if (id.type() == HGCSiliconDetId::HGCalLD200) hYZhitsHEFCN->Fill(TMath::Abs(global2.z()), TMath::Abs(global2.y())); - if (id.type() == HGCSiliconDetId::HGCalCoarseThick) + if (id.type() == HGCSiliconDetId::HGCalLD300) hYZhitsHEFCK->Fill(TMath::Abs(global2.z()), TMath::Abs(global2.y())); } } @@ -1357,7 +1357,7 @@ void HGCalCellHitSum::analyze(const edm::Event &iEvent, const edm::EventSetup &i HGCSiliconDetId id(itHit->id()); HGCalDetId hid(itHit->id()); - if (id.type() == HGCSiliconDetId::HGCalFine) { + if (id.type() == HGCSiliconDetId::HGCalHD120) { if (global1.z() < 0.0) { grXYhitsF0[il]->SetPoint(ixyF0[il]++, global1.x(), global1.y()); grEtaPhihitsF0[il]->SetPoint(iepF0[il]++, global1.eta(), global1.phi()); @@ -1366,7 +1366,7 @@ void HGCalCellHitSum::analyze(const edm::Event &iEvent, const edm::EventSetup &i grEtaPhihitsF1[il]->SetPoint(iepF1[il]++, global1.eta(), global1.phi()); } } - if (id.type() == HGCSiliconDetId::HGCalCoarseThin) { + if (id.type() == HGCSiliconDetId::HGCalLD200) { if (global1.z() < 0.0) { grXYhitsCN0[il]->SetPoint(ixyCN0[il]++, global1.x(), global1.y()); grEtaPhihitsCN0[il]->SetPoint(iepCN0[il]++, global1.eta(), global1.phi()); @@ -1375,7 +1375,7 @@ void HGCalCellHitSum::analyze(const edm::Event &iEvent, const edm::EventSetup &i grEtaPhihitsCN1[il]->SetPoint(iepCN1[il]++, global1.eta(), global1.phi()); } } - if (id.type() == HGCSiliconDetId::HGCalCoarseThick) { //case 2 : + if (id.type() == HGCSiliconDetId::HGCalLD300) { //case 2 : if (global1.z() < 0.0) { grXYhitsCK0[il]->SetPoint(ixyCK0[il]++, global1.x(), global1.y()); @@ -1451,7 +1451,7 @@ void HGCalCellHitSum::analyze(const edm::Event &iEvent, const edm::EventSetup &i if (rhtools_.isSilicon(id1)) { HGCSiliconDetId id((*itr).first); //int il = rhtools_.getLayerWithOffset(id1); - if (id.type() == HGCSiliconDetId::HGCalFine) { + if (id.type() == HGCSiliconDetId::HGCalHD120) { if (global1.z() < 0.0) { hXYhitsF0[il]->Fill(global1.x(), global1.y()); hEPhitsF0[il]->Fill(global1.eta(), global1.phi()); @@ -1462,7 +1462,7 @@ void HGCalCellHitSum::analyze(const edm::Event &iEvent, const edm::EventSetup &i hELossLayerF1[il]->Fill(esum.etotal * 1.0e6); } } - if (id.type() == HGCSiliconDetId::HGCalCoarseThin) { + if (id.type() == HGCSiliconDetId::HGCalLD200) { if (global1.z() < 0.0) { hXYhitsCN0[il]->Fill(global1.x(), global1.y()); hEPhitsCN0[il]->Fill(global1.eta(), global1.phi()); @@ -1473,7 +1473,7 @@ void HGCalCellHitSum::analyze(const edm::Event &iEvent, const edm::EventSetup &i hELossLayerCN1[il]->Fill(esum.etotal * 1.0e6); } } - if (id.type() == HGCSiliconDetId::HGCalCoarseThick) { //case 2 : + if (id.type() == HGCSiliconDetId::HGCalLD300) { //case 2 : if (global1.z() < 0.0) { hXYhitsCK0[il]->Fill(global1.x(), global1.y()); @@ -1505,7 +1505,7 @@ void HGCalCellHitSum::analyze(const edm::Event &iEvent, const edm::EventSetup &i if (rhtools_.isSilicon(id1)) { HGCSiliconDetId id((*itr).first); //int il = rhtools_.getLayerWithOffset(id1); - if (id.type() == HGCSiliconDetId::HGCalFine) { + if (id.type() == HGCSiliconDetId::HGCalHD120) { if (global1.z() < 0.0) { hXYFailhitsF0[il]->Fill(global1.x(), global1.y()); hEPFailhitsF0[il]->Fill(global1.eta(), global1.phi()); @@ -1514,7 +1514,7 @@ void HGCalCellHitSum::analyze(const edm::Event &iEvent, const edm::EventSetup &i hEPFailhitsF1[il]->Fill(global1.eta(), global1.phi()); } } - if (id.type() == HGCSiliconDetId::HGCalCoarseThin) { + if (id.type() == HGCSiliconDetId::HGCalLD200) { if (global1.z() < 0.0) { hXYFailhitsCN0[il]->Fill(global1.x(), global1.y()); hEPFailhitsCN0[il]->Fill(global1.eta(), global1.phi()); @@ -1523,7 +1523,7 @@ void HGCalCellHitSum::analyze(const edm::Event &iEvent, const edm::EventSetup &i hEPFailhitsCN1[il]->Fill(global1.eta(), global1.phi()); } } - if (id.type() == HGCSiliconDetId::HGCalCoarseThick) { //case 2 : + if (id.type() == HGCSiliconDetId::HGCalLD300) { //case 2 : if (global1.z() < 0.0) { hXYFailhitsCK0[il]->Fill(global1.x(), global1.y()); @@ -1553,27 +1553,27 @@ void HGCalCellHitSum::analyze(const edm::Event &iEvent, const edm::EventSetup &i if (!TMath::AreEqualAbs(convertGeVToKeV(esum.eTime[0]), 0.0, 1.e-5)) { if (name_ == "HGCalEESensitive") { hELossCSinBunchEE->Fill(convertGeVToKeV(esum.eTime[0])); - if (id.type() == HGCSiliconDetId::HGCalFine) { + if (id.type() == HGCSiliconDetId::HGCalHD120) { hELossCSinBunchEEF->Fill(convertGeVToKeV(esum.eTime[0])); //in keV } - if (id.type() == HGCSiliconDetId::HGCalCoarseThin) { + if (id.type() == HGCSiliconDetId::HGCalLD200) { hELossCSinBunchEECN->Fill(convertGeVToKeV(esum.eTime[0])); //in keV } - if (id.type() == HGCSiliconDetId::HGCalCoarseThick) { + if (id.type() == HGCSiliconDetId::HGCalLD300) { hELossCSinBunchEECK->Fill(convertGeVToKeV(esum.eTime[0])); //in keV } } if (name_ == "HGCalHESiliconSensitive") { hELossCSinBunchHEF->Fill(convertGeVToKeV(esum.eTime[0])); - if (id.type() == HGCSiliconDetId::HGCalFine) { + if (id.type() == HGCSiliconDetId::HGCalHD120) { hELossCSinBunchHEFF->Fill(convertGeVToKeV(esum.eTime[0])); //in keV if (convertGeVToKeV(esum.eTime[0]) < 35.) { hXYLowELosshitsF->Fill(hinfo.x, hinfo.y); hYZLowELosshitsF->Fill(TMath::Abs(hinfo.z), TMath::Sqrt(hinfo.x * hinfo.x + hinfo.y * hinfo.y)); } } - if (id.type() == HGCSiliconDetId::HGCalCoarseThin) { + if (id.type() == HGCSiliconDetId::HGCalLD200) { hELossCSinBunchHEFCN->Fill(convertGeVToKeV(esum.eTime[0])); //in keV if (TMath::Sqrt(hinfo.x * hinfo.x + hinfo.y * hinfo.y) > 45.0 and TMath::Sqrt(hinfo.x * hinfo.x + hinfo.y * hinfo.y) < 60.0 and hinfo.layer >= 38) @@ -1595,7 +1595,7 @@ void HGCalCellHitSum::analyze(const edm::Event &iEvent, const edm::EventSetup &i hZLowELosshitsHEFCN->Fill(hinfo.z); } } - if (id.type() == HGCSiliconDetId::HGCalCoarseThick) { + if (id.type() == HGCSiliconDetId::HGCalLD300) { hELossCSinBunchHEFCK->Fill(convertGeVToKeV(esum.eTime[0])); //in keV if (convertGeVToKeV(esum.eTime[0]) < 10.) { hXYLowELosshitsCK->Fill(hinfo.x, hinfo.y); @@ -1608,11 +1608,11 @@ void HGCalCellHitSum::analyze(const edm::Event &iEvent, const edm::EventSetup &i if (!TMath::AreEqualAbs(convertGeVToKeV(esum.eTime[2]), 0.0, 1.e-5)) { if (name_ == "HGCalEESensitive") { hELossCSmissedEE->Fill(convertGeVToKeV(esum.eTime[2])); - if (id.type() == HGCSiliconDetId::HGCalFine) + if (id.type() == HGCSiliconDetId::HGCalHD120) hELossCSmissedEEF->Fill(convertGeVToKeV(esum.eTime[2])); //in keV - if (id.type() == HGCSiliconDetId::HGCalCoarseThin) + if (id.type() == HGCSiliconDetId::HGCalLD200) hELossCSmissedEECN->Fill(convertGeVToKeV(esum.eTime[2])); //in keV - if (id.type() == HGCSiliconDetId::HGCalCoarseThick) + if (id.type() == HGCSiliconDetId::HGCalLD300) hELossCSmissedEECK->Fill(convertGeVToKeV(esum.eTime[2])); //in keV hXYmissedhits->Fill(hinfo.x, hinfo.y); hYZmissedhits->Fill(TMath::Abs(hinfo.z), TMath::Abs(hinfo.y)); @@ -1620,11 +1620,11 @@ void HGCalCellHitSum::analyze(const edm::Event &iEvent, const edm::EventSetup &i if (name_ == "HGCalHESiliconSensitive") { hELossCSmissedHEF->Fill(convertGeVToKeV(esum.eTime[2])); - if (id.type() == HGCSiliconDetId::HGCalFine) + if (id.type() == HGCSiliconDetId::HGCalHD120) hELossCSmissedHEFF->Fill(convertGeVToKeV(esum.eTime[2])); //in keV - if (id.type() == HGCSiliconDetId::HGCalCoarseThin) + if (id.type() == HGCSiliconDetId::HGCalLD200) hELossCSmissedHEFCN->Fill(convertGeVToKeV(esum.eTime[2])); //in keV - if (id.type() == HGCSiliconDetId::HGCalCoarseThick) + if (id.type() == HGCSiliconDetId::HGCalLD300) hELossCSmissedHEFCK->Fill(convertGeVToKeV(esum.eTime[2])); //in keV hXYmissedhits->Fill(hinfo.x, hinfo.y); hYZmissedhits->Fill(TMath::Abs(hinfo.z), TMath::Abs(hinfo.y)); @@ -1720,7 +1720,7 @@ void HGCalCellHitSum::analyze(const edm::Event &iEvent, const edm::EventSetup &i if (name_ == "HGCalEESensitive") { hCellThickness->Fill(rhtools_.getSiThickness(id1)); hELossCSMaxEE->Fill(convertGeVToKeV(esum.eTime[0])); - if (id.type() == HGCSiliconDetId::HGCalFine) { + if (id.type() == HGCSiliconDetId::HGCalHD120) { hELossCSMaxEEF->Fill(convertGeVToKeV(esum.eTime[0])); //in keV hELCSMaxF[il]->Fill(convertGeVToKeV(esum.eTime[0])); //in keV if (isPWafer) { @@ -1733,7 +1733,7 @@ void HGCalCellHitSum::analyze(const edm::Event &iEvent, const edm::EventSetup &i hHxELCSMaxF[il]->Fill(convertGeVToKeV(esum.eTime[0])); } } - if (id.type() == HGCSiliconDetId::HGCalCoarseThin) { + if (id.type() == HGCSiliconDetId::HGCalLD200) { hELossCSMaxEECN->Fill(convertGeVToKeV(esum.eTime[0])); //in keV hELCSMaxCN[il]->Fill(convertGeVToKeV(esum.eTime[0])); //in keV if (isPWafer) { @@ -1746,7 +1746,7 @@ void HGCalCellHitSum::analyze(const edm::Event &iEvent, const edm::EventSetup &i hHxELCSMaxCN[il]->Fill(convertGeVToKeV(esum.eTime[0])); } } - if (id.type() == HGCSiliconDetId::HGCalCoarseThick) { + if (id.type() == HGCSiliconDetId::HGCalLD300) { hELossCSMaxEECK->Fill(convertGeVToKeV(esum.eTime[0])); //in keV hELCSMaxCK[il]->Fill(convertGeVToKeV(esum.eTime[0])); //in keV if (isPWafer) { @@ -1764,7 +1764,7 @@ void HGCalCellHitSum::analyze(const edm::Event &iEvent, const edm::EventSetup &i if (name_ == "HGCalHESiliconSensitive") { hCellThickness->Fill(rhtools_.getSiThickness(id1)); hELossCSMaxHEF->Fill(convertGeVToKeV(esum.eTime[0])); - if (id.type() == HGCSiliconDetId::HGCalFine) { + if (id.type() == HGCSiliconDetId::HGCalHD120) { hELossCSMaxHEFF->Fill(convertGeVToKeV(esum.eTime[0])); //in keV hELCSMaxF[il]->Fill(convertGeVToKeV(esum.eTime[0])); //in keV if (isPWafer) { @@ -1777,7 +1777,7 @@ void HGCalCellHitSum::analyze(const edm::Event &iEvent, const edm::EventSetup &i hHxELCSMaxF[il]->Fill(convertGeVToKeV(esum.eTime[0])); } } - if (id.type() == HGCSiliconDetId::HGCalCoarseThin) { + if (id.type() == HGCSiliconDetId::HGCalLD200) { hELossCSMaxHEFCN->Fill(convertGeVToKeV(esum.eTime[0])); //in keV hELCSMaxCN[il]->Fill(convertGeVToKeV(esum.eTime[0])); //in keV if (convertGeVToKeV(esum.eTime[0]) < 30. and convertGeVToKeV(esum.eTime[0]) > 10.) @@ -1794,7 +1794,7 @@ void HGCalCellHitSum::analyze(const edm::Event &iEvent, const edm::EventSetup &i hHxELCSMaxCN[il]->Fill(convertGeVToKeV(esum.eTime[0])); } } - if (id.type() == HGCSiliconDetId::HGCalCoarseThick) { + if (id.type() == HGCSiliconDetId::HGCalLD300) { hELossCSMaxHEFCK->Fill(convertGeVToKeV(esum.eTime[0])); //in keV hELCSMaxCK[il]->Fill(convertGeVToKeV(esum.eTime[0])); //in keV if (convertGeVToKeV(esum.eTime[0]) < 10.) diff --git a/Validation/HGCalValidation/test/HGCalMTRecoStudy.cc b/Validation/HGCalValidation/test/HGCalMTRecoStudy.cc index c942d07fa5f00..2585699fbd402 100644 --- a/Validation/HGCalValidation/test/HGCalMTRecoStudy.cc +++ b/Validation/HGCalValidation/test/HGCalMTRecoStudy.cc @@ -662,7 +662,7 @@ void HGCalMTRecoStudy::analyze(const edm::Event &iEvent, const edm::EventSetup & if (rhtools_.isSilicon(detId)) { HGCSiliconDetId id(it.id()); - if (id.type() == HGCSiliconDetId::HGCalFine) { + if (id.type() == HGCSiliconDetId::HGCalHD120) { hEF->Fill(energy); if (ilyr != layerList.cend()) { @@ -682,7 +682,7 @@ void HGCalMTRecoStudy::analyze(const edm::Event &iEvent, const edm::EventSetup & } } //isvalid layer } - if (id.type() == HGCSiliconDetId::HGCalCoarseThin) { + if (id.type() == HGCSiliconDetId::HGCalLD200) { hECN->Fill(energy); if (ilyr != layerList.cend()) { @@ -702,7 +702,7 @@ void HGCalMTRecoStudy::analyze(const edm::Event &iEvent, const edm::EventSetup & } } //isvalid layer } - if (id.type() == HGCSiliconDetId::HGCalCoarseThick) { //case 2 : + if (id.type() == HGCSiliconDetId::HGCalLD300) { //case 2 : hECK->Fill(energy); if (ilyr != layerList.cend()) { @@ -771,7 +771,7 @@ void HGCalMTRecoStudy::analyze(const edm::Event &iEvent, const edm::EventSetup & if (rhtools_.isSilicon(detId)) { HGCSiliconDetId id(it.id()); //int il = rhtools_.getLayerWithOffset(detId); - if (id.type() == HGCSiliconDetId::HGCalFine) { + if (id.type() == HGCSiliconDetId::HGCalHD120) { if (ilyr != layerList.cend()) { int il = std::distance(layerList.begin(), ilyr); if (global1.z() < 0.0) { @@ -783,7 +783,7 @@ void HGCalMTRecoStudy::analyze(const edm::Event &iEvent, const edm::EventSetup & } } //isvalid layer } - if (id.type() == HGCSiliconDetId::HGCalCoarseThin) { + if (id.type() == HGCSiliconDetId::HGCalLD200) { if (ilyr != layerList.cend()) { int il = std::distance(layerList.begin(), ilyr); if (global1.z() < 0.0) { @@ -795,7 +795,7 @@ void HGCalMTRecoStudy::analyze(const edm::Event &iEvent, const edm::EventSetup & } } //isvalid layer } - if (id.type() == HGCSiliconDetId::HGCalCoarseThick) { //case 2 : + if (id.type() == HGCSiliconDetId::HGCalLD300) { //case 2 : if (ilyr != layerList.cend()) { int il = std::distance(layerList.begin(), ilyr); From c40162758b18a842ab7ee35bfd31136196bee743 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Sat, 22 Jun 2024 05:30:48 +0200 Subject: [PATCH 2/2] Code check --- .../ForwardDetId/interface/HGCSiliconDetId.h | 3 +- .../ForwardDetId/src/HGCalTriggerDetId.cc | 20 +++-- .../src/HGCalCalibrationCell.cc | 2 +- .../HGCalCommonData/src/HGCalDDDConstants.cc | 76 +++++++++++++------ .../HGCalCommonData/test/HGCalConvert.cpp | 17 ++--- SimG4CMS/Calo/plugins/HGCalTestGuardRing.cc | 5 +- 6 files changed, 72 insertions(+), 51 deletions(-) diff --git a/DataFormats/ForwardDetId/interface/HGCSiliconDetId.h b/DataFormats/ForwardDetId/interface/HGCSiliconDetId.h index 3d1682d5f4680..234e3717ecad3 100644 --- a/DataFormats/ForwardDetId/interface/HGCSiliconDetId.h +++ b/DataFormats/ForwardDetId/interface/HGCSiliconDetId.h @@ -98,8 +98,7 @@ class HGCSiliconDetId : public DetId { constexpr bool lowDensity() const { return ((type() == HGCalLD200) || (type() == HGCalLD300)); } constexpr bool highDensity() const { return ((type() == HGCalHD120) || (type() == HGCalHD200)); } constexpr int32_t depletion() const { - return ((type() == HGCalHD120) ? HGCal0Depletion - : ((type() == HGCalLD300) ? HGCal2Depletion : HGCal1Depletion)); + return ((type() == HGCalHD120) ? HGCal0Depletion : ((type() == HGCalLD300) ? HGCal2Depletion : HGCal1Depletion)); } /// get the z-side of the cell (1/-1) diff --git a/DataFormats/ForwardDetId/src/HGCalTriggerDetId.cc b/DataFormats/ForwardDetId/src/HGCalTriggerDetId.cc index 356388231255f..679ea5930fa48 100644 --- a/DataFormats/ForwardDetId/src/HGCalTriggerDetId.cc +++ b/DataFormats/ForwardDetId/src/HGCalTriggerDetId.cc @@ -47,8 +47,9 @@ HGCalTriggerDetId& HGCalTriggerDetId::operator=(const DetId& gen) { } int HGCalTriggerDetId::triggerCellX() const { - int nT = - ((type() == HGCSiliconDetId::HGCalHD120) || (type() == HGCSiliconDetId::HGCalHD200)) ? HGCSiliconDetId::HGCalFineTrigger : HGCSiliconDetId::HGCalCoarseTrigger; + int nT = ((type() == HGCSiliconDetId::HGCalHD120) || (type() == HGCSiliconDetId::HGCalHD200)) + ? HGCSiliconDetId::HGCalFineTrigger + : HGCSiliconDetId::HGCalCoarseTrigger; int N = nT * HGCalTriggerCell; std::vector vc = cellV(); int x(0); @@ -59,8 +60,9 @@ int HGCalTriggerDetId::triggerCellX() const { } int HGCalTriggerDetId::triggerCellY() const { - int nT = - ((type() == HGCSiliconDetId::HGCalHD120) || (type() == HGCSiliconDetId::HGCalHD200)) ? HGCSiliconDetId::HGCalFineTrigger : HGCSiliconDetId::HGCalCoarseTrigger; + int nT = ((type() == HGCSiliconDetId::HGCalHD120) || (type() == HGCSiliconDetId::HGCalHD200)) + ? HGCSiliconDetId::HGCalFineTrigger + : HGCSiliconDetId::HGCalCoarseTrigger; int N = nT * HGCalTriggerCell; std::vector uc = cellU(); std::vector vc = cellV(); @@ -73,8 +75,9 @@ int HGCalTriggerDetId::triggerCellY() const { std::vector HGCalTriggerDetId::cellU() const { std::vector uc; - int nT = - ((type() == HGCSiliconDetId::HGCalHD120) || (type() == HGCSiliconDetId::HGCalHD200)) ? HGCSiliconDetId::HGCalFineTrigger : HGCSiliconDetId::HGCalCoarseTrigger; + int nT = ((type() == HGCSiliconDetId::HGCalHD120) || (type() == HGCSiliconDetId::HGCalHD200)) + ? HGCSiliconDetId::HGCalFineTrigger + : HGCSiliconDetId::HGCalCoarseTrigger; if ((triggerCellU() >= HGCalTriggerCell) && (triggerCellV() >= HGCalTriggerCell)) { int u0 = nT * triggerCellU(); for (int i = 0; i < nT; ++i) { @@ -103,8 +106,9 @@ std::vector HGCalTriggerDetId::cellU() const { std::vector HGCalTriggerDetId::cellV() const { std::vector vc; - int nT = - ((type() == HGCSiliconDetId::HGCalHD120) || (type() == HGCSiliconDetId::HGCalHD200)) ? HGCSiliconDetId::HGCalFineTrigger : HGCSiliconDetId::HGCalCoarseTrigger; + int nT = ((type() == HGCSiliconDetId::HGCalHD120) || (type() == HGCSiliconDetId::HGCalHD200)) + ? HGCSiliconDetId::HGCalFineTrigger + : HGCSiliconDetId::HGCalCoarseTrigger; if ((triggerCellU() >= HGCalTriggerCell) && (triggerCellV() >= HGCalTriggerCell)) { int v0 = nT * triggerCellV(); for (int i = 0; i < nT; ++i) { diff --git a/Geometry/HGCalCommonData/src/HGCalCalibrationCell.cc b/Geometry/HGCalCommonData/src/HGCalCalibrationCell.cc index 49e3283b2a092..585b2c1e3fd88 100644 --- a/Geometry/HGCalCommonData/src/HGCalCalibrationCell.cc +++ b/Geometry/HGCalCommonData/src/HGCalCalibrationCell.cc @@ -39,7 +39,7 @@ HGCalCalibrationCell::HGCalCalibrationCell(const HGCalDDDConstants* cons) : cons int HGCalCalibrationCell::findCell( int zside, int layer, int waferU, int waferV, int cellUV, const std::pair& xy) const { const auto& info = cons_->waferInfo(layer, waferU, waferV); - int ld = ((info.type == HGCalTypes::WaferHD120) ||(info.type == HGCalTypes::WaferHD200)) ? 1 : 0; + int ld = ((info.type == HGCalTypes::WaferHD120) || (info.type == HGCalTypes::WaferHD200)) ? 1 : 0; int part = (info.part == HGCalTypes::WaferFull) ? 1 : 0; int indx = 2 * ld + part; #ifdef EDM_ML_DEBUG diff --git a/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc b/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc index fd4d132016f2c..02d3d9a3c036c 100644 --- a/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc +++ b/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc @@ -317,7 +317,8 @@ bool HGCalDDDConstants::cellInLayer(int waferU, int waferV, int cellU, int cellV part = (ktr->second).part; rotn = (ktr->second).orient; } - int ncell = ((thck == HGCalTypes::WaferHD120) || (thck == HGCalTypes::WaferHD200)) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_; + int ncell = ((thck == HGCalTypes::WaferHD120) || (thck == HGCalTypes::WaferHD200)) ? hgpar_->nCellsFine_ + : hgpar_->nCellsCoarse_; return HGCalWaferMask::goodCell(cellU, cellV, ncell, part, rotn); } else if (waferHexagon8() || waferHexagon6()) { const auto& xy = @@ -355,7 +356,8 @@ double HGCalDDDConstants::cellSizeHex(int type) const { int32_t HGCalDDDConstants::cellType(int type, int cellU, int cellV, int iz, int fwdBack, int orient) const { int placement = (orient < 0) ? HGCalCell::cellPlacementOld : HGCalCell::cellPlacementIndex(iz, fwdBack, orient); - int ncell = ((type == HGCSiliconDetId::HGCalHD120) || (type == HGCSiliconDetId::HGCalHD200)) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_; + int ncell = ((type == HGCSiliconDetId::HGCalHD120) || (type == HGCSiliconDetId::HGCalHD200)) ? hgpar_->nCellsFine_ + : hgpar_->nCellsCoarse_; auto cellType = HGCalCell::cellType(cellU, cellV, ncell, placement); return cellType.first; } @@ -563,7 +565,9 @@ double HGCalDDDConstants::guardRingOffset(bool reco) const { bool HGCalDDDConstants::isHalfCell(int waferType, int cell) const { if (waferType < 1 || cell < 0) return false; - return ((waferType == HGCalTypes::WaferLD200) || (waferType == HGCalTypes::WaferLD300)) ? hgpar_->cellCoarseHalf_[cell] : hgpar_->cellFineHalf_[cell]; + return ((waferType == HGCalTypes::WaferLD200) || (waferType == HGCalTypes::WaferLD300)) + ? hgpar_->cellCoarseHalf_[cell] + : hgpar_->cellFineHalf_[cell]; } bool HGCalDDDConstants::isValidHex(int lay, int mod, int cell, bool reco) const { @@ -588,7 +592,10 @@ bool HGCalDDDConstants::isValidHex(int lay, int mod, int cell, bool reco) const if (mod >= static_cast(hgpar_->waferTypeT_.size())) edm::LogWarning("HGCalGeom") << "Module no. out of bound for " << mod << " to be compared with " << (hgpar_->waferTypeT_).size() << " ***** ERROR *****"; - cellmax = (((hgpar_->waferTypeT_[mod] - 1) == HGCSiliconDetId::HGCalHD120) || ((hgpar_->waferTypeT_[mod] - 1) == HGCSiliconDetId::HGCalHD200)) ? static_cast(hgpar_->cellFineX_.size()) : static_cast(hgpar_->cellCoarseX_.size()); + cellmax = (((hgpar_->waferTypeT_[mod] - 1) == HGCSiliconDetId::HGCalHD120) || + ((hgpar_->waferTypeT_[mod] - 1) == HGCSiliconDetId::HGCalHD200)) + ? static_cast(hgpar_->cellFineX_.size()) + : static_cast(hgpar_->cellCoarseX_.size()); result = (cell >= 0 && cell <= cellmax); } else { result = isValidCell(lay_idx, mod, cell); @@ -686,7 +693,10 @@ bool HGCalDDDConstants::isValidHex8(int layer, int modU, int modV, int cellU, in int indx = HGCalWaferIndex::waferIndex(layer, modU, modV); auto itr = hgpar_->typesInLayers_.find(indx); int type = hgpar_->waferTypeL_[itr->second]; - int N = (((hgpar_->waferTypeL_[itr->second] == HGCalTypes::WaferHD120) || (hgpar_->waferTypeL_[itr->second] == HGCalTypes::WaferHD200)) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_); + int N = (((hgpar_->waferTypeL_[itr->second] == HGCalTypes::WaferHD120) || + (hgpar_->waferTypeL_[itr->second] == HGCalTypes::WaferHD200)) + ? hgpar_->nCellsFine_ + : hgpar_->nCellsCoarse_); #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants::isValidHex8:Cell " << cellU << ":" << cellV << ":" << N << " Tests " << (cellU >= 0) << ":" << (cellU < 2 * N) << ":" << (cellV >= 0) << ":" @@ -804,7 +814,8 @@ std::pair HGCalDDDConstants::locateCell(int cell, int lay, int typ #ifdef EDM_ML_DEBUG float x0(x), y0(y); #endif - if ((hgpar_->waferTypeT_[type] - 1 == HGCSiliconDetId::HGCalHD120) || (hgpar_->waferTypeT_[type] - 1 == HGCSiliconDetId::HGCalHD200)) { + if ((hgpar_->waferTypeT_[type] - 1 == HGCSiliconDetId::HGCalHD120) || + (hgpar_->waferTypeT_[type] - 1 == HGCSiliconDetId::HGCalHD200)) { x += hgpar_->cellFineX_[cell]; y += hgpar_->cellFineY_[cell]; } else { @@ -915,7 +926,8 @@ std::pair HGCalDDDConstants::locateCell(const HGCScintillatorDetId std::pair HGCalDDDConstants::locateCellHex(int cell, int wafer, bool reco) const { float x(0), y(0); - if ((hgpar_->waferTypeT_[wafer] - 1 == HGCSiliconDetId::HGCalHD120) || (hgpar_->waferTypeT_[wafer] - 1 == HGCSiliconDetId::HGCalHD200)) { + if ((hgpar_->waferTypeT_[wafer] - 1 == HGCSiliconDetId::HGCalHD120) || + (hgpar_->waferTypeT_[wafer] - 1 == HGCSiliconDetId::HGCalHD200)) { x = hgpar_->cellFineX_[cell]; y = hgpar_->cellFineY_[cell]; } else { @@ -1040,7 +1052,10 @@ int HGCalDDDConstants::maxCells(int lay, bool reco) const { unsigned int cells(0); for (unsigned int k = 0; k < hgpar_->waferTypeT_.size(); ++k) { if (waferInLayerTest(k, index.first, hgpar_->defineFull_)) { - unsigned int cell = (((hgpar_->waferTypeT_[k] - 1) == HGCSiliconDetId::HGCalHD120) || ((hgpar_->waferTypeT_[k] - 1) == HGCSiliconDetId::HGCalHD200)) ? (hgpar_->cellFineX_.size()) : (hgpar_->cellCoarseX_.size()); + unsigned int cell = (((hgpar_->waferTypeT_[k] - 1) == HGCSiliconDetId::HGCalHD120) || + ((hgpar_->waferTypeT_[k] - 1) == HGCSiliconDetId::HGCalHD200)) + ? (hgpar_->cellFineX_.size()) + : (hgpar_->cellCoarseX_.size()); if (cell > cells) cells = cell; } @@ -1052,9 +1067,11 @@ int HGCalDDDConstants::maxCells(int lay, bool reco) const { if (waferInLayerTest(k, index.first, hgpar_->defineFull_)) { auto itr = hgpar_->typesInLayers_.find(HGCalWaferIndex::waferIndex( lay, HGCalWaferIndex::waferU(hgpar_->waferCopy_[k]), HGCalWaferIndex::waferV(hgpar_->waferCopy_[k]))); - int type = ((itr == hgpar_->typesInLayers_.end()) ? HGCSiliconDetId::HGCalLD300 - : hgpar_->waferTypeL_[itr->second]); - int N = ((type == HGCSiliconDetId::HGCalHD120) || (type == HGCSiliconDetId::HGCalHD200)) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_; + int type = + ((itr == hgpar_->typesInLayers_.end()) ? HGCSiliconDetId::HGCalLD300 : hgpar_->waferTypeL_[itr->second]); + int N = ((type == HGCSiliconDetId::HGCalHD120) || (type == HGCSiliconDetId::HGCalHD200)) + ? hgpar_->nCellsFine_ + : hgpar_->nCellsCoarse_; cells = std::max(cells, 3 * N * N); } } @@ -1092,10 +1109,10 @@ int HGCalDDDConstants::modifyUV(int uv, int type1, int type2) const { if (type1 != type2) { if ((type1 == HGCSiliconDetId::HGCalHD120) || (type1 == HGCSiliconDetId::HGCalHD200)) { if ((type2 == HGCSiliconDetId::HGCalLD200) || (type2 == HGCSiliconDetId::HGCalLD300)) - uvx = (2 * uv + 1) / 3; + uvx = (2 * uv + 1) / 3; } else { if ((type2 == HGCSiliconDetId::HGCalHD120) || (type2 == HGCSiliconDetId::HGCalHD200)) - uvx = (3 * uv) / 2; + uvx = (3 * uv) / 2; } } return uvx; @@ -1151,7 +1168,10 @@ std::vector HGCalDDDConstants::numberCells(int lay, bool reco) const { if (waferHexagon6()) { for (unsigned int k = 0; k < hgpar_->waferTypeT_.size(); ++k) { if (waferInLayerTest(k, i, hgpar_->defineFull_)) { - unsigned int cell = (((hgpar_->waferTypeT_[k] - 1) == HGCSiliconDetId::HGCalHD120) || ((hgpar_->waferTypeT_[k] - 1) == HGCSiliconDetId::HGCalHD200)) ? (hgpar_->cellFineX_.size()) : (hgpar_->cellCoarseX_.size()); + unsigned int cell = (((hgpar_->waferTypeT_[k] - 1) == HGCSiliconDetId::HGCalHD120) || + ((hgpar_->waferTypeT_[k] - 1) == HGCSiliconDetId::HGCalHD200)) + ? (hgpar_->cellFineX_.size()) + : (hgpar_->cellCoarseX_.size()); ncell.emplace_back(static_cast(cell)); } } @@ -1176,7 +1196,8 @@ std::vector HGCalDDDConstants::numberCells(int lay, bool reco) const { int HGCalDDDConstants::numberCellsHexagon(int wafer) const { if (wafer >= 0 && wafer < static_cast(hgpar_->waferTypeT_.size())) { - if (((hgpar_->waferTypeT_[wafer] - 1) == HGCSiliconDetId::HGCalHD120) || ((hgpar_->waferTypeT_[wafer] - 1) == HGCSiliconDetId::HGCalHD200)) + if (((hgpar_->waferTypeT_[wafer] - 1) == HGCSiliconDetId::HGCalHD120) || + ((hgpar_->waferTypeT_[wafer] - 1) == HGCSiliconDetId::HGCalHD200)) return static_cast(hgpar_->cellFineX_.size()); else return static_cast(hgpar_->cellCoarseX_.size()); @@ -1187,9 +1208,9 @@ int HGCalDDDConstants::numberCellsHexagon(int wafer) const { int HGCalDDDConstants::numberCellsHexagon(int lay, int waferU, int waferV, bool flag) const { auto itr = hgpar_->typesInLayers_.find(HGCalWaferIndex::waferIndex(lay, waferU, waferV)); - int type = - ((itr == hgpar_->typesInLayers_.end()) ? HGCSiliconDetId::HGCalLD300 : hgpar_->waferTypeL_[itr->second]); - int N = ((type == HGCSiliconDetId::HGCalHD120) || (type == HGCSiliconDetId::HGCalHD200)) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_; + int type = ((itr == hgpar_->typesInLayers_.end()) ? HGCSiliconDetId::HGCalLD300 : hgpar_->waferTypeL_[itr->second]); + int N = ((type == HGCSiliconDetId::HGCalHD120) || (type == HGCSiliconDetId::HGCalHD200)) ? hgpar_->nCellsFine_ + : hgpar_->nCellsCoarse_; if (flag) return (3 * N * N); else @@ -1588,8 +1609,8 @@ void HGCalDDDConstants::waferFromPosition(const double x, << HGCalWaferType::getCassette(index, hgpar_->waferInfoMap_); } else { auto itr = hgpar_->typesInLayers_.find(HGCalWaferIndex::waferIndex(layer, waferU, waferV)); - celltype = ((itr == hgpar_->typesInLayers_.end()) ? HGCSiliconDetId::HGCalLD300 - : hgpar_->waferTypeL_[itr->second]); + celltype = + ((itr == hgpar_->typesInLayers_.end()) ? HGCSiliconDetId::HGCalLD300 : hgpar_->waferTypeL_[itr->second]); } xx -= (dx0 + hgpar_->waferPosX_[k]); yy -= (dy0 + hgpar_->waferPosY_[k]); @@ -1612,7 +1633,10 @@ void HGCalDDDConstants::waferFromPosition(const double x, } } cellHex(xx, yy, celltype, place, part, cellU, cellV, extend, debug); - wt = ((((celltype == HGCSiliconDetId::HGCalHD120) || (celltype == HGCSiliconDetId::HGCalHD200)) && (hgpar_->useSimWt_ > 0)) ? (hgpar_->cellThickness_[celltype] / hgpar_->waferThick_) : 1.0); + wt = ((((celltype == HGCSiliconDetId::HGCalHD120) || (celltype == HGCSiliconDetId::HGCalHD200)) && + (hgpar_->useSimWt_ > 0)) + ? (hgpar_->cellThickness_[celltype] / hgpar_->waferThick_) + : 1.0); } else { cellU = cellV = 2 * hgpar_->nCellsFine_; wt = 1.0; @@ -1950,7 +1974,9 @@ void HGCalDDDConstants::cellHex( cellU = uv.first; cellV = uv.second; } else { - int ncell = ((cellType == HGCSiliconDetId::HGCalHD120) || (cellType == HGCSiliconDetId::HGCalHD200)) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_; + int ncell = ((cellType == HGCSiliconDetId::HGCalHD120) || (cellType == HGCSiliconDetId::HGCalHD200)) + ? hgpar_->nCellsFine_ + : hgpar_->nCellsCoarse_; double delY = 2 * rmax_ / (3 * ncell); double delX = 0.5 * delY * sqrt3_; double delYT = (extend) ? (2 * rmaxT_ / (3 * ncell)) : delY; @@ -2041,7 +2067,8 @@ bool HGCalDDDConstants::isValidCell(int lay, int wafer, int cell) const { // Works for options HGCalHexagon/HGCalHexagonFull double x = hgpar_->waferPosX_[wafer]; double y = hgpar_->waferPosY_[wafer]; - if (((hgpar_->waferTypeT_[wafer] - 1) == HGCSiliconDetId::HGCalHD120) || ((hgpar_->waferTypeT_[wafer] - 1) == HGCSiliconDetId::HGCalHD200)) { + if (((hgpar_->waferTypeT_[wafer] - 1) == HGCSiliconDetId::HGCalHD120) || + ((hgpar_->waferTypeT_[wafer] - 1) == HGCSiliconDetId::HGCalHD200)) { x += hgpar_->cellFineX_[cell]; y += hgpar_->cellFineY_[cell]; } else { @@ -2114,7 +2141,8 @@ bool HGCalDDDConstants::isValidCell8(int lay, int waferU, int waferV, int cellU, << " from Radius Limits"; #endif if (result && waferHexagon8File()) { - int N = ((type == HGCSiliconDetId::HGCalHD120) || (type == HGCSiliconDetId::HGCalHD200)) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_; + int N = ((type == HGCSiliconDetId::HGCalHD120) || (type == HGCSiliconDetId::HGCalHD200)) ? hgpar_->nCellsFine_ + : hgpar_->nCellsCoarse_; result = HGCalWaferMask::goodCell(cellU, cellV, N, partn.first, partn.second); #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "Input " << lay << ":" << waferU << ":" << waferV << ":" << cellU << ":" << cellV diff --git a/Geometry/HGCalCommonData/test/HGCalConvert.cpp b/Geometry/HGCalCommonData/test/HGCalConvert.cpp index a3b04313e7ce8..5254f150529f2 100644 --- a/Geometry/HGCalCommonData/test/HGCalConvert.cpp +++ b/Geometry/HGCalCommonData/test/HGCalConvert.cpp @@ -508,10 +508,7 @@ void ConvertSiliconV1::convert( //First read in all records char buffer[1024]; std::string thick[4] = {"h120", "l200", "l300", "h200"}; - int addType[4] = {HGCalTypes::WaferHD120, - HGCalTypes::WaferLD200, - HGCalTypes::WaferLD300, - HGCalTypes::WaferHD200}; + int addType[4] = {HGCalTypes::WaferHD120, HGCalTypes::WaferLD200, HGCalTypes::WaferLD300, HGCalTypes::WaferHD200}; const int partTypeH[6] = {HGCalTypes::WaferFull, HGCalTypes::WaferHalf2, HGCalTypes::WaferChopTwoM, @@ -713,10 +710,8 @@ void ConvertSiliconV2::convert( char buffer[1024]; const int thksize = 4; std::string thick[thksize] = {"h120", "l200", "l300", "h200"}; - int addType[thksize] = {HGCalTypes::WaferHD120, - HGCalTypes::WaferLD200, - HGCalTypes::WaferLD300, - HGCalTypes::WaferHD200}; + int addType[thksize] = { + HGCalTypes::WaferHD120, HGCalTypes::WaferLD200, HGCalTypes::WaferLD300, HGCalTypes::WaferHD200}; const int partTypeH[6] = {HGCalTypes::WaferFull, HGCalTypes::WaferHDTop, HGCalTypes::WaferHDBottom, @@ -1910,10 +1905,8 @@ void ConvertNoseV0::convert( char buffer[1024]; const int thksize = 4; std::string thick[thksize] = {"h120", "l200", "l300", "h200"}; - int addType[thksize] = {HGCalTypes::WaferHD120, - HGCalTypes::WaferLD200, - HGCalTypes::WaferLD300, - HGCalTypes::WaferHD200}; + int addType[thksize] = { + HGCalTypes::WaferHD120, HGCalTypes::WaferLD200, HGCalTypes::WaferLD300, HGCalTypes::WaferHD200}; const int partTypeH[6] = {HGCalTypes::WaferFull, HGCalTypes::WaferHDTop, HGCalTypes::WaferHDBottom, diff --git a/SimG4CMS/Calo/plugins/HGCalTestGuardRing.cc b/SimG4CMS/Calo/plugins/HGCalTestGuardRing.cc index a45225ce42976..dec9d216164f9 100644 --- a/SimG4CMS/Calo/plugins/HGCalTestGuardRing.cc +++ b/SimG4CMS/Calo/plugins/HGCalTestGuardRing.cc @@ -62,10 +62,7 @@ HGCalTestGuardRing::HGCalTestGuardRing(const edm::ParameterSet& ps) << " for wafers read from file " << waferFile_; if (!waferFile_.empty()) { std::string thick[4] = {"h120", "l200", "l300", "h200"}; - int addType[4] = {HGCalTypes::WaferHD120, - HGCalTypes::WaferLD200, - HGCalTypes::WaferLD300, - HGCalTypes::WaferHD200}; + int addType[4] = {HGCalTypes::WaferHD120, HGCalTypes::WaferLD200, HGCalTypes::WaferLD300, HGCalTypes::WaferHD200}; const int partTypeH[6] = {HGCalTypes::WaferFull, HGCalTypes::WaferHalf2, HGCalTypes::WaferChopTwoM,