Skip to content

Commit

Permalink
Backport the bugfixes to HGCal geometries of versions V16 (cms-sw#41208
Browse files Browse the repository at this point in the history
…) and V17 (cms-sw#41294) to CMSSW version 13_0_X
  • Loading branch information
Sunanda authored and Ming-Yan committed Nov 29, 2023
1 parent 07a299e commit e5c90ef
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 139 deletions.
12 changes: 3 additions & 9 deletions Geometry/HGCalCommonData/interface/HGCalWaferMask.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,12 @@ class HGCalWaferMask {
const bool& debug = false);
// Gets the corners of the partial wafers from its type, orientation, zside
// (Good for V15, V16 geometries)
static std::vector<std::pair<double, double> > waferXY(const int& part,
const int& orient,
const int& zside,
const double& waferSize,
const double& offset,
const double& xpos,
const double& ypos,
const bool& v17);
static std::vector<std::pair<double, double> > waferXY(
int part, int orient, int zside, double waferSize, double offset, double xpos, double ypos);
// Gets the corners of the partial wafers from its type, placement index
// (Good for V17 geometry)
static std::vector<std::pair<double, double> > waferXY(
int part, int placement, double delX, double delY, double xpos, double ypos);
int part, int placement, double wafersize, double offset, double xpos, double ypos);

private:
static constexpr double sqrt3_ = 1.732050807568877; // std::sqrt(3.0) in double precision
Expand Down
4 changes: 2 additions & 2 deletions Geometry/HGCalCommonData/plugins/DDHGCalWaferP.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void DDHGCalWaferP::execute(DDCompactView& cpv) {
// First the mother
std::string mother = parentName + tags_[k];
std::vector<std::pair<double, double> > wxy =
HGCalWaferMask::waferXY(partialTypes_[k], orientations_[k], 1, waferSize_, 0.0, 0.0, 0.0, true);
HGCalWaferMask::waferXY(partialTypes_[k], orientations_[k], 1, waferSize_, 0.0, 0.0, 0.0);
std::vector<double> xM, yM;
for (unsigned int i = 0; i < (wxy.size() - 1); ++i) {
xM.emplace_back(wxy[i].first);
Expand All @@ -136,7 +136,7 @@ void DDHGCalWaferP::execute(DDCompactView& cpv) {
#endif

// Then the layers
wxy = HGCalWaferMask::waferXY(partialTypes_[k], orientations_[k], 1, waferSize_, 0.0, 0.0, 0.0, true);
wxy = HGCalWaferMask::waferXY(partialTypes_[k], orientations_[k], 1, waferSize_, 0.0, 0.0, 0.0);
std::vector<double> xL, yL;
for (unsigned int i = 0; i < (wxy.size() - 1); ++i) {
xL.emplace_back(wxy[i].first);
Expand Down
4 changes: 2 additions & 2 deletions Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalWaferP.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext
// First the mother
std::string mother = parentName + tags[k];
std::vector<std::pair<double, double>> wxy =
HGCalWaferMask::waferXY(partialTypes[k], orientations[k], 1, waferSize, 0.0, 0.0, 0.0, true);
HGCalWaferMask::waferXY(partialTypes[k], orientations[k], 1, waferSize, 0.0, 0.0, 0.0);
std::vector<double> xM, yM;
for (unsigned int i = 0; i < (wxy.size() - 1); ++i) {
xM.emplace_back(wxy[i].first);
Expand All @@ -103,7 +103,7 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext

// Then the layers
dd4hep::Rotation3D rotation;
wxy = HGCalWaferMask::waferXY(partialTypes[k], orientations[k], 1, waferSize, 0.0, 0.0, 0.0, true);
wxy = HGCalWaferMask::waferXY(partialTypes[k], orientations[k], 1, waferSize, 0.0, 0.0, 0.0);
std::vector<double> xL, yL;
for (unsigned int i = 0; i < (wxy.size() - 1); ++i) {
xL.emplace_back(wxy[i].first);
Expand Down
238 changes: 112 additions & 126 deletions Geometry/HGCalCommonData/src/HGCalWaferMask.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1046,14 +1046,8 @@ bool HGCalWaferMask::goodTypeMode(const double& xpos,
return ok;
}

std::vector<std::pair<double, double> > HGCalWaferMask::waferXY(const int& part,
const int& ori,
const int& zside,
const double& waferSize,
const double& offset,
const double& xpos,
const double& ypos,
const bool& v17OrLess) {
std::vector<std::pair<double, double> > HGCalWaferMask::waferXY(
int part, int ori, int zside, double waferSize, double offset, double xpos, double ypos) {
// Good for V15 and V16 versions
std::vector<std::pair<double, double> > xy;
int orient = getRotation(-zside, part, ori);
Expand Down Expand Up @@ -1094,102 +1088,30 @@ std::vector<std::pair<double, double> > HGCalWaferMask::waferXY(const int& part,
*/
double delX = 0.5 * waferSize;
double delY = delX / sin_60_;
double dx[48] = {HGCalTypes::c00 * delX,
HGCalTypes::c10 * delX,
HGCalTypes::c10 * delX,
HGCalTypes::c00 * delX,
-HGCalTypes::c10 * delX,
-HGCalTypes::c10 * delX,
HGCalTypes::c50 * delX,
HGCalTypes::c10 * delX,
HGCalTypes::c50 * delX,
-HGCalTypes::c50 * delX,
-HGCalTypes::c10 * delX,
-HGCalTypes::c50 * delX,
c22 * delX,
HGCalTypes::c10 * delX,
c77 * delX,
-c22 * delX,
-HGCalTypes::c10 * delX,
-c77 * delX,
c22 * delX,
-c77 * delX,
-HGCalTypes::c10 * delX,
-c22 * delX,
c77 * delX,
HGCalTypes::c10 * delX,
HGCalTypes::c50 * delX,
HGCalTypes::c10 * delX,
HGCalTypes::c50 * delX,
-HGCalTypes::c50 * delX,
-HGCalTypes::c10 * delX,
-HGCalTypes::c50 * delX,
HGCalTypes::c50 * delX,
HGCalTypes::c10 * delX,
HGCalTypes::c50 * delX,
-HGCalTypes::c50 * delX,
-HGCalTypes::c10 * delX,
-HGCalTypes::c50 * delX,
c22 * delX,
HGCalTypes::c10 * delX,
c77 * delX,
-c22 * delX,
-HGCalTypes::c10 * delX,
-c77 * delX,
c22 * delX,
-c77 * delX,
-HGCalTypes::c10 * delX,
-c22 * delX,
c77 * delX,
HGCalTypes::c10 * delX};
double dy[48] = {-HGCalTypes::c10 * delY,
-HGCalTypes::c50 * delY,
HGCalTypes::c50 * delY,
HGCalTypes::c10 * delY,
HGCalTypes::c50 * delY,
-HGCalTypes::c50 * delY,
-HGCalTypes::c75 * delY,
HGCalTypes::c00 * delY,
HGCalTypes::c75 * delY,
HGCalTypes::c75 * delY,
HGCalTypes::c00 * delY,
-HGCalTypes::c75 * delY,
-c88 * delY,
-c27 * delY,
c61 * delY,
c88 * delY,
c27 * delY,
-c61 * delY,
c88 * delY,
c61 * delY,
-c27 * delY,
-c88 * delY,
-c61 * delY,
c27 * delY,
-HGCalTypes::c75 * delY,
HGCalTypes::c00 * delY,
-HGCalTypes::c75 * delY,
HGCalTypes::c00 * delY,
HGCalTypes::c75 * delY,
HGCalTypes::c75 * delY,
HGCalTypes::c00 * delY,
-HGCalTypes::c75 * delY,
HGCalTypes::c75 * delY,
HGCalTypes::c75 * delY,
HGCalTypes::c00 * delY,
-HGCalTypes::c75 * delY,
-c88 * delY,
-c27 * delY,
c61 * delY,
c88 * delY,
c27 * delY,
-c61 * delY,
c88 * delY,
c61 * delY,
-c27 * delY,
-c88 * delY,
-c61 * delY,
c27 * delY};
double dx[48] = {HGCalTypes::c00 * delX, HGCalTypes::c10 * delX, HGCalTypes::c10 * delX, HGCalTypes::c00 * delX,
-HGCalTypes::c10 * delX, -HGCalTypes::c10 * delX, HGCalTypes::c50 * delX, HGCalTypes::c10 * delX,
HGCalTypes::c50 * delX, -HGCalTypes::c50 * delX, -HGCalTypes::c10 * delX, -HGCalTypes::c50 * delX,
HGCalTypes::c22 * delX, HGCalTypes::c10 * delX, HGCalTypes::c77 * delX, -HGCalTypes::c22 * delX,
-HGCalTypes::c10 * delX, -HGCalTypes::c77 * delX, HGCalTypes::c22 * delX, -HGCalTypes::c77 * delX,
-HGCalTypes::c10 * delX, -HGCalTypes::c22 * delX, HGCalTypes::c77 * delX, HGCalTypes::c10 * delX,
HGCalTypes::c50 * delX, HGCalTypes::c10 * delX, HGCalTypes::c50 * delX, -HGCalTypes::c50 * delX,
-HGCalTypes::c10 * delX, -HGCalTypes::c50 * delX, HGCalTypes::c50 * delX, HGCalTypes::c10 * delX,
HGCalTypes::c50 * delX, -HGCalTypes::c50 * delX, -HGCalTypes::c10 * delX, -HGCalTypes::c50 * delX,
HGCalTypes::c22 * delX, HGCalTypes::c10 * delX, HGCalTypes::c77 * delX, -HGCalTypes::c22 * delX,
-HGCalTypes::c10 * delX, -HGCalTypes::c77 * delX, HGCalTypes::c22 * delX, -HGCalTypes::c77 * delX,
-HGCalTypes::c10 * delX, -HGCalTypes::c22 * delX, HGCalTypes::c77 * delX, HGCalTypes::c10 * delX};
double dy[48] = {-HGCalTypes::c10 * delY, -HGCalTypes::c50 * delY, HGCalTypes::c50 * delY, HGCalTypes::c10 * delY,
HGCalTypes::c50 * delY, -HGCalTypes::c50 * delY, -HGCalTypes::c75 * delY, HGCalTypes::c00 * delY,
HGCalTypes::c75 * delY, HGCalTypes::c75 * delY, HGCalTypes::c00 * delY, -HGCalTypes::c75 * delY,
-HGCalTypes::c88 * delY, -HGCalTypes::c27 * delY, HGCalTypes::c61 * delY, HGCalTypes::c88 * delY,
HGCalTypes::c27 * delY, -HGCalTypes::c61 * delY, HGCalTypes::c88 * delY, HGCalTypes::c61 * delY,
-HGCalTypes::c27 * delY, -HGCalTypes::c88 * delY, -HGCalTypes::c61 * delY, HGCalTypes::c27 * delY,
-HGCalTypes::c75 * delY, HGCalTypes::c00 * delY, -HGCalTypes::c75 * delY, HGCalTypes::c00 * delY,
HGCalTypes::c75 * delY, HGCalTypes::c75 * delY, HGCalTypes::c00 * delY, -HGCalTypes::c75 * delY,
HGCalTypes::c75 * delY, HGCalTypes::c75 * delY, HGCalTypes::c00 * delY, -HGCalTypes::c75 * delY,
-HGCalTypes::c88 * delY, -HGCalTypes::c27 * delY, HGCalTypes::c61 * delY, HGCalTypes::c88 * delY,
HGCalTypes::c27 * delY, -HGCalTypes::c61 * delY, HGCalTypes::c88 * delY, HGCalTypes::c61 * delY,
-HGCalTypes::c27 * delY, -HGCalTypes::c88 * delY, -HGCalTypes::c61 * delY, HGCalTypes::c27 * delY};

double offsetx[48] = {0.0,
-offset,
Expand Down Expand Up @@ -1470,26 +1392,42 @@ std::vector<std::pair<double, double> > HGCalWaferMask::waferXY(
*/
double delX = 0.5 * waferSize;
double delY = delX / sin_60_;
double dx[36] = {HGCalTypes::c00 * delX, HGCalTypes::c10 * delX, HGCalTypes::c10 * delX, HGCalTypes::c00 * delX,
-HGCalTypes::c10 * delX, -HGCalTypes::c10 * delX, HGCalTypes::c50 * delX, HGCalTypes::c10 * delX,
HGCalTypes::c50 * delX, -HGCalTypes::c50 * delX, -HGCalTypes::c10 * delX, -HGCalTypes::c50 * delX,
HGCalTypes::c22 * delX, HGCalTypes::c10 * delX, HGCalTypes::c77 * delX, -HGCalTypes::c22 * delX,
-HGCalTypes::c10 * delX, -HGCalTypes::c77 * delX, HGCalTypes::c22 * delX, -HGCalTypes::c77 * delX,
-HGCalTypes::c10 * delX, -HGCalTypes::c22 * delX, HGCalTypes::c77 * delX, HGCalTypes::c10 * delX,
HGCalTypes::c22 * delX, HGCalTypes::c10 * delX, HGCalTypes::c77 * delX, -HGCalTypes::c22 * delX,
-HGCalTypes::c10 * delX, -HGCalTypes::c77 * delX, HGCalTypes::c22 * delX, -HGCalTypes::c77 * delX,
-HGCalTypes::c10 * delX, -HGCalTypes::c22 * delX, HGCalTypes::c77 * delX, HGCalTypes::c10 * delX};
double dy[36] = {-HGCalTypes::c10 * delY, -HGCalTypes::c50 * delY, HGCalTypes::c50 * delY, HGCalTypes::c10 * delY,
HGCalTypes::c50 * delY, -HGCalTypes::c50 * delY, -HGCalTypes::c75 * delY, HGCalTypes::c00 * delY,
HGCalTypes::c75 * delY, HGCalTypes::c75 * delY, HGCalTypes::c00 * delY, -HGCalTypes::c75 * delY,
-HGCalTypes::c88 * delY, -HGCalTypes::c27 * delY, HGCalTypes::c61 * delY, HGCalTypes::c88 * delY,
HGCalTypes::c27 * delY, -HGCalTypes::c61 * delY, HGCalTypes::c88 * delY, HGCalTypes::c61 * delY,
-HGCalTypes::c27 * delY, -HGCalTypes::c88 * delY, -HGCalTypes::c61 * delY, HGCalTypes::c27 * delY,
-HGCalTypes::c88 * delY, -HGCalTypes::c27 * delY, HGCalTypes::c61 * delY, HGCalTypes::c88 * delY,
HGCalTypes::c27 * delY, -HGCalTypes::c61 * delY, HGCalTypes::c88 * delY, HGCalTypes::c61 * delY,
-HGCalTypes::c27 * delY, -HGCalTypes::c88 * delY, -HGCalTypes::c61 * delY, HGCalTypes::c27 * delY};
double dx[60] = {
HGCalTypes::c00 * delX, HGCalTypes::c10 * delX, HGCalTypes::c10 * delX, HGCalTypes::c00 * delX,
-HGCalTypes::c10 * delX, -HGCalTypes::c10 * delX, HGCalTypes::c50 * delX, HGCalTypes::c10 * delX,
HGCalTypes::c50 * delX, -HGCalTypes::c50 * delX, -HGCalTypes::c10 * delX, -HGCalTypes::c50 * delX,
HGCalTypes::c22 * delX, HGCalTypes::c10 * delX, HGCalTypes::c77 * delX, -HGCalTypes::c22 * delX,
-HGCalTypes::c10 * delX, -HGCalTypes::c77 * delX, HGCalTypes::c22 * delX, -HGCalTypes::c77 * delX,
-HGCalTypes::c10 * delX, -HGCalTypes::c22 * delX, HGCalTypes::c77 * delX, HGCalTypes::c10 * delX,
HGCalTypes::c22 * delX, HGCalTypes::c10 * delX, HGCalTypes::c77 * delX, -HGCalTypes::c22 * delX,
-HGCalTypes::c10 * delX, -HGCalTypes::c77 * delX, HGCalTypes::c22 * delX, -HGCalTypes::c77 * delX,
-HGCalTypes::c10 * delX, -HGCalTypes::c22 * delX, HGCalTypes::c77 * delX, HGCalTypes::c10 * delX,
HGCalTypes::c00 * delX, HGCalTypes::c10 * delX, HGCalTypes::c10 * delX, HGCalTypes::c00 * delX,
-HGCalTypes::c10 * delX, -HGCalTypes::c10 * delX, HGCalTypes::c00 * delX, HGCalTypes::c10 * delX,
HGCalTypes::c10 * delX, HGCalTypes::c00 * delX, -HGCalTypes::c10 * delX, -HGCalTypes::c10 * delX,
HGCalTypes::c00 * delX, HGCalTypes::c10 * delX, HGCalTypes::c10 * delX, HGCalTypes::c00 * delX,
-HGCalTypes::c10 * delX, -HGCalTypes::c10 * delX, HGCalTypes::c00 * delX, HGCalTypes::c10 * delX,
HGCalTypes::c10 * delX, HGCalTypes::c00 * delX, -HGCalTypes::c10 * delX, -HGCalTypes::c10 * delX,
};
double dy[60] = {
-HGCalTypes::c10 * delY, -HGCalTypes::c50 * delY, HGCalTypes::c50 * delY, HGCalTypes::c10 * delY,
HGCalTypes::c50 * delY, -HGCalTypes::c50 * delY, -HGCalTypes::c75 * delY, HGCalTypes::c00 * delY,
HGCalTypes::c75 * delY, HGCalTypes::c75 * delY, HGCalTypes::c00 * delY, -HGCalTypes::c75 * delY,
-HGCalTypes::c88 * delY, -HGCalTypes::c27 * delY, HGCalTypes::c61 * delY, HGCalTypes::c88 * delY,
HGCalTypes::c27 * delY, -HGCalTypes::c61 * delY, HGCalTypes::c88 * delY, HGCalTypes::c61 * delY,
-HGCalTypes::c27 * delY, -HGCalTypes::c88 * delY, -HGCalTypes::c61 * delY, HGCalTypes::c27 * delY,
-HGCalTypes::c88 * delY, -HGCalTypes::c27 * delY, HGCalTypes::c61 * delY, HGCalTypes::c88 * delY,
HGCalTypes::c27 * delY, -HGCalTypes::c61 * delY, HGCalTypes::c88 * delY, HGCalTypes::c61 * delY,
-HGCalTypes::c27 * delY, -HGCalTypes::c88 * delY, -HGCalTypes::c61 * delY, HGCalTypes::c27 * delY,
-HGCalTypes::c10 * delY, -HGCalTypes::c50 * delY, HGCalTypes::c50 * delY, HGCalTypes::c10 * delY,
HGCalTypes::c50 * delY, -HGCalTypes::c50 * delY, -HGCalTypes::c10 * delY, -HGCalTypes::c50 * delY,
HGCalTypes::c50 * delY, HGCalTypes::c10 * delY, HGCalTypes::c50 * delY, -HGCalTypes::c50 * delY,
-HGCalTypes::c10 * delY, -HGCalTypes::c50 * delY, HGCalTypes::c50 * delY, HGCalTypes::c10 * delY,
HGCalTypes::c50 * delY, -HGCalTypes::c50 * delY, -HGCalTypes::c10 * delY, -HGCalTypes::c50 * delY,
HGCalTypes::c50 * delY, HGCalTypes::c10 * delY, HGCalTypes::c50 * delY, -HGCalTypes::c50 * delY,
};

double offsetx[36] = {0.0,
double offsetx[60] = {0.0,
-offset,
-offset,
0.0,
Expand Down Expand Up @@ -1524,8 +1462,32 @@ std::vector<std::pair<double, double> > HGCalWaferMask::waferXY(
offset,
0.0,
-offset,
-offset};
double offsety[36] = {offset / sin_60_,
-offset,
-offset,
-offset / cos_60_,
-offset,
offset,
offset / cos_60_,
offset,
offset,
-offset,
-offset / cos_60_,
-offset,
offset,
offset / cos_60_,
-offset * cos_60_,
-offset,
-offset * cos_60_,
offset * cos_60_,
offset,
offset * cos_60_,
offset * cos_60_,
-offset * cos_60_,
-offset,
-offset * cos_60_,
offset * cos_60_,
offset};
double offsety[60] = {offset / sin_60_,
offset / tan_60_,
-offset / tan_60_,
-offset / sin_60_,
Expand Down Expand Up @@ -1560,7 +1522,31 @@ std::vector<std::pair<double, double> > HGCalWaferMask::waferXY(
offset / tan_60_,
offset / sin_60_,
offset / tan_60_,
-offset / tan_60_};
-offset / tan_60_,
offset * tan_60_,
0,
-offset * tan_60_,
-offset * tan_60_,
0,
offset * tan_60_,
offset * tan_60_,
offset * tan_60_,
0,
-offset * tan_60_,
-offset * tan_60_,
0,
offset * sin_60_,
0,
-offset * sin_60_,
-offset * sin_60_,
0,
offset * sin_60_,
offset * sin_60_,
offset * sin_60_,
0,
-offset * sin_60_,
-offset * sin_60_,
0};

if (part == HGCalTypes::WaferFull) {
int np[7] = {0, 1, 2, 3, 4, 5, 0};
Expand Down

0 comments on commit e5c90ef

Please sign in to comment.