Skip to content

Commit

Permalink
Merge pull request #34201 from bsunanda/Phase2-hgx287X
Browse files Browse the repository at this point in the history
Phase2-hgx287X Next step for V16 Geometry for HGCAL
  • Loading branch information
cmsbuild authored Jun 25, 2021
2 parents 6243eb5 + b74e8b6 commit 16e3f88
Show file tree
Hide file tree
Showing 11 changed files with 107 additions and 11 deletions.
8 changes: 8 additions & 0 deletions Geometry/HGCalCommonData/data/hgcalCons/v15/hgcalCons.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
<Parameter name="LevelZSide" value="3"/>
<Parameter name="LevelTop" value="9"/>
<Parameter name="LevelTop" value="11"/>
<Parameter name="WaferThickness" value="[hgcal:WaferThickness]"/>
<Parameter name="WaferThickness" value="[hgcal:WaferThickness]"/>
<Parameter name="WaferThickness" value="[hgcal:WaferThickness]"/>
<Parameter name="CellThickness" value="[hgcal:CellThicknessFine]"/>
<Parameter name="CellThickness" value="[hgcal:CellThicknessCoarse1]"/>
<Parameter name="CellThickness" value="[hgcal:CellThicknessCoarse2]"/>
Expand All @@ -35,6 +38,7 @@
<Parameter name="DetectorType" value="1"/>
<Parameter name="WaferMaskMode" value="2"/>
<Parameter name="WaferZside" value="-1"/>
<Parameter name="LayerRotation" value="[hgcal:LayerRotation]"/>
<Parameter name="Radius100to200" value="[hgcal:rad100200P0]"/>
<Parameter name="Radius100to200" value="[hgcal:rad100200P1]"/>
<Parameter name="Radius100to200" value="[hgcal:rad100200P2]"/>
Expand Down Expand Up @@ -85,6 +89,9 @@
<Parameter name="LevelZSide" value="3"/>
<Parameter name="LevelTop" value="9"/>
<Parameter name="LevelTop" value="11"/>
<Parameter name="WaferThickness" value="[hgcal:WaferThickness]"/>
<Parameter name="WaferThickness" value="[hgcal:WaferThickness]"/>
<Parameter name="WaferThickness" value="[hgcal:WaferThickness]"/>
<Parameter name="CellThickness" value="[hgcal:CellThicknessFine]"/>
<Parameter name="CellThickness" value="[hgcal:CellThicknessCoarse1]"/>
<Parameter name="CellThickness" value="[hgcal:CellThicknessCoarse2]"/>
Expand All @@ -93,6 +100,7 @@
<Parameter name="DetectorType" value="2"/>
<Parameter name="WaferMaskMode" value="3"/>
<Parameter name="WaferZside" value="-1"/>
<Parameter name="LayerRotation" value="[hgcal:LayerRotation]"/>
<Parameter name="Radius100to200" value="[hgcal:rad100200P0]"/>
<Parameter name="Radius100to200" value="[hgcal:rad100200P1]"/>
<Parameter name="Radius100to200" value="[hgcal:rad100200P2]"/>
Expand Down
4 changes: 4 additions & 0 deletions Geometry/HGCalCommonData/data/hgcalCons/v15f/hgcalCons.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
<Parameter name="LevelZSide" value="3"/>
<Parameter name="LevelTop" value="9"/>
<Parameter name="LevelTop" value="11"/>
<Parameter name="WaferThickness" value="[hgcal:WaferThickness]"/>
<Parameter name="WaferThickness" value="[hgcal:WaferThickness]"/>
<Parameter name="WaferThickness" value="[hgcal:WaferThickness]"/>
<Parameter name="CellThickness" value="[hgcal:CellThicknessFine]"/>
<Parameter name="CellThickness" value="[hgcal:CellThicknessCoarse1]"/>
<Parameter name="CellThickness" value="[hgcal:CellThicknessCoarse2]"/>
Expand All @@ -35,6 +38,7 @@
<Parameter name="DetectorType" value="1"/>
<Parameter name="WaferMaskMode" value="2"/>
<Parameter name="WaferZside" value="-1"/>
<Parameter name="LayerRotation" value="[hgcal:LayerRotation]"/>
<Parameter name="Radius100to200" value="[hgcal:rad100200P0]"/>
<Parameter name="Radius100to200" value="[hgcal:rad100200P1]"/>
<Parameter name="Radius100to200" value="[hgcal:rad100200P2]"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
<DDDefinition>

<ConstantsSection label="hgcalConsData.xml" eval="true">
<Vector name="WaferIndexEE" type="numeric" nEntries="8736">
<Vector name="LayerTypesEE" type="numeric" nEntries="28">
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
</Vector>
<Vector name="WaferIndexEE" type="numeric" nEntries="8736">
262146, 262147, 262148, 262149, 262150, 262151, 262152,
262153, 262178, 262179, 262180, 262181, 262182, 262183,
262184, 262185, 262210, 262211, 262212, 262213, 262214,
Expand Down Expand Up @@ -2128,6 +2132,10 @@
4002, 4002, 4042, 5042, 5012, 4002, 4002, 4002, 4002, 4002,
5012, 4042, 4052, 4072, 4072, 4052
</Vector>
<Vector name="LayerTypesHE" type="numeric" nEntries="22">
3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2,
3, 2
</Vector>
<Vector name="WaferIndexHE" type="numeric" nEntries="5961">
262146, 262147, 262148, 262149, 262150, 262151, 262152,
262153, 262178, 262179, 262180, 262181, 262182, 262183,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
<DDDefinition>

<ConstantsSection label="hgcalConsData.xml" eval="true">
<Vector name="WaferIndexEE" type="numeric" nEntries="8736">
<Vector name="LayerTypesEE" type="numeric" nEntries="28">
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
</Vector>
<Vector name="WaferIndexEE" type="numeric" nEntries="8736">
262146, 262147, 262148, 262149, 262150, 262151, 262152,
262153, 262178, 262179, 262180, 262181, 262182, 262183,
262184, 262185, 262210, 262211, 262212, 262213, 262214,
Expand Down
1 change: 1 addition & 0 deletions Geometry/HGCalCommonData/interface/HGCalGeomParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ class HGCalGeomParameters {
void loadSpecParsHexagon(const HGCalParameters& php);
void loadSpecParsHexagon8(HGCalParameters& php);
void loadSpecParsHexagon8(HGCalParameters& php,
const std::vector<int>& layerType,
const std::vector<int>& waferIndex,
const std::vector<int>& waferProperties);
void loadSpecParsTrapezoid(HGCalParameters& php);
Expand Down
5 changes: 5 additions & 0 deletions Geometry/HGCalCommonData/interface/HGCalParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ class HGCalParameters {
int waferUVMax_;
std::vector<int> waferUVMaxLayer_;
bool defineFull_;
std::vector<double> waferThickness_;
std::vector<double> cellThickness_;
std::vector<double> radius100to200_;
std::vector<double> radius200to300_;
Expand All @@ -172,13 +173,17 @@ class HGCalParameters {
int firstLayer_;
int firstMixedLayer_;
int layerOffset_;
double layerRotation_;
std::vector<int> layerType_;
std::vector<int> layerCenter_;
wafer_map wafersInLayers_;
wafer_map typesInLayers_;
waferT_map waferTypes_;
int waferMaskMode_;
int waferZSide_;
waferInfo_map waferInfoMap_;
std::vector<std::pair<double, double> > layerRotF_;
std::vector<std::pair<double, double> > layerRotB_;
tileInfo_map tileInfoMap_;
std::vector<std::pair<double, double> > tileRingR_;
std::vector<std::pair<int, int> > tileRingRange_;
Expand Down
4 changes: 3 additions & 1 deletion Geometry/HGCalCommonData/interface/HGCalTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down
2 changes: 2 additions & 0 deletions Geometry/HGCalCommonData/src/HGCalDDDConstants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
60 changes: 56 additions & 4 deletions Geometry/HGCalCommonData/src/HGCalGeomParameters.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -1285,16 +1292,23 @@ void HGCalGeomParameters::loadSpecParsHexagon8(const DDFilteredView& fv, HGCalPa

// Read in parameters from Philip's file
if (php.waferMaskMode_ > 1) {
std::vector<int> waferIndex, waferProperties;
std::vector<int> layerType, waferIndex, waferProperties;
if (php.waferMaskMode_ == siliconFileEE) {
waferIndex = dbl_to_int(fv.vector("WaferIndexEE"));
waferProperties = dbl_to_int(fv.vector("WaferPropertiesEE"));
} else if (php.waferMaskMode_ == siliconFileHE) {
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);
}
}

Expand All @@ -1304,6 +1318,13 @@ void HGCalGeomParameters::loadSpecParsHexagon8(const cms::DDFilteredView& fv,
const std::string& sdTag1) {
php.cellThickness_ = fv.get<std::vector<double> >(sdTag1, "CellThickness");
rescale(php.cellThickness_, HGCalParameters::k_ScaleFromDD4Hep);
if (php.mode_ == HGCalGeometryMode::Hexagon8Module) {
php.waferThickness_ = fv.get<std::vector<double> >(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<std::vector<double> >(sdTag1, "Radius100to200");
php.radius200to300_ = fv.get<std::vector<double> >(sdTag1, "Radius200to300");
Expand Down Expand Up @@ -1357,7 +1378,7 @@ void HGCalGeomParameters::loadSpecParsHexagon8(const cms::DDFilteredView& fv,

// Read in parameters from Philip's file
if (php.waferMaskMode_ > 1) {
std::vector<int> waferIndex, waferProperties;
std::vector<int> layerType, waferIndex, waferProperties;
if (php.waferMaskMode_ == siliconFileEE) {
for (auto const& it : vmap) {
if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "WaferIndexEE")) {
Expand All @@ -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 "
Expand Down Expand Up @@ -1419,9 +1459,21 @@ void HGCalGeomParameters::loadSpecParsHexagon8(HGCalParameters& php) {
}

void HGCalGeomParameters::loadSpecParsHexagon8(HGCalParameters& php,
const std::vector<int>& layerType,
const std::vector<int>& waferIndex,
const std::vector<int>& 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]));
Expand Down
14 changes: 12 additions & 2 deletions Geometry/HGCalCommonData/src/HGCalParametersFromDD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<HGCalGeomParameters> geom = std::make_unique<HGCalGeomParameters>();
if ((php.mode_ == HGCalGeometryMode::Hexagon) || (php.mode_ == HGCalGeometryMode::HexagonFull)) {
attribute = "OnlyForHGCalNumbering";
Expand Down Expand Up @@ -119,11 +120,14 @@ bool HGCalParametersFromDD::build(const DDCompactView* cpv,
php.minTileSize_ = 0;
php.waferMaskMode_ = static_cast<int>(getDDDValue("WaferMaskMode", sv));
php.waferZSide_ = static_cast<int>(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;
Expand Down Expand Up @@ -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<HGCalGeomParameters> geom = std::make_unique<HGCalGeomParameters>();
if ((php.mode_ == HGCalGeometryMode::Hexagon) || (php.mode_ == HGCalGeometryMode::HexagonFull)) {
tempS = fv.get<std::vector<std::string> >(namet, "WaferMode");
Expand Down Expand Up @@ -312,11 +317,16 @@ bool HGCalParametersFromDD::build(const cms::DDCompactView* cpv,
php.waferMaskMode_ = static_cast<int>(tempD[0]);
tempD = fv.get<std::vector<double> >(name, "WaferZside");
php.waferZSide_ = static_cast<int>(tempD[0]);
if (php.mode_ == HGCalGeometryMode::Hexagon8Module) {
tempD = fv.get<std::vector<double> >(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<std::vector<std::string> >(namet, "WaferMode");
Expand Down
4 changes: 2 additions & 2 deletions Geometry/HGCalCommonData/src/HGCalWaferMask.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 16e3f88

Please sign in to comment.