diff --git a/Geometry/HGCalCommonData/data/hgcalCons/v15/hgcalCons.xml b/Geometry/HGCalCommonData/data/hgcalCons/v15/hgcalCons.xml index 0e56ff2d3a864..a4c8033593f32 100644 --- a/Geometry/HGCalCommonData/data/hgcalCons/v15/hgcalCons.xml +++ b/Geometry/HGCalCommonData/data/hgcalCons/v15/hgcalCons.xml @@ -27,6 +27,9 @@ + + + @@ -35,6 +38,7 @@ + @@ -85,6 +89,9 @@ + + + @@ -93,6 +100,7 @@ + diff --git a/Geometry/HGCalCommonData/data/hgcalCons/v15f/hgcalCons.xml b/Geometry/HGCalCommonData/data/hgcalCons/v15f/hgcalCons.xml index 1c41b0c646f56..64f6a0df010fb 100644 --- a/Geometry/HGCalCommonData/data/hgcalCons/v15f/hgcalCons.xml +++ b/Geometry/HGCalCommonData/data/hgcalCons/v15f/hgcalCons.xml @@ -27,6 +27,9 @@ + + + @@ -35,6 +38,7 @@ + diff --git a/Geometry/HGCalCommonData/data/hgcalConsData/v15/hgcalConsData.xml b/Geometry/HGCalCommonData/data/hgcalConsData/v15/hgcalConsData.xml index e94c67cc22d72..115aa1d89efab 100644 --- a/Geometry/HGCalCommonData/data/hgcalConsData/v15/hgcalConsData.xml +++ b/Geometry/HGCalCommonData/data/hgcalConsData/v15/hgcalConsData.xml @@ -2,7 +2,11 @@ - + + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1 + + 262146, 262147, 262148, 262149, 262150, 262151, 262152, 262153, 262178, 262179, 262180, 262181, 262182, 262183, 262184, 262185, 262210, 262211, 262212, 262213, 262214, @@ -2128,6 +2132,10 @@ 4002, 4002, 4042, 5042, 5012, 4002, 4002, 4002, 4002, 4002, 5012, 4042, 4052, 4072, 4072, 4052 + + 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, + 3, 2 + 262146, 262147, 262148, 262149, 262150, 262151, 262152, 262153, 262178, 262179, 262180, 262181, 262182, 262183, diff --git a/Geometry/HGCalCommonData/data/hgcalConsData/v15f/hgcalConsData.xml b/Geometry/HGCalCommonData/data/hgcalConsData/v15f/hgcalConsData.xml index 19e97ad90412e..42b1034e22575 100644 --- a/Geometry/HGCalCommonData/data/hgcalConsData/v15f/hgcalConsData.xml +++ b/Geometry/HGCalCommonData/data/hgcalConsData/v15f/hgcalConsData.xml @@ -2,7 +2,11 @@ - + + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1 + + 262146, 262147, 262148, 262149, 262150, 262151, 262152, 262153, 262178, 262179, 262180, 262181, 262182, 262183, 262184, 262185, 262210, 262211, 262212, 262213, 262214, diff --git a/Geometry/HGCalCommonData/interface/HGCalGeomParameters.h b/Geometry/HGCalCommonData/interface/HGCalGeomParameters.h index 21c53524d958c..154407eeadad9 100644 --- a/Geometry/HGCalCommonData/interface/HGCalGeomParameters.h +++ b/Geometry/HGCalCommonData/interface/HGCalGeomParameters.h @@ -118,6 +118,7 @@ class HGCalGeomParameters { void loadSpecParsHexagon(const HGCalParameters& php); void loadSpecParsHexagon8(HGCalParameters& php); void loadSpecParsHexagon8(HGCalParameters& php, + const std::vector& layerType, const std::vector& waferIndex, const std::vector& waferProperties); void loadSpecParsTrapezoid(HGCalParameters& php); diff --git a/Geometry/HGCalCommonData/interface/HGCalParameters.h b/Geometry/HGCalCommonData/interface/HGCalParameters.h index 9685f326f0284..8c2cc6d1795e7 100644 --- a/Geometry/HGCalCommonData/interface/HGCalParameters.h +++ b/Geometry/HGCalCommonData/interface/HGCalParameters.h @@ -148,6 +148,7 @@ class HGCalParameters { int waferUVMax_; std::vector waferUVMaxLayer_; bool defineFull_; + std::vector waferThickness_; std::vector cellThickness_; std::vector radius100to200_; std::vector radius200to300_; @@ -172,6 +173,8 @@ class HGCalParameters { int firstLayer_; int firstMixedLayer_; int layerOffset_; + double layerRotation_; + std::vector layerType_; std::vector layerCenter_; wafer_map wafersInLayers_; wafer_map typesInLayers_; @@ -179,6 +182,8 @@ class HGCalParameters { int waferMaskMode_; int waferZSide_; waferInfo_map waferInfoMap_; + std::vector > layerRotF_; + std::vector > layerRotB_; tileInfo_map tileInfoMap_; std::vector > tileRingR_; std::vector > tileRingRange_; diff --git a/Geometry/HGCalCommonData/interface/HGCalTypes.h b/Geometry/HGCalCommonData/interface/HGCalTypes.h index 04de7a377dd00..fd1fb33d4c775 100644 --- a/Geometry/HGCalCommonData/interface/HGCalTypes.h +++ b/Geometry/HGCalCommonData/interface/HGCalTypes.h @@ -41,7 +41,9 @@ class HGCalTypes { CornerCenterYp = 1, CornerCenterYm = 2, CornerCenterXp = 3, - CornerCenterXm = 4 + CornerCenterXm = 4, + WaferCenterB = 5, + WaferCenterR = 6 }; enum WaferType { WaferFineThin = 0, WaferCoarseThin = 1, WaferCoarseThick = 2, WaferFineThick = 3 }; diff --git a/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc b/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc index 523c7df173f51..0f4f36276d998 100644 --- a/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc +++ b/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc @@ -1598,9 +1598,11 @@ bool HGCalDDDConstants::isValidCell8(int lay, int waferU, int waferV, int cellU, int N = (type == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_; auto partn = waferTypeRotation(lay, waferU, waferV, false, false); result = HGCalWaferMask::goodCell(cellU, cellV, N, partn.first, partn.second); +#ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "Input " << lay << ":" << waferU << ":" << waferV << ":" << cellU << ":" << cellV << " N " << N << " part " << partn.first << ":" << partn.second << " Result " << result; +#endif } return result; } diff --git a/Geometry/HGCalCommonData/src/HGCalGeomParameters.cc b/Geometry/HGCalCommonData/src/HGCalGeomParameters.cc index 935ad9a04ce10..33ceff2a472c3 100644 --- a/Geometry/HGCalCommonData/src/HGCalGeomParameters.cc +++ b/Geometry/HGCalCommonData/src/HGCalGeomParameters.cc @@ -1249,6 +1249,13 @@ void HGCalGeomParameters::loadSpecParsHexagon8(const DDFilteredView& fv, HGCalPa DDsvalues_type sv(fv.mergedSpecifics()); php.cellThickness_ = getDDDArray("CellThickness", sv, 3); rescale(php.cellThickness_, HGCalParameters::k_ScaleFromDDD); + if (php.mode_ == HGCalGeometryMode::Hexagon8Module) { + php.waferThickness_ = getDDDArray("WaferThickness", sv, 3); + rescale(php.waferThickness_, HGCalParameters::k_ScaleFromDDD); + } else { + for (unsigned int k = 0; k < php.cellThickness_.size(); ++k) + php.waferThickness_.emplace_back(php.waferThick_); + } php.radius100to200_ = getDDDArray("Radius100to200", sv, 5); php.radius200to300_ = getDDDArray("Radius200to300", sv, 5); @@ -1285,7 +1292,7 @@ void HGCalGeomParameters::loadSpecParsHexagon8(const DDFilteredView& fv, HGCalPa // Read in parameters from Philip's file if (php.waferMaskMode_ > 1) { - std::vector waferIndex, waferProperties; + std::vector layerType, waferIndex, waferProperties; if (php.waferMaskMode_ == siliconFileEE) { waferIndex = dbl_to_int(fv.vector("WaferIndexEE")); waferProperties = dbl_to_int(fv.vector("WaferPropertiesEE")); @@ -1293,8 +1300,15 @@ void HGCalGeomParameters::loadSpecParsHexagon8(const DDFilteredView& fv, HGCalPa waferIndex = dbl_to_int(fv.vector("WaferIndexHE")); waferProperties = dbl_to_int(fv.vector("WaferPropertiesHE")); } + if (php.mode_ == HGCalGeometryMode::Hexagon8Module) { + if (php.waferMaskMode_ == siliconFileEE) { + layerType = dbl_to_int(fv.vector("LayerTypeEE")); + } else if (php.waferMaskMode_ == siliconFileHE) { + layerType = dbl_to_int(fv.vector("LayerTypeHE")); + } + } - loadSpecParsHexagon8(php, waferIndex, waferProperties); + loadSpecParsHexagon8(php, layerType, waferIndex, waferProperties); } } @@ -1304,6 +1318,13 @@ void HGCalGeomParameters::loadSpecParsHexagon8(const cms::DDFilteredView& fv, const std::string& sdTag1) { php.cellThickness_ = fv.get >(sdTag1, "CellThickness"); rescale(php.cellThickness_, HGCalParameters::k_ScaleFromDD4Hep); + if (php.mode_ == HGCalGeometryMode::Hexagon8Module) { + php.waferThickness_ = fv.get >(sdTag1, "WaferThickness"); + rescale(php.waferThickness_, HGCalParameters::k_ScaleFromDD4Hep); + } else { + for (unsigned int k = 0; k < php.cellThickness_.size(); ++k) + php.waferThickness_.emplace_back(php.waferThick_); + } php.radius100to200_ = fv.get >(sdTag1, "Radius100to200"); php.radius200to300_ = fv.get >(sdTag1, "Radius200to300"); @@ -1357,7 +1378,7 @@ void HGCalGeomParameters::loadSpecParsHexagon8(const cms::DDFilteredView& fv, // Read in parameters from Philip's file if (php.waferMaskMode_ > 1) { - std::vector waferIndex, waferProperties; + std::vector layerType, waferIndex, waferProperties; if (php.waferMaskMode_ == siliconFileEE) { for (auto const& it : vmap) { if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "WaferIndexEE")) { @@ -1379,13 +1400,32 @@ void HGCalGeomParameters::loadSpecParsHexagon8(const cms::DDFilteredView& fv, } } } + if (php.mode_ == HGCalGeometryMode::Hexagon8Module) { + if (php.waferMaskMode_ == siliconFileEE) { + for (auto const& it : vmap) { + if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "LayerTypeEE")) { + for (const auto& i : it.second) + layerType.emplace_back(std::round(i)); + } + } + } else if (php.waferMaskMode_ == siliconFileHE) { + for (auto const& it : vmap) { + if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "LayerTypeHE")) { + for (const auto& i : it.second) + layerType.emplace_back(std::round(i)); + } + } + } + } - loadSpecParsHexagon8(php, waferIndex, waferProperties); + loadSpecParsHexagon8(php, layerType, waferIndex, waferProperties); } } void HGCalGeomParameters::loadSpecParsHexagon8(HGCalParameters& php) { #ifdef EDM_ML_DEBUG + for (unsigned int k = 0; k < php.waferThickness_.size(); ++k) + edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: wafer[" << k << "] Thickness " << php.waferThickness_[k]; for (unsigned int k = 0; k < php.cellThickness_.size(); ++k) edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: cell[" << k << "] Thickness " << php.cellThickness_[k]; edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Polynomial " @@ -1419,9 +1459,21 @@ void HGCalGeomParameters::loadSpecParsHexagon8(HGCalParameters& php) { } void HGCalGeomParameters::loadSpecParsHexagon8(HGCalParameters& php, + const std::vector& layerType, const std::vector& waferIndex, const std::vector& waferProperties) { // Store parameters from Philip's file + int types[5] = {HGCalTypes::WaferCenter, + HGCalTypes::WaferCenterB, + HGCalTypes::CornerCenterYm, + HGCalTypes::CornerCenterYp, + HGCalTypes::WaferCenterR}; + for (unsigned int k = 0; k < layerType.size(); ++k) { + php.layerType_.emplace_back(types[layerType[k]]); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HGCalGeom") << "Layer[" << k << "] Type " << layerType[k] << ":" << php.layerType_[k]; +#endif + } for (unsigned int k = 0; k < waferIndex.size(); ++k) { int partial = HGCalProperty::waferPartial(waferProperties[k]); int orient = HGCalWaferMask::getRotation(php.waferZSide_, partial, HGCalProperty::waferOrient(waferProperties[k])); diff --git a/Geometry/HGCalCommonData/src/HGCalParametersFromDD.cc b/Geometry/HGCalCommonData/src/HGCalParametersFromDD.cc index 6fcd0bad59173..d04ced90c931a 100644 --- a/Geometry/HGCalCommonData/src/HGCalParametersFromDD.cc +++ b/Geometry/HGCalCommonData/src/HGCalParametersFromDD.cc @@ -88,6 +88,7 @@ bool HGCalParametersFromDD::build(const DDCompactView* cpv, php.levelZSide_ = 3; // Default level for ZSide php.detectorType_ = 0; // These two parameters are php.firstMixedLayer_ = -1; // defined for post TDR geometry + php.layerRotation_ = 0; // default layer rotation angle std::unique_ptr geom = std::make_unique(); if ((php.mode_ == HGCalGeometryMode::Hexagon) || (php.mode_ == HGCalGeometryMode::HexagonFull)) { attribute = "OnlyForHGCalNumbering"; @@ -119,11 +120,14 @@ bool HGCalParametersFromDD::build(const DDCompactView* cpv, php.minTileSize_ = 0; php.waferMaskMode_ = static_cast(getDDDValue("WaferMaskMode", sv)); php.waferZSide_ = static_cast(getDDDValue("WaferZside", sv)); + if (php.mode_ == HGCalGeometryMode::Hexagon8Module) + php.layerRotation_ = getDDDValue("LayerRotation", sv); #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "Top levels " << php.levelT_[0] << ":" << php.levelT_[1] << " ZSide Level " << php.levelZSide_ << " first layers " << php.firstLayer_ << ":" << php.firstMixedLayer_ << " Det Type " << php.detectorType_ << " Wafer Mask Mode " - << php.waferMaskMode_ << " Zside " << php.waferZSide_; + << php.waferMaskMode_ << " Zside " << php.waferZSide_ << " Layer Rotation " + << convertRadToDeg(php.layerRotation_); #endif attribute = "OnlyForHGCalNumbering"; value = namet; @@ -283,6 +287,7 @@ bool HGCalParametersFromDD::build(const cms::DDCompactView* cpv, php.levelZSide_ = 3; // Default level for ZSide php.detectorType_ = 0; // These two parameters are php.firstMixedLayer_ = -1; // defined for post TDR geometry + php.layerRotation_ = 0; // default layer rotation angle std::unique_ptr geom = std::make_unique(); if ((php.mode_ == HGCalGeometryMode::Hexagon) || (php.mode_ == HGCalGeometryMode::HexagonFull)) { tempS = fv.get >(namet, "WaferMode"); @@ -312,11 +317,16 @@ bool HGCalParametersFromDD::build(const cms::DDCompactView* cpv, php.waferMaskMode_ = static_cast(tempD[0]); tempD = fv.get >(name, "WaferZside"); php.waferZSide_ = static_cast(tempD[0]); + if (php.mode_ == HGCalGeometryMode::Hexagon8Module) { + tempD = fv.get >(name, "LayerRotation"); + php.layerRotation_ = tempD[0]; + } #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "Top levels " << php.levelT_[0] << ":" << php.levelT_[1] << " ZSide Level " << php.levelZSide_ << " first layers " << php.firstLayer_ << ":" << php.firstMixedLayer_ << " Det Type " << php.detectorType_ << " Wafer Mask Mode " - << php.waferMaskMode_ << " ZSide " << php.waferZSide_; + << php.waferMaskMode_ << " ZSide " << php.waferZSide_ << " Layer Rotation " + << convertRadToDeg(php.layerRotation_); #endif tempS = fv.get >(namet, "WaferMode"); diff --git a/Geometry/HGCalCommonData/src/HGCalWaferMask.cc b/Geometry/HGCalCommonData/src/HGCalWaferMask.cc index 9b4f420bc62a4..8d16350d2f548 100644 --- a/Geometry/HGCalCommonData/src/HGCalWaferMask.cc +++ b/Geometry/HGCalCommonData/src/HGCalWaferMask.cc @@ -399,7 +399,7 @@ int HGCalWaferMask::getRotation(int zside, int type, int rotn) { rotn = HGCalTypes::WaferCorner0; int newrotn(rotn); if ((zside < 0) && (type != HGCalTypes::WaferFull)) { - if (type == HGCalTypes::WaferFive) { //WaferFive + if ((type == HGCalTypes::WaferFive) || (type == HGCalTypes::WaferFive2)) { //WaferFive/WaferFive2 static constexpr int rot1[HGCalTypes::WaferCornerMax] = {HGCalTypes::WaferCorner4, HGCalTypes::WaferCorner3, HGCalTypes::WaferCorner2, @@ -416,7 +416,7 @@ int HGCalWaferMask::getRotation(int zside, int type, int rotn) { HGCalTypes::WaferCorner4, HGCalTypes::WaferCorner3}; newrotn = rot2[rotn]; - } else { //WaferHalf/WaferChopTwo/WaferChopTwoM + } else { //WaferHalf/WaferChopTwo/WaferChopTwoM/WaferHalf2 static constexpr int rot3[HGCalTypes::WaferCornerMax] = {HGCalTypes::WaferCorner3, HGCalTypes::WaferCorner2, HGCalTypes::WaferCorner1,