File indexing completed on 2025-02-11 03:08:00
0001 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0002 #include "Geometry/HGCalCommonData/interface/HGCalCellOffset.h"
0003 #include "Geometry/HGCalCommonData/interface/HGCalParameters.h"
0004 #include <vector>
0005 #include <iostream>
0006
0007
0008
0009 HGCalCellOffset::HGCalCellOffset(double waferSize,
0010 int32_t nFine,
0011 int32_t nCoarse,
0012 double guardRingOffset_,
0013 double mouseBiteCut_,
0014 double sizeOffset_) {
0015 ncell_[0] = nFine;
0016 ncell_[1] = nCoarse;
0017 hgcalcell_ = std::make_unique<HGCalCell>(waferSize, nFine, nCoarse);
0018 double guardRingSizeOffset_ = guardRingOffset_ + sizeOffset_;
0019 for (int k = 0; k < 2; ++k) {
0020 cellX_[k] = waferSize / (3 * ncell_[k]);
0021 cellY_[k] = sqrt3By2_ * cellX_[k];
0022
0023 for (int j = 0; j < 6; ++j) {
0024 if (j == HGCalCell::fullCell) {
0025 for (int i = 0; i < 6; ++i) {
0026 offsetX[k][j][i] = 0.0;
0027 offsetY[k][j][i] = 0.0;
0028 cellArea[k][j] = 3 * sqrt3By2_ * std::pow(cellX_[k], 2);
0029 }
0030 } else if (j == HGCalCell::cornerCell) {
0031 if (k == 0) {
0032 double h = (mouseBiteCut_ - sqrt3By2_ * cellX_[k]);
0033 double H = mouseBiteCut_ - (1 / sqrt3By2_ * guardRingSizeOffset_);
0034 double h1 = H - (sqrt3_ / 4 * cellX_[k]) + (guardRingSizeOffset_ / (2 * sqrt3_));
0035 double h2 = H - (sqrt3_ / 2 * cellX_[k]) + (guardRingSizeOffset_ / (2 * sqrt3_));
0036 double totalArea = 11.0 * sqrt3_ * std::pow(cellX_[k], 2) / 8.0;
0037 double cutArea1 =
0038 (sqrt3_ * cellX_[k] * guardRingSizeOffset_) - (0.5 / sqrt3_ * std::pow(guardRingSizeOffset_, 2));
0039 double cutArea2 =
0040 (sqrt3By2_ * cellX_[k] * guardRingSizeOffset_) - (0.5 / sqrt3_ * std::pow(guardRingSizeOffset_, 2));
0041 double A1 = 2.0 * cellX_[k] * h - std::pow(h, 2) / (sqrt3_);
0042 double A2 = sqrt3By2_ * cellX_[k] * cellX_[k];
0043 double A3 = sqrt3By2_ * cellX_[k] * cellX_[k] / 4.0;
0044 double cutArea3 =
0045 sqrt3_ * std::pow(H, 2) - (1 / sqrt3By2_ * std::pow(h1, 2)) - (1 / sqrt3By2_ * std::pow(h2, 2));
0046 double x3_1 = -(((2.0 * std::pow(h, 3)) / (3.0 * sqrt3_) - cellX_[k] * std::pow(h, 2)) / A1);
0047 double y3_1 = 0;
0048 double x3_2 = -(sqrt3By2_ * cellX_[k] / 3);
0049 double y3_2 = cellX_[k] / 6.0;
0050 double x3_3 = -(cellX_[k] * sqrt3_ / 4.0);
0051 double y3_3 = cellX_[k] * 11.0 / 12.0;
0052
0053 double x1 = -(3.0 * sqrt3_ * cellX_[k] / 8.0 - sqrt3_ * guardRingOffset_ / 4.0);
0054 double y1 = 5.0 * cellX_[k] / 12.0 - guardRingOffset_ / 4.0;
0055 double x2 = -((0.5 * cellX_[k] - 0.5 * guardRingOffset_) * sqrt3By2_);
0056 double y2 = -(0.5 * cellX_[k] - 0.5 * guardRingOffset_) * 0.5;
0057 double x3 = (A1 * x3_1 + A2 * x3_2 + A3 * x3_3) / cutArea3;
0058 double y3 = (A1 * y3_1 + A2 * y3_2 + A3 * y3_3) / cutArea3;
0059 cellArea[k][j] = totalArea - cutArea1 - cutArea2 - cutArea3;
0060 double xMag1 =
0061 ((5.0 * sqrt3_ * cellX_[k] / 132.0) * totalArea - (cutArea1 * x1) - (cutArea2 * x2) - (cutArea3 * x3)) /
0062 (cellArea[k][j]);
0063 double yMag1 =
0064 ((19.0 * cellX_[k] / 132.0) * totalArea - (cutArea1 * y1) - (cutArea2 * y2) - (cutArea3 * y3)) /
0065 (cellArea[k][j]);
0066
0067 double xMag = 0.5 * xMag1 + sqrt3By2_ * yMag1;
0068 double yMag = sqrt3By2_ * xMag1 - 0.5 * yMag1;
0069
0070 std::array<double, 6> tempOffsetX = {{(sqrt3By2_ * xMag - 0.5 * yMag),
0071 yMag,
0072 yMag,
0073 (sqrt3By2_ * xMag - 0.5 * yMag),
0074 (-sqrt3By2_ * xMag - 0.5 * yMag),
0075 (-sqrt3By2_ * xMag - 0.5 * yMag)}};
0076 std::array<double, 6> tempOffsetY = {{(0.5 * xMag + sqrt3By2_ * yMag),
0077 xMag,
0078 -xMag,
0079 (-0.5 * xMag - sqrt3By2_ * yMag),
0080 (0.5 * xMag - sqrt3By2_ * yMag),
0081 (-0.5 * xMag + sqrt3By2_ * yMag)}};
0082
0083 for (int i = 0; i < 6; ++i) {
0084 offsetX[k][j][i] = tempOffsetX[i];
0085 offsetY[k][j][i] = tempOffsetY[i];
0086 }
0087 } else if (k == 1) {
0088 double h = (mouseBiteCut_ - guardRingOffset_) / sqrt3By2_ - cellX_[k] / 2;
0089 double H = mouseBiteCut_ - (1 / sqrt3By2_ * guardRingSizeOffset_);
0090 double h1 = H - ((sqrt3_ / 4) * cellX_[k]) + (guardRingSizeOffset_ / (2 * sqrt3_));
0091 double totalArea = 11.0 * sqrt3_ * std::pow(cellX_[k], 2) / 8.0;
0092 double cutArea1 =
0093 (sqrt3_ * cellX_[k] * guardRingSizeOffset_) - (0.5 / sqrt3_ * std::pow(guardRingSizeOffset_, 2));
0094 double cutArea2 =
0095 (sqrt3By2_ * cellX_[k] * guardRingSizeOffset_) - (0.5 / sqrt3_ * std::pow(guardRingSizeOffset_, 2));
0096 double cutArea3 = sqrt3_ * std::pow(H, 2) - (1 / sqrt3By2_ * std::pow(h1, 2));
0097
0098
0099 double x2_0 = (0.375 * cellX_[k] * cellX_[k] - (0.25 * cellX_[k] * guardRingOffset_) +
0100 std::pow(guardRingOffset_, 2) / 18) /
0101 (sqrt3By2_ * cellX_[k] + guardRingOffset_ / (2 * sqrt3_));
0102 double y2_0 = (sqrt3_ * cellX_[k] * guardRingOffset_ / 4 + std::pow(guardRingOffset_, 2) / (6 * sqrt3_)) /
0103 (sqrt3By2_ * cellX_[k] + guardRingOffset_ / (2 * sqrt3_));
0104 double x3_1 = -(cellX_[k] - guardRingOffset_ - 2 * (mouseBiteCut_ - guardRingOffset_) / 3) * sqrt3By2_;
0105 double y3_1 = 0.5 * (cellX_[k] - guardRingOffset_ - 2 * (mouseBiteCut_ - guardRingOffset_) / 3);
0106 double x3_2 = -((3 * cellX_[k] / 2 - h / 3) * sqrt3By2_ + sqrt3_ * h / 6);
0107 double y3_2 = -(cellX_[k] / 4 + 4 * h / 6);
0108 double A1 = sqrt3_ * std::pow((mouseBiteCut_ - guardRingOffset_), 2);
0109 double A2 = sqrt3By2_ * std::pow(h, 2);
0110
0111 double x1 = 0;
0112 double y1 = 0.5 * cellX_[k] - 0.5 * guardRingOffset_;
0113 double x2 = -(1.5 * sqrt3By2_ * cellX_[k] - x2_0 * 0.5 - y2_0 * sqrt3By2_);
0114 double y2 = -(0.25 * cellX_[k] - x2_0 * sqrt3By2_ + y2_0 / 2);
0115 double x3 = (A1 * x3_1 - A2 * x3_2) / (A1 - A2);
0116 double y3 = (A1 * y3_1 - A2 * y3_2) / (A1 - A2);
0117 cellArea[k][j] = totalArea - cutArea1 - cutArea2 - cutArea3;
0118 double xMag1 = ((0.0) * totalArea - (cutArea1 * x1) - (cutArea2 * x2) - (cutArea3 * x3)) / (cellArea[k][j]);
0119 double yMag1 = ((-5 * cellX_[k] / 42) * totalArea - (cutArea1 * y1) - (cutArea2 * y2) - (cutArea3 * y3)) /
0120 (cellArea[k][j]);
0121
0122 double xMag = -0.5 * xMag1 - sqrt3By2_ * yMag1;
0123 double yMag = sqrt3By2_ * xMag1 - 0.5 * yMag1;
0124
0125 std::array<double, 6> tempOffsetX = {{(sqrt3By2_ * xMag - 0.5 * yMag),
0126 yMag,
0127 yMag,
0128 (sqrt3By2_ * xMag - 0.5 * yMag),
0129 (-sqrt3By2_ * xMag - 0.5 * yMag),
0130 (-sqrt3By2_ * xMag - 0.5 * yMag)}};
0131 std::array<double, 6> tempOffsetY = {{(0.5 * xMag + sqrt3By2_ * yMag),
0132 xMag,
0133 -xMag,
0134 (-0.5 * xMag - sqrt3By2_ * yMag),
0135 (0.5 * xMag - sqrt3By2_ * yMag),
0136 (-0.5 * xMag + sqrt3By2_ * yMag)}};
0137 for (int i = 0; i < 6; ++i) {
0138 offsetX[k][j][i] = tempOffsetX[i];
0139 offsetY[k][j][i] = tempOffsetY[i];
0140 }
0141 }
0142 } else if (j == HGCalCell::truncatedCell) {
0143 double totalArea = (5.0 * sqrt3_ / 4.0) * std::pow(cellX_[k], 2);
0144 double cutArea =
0145 cellX_[k] * sqrt3_ * guardRingSizeOffset_;
0146 cellArea[k][j] = totalArea - cutArea;
0147 double offMag = (((-2.0 / 15.0) * totalArea * cellX_[k]) - ((cellX_[k] - (0.5 * guardRingOffset_)) * cutArea)) /
0148 (cellArea[k][j]);
0149
0150
0151
0152 std::array<double, 6> tempOffsetX = {
0153 {-0.5 * offMag, -offMag, -0.5 * offMag, 0.5 * offMag, offMag, 0.5 * offMag}};
0154 std::array<double, 6> tempOffsetY = {
0155 {-sqrt3By2_ * offMag, 0.0, sqrt3By2_ * offMag, sqrt3By2_ * offMag, 0.0, -sqrt3By2_ * offMag}};
0156 for (int i = 0; i < 6; ++i) {
0157 offsetX[k][j][i] = tempOffsetX[i];
0158 offsetY[k][j][i] = tempOffsetY[i];
0159 }
0160 } else if (j == HGCalCell::extendedCell) {
0161 double totalArea = (7.0 * sqrt3_ / 4.0) * std::pow(cellX_[k], 2);
0162 double cutArea =
0163 cellX_[k] * sqrt3_ * guardRingSizeOffset_;
0164 cellArea[k][j] = totalArea - cutArea;
0165 double offMag =
0166 (((5.0 / 42.0) * totalArea * cellX_[k]) - ((cellX_[k] - (0.5 * guardRingOffset_))) * (cutArea)) /
0167 (cellArea[k][j]);
0168
0169
0170
0171 std::array<double, 6> tempOffsetX = {
0172 {-0.5 * offMag, -offMag, -0.5 * offMag, 0.5 * offMag, offMag, 0.5 * offMag}};
0173 std::array<double, 6> tempOffsetY = {
0174 {-sqrt3By2_ * offMag, 0.0, sqrt3By2_ * offMag, sqrt3By2_ * offMag, 0.0, -sqrt3By2_ * offMag}};
0175 for (int i = 0; i < 6; ++i) {
0176 offsetX[k][j][i] = tempOffsetX[i];
0177 offsetY[k][j][i] = tempOffsetY[i];
0178 }
0179 } else if (j == HGCalCell::truncatedMBCell) {
0180 double H = mouseBiteCut_ - (1 / sqrt3By2_ * guardRingSizeOffset_);
0181 double h = H - (sqrt3_ / 2 * cellX_[k]) + (guardRingSizeOffset_ / (2 * sqrt3_));
0182 if (h > 0) {
0183 double totalArea = 5.0 * sqrt3_ * std::pow(cellX_[k], 2) / 4.0;
0184
0185 double cutArea1 = (sqrt3_ * cellX_[k] * guardRingSizeOffset_);
0186 double cutArea2 = std::pow(h, 2) / sqrt3By2_;
0187
0188 double x1 = -(0.5 * cellX_[k] - 0.5 * guardRingOffset_) * sqrt3By2_;
0189 double y1 = -(0.5 * cellX_[k] - 0.5 * guardRingOffset_) * 0.5;
0190 double x2 = -((sqrt3By2_ * cellX_[k]) - (2.0 * h) / 3.0);
0191 double y2 = 0.5 * cellX_[k] - (2.0 * h) / (3.0 * sqrt3_);
0192 cellArea[k][j] = totalArea - cutArea1 - cutArea2;
0193 double xMag1 =
0194 ((sqrt3_ * cellX_[k] / 15.0) * totalArea - (cutArea1 * x1) - (cutArea2 * x2)) / (cellArea[k][j]);
0195 double yMag1 = ((cellX_[k] / 15.0) * totalArea - (cutArea1 * y1) - (cutArea2 * y2)) / (cellArea[k][j]);
0196 double xMag = -yMag1;
0197 double yMag = -xMag1;
0198
0199 std::array<double, 6> tempOffsetX = {{(sqrt3By2_ * xMag - 0.5 * yMag),
0200 (-sqrt3By2_ * xMag - 0.5 * yMag),
0201 (-sqrt3By2_ * xMag - 0.5 * yMag),
0202 (sqrt3By2_ * xMag - 0.5 * yMag),
0203 yMag,
0204 yMag}};
0205 std::array<double, 6> tempOffsetY = {{(0.5 * xMag + sqrt3By2_ * yMag),
0206 (0.5 * xMag - sqrt3By2_ * yMag),
0207 (-0.5 * xMag + sqrt3By2_ * yMag),
0208 (-0.5 * xMag - sqrt3By2_ * yMag),
0209 xMag,
0210 -xMag}};
0211 for (int i = 0; i < 6; ++i) {
0212 offsetX[k][j][i] = tempOffsetX[i];
0213 offsetY[k][j][i] = tempOffsetY[i];
0214 }
0215 } else {
0216 cellArea[k][j] = cellArea[k][HGCalCell::truncatedCell];
0217 std::array<double, 6> tempOffsetX = {{offsetX[k][HGCalCell::truncatedCell][0],
0218 offsetX[k][HGCalCell::truncatedCell][0],
0219 offsetX[k][HGCalCell::truncatedCell][2],
0220 offsetX[k][HGCalCell::truncatedCell][2],
0221 offsetX[k][HGCalCell::truncatedCell][4],
0222 offsetX[k][HGCalCell::truncatedCell][4]}};
0223 std::array<double, 6> tempOffsetY = {{offsetY[k][HGCalCell::truncatedCell][0],
0224 offsetY[k][HGCalCell::truncatedCell][0],
0225 offsetY[k][HGCalCell::truncatedCell][2],
0226 offsetY[k][HGCalCell::truncatedCell][2],
0227 offsetY[k][HGCalCell::truncatedCell][4],
0228 offsetY[k][HGCalCell::truncatedCell][4]}};
0229 for (int i = 0; i < 6; ++i) {
0230 offsetX[k][j][i] = tempOffsetX[i];
0231 offsetY[k][j][i] = tempOffsetY[i];
0232 }
0233 }
0234 } else if (j == HGCalCell::extendedMBCell) {
0235 double H = mouseBiteCut_ - (1 / sqrt3By2_ * guardRingSizeOffset_);
0236 double h = H - (sqrt3_ / 4 * cellX_[k]) + (guardRingSizeOffset_ / (2 * sqrt3_));
0237
0238 double totalArea = 7.0 * sqrt3_ * std::pow(cellX_[k], 2) / 4.0;
0239 double cutArea1 = (sqrt3_ * cellX_[k] * guardRingSizeOffset_);
0240 double cutArea2 = std::pow(h, 2) / sqrt3By2_;
0241
0242 double x1 = -(sqrt3By2_ * cellX_[k] - sqrt3By2_ * guardRingOffset_ / 2.0);
0243 double y1 = (0.5 * cellX_[k] - 0.25 * guardRingOffset_);
0244 double x2 = -(sqrt3By2_ * 1.5 * cellX_[k] - h / sqrt3_);
0245 double y2 = -0.25 * cellX_[k] + h / 3.0;
0246 cellArea[k][j] = totalArea - cutArea1 - cutArea2;
0247 double xMag1 =
0248 ((-10.0 * sqrt3_ * cellX_[k] / 168.0) * totalArea - (cutArea1 * x1) - (cutArea2 * x2)) / (cellArea[k][j]);
0249 double yMag1 = ((10.0 * cellX_[k] / 168.0) * totalArea - (cutArea1 * y1) - (cutArea2 * y2)) / (cellArea[k][j]);
0250
0251 double xMag = yMag1;
0252 double yMag = -xMag1;
0253
0254 std::array<double, 6> tempOffsetX = {{(sqrt3By2_ * xMag - 0.5 * yMag),
0255 yMag,
0256 yMag,
0257 (sqrt3By2_ * xMag - 0.5 * yMag),
0258 (-sqrt3By2_ * xMag - 0.5 * yMag),
0259 (-sqrt3By2_ * xMag - 0.5 * yMag)}};
0260 std::array<double, 6> tempOffsetY = {{(0.5 * xMag + sqrt3By2_ * yMag),
0261 xMag,
0262 -xMag,
0263 (-0.5 * xMag - sqrt3By2_ * yMag),
0264 (0.5 * xMag - sqrt3By2_ * yMag),
0265 (-0.5 * xMag + sqrt3By2_ * yMag)}};
0266 for (int i = 0; i < 6; ++i) {
0267 offsetX[k][j][i] = tempOffsetX[i];
0268 offsetY[k][j][i] = tempOffsetY[i];
0269 }
0270 }
0271 }
0272 for (int j = HGCalCell::partiaclWaferCellsOffset; j < (25 + HGCalCell::partiaclWaferCellsOffset);
0273 ++j) {
0274 if (j == (HGCalCell::halfCell)) {
0275 double totalArea = (3.0 * sqrt3_ / 4.0) * std::pow(cellX_[k], 2);
0276 double cutArea = cellX_[k] * 2.0 * guardRingOffset_ - std::pow(guardRingOffset_, 2) / sqrt3_;
0277 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] = totalArea - cutArea;
0278 double x1 = (-cellX_[k] * guardRingOffset_ + 2 * std::pow(guardRingOffset_, 2) / (3 * sqrt3_)) /
0279 (2 * cellX_[k] - guardRingOffset_ / sqrt3_);
0280 double y1 = 0;
0281 double xMag = ((-2.0 * sqrt3_ * cellX_[k] / 9.0) * totalArea - (cutArea * x1)) /
0282 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0283 double yMag = (0 * totalArea - (cutArea * y1)) / (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0284
0285 std::array<double, 6> tempOffsetX = {{(-sqrt3By2_ * xMag - 0.5 * yMag),
0286 (-sqrt3By2_ * xMag + 0.5 * yMag),
0287 yMag,
0288 (sqrt3By2_ * xMag + 0.5 * yMag),
0289 (sqrt3By2_ * xMag - 0.5 * yMag),
0290 -yMag}};
0291 std::array<double, 6> tempOffsetY = {{(0.5 * xMag - sqrt3By2_ * yMag),
0292 (-sqrt3By2_ * yMag - 0.5 * xMag),
0293 -xMag,
0294 (-0.5 * xMag + sqrt3By2_ * yMag),
0295 (0.5 * xMag + sqrt3By2_ * yMag),
0296 xMag}};
0297
0298 for (int i = 0; i < 6; ++i) {
0299 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetX[i];
0300 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetY[i];
0301 }
0302 } else if (j == (HGCalCell::extHalfTrunCell)) {
0303 double totalArea = 5 * sqrt3_ * std::pow(cellX_[k], 2) / 8;
0304 double cutArea1 = (sqrt3By2_ * cellX_[k] * guardRingSizeOffset_) - guardRingOffset_ * guardRingSizeOffset_;
0305 double cutArea2 = (2 * cellX_[k] * guardRingOffset_) - std::pow(guardRingOffset_, 2) / (2 * sqrt3_);
0306
0307 double x1 = -sqrt3_ * cellX_[k] / 4;
0308 double y1 = (0.5 * cellX_[k] - 0.5 * guardRingOffset_);
0309 double x2 = (-3 * cellX_[k] * guardRingOffset_ / 4 + std::pow(guardRingOffset_, 2) / (3 * sqrt3_)) /
0310 (3 * cellX_[k] / 2 - guardRingOffset_ / (2 * sqrt3_));
0311 double y2 = (-cellX_[k] * guardRingOffset_ / (2 * sqrt3_) + std::pow(guardRingOffset_, 2) / 18 -
0312 3 * std::pow(cellX_[k], 2) / 8) /
0313 (3 * cellX_[k] / 2 - guardRingOffset_ / (2 * sqrt3_));
0314 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] = totalArea - cutArea1 - cutArea2;
0315 double xMag1 = ((-7 * sqrt3_ * cellX_[k] / 30) * totalArea - (cutArea1 * x1) - (cutArea2 * x2)) /
0316 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0317 double yMag = ((-2 * cellX_[k] / 15) * totalArea - (cutArea1 * y1) - (cutArea2 * y2)) /
0318 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0319 double xMag = -xMag1;
0320
0321 std::array<double, 6> tempOffsetX = {{(-sqrt3By2_ * xMag - 0.5 * yMag),
0322 (-sqrt3By2_ * xMag + 0.5 * yMag),
0323 yMag,
0324 (sqrt3By2_ * xMag + 0.5 * yMag),
0325 (sqrt3By2_ * xMag - 0.5 * yMag),
0326 -yMag}};
0327 std::array<double, 6> tempOffsetY = {{(0.5 * xMag - sqrt3By2_ * yMag),
0328 (-sqrt3By2_ * yMag - 0.5 * xMag),
0329 -xMag,
0330 (-0.5 * xMag + sqrt3By2_ * yMag),
0331 (0.5 * xMag + sqrt3By2_ * yMag),
0332 xMag}};
0333 for (int i = 0; i < 6; ++i) {
0334 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetX[i];
0335 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetY[i];
0336 }
0337 } else if (j == (HGCalCell::extHalfExtCell)) {
0338 double totalArea = (7.0 * sqrt3_ / 8.0) * std::pow(cellX_[k], 2);
0339 double cutArea1 = (sqrt3By2_ * cellX_[k] * guardRingSizeOffset_) - guardRingOffset_ * guardRingSizeOffset_;
0340 double cutArea2 = (2 * cellX_[k] * guardRingOffset_) - std::pow(guardRingOffset_, 2) / (2 * sqrt3_);
0341 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] = totalArea - cutArea1 - cutArea2;
0342
0343 double x1 = -sqrt3By2_ * cellX_[k] / 2;
0344 double y1 = -(cellX_[k] - guardRingOffset_ / 2);
0345 double x2 = (-cellX_[k] * guardRingOffset_ + std::pow(guardRingOffset_, 2) / (3 * sqrt3_)) /
0346 (2 * cellX_[k] - guardRingOffset_ / (2 * sqrt3_));
0347 double y2 = (-cellX_[k] * guardRingOffset_ / (2 * sqrt3_) + std::pow(guardRingOffset_, 2) / 18) /
0348 (2 * cellX_[k] - guardRingOffset_ / (2 * sqrt3_));
0349 double xMag = ((-5 * sqrt3_ * cellX_[k] / 21.0) * totalArea - (cutArea1 * x1) - (cutArea2 * x2)) /
0350 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0351 double yMag = ((-5 * cellX_[k] / 42.0) * totalArea - (cutArea1 * y1) - (cutArea2 * y2)) /
0352 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0353
0354 std::array<double, 6> tempOffsetX = {{(-sqrt3By2_ * xMag - 0.5 * yMag),
0355 (-sqrt3By2_ * xMag + 0.5 * yMag),
0356 yMag,
0357 (sqrt3By2_ * xMag + 0.5 * yMag),
0358 (sqrt3By2_ * xMag - 0.5 * yMag),
0359 -yMag}};
0360 std::array<double, 6> tempOffsetY = {{(0.5 * xMag - sqrt3By2_ * yMag),
0361 (-sqrt3By2_ * yMag - 0.5 * xMag),
0362 -xMag,
0363 (-0.5 * xMag + sqrt3By2_ * yMag),
0364 (0.5 * xMag + sqrt3By2_ * yMag),
0365 xMag}};
0366
0367 for (int i = 0; i < 6; ++i) {
0368 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetX[i];
0369 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetY[i];
0370 }
0371 } else if (j == (HGCalCell::extTrunCellCenCut)) {
0372 double totalArea = 5 * sqrt3_ * std::pow(cellX_[k], 2) / 8;
0373 double cutArea1 = (sqrt3By2_ * cellX_[k] * guardRingSizeOffset_) - guardRingOffset_ * guardRingSizeOffset_;
0374 double cutArea2 = (cellX_[k] * guardRingOffset_) - std::pow(guardRingOffset_, 2) / (2 * sqrt3_);
0375
0376 double x1 = -sqrt3_ * cellX_[k] / 4;
0377 double y1 = (0.5 * cellX_[k] - 0.5 * guardRingOffset_);
0378 double x2 = (-3 * cellX_[k] * guardRingOffset_ / 4 + std::pow(guardRingOffset_, 2) / (3 * sqrt3_)) /
0379 (3 * cellX_[k] / 2 - guardRingOffset_ / (2 * sqrt3_));
0380 double y2 = (-cellX_[k] * guardRingOffset_ / (2 * sqrt3_) + std::pow(guardRingOffset_, 2) / 18 -
0381 3 * std::pow(cellX_[k], 2) / 8) /
0382 (3 * cellX_[k] / 2 - guardRingOffset_ / (2 * sqrt3_));
0383 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] =
0384 2 * cellAreaPartial[k][HGCalCell::extHalfTrunCell - HGCalCell::partiaclWaferCellsOffset];
0385 double xMag1 = ((-7 * sqrt3_ * cellX_[k] / 30) * totalArea - (cutArea1 * x1) - (cutArea2 * x2)) /
0386 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0387 double yMag = ((-2 * cellX_[k] / 15) * totalArea - (cutArea1 * y1) - (cutArea2 * y2)) /
0388 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0389 double xMag = -xMag1;
0390
0391 std::array<double, 6> tempOffsetX = {{(-sqrt3By2_ * xMag - 0.5 * yMag),
0392 (-sqrt3By2_ * xMag + 0.5 * yMag),
0393 yMag,
0394 (sqrt3By2_ * xMag + 0.5 * yMag),
0395 (sqrt3By2_ * xMag - 0.5 * yMag),
0396 -yMag}};
0397 std::array<double, 6> tempOffsetY = {{(0.5 * xMag - sqrt3By2_ * yMag),
0398 (-sqrt3By2_ * yMag - 0.5 * xMag),
0399 -xMag,
0400 (-0.5 * xMag + sqrt3By2_ * yMag),
0401 (0.5 * xMag + sqrt3By2_ * yMag),
0402 xMag}};
0403 for (int i = 0; i < 6; ++i) {
0404 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetX[i];
0405 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetY[i];
0406 }
0407 } else if (j == (HGCalCell::extExtCellCenCut)) {
0408 double totalArea = (7.0 * sqrt3_ / 8.0) * std::pow(cellX_[k], 2);
0409 double cutArea1 = (sqrt3By2_ * cellX_[k] * guardRingSizeOffset_) - guardRingOffset_ * guardRingSizeOffset_;
0410 double cutArea2 = (2 * cellX_[k] * guardRingOffset_) - std::pow(guardRingOffset_, 2) / (2 * sqrt3_);
0411 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] =
0412 2 * cellAreaPartial[k][HGCalCell::extHalfExtCell - HGCalCell::partiaclWaferCellsOffset];
0413
0414 double x1 = -sqrt3By2_ * cellX_[k] / 2;
0415 double y1 = -(cellX_[k] - guardRingOffset_ / 2);
0416 double x2 = (-cellX_[k] * guardRingOffset_ + std::pow(guardRingOffset_, 2) / (3 * sqrt3_)) /
0417 (2 * cellX_[k] - guardRingOffset_ / (2 * sqrt3_));
0418 double y2 = (-cellX_[k] * guardRingOffset_ / (2 * sqrt3_) + std::pow(guardRingOffset_, 2) / 18) /
0419 (2 * cellX_[k] - guardRingOffset_ / (2 * sqrt3_));
0420 double xMag = ((-5 * sqrt3_ * cellX_[k] / 21.0) * totalArea - (cutArea1 * x1) - (cutArea2 * x2)) /
0421 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0422 double yMag = ((-5 * cellX_[k] / 42.0) * totalArea - (cutArea1 * y1) - (cutArea2 * y2)) /
0423 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0424
0425 std::array<double, 6> tempOffsetX = {{(-sqrt3By2_ * xMag - 0.5 * yMag),
0426 (-sqrt3By2_ * xMag + 0.5 * yMag),
0427 yMag,
0428 (sqrt3By2_ * xMag + 0.5 * yMag),
0429 (sqrt3By2_ * xMag - 0.5 * yMag),
0430 -yMag}};
0431 std::array<double, 6> tempOffsetY = {{(0.5 * xMag - sqrt3By2_ * yMag),
0432 (-sqrt3By2_ * yMag - 0.5 * xMag),
0433 -xMag,
0434 (-0.5 * xMag + sqrt3By2_ * yMag),
0435 (0.5 * xMag + sqrt3By2_ * yMag),
0436 xMag}};
0437
0438 for (int i = 0; i < 6; ++i) {
0439 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetX[i];
0440 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetY[i];
0441 }
0442 } else if (j == (HGCalCell::extTrunCellEdgeCut)) {
0443 double totalArea = 5 * sqrt3_ * std::pow(cellX_[k], 2) / 4;
0444 double cutArea1 = (sqrt3_ * cellX_[k] * guardRingSizeOffset_) - guardRingOffset_ * guardRingSizeOffset_;
0445 double cutArea2 = (cellX_[k] * guardRingOffset_) - std::pow(guardRingOffset_, 2) / (2 * sqrt3_);
0446
0447 double x1 = -sqrt3_ * cellX_[k] / 4;
0448 double y1 = (0.5 * cellX_[k] - 0.5 * guardRingOffset_);
0449 double x2 = (-3 * cellX_[k] * guardRingOffset_ / 4 + std::pow(guardRingOffset_, 2) / (3 * sqrt3_)) /
0450 (3 * cellX_[k] / 2 - guardRingOffset_ / (2 * sqrt3_));
0451 double y2 = (-cellX_[k] * guardRingOffset_ / (2 * sqrt3_) + std::pow(guardRingOffset_, 2) / 18 -
0452 3 * std::pow(cellX_[k], 2) / 8) /
0453 (3 * cellX_[k] / 2 - guardRingOffset_ / (2 * sqrt3_));
0454 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] = totalArea - cutArea1 - cutArea2;
0455 double xMag1 = ((-7 * sqrt3_ * cellX_[k] / 30) * totalArea - (cutArea1 * x1) - (cutArea2 * x2)) /
0456 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0457 double yMag = ((-2 * cellX_[k] / 15) * totalArea - (cutArea1 * y1) - (cutArea2 * y2)) /
0458 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0459 double xMag = -xMag1;
0460
0461 std::array<double, 6> tempOffsetX = {{(-sqrt3By2_ * xMag - 0.5 * yMag),
0462 (-sqrt3By2_ * xMag + 0.5 * yMag),
0463 yMag,
0464 (sqrt3By2_ * xMag + 0.5 * yMag),
0465 (sqrt3By2_ * xMag - 0.5 * yMag),
0466 -yMag}};
0467 std::array<double, 6> tempOffsetY = {{(0.5 * xMag - sqrt3By2_ * yMag),
0468 (-sqrt3By2_ * yMag - 0.5 * xMag),
0469 -xMag,
0470 (-0.5 * xMag + sqrt3By2_ * yMag),
0471 (0.5 * xMag + sqrt3By2_ * yMag),
0472 xMag}};
0473 for (int i = 0; i < 6; ++i) {
0474 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetX[i];
0475 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetY[i];
0476 }
0477 } else if (j == (HGCalCell::extExtCellEdgeCut)) {
0478 double totalArea = (7.0 * sqrt3_ / 4.0) * std::pow(cellX_[k], 2);
0479 double cutArea1 = (sqrt3_ * cellX_[k] * guardRingSizeOffset_) - guardRingOffset_ * guardRingSizeOffset_;
0480 double cutArea2 = (1.5 * cellX_[k] * guardRingOffset_) - std::pow(guardRingOffset_, 2) / (2 * sqrt3_);
0481 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] = totalArea - cutArea1 - cutArea2;
0482
0483 double x1 = -sqrt3By2_ * cellX_[k] / 2;
0484 double y1 = -(cellX_[k] - guardRingOffset_ / 2);
0485 double x2 = (-cellX_[k] * guardRingOffset_ + std::pow(guardRingOffset_, 2) / (3 * sqrt3_)) /
0486 (2 * cellX_[k] - guardRingOffset_ / (2 * sqrt3_));
0487 double y2 = (-cellX_[k] * guardRingOffset_ / (2 * sqrt3_) + std::pow(guardRingOffset_, 2) / 18) /
0488 (2 * cellX_[k] - guardRingOffset_ / (2 * sqrt3_));
0489 double xMag = ((-5 * sqrt3_ * cellX_[k] / 21.0) * totalArea - (cutArea1 * x1) - (cutArea2 * x2)) /
0490 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0491 double yMag = ((-5 * cellX_[k] / 42.0) * totalArea - (cutArea1 * y1) - (cutArea2 * y2)) /
0492 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0493
0494 std::array<double, 6> tempOffsetX = {{(-sqrt3By2_ * xMag - 0.5 * yMag),
0495 (-sqrt3By2_ * xMag + 0.5 * yMag),
0496 yMag,
0497 (sqrt3By2_ * xMag + 0.5 * yMag),
0498 (sqrt3By2_ * xMag - 0.5 * yMag),
0499 -yMag}};
0500 std::array<double, 6> tempOffsetY = {{(0.5 * xMag - sqrt3By2_ * yMag),
0501 (-sqrt3By2_ * yMag - 0.5 * xMag),
0502 -xMag,
0503 (-0.5 * xMag + sqrt3By2_ * yMag),
0504 (0.5 * xMag + sqrt3By2_ * yMag),
0505 xMag}};
0506
0507 for (int i = 0; i < 6; ++i) {
0508 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetX[i];
0509 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetY[i];
0510 }
0511 } else if (j == (HGCalCell::fullCellCenCut)) {
0512 double totalArea = (3.0 * sqrt3_ / 2.0) * std::pow(cellX_[k], 2);
0513 double cutArea = cellX_[k] * 4.0 * guardRingOffset_ - std::pow(guardRingOffset_, 2) / sqrt3By2_;
0514 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] = totalArea - cutArea;
0515 double x1 = (-cellX_[k] * guardRingOffset_ + 2 * std::pow(guardRingOffset_, 2) / (3 * sqrt3_)) /
0516 (2 * cellX_[k] - guardRingOffset_ / sqrt3_);
0517 double y1 = 0;
0518 double xMag = ((-2.0 * sqrt3_ * cellX_[k] / 9.0) * totalArea - (cutArea * x1)) /
0519 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0520 double yMag = (0 * totalArea - (cutArea * y1)) / (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0521
0522 std::array<double, 6> tempOffsetX = {{(-sqrt3By2_ * xMag - 0.5 * yMag),
0523 (-sqrt3By2_ * xMag + 0.5 * yMag),
0524 yMag,
0525 (sqrt3By2_ * xMag + 0.5 * yMag),
0526 (sqrt3By2_ * xMag - 0.5 * yMag),
0527 -yMag}};
0528 std::array<double, 6> tempOffsetY = {{(0.5 * xMag - sqrt3By2_ * yMag),
0529 (-sqrt3By2_ * yMag - 0.5 * xMag),
0530 -xMag,
0531 (-0.5 * xMag + sqrt3By2_ * yMag),
0532 (0.5 * xMag + sqrt3By2_ * yMag),
0533 xMag}};
0534
0535 for (int i = 0; i < 6; ++i) {
0536 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetX[i];
0537 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetY[i];
0538 }
0539 } else if (j == (HGCalCell::fullCellEdgeCut)) {
0540 double totalArea = (3.0 * sqrt3_ / 2.0) * std::pow(cellX_[k], 2);
0541 double cutArea = cellX_[k] * guardRingOffset_ - std::pow(guardRingOffset_, 2) / sqrt3_;
0542 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] = totalArea - cutArea;
0543 double x1 = (-cellX_[k] * guardRingOffset_ + 2 * std::pow(guardRingOffset_, 2) / (3 * sqrt3_)) /
0544 (2 * cellX_[k] - guardRingOffset_ / sqrt3_);
0545 double y1 = 0;
0546 double xMag = ((-2.0 * sqrt3_ * cellX_[k] / 9.0) * totalArea - (cutArea * x1)) /
0547 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0548 double yMag = (0 * totalArea - (cutArea * y1)) / (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0549
0550 std::array<double, 6> tempOffsetX = {{(-sqrt3By2_ * xMag - 0.5 * yMag),
0551 (-sqrt3By2_ * xMag + 0.5 * yMag),
0552 yMag,
0553 (sqrt3By2_ * xMag + 0.5 * yMag),
0554 (sqrt3By2_ * xMag - 0.5 * yMag),
0555 -yMag}};
0556 std::array<double, 6> tempOffsetY = {{(0.5 * xMag - sqrt3By2_ * yMag),
0557 (-sqrt3By2_ * yMag - 0.5 * xMag),
0558 -xMag,
0559 (-0.5 * xMag + sqrt3By2_ * yMag),
0560 (0.5 * xMag + sqrt3By2_ * yMag),
0561 xMag}};
0562
0563 for (int i = 0; i < 6; ++i) {
0564 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetX[i];
0565 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetY[i];
0566 }
0567 } else if (j == HGCalCell::intTrunCell) {
0568 double totalArea = (5.0 * sqrt3_ / 4.0) * std::pow(cellX_[k], 2);
0569 double cutArea =
0570 cellX_[k] * sqrt3_ * guardRingOffset_;
0571 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] = totalArea - cutArea;
0572 double offMag = (((-2.0 / 15.0) * totalArea * cellX_[k]) - ((cellX_[k] - (0.5 * guardRingOffset_)) * cutArea)) /
0573 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0574
0575
0576
0577 std::array<double, 6> tempOffsetX = {
0578 {-0.5 * offMag, -offMag, -0.5 * offMag, 0.5 * offMag, offMag, 0.5 * offMag}};
0579 std::array<double, 6> tempOffsetY = {
0580 {-sqrt3By2_ * offMag, 0.0, sqrt3By2_ * offMag, sqrt3By2_ * offMag, 0.0, -sqrt3By2_ * offMag}};
0581 for (int i = 0; i < 6; ++i) {
0582 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetX[i];
0583 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetY[i];
0584 }
0585 } else if (j == HGCalCell::intExtCell) {
0586 double totalArea = (7.0 * sqrt3_ / 4.0) * std::pow(cellX_[k], 2);
0587 double cutArea =
0588 cellX_[k] * sqrt3_ * guardRingOffset_;
0589 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] = totalArea - cutArea;
0590 double offMag =
0591 (((5.0 / 42.0) * totalArea * cellX_[k]) - ((cellX_[k] - (0.5 * guardRingOffset_))) * (cutArea)) /
0592 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0593
0594
0595
0596 std::array<double, 6> tempOffsetX = {
0597 {-0.5 * offMag, -offMag, -0.5 * offMag, 0.5 * offMag, offMag, 0.5 * offMag}};
0598 std::array<double, 6> tempOffsetY = {
0599 {-sqrt3By2_ * offMag, 0.0, sqrt3By2_ * offMag, sqrt3By2_ * offMag, 0.0, -sqrt3By2_ * offMag}};
0600 for (int i = 0; i < 6; ++i) {
0601 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetX[i];
0602 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetY[i];
0603 }
0604 } else if (j == (HGCalCell::intHalfExtCell)) {
0605 double totalArea = (7.0 * sqrt3_ / 8.0) * std::pow(cellX_[k], 2);
0606 double cutArea1 = (sqrt3By2_ * cellX_[k] * guardRingOffset_) - guardRingOffset_ * guardRingOffset_;
0607 double cutArea2 = (2 * cellX_[k] * guardRingOffset_) - std::pow(guardRingOffset_, 2) / (2 * sqrt3_);
0608 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] = totalArea - cutArea1 - cutArea2;
0609 double x1 = -sqrt3By2_ * cellX_[k] / 2;
0610 double y1 = -(cellX_[k] - guardRingOffset_ / 2);
0611 double x2 = (-cellX_[k] * guardRingOffset_ + std::pow(guardRingOffset_, 2) / (3 * sqrt3_)) /
0612 (2 * cellX_[k] - guardRingOffset_ / (2 * sqrt3_));
0613 double y2 = (-cellX_[k] * guardRingOffset_ / (2 * sqrt3_) + std::pow(guardRingOffset_, 2) / 18) /
0614 (2 * cellX_[k] - guardRingOffset_ / (2 * sqrt3_));
0615 double xMag = ((-5 * sqrt3_ * cellX_[k] / 21.0) * totalArea - (cutArea1 * x1) - (cutArea2 * x2)) /
0616 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0617 double yMag = ((-5 * cellX_[k] / 42.0) * totalArea - (cutArea1 * y1) - (cutArea2 * y2)) /
0618 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0619
0620 std::array<double, 6> tempOffsetX = {{(-sqrt3By2_ * xMag - 0.5 * yMag),
0621 (-sqrt3By2_ * xMag + 0.5 * yMag),
0622 yMag,
0623 (sqrt3By2_ * xMag + 0.5 * yMag),
0624 (sqrt3By2_ * xMag - 0.5 * yMag),
0625 -yMag}};
0626 std::array<double, 6> tempOffsetY = {{(0.5 * xMag - sqrt3By2_ * yMag),
0627 (-sqrt3By2_ * yMag - 0.5 * xMag),
0628 -xMag,
0629 (-0.5 * xMag + sqrt3By2_ * yMag),
0630 (0.5 * xMag + sqrt3By2_ * yMag),
0631 xMag}};
0632
0633 for (int i = 0; i < 6; ++i) {
0634 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetX[i];
0635 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetY[i];
0636 }
0637 } else if (j == (HGCalCell::intHalfTrunCell)) {
0638 double totalArea = 5 * sqrt3_ * std::pow(cellX_[k], 2) / 8;
0639 double cutArea1 = (sqrt3By2_ * cellX_[k] * guardRingOffset_) - guardRingOffset_ * guardRingOffset_;
0640 double cutArea2 = (2 * cellX_[k] * guardRingOffset_) - std::pow(guardRingOffset_, 2) / (2 * sqrt3_);
0641 double x1 = -sqrt3_ * cellX_[k] / 4;
0642 double y1 = (0.5 * cellX_[k] - 0.5 * guardRingOffset_);
0643 double x2 = (-3 * cellX_[k] * guardRingOffset_ / 4 + std::pow(guardRingOffset_, 2) / (3 * sqrt3_)) /
0644 (3 * cellX_[k] / 2 - guardRingOffset_ / (2 * sqrt3_));
0645 double y2 = (-cellX_[k] * guardRingOffset_ / (2 * sqrt3_) + std::pow(guardRingOffset_, 2) / 18 -
0646 3 * std::pow(cellX_[k], 2) / 8) /
0647 (3 * cellX_[k] / 2 - guardRingOffset_ / (2 * sqrt3_));
0648 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] = totalArea - cutArea1 - cutArea2;
0649 double xMag1 = ((-7 * sqrt3_ * cellX_[k] / 30) * totalArea - (cutArea1 * x1) - (cutArea2 * x2)) /
0650 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0651 double yMag = ((-2 * cellX_[k] / 15) * totalArea - (cutArea1 * y1) - (cutArea2 * y2)) /
0652 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0653 double xMag = -xMag1;
0654
0655 std::array<double, 6> tempOffsetX = {{(-sqrt3By2_ * xMag - 0.5 * yMag),
0656 (-sqrt3By2_ * xMag + 0.5 * yMag),
0657 yMag,
0658 (sqrt3By2_ * xMag + 0.5 * yMag),
0659 (sqrt3By2_ * xMag - 0.5 * yMag),
0660 -yMag}};
0661 std::array<double, 6> tempOffsetY = {{(0.5 * xMag - sqrt3By2_ * yMag),
0662 (-sqrt3By2_ * yMag - 0.5 * xMag),
0663 -xMag,
0664 (-0.5 * xMag + sqrt3By2_ * yMag),
0665 (0.5 * xMag + sqrt3By2_ * yMag),
0666 xMag}};
0667 for (int i = 0; i < 6; ++i) {
0668 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetX[i];
0669 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetY[i];
0670 }
0671 } else if (j == (HGCalCell::intTrunCellCenCut)) {
0672 double totalArea = (7.0 * sqrt3_ / 4.0) * std::pow(cellX_[k], 2);
0673 double cutArea1 = (sqrt3By2_ * cellX_[k] * guardRingOffset_) - guardRingOffset_ * guardRingOffset_;
0674 double cutArea2 = (2 * cellX_[k] * guardRingOffset_) - std::pow(guardRingOffset_, 2) / (2 * sqrt3_);
0675 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] =
0676 2 * cellAreaPartial[k][HGCalCell::intHalfTrunCell - HGCalCell::partiaclWaferCellsOffset];
0677
0678 double x1 = -sqrt3By2_ * cellX_[k] / 2;
0679 double y1 = -(cellX_[k] - guardRingOffset_ / 2);
0680 double x2 = (-cellX_[k] * guardRingOffset_ + std::pow(guardRingOffset_, 2) / (3 * sqrt3_)) /
0681 (2 * cellX_[k] - guardRingOffset_ / (2 * sqrt3_));
0682 double y2 = (-cellX_[k] * guardRingOffset_ / (2 * sqrt3_) + std::pow(guardRingOffset_, 2) / 18) /
0683 (2 * cellX_[k] - guardRingOffset_ / (2 * sqrt3_));
0684 double xMag = ((-5 * sqrt3_ * cellX_[k] / 21.0) * totalArea - (cutArea1 * x1) - (cutArea2 * x2)) /
0685 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0686 double yMag = ((-5 * cellX_[k] / 42.0) * totalArea - (cutArea1 * y1) - (cutArea2 * y2)) /
0687 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0688
0689 std::array<double, 6> tempOffsetX = {{(-sqrt3By2_ * xMag - 0.5 * yMag),
0690 (-sqrt3By2_ * xMag + 0.5 * yMag),
0691 yMag,
0692 (sqrt3By2_ * xMag + 0.5 * yMag),
0693 (sqrt3By2_ * xMag - 0.5 * yMag),
0694 -yMag}};
0695 std::array<double, 6> tempOffsetY = {{(0.5 * xMag - sqrt3By2_ * yMag),
0696 (-sqrt3By2_ * yMag - 0.5 * xMag),
0697 -xMag,
0698 (-0.5 * xMag + sqrt3By2_ * yMag),
0699 (0.5 * xMag + sqrt3By2_ * yMag),
0700 xMag}};
0701
0702 for (int i = 0; i < 6; ++i) {
0703 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetX[i];
0704 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetY[i];
0705 }
0706 } else if (j == (HGCalCell::intExtCellCenCut)) {
0707 double totalArea = 5 * sqrt3_ * std::pow(cellX_[k], 2) / 8;
0708 double cutArea1 = (sqrt3By2_ * cellX_[k] * guardRingOffset_) - guardRingOffset_ * guardRingOffset_;
0709 double cutArea2 = (2 * cellX_[k] * guardRingOffset_) - std::pow(guardRingOffset_, 2) / (2 * sqrt3_);
0710 double x1 = -sqrt3_ * cellX_[k] / 4;
0711 double y1 = (0.5 * cellX_[k] - 0.5 * guardRingOffset_);
0712 double x2 = (-3 * cellX_[k] * guardRingOffset_ / 4 + std::pow(guardRingOffset_, 2) / (3 * sqrt3_)) /
0713 (3 * cellX_[k] / 2 - guardRingOffset_ / (2 * sqrt3_));
0714 double y2 = (-cellX_[k] * guardRingOffset_ / (2 * sqrt3_) + std::pow(guardRingOffset_, 2) / 18 -
0715 3 * std::pow(cellX_[k], 2) / 8) /
0716 (3 * cellX_[k] / 2 - guardRingOffset_ / (2 * sqrt3_));
0717 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] =
0718 2 * cellAreaPartial[k][HGCalCell::intHalfExtCell - HGCalCell::partiaclWaferCellsOffset];
0719 double xMag1 = ((-7 * sqrt3_ * cellX_[k] / 30) * totalArea - (cutArea1 * x1) - (cutArea2 * x2)) /
0720 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0721 double yMag = ((-2 * cellX_[k] / 15) * totalArea - (cutArea1 * y1) - (cutArea2 * y2)) /
0722 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0723 double xMag = -xMag1;
0724
0725 std::array<double, 6> tempOffsetX = {{(-sqrt3By2_ * xMag - 0.5 * yMag),
0726 (-sqrt3By2_ * xMag + 0.5 * yMag),
0727 yMag,
0728 (sqrt3By2_ * xMag + 0.5 * yMag),
0729 (sqrt3By2_ * xMag - 0.5 * yMag),
0730 -yMag}};
0731 std::array<double, 6> tempOffsetY = {{(0.5 * xMag - sqrt3By2_ * yMag),
0732 (-sqrt3By2_ * yMag - 0.5 * xMag),
0733 -xMag,
0734 (-0.5 * xMag + sqrt3By2_ * yMag),
0735 (0.5 * xMag + sqrt3By2_ * yMag),
0736 xMag}};
0737 for (int i = 0; i < 6; ++i) {
0738 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetX[i];
0739 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetY[i];
0740 }
0741 } else if (j == (HGCalCell::intTrunCellEdgeCut)) {
0742 double totalArea = (7.0 * sqrt3_ / 4.0) * std::pow(cellX_[k], 2);
0743 double cutArea1 = (sqrt3By2_ * cellX_[k] * guardRingOffset_) - guardRingOffset_ * guardRingOffset_;
0744 double cutArea2 = (2 * cellX_[k] * guardRingOffset_) - std::pow(guardRingOffset_, 2) / (2 * sqrt3_);
0745 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] =
0746 2 * cellAreaPartial[k][HGCalCell::intHalfTrunCell - HGCalCell::partiaclWaferCellsOffset];
0747
0748 double x1 = -sqrt3By2_ * cellX_[k] / 2;
0749 double y1 = -(cellX_[k] - guardRingOffset_ / 2);
0750 double x2 = (-cellX_[k] * guardRingOffset_ + std::pow(guardRingOffset_, 2) / (3 * sqrt3_)) /
0751 (2 * cellX_[k] - guardRingOffset_ / (2 * sqrt3_));
0752 double y2 = (-cellX_[k] * guardRingOffset_ / (2 * sqrt3_) + std::pow(guardRingOffset_, 2) / 18) /
0753 (2 * cellX_[k] - guardRingOffset_ / (2 * sqrt3_));
0754 double xMag = ((-5 * sqrt3_ * cellX_[k] / 21.0) * totalArea - (cutArea1 * x1) - (cutArea2 * x2)) /
0755 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0756 double yMag = ((-5 * cellX_[k] / 42.0) * totalArea - (cutArea1 * y1) - (cutArea2 * y2)) /
0757 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0758
0759 std::array<double, 6> tempOffsetX = {{(-sqrt3By2_ * xMag - 0.5 * yMag),
0760 (-sqrt3By2_ * xMag + 0.5 * yMag),
0761 yMag,
0762 (sqrt3By2_ * xMag + 0.5 * yMag),
0763 (sqrt3By2_ * xMag - 0.5 * yMag),
0764 -yMag}};
0765 std::array<double, 6> tempOffsetY = {{(0.5 * xMag - sqrt3By2_ * yMag),
0766 (-sqrt3By2_ * yMag - 0.5 * xMag),
0767 -xMag,
0768 (-0.5 * xMag + sqrt3By2_ * yMag),
0769 (0.5 * xMag + sqrt3By2_ * yMag),
0770 xMag}};
0771
0772 for (int i = 0; i < 6; ++i) {
0773 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetX[i];
0774 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetY[i];
0775 }
0776 } else if (j == (HGCalCell::intExtCellEdgeCut)) {
0777 double totalArea = 5 * sqrt3_ * std::pow(cellX_[k], 2) / 8;
0778 double cutArea1 = (sqrt3By2_ * cellX_[k] * guardRingOffset_) - guardRingOffset_ * guardRingOffset_;
0779 double cutArea2 = (2 * cellX_[k] * guardRingOffset_) - std::pow(guardRingOffset_, 2) / (2 * sqrt3_);
0780 double x1 = -sqrt3_ * cellX_[k] / 4;
0781 double y1 = (0.5 * cellX_[k] - 0.5 * guardRingOffset_);
0782 double x2 = (-3 * cellX_[k] * guardRingOffset_ / 4 + std::pow(guardRingOffset_, 2) / (3 * sqrt3_)) /
0783 (3 * cellX_[k] / 2 - guardRingOffset_ / (2 * sqrt3_));
0784 double y2 = (-cellX_[k] * guardRingOffset_ / (2 * sqrt3_) + std::pow(guardRingOffset_, 2) / 18 -
0785 3 * std::pow(cellX_[k], 2) / 8) /
0786 (3 * cellX_[k] / 2 - guardRingOffset_ / (2 * sqrt3_));
0787 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] =
0788 2 * cellAreaPartial[k][HGCalCell::intHalfExtCell - HGCalCell::partiaclWaferCellsOffset];
0789 double xMag1 = ((-7 * sqrt3_ * cellX_[k] / 30) * totalArea - (cutArea1 * x1) - (cutArea2 * x2)) /
0790 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0791 double yMag = ((-2 * cellX_[k] / 15) * totalArea - (cutArea1 * y1) - (cutArea2 * y2)) /
0792 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0793 double xMag = -xMag1;
0794
0795 std::array<double, 6> tempOffsetX = {{(-sqrt3By2_ * xMag - 0.5 * yMag),
0796 (-sqrt3By2_ * xMag + 0.5 * yMag),
0797 yMag,
0798 (sqrt3By2_ * xMag + 0.5 * yMag),
0799 (sqrt3By2_ * xMag - 0.5 * yMag),
0800 -yMag}};
0801 std::array<double, 6> tempOffsetY = {{(0.5 * xMag - sqrt3By2_ * yMag),
0802 (-sqrt3By2_ * yMag - 0.5 * xMag),
0803 -xMag,
0804 (-0.5 * xMag + sqrt3By2_ * yMag),
0805 (0.5 * xMag + sqrt3By2_ * yMag),
0806 xMag}};
0807 for (int i = 0; i < 6; ++i) {
0808 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetX[i];
0809 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetY[i];
0810 }
0811 } else if (j == (HGCalCell::LDPartial0714Cell)) {
0812 if (k == 1) {
0813 double totalArea = (9.0 * sqrt3_ / 4.0) * std::pow(cellX_[k], 2);
0814 double cutArea1 =
0815 (3 * cellX_[k] * sqrt3By2_ * guardRingSizeOffset_) - (std::pow(guardRingSizeOffset_, 2) / (2 * sqrt3_));
0816 double cutArea2 = (3 * cellX_[k] * sqrt3By2_ * guardRingOffset_);
0817 double cutArea3 = (sqrt3_ * std::pow((mouseBiteCut_ - (guardRingSizeOffset_ / sqrt3By2_)), 2) / 2) -
0818 (mouseBiteCut_ * guardRingOffset_);
0819 double x1_0 = ((3.375 * cellX_[k] * cellX_[k]) - (cellX_[k] * 0.75 * guardRingOffset_) +
0820 (std::pow(guardRingOffset_, 2) / 18)) /
0821 ((3 * cellX_[k] * sqrt3By2_) - (guardRingOffset_ / (2 * sqrt3_)));
0822 double y1_0 =
0823 ((3 * cellX_[k] * sqrt3By2_ * guardRingOffset_ / 2) - (std::pow(guardRingOffset_, 2) / (6 * sqrt3_))) /
0824 ((3 * cellX_[k] * sqrt3By2_) - (guardRingOffset_ / (2 * sqrt3_)));
0825
0826 double x2_0 = (3 * sqrt3By2_ * cellX_[k] / 2);
0827 double y2_0 = guardRingOffset_ / 2;
0828
0829 double x1 = (cellX_[k] / 2 - guardRingOffset_) * sqrt3By2_ + x1_0 * 0.5 + y1_0 * sqrt3By2_;
0830 double y1 = cellX_[k] + (cellX_[k] / 2 - guardRingOffset_) * 0.5 - x1_0 * sqrt3By2_ + y1_0 * 0.5;
0831
0832 double x2 = x2_0 - sqrt3By2_ * cellX_[k];
0833 double y2 = -(cellX_[k] - y2_0);
0834
0835 double x3 = sqrt3_ * cellX_[k] - mouseBiteCut_ + (mouseBiteCut_ - (guardRingOffset_ / sqrt3By2_)) / 3;
0836 double y3 = -(cellX_[k] - sqrt3_ * (mouseBiteCut_ - (guardRingOffset_ / sqrt3By2_)) / 3 - guardRingOffset_);
0837
0838 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] = totalArea - cutArea1 - cutArea2 - cutArea3;
0839 double xMag = ((sqrt3_ * cellX_[k] / 8) * totalArea - (cutArea1 * x1) - (cutArea2 * x2) - (cutArea3 * x3)) /
0840 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0841 double yMag = ((-1 * cellX_[k] / 8) * totalArea - (cutArea1 * y1) - (cutArea2 * y2) - (cutArea3 * y3)) /
0842 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0843
0844 std::array<double, 6> tempOffsetX = {{(-sqrt3By2_ * xMag - 0.5 * yMag),
0845 (-sqrt3By2_ * xMag + 0.5 * yMag),
0846 yMag,
0847 (sqrt3By2_ * xMag + 0.5 * yMag),
0848 (sqrt3By2_ * xMag - 0.5 * yMag),
0849 -yMag}};
0850 std::array<double, 6> tempOffsetY = {{(0.5 * xMag - sqrt3By2_ * yMag),
0851 (-sqrt3By2_ * yMag - 0.5 * xMag),
0852 -xMag,
0853 (-0.5 * xMag + sqrt3By2_ * yMag),
0854 (0.5 * xMag + sqrt3By2_ * yMag),
0855 xMag}};
0856
0857 for (int i = 0; i < 6; ++i) {
0858 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetX[i];
0859 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetY[i];
0860 }
0861 } else {
0862 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] = 0.0;
0863 for (int i = 0; i < 6; ++i) {
0864 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = 0.0;
0865 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = 0.0;
0866 }
0867 }
0868 } else if (j == (HGCalCell::LDPartial0209Cell)) {
0869 if (k == 1) {
0870 double totalArea = (23.0 * sqrt3_ / 8.0) * std::pow(cellX_[k], 2);
0871 double cutArea1 =
0872 (5 * cellX_[k] * sqrt3By2_ * guardRingSizeOffset_) - (std::pow(guardRingSizeOffset_, 2) / (2 * sqrt3_));
0873 double cutArea2 = (4 * cellX_[k] * guardRingOffset_) - (2 * guardRingSizeOffset_ * guardRingOffset_) +
0874 (1 / sqrt3By2_ * (std::pow(guardRingOffset_, 2)));
0875 double cutArea3 =
0876 std::pow(mouseBiteCut_, 2) / sqrt3_ -
0877 (2 * mouseBiteCut_ - sqrt3_ * guardRingSizeOffset_) * guardRingSizeOffset_ -
0878 (1 / sqrt3By2_ * mouseBiteCut_ - 2 * guardRingSizeOffset_ - guardRingOffset_ / sqrt3_) * guardRingOffset_;
0879
0880 double x1_0 = (9.375 * cellX_[k] * cellX_[k] - (cellX_[k] * 1.25 * guardRingOffset_) +
0881 (std::pow(guardRingOffset_, 2) / 18)) /
0882 ((5 * cellX_[k] * sqrt3By2_) - (guardRingOffset_ / (2 * sqrt3_)));
0883 double y1_0 =
0884 ((5 * cellX_[k] * sqrt3By2_ * guardRingOffset_ / 2) - (std::pow(guardRingOffset_, 2) / (6 * sqrt3_))) /
0885 ((5 * cellX_[k] * sqrt3By2_) - (guardRingOffset_ / (2 * sqrt3_)));
0886
0887 double x1 = (1.5 * cellX_[k]) * sqrt3By2_ - x1_0 * 0.5 - y1_0 * sqrt3By2_;
0888 double y1 = -0.25 * cellX_[k] + x1_0 * sqrt3By2_ - y1_0 * 0.5;
0889 double x2 = -(sqrt3By2_ * cellX_[k] - 0.5 * guardRingOffset_);
0890 double y2 = 1.5 * cellX_[k];
0891 double x3 = -(sqrt3By2_ * cellX_[k] - mouseBiteCut_ / 3);
0892 double y3 = 3.5 * cellX_[k] - (5 * mouseBiteCut_) / 3 * sqrt3_;
0893
0894 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] = totalArea - cutArea1 - cutArea2 - cutArea3;
0895 double xMag =
0896 ((-9 * cellX_[k] / (sqrt3_ * 92)) * totalArea - (cutArea1 * x1) - (cutArea2 * x2) - (cutArea3 * x3)) /
0897 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0898 double yMag =
0899 ((199 * cellX_[k] / (sqrt3_ * 276)) * totalArea - (cutArea1 * y1) - (cutArea2 * y2) - (cutArea3 * y3)) /
0900 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0901
0902 std::array<double, 6> tempOffsetX = {{(-sqrt3By2_ * xMag - 0.5 * yMag),
0903 (-sqrt3By2_ * xMag + 0.5 * yMag),
0904 yMag,
0905 (sqrt3By2_ * xMag + 0.5 * yMag),
0906 (sqrt3By2_ * xMag - 0.5 * yMag),
0907 -yMag}};
0908 std::array<double, 6> tempOffsetY = {{(0.5 * xMag - sqrt3By2_ * yMag),
0909 (-sqrt3By2_ * yMag - 0.5 * xMag),
0910 -xMag,
0911 (-0.5 * xMag + sqrt3By2_ * yMag),
0912 (0.5 * xMag + sqrt3By2_ * yMag),
0913 xMag}};
0914 for (int i = 0; i < 6; ++i) {
0915 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetX[i];
0916 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetY[i];
0917 }
0918 } else {
0919 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] = 0.0;
0920 for (int i = 0; i < 6; ++i) {
0921 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = 0.0;
0922 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = 0.0;
0923 }
0924 }
0925 } else if (j == (HGCalCell::LDPartial0007Cell)) {
0926 if (k == 1) {
0927 double totalArea = (5.0 * sqrt3_ / 4.0) * std::pow(cellX_[k], 2);
0928 double cutArea1 = (cellX_[k] * guardRingOffset_);
0929 double cutArea2 = (sqrt3_ * cellX_[k] - guardRingOffset_) * guardRingSizeOffset_;
0930 double h = 2 * mouseBiteCut_ - sqrt3_ * guardRingSizeOffset_ - guardRingOffset_;
0931 double cutArea3 = 1 / (2 * sqrt3_) * std::pow(h, 2) / 2;
0932
0933 double x1 = cellX_[k] * sqrt3By2_ - guardRingOffset_ / 2;
0934 double y1 = 0;
0935 double x2 = 0;
0936 double y2 = 0.5 * cellX_[k] - guardRingOffset_ / 2;
0937 double x3 = sqrt3By2_ * cellX_[k] - guardRingOffset_ - h / sqrt3_;
0938 double y3 = 0.5 * cellX_[k] - guardRingOffset_ - h / 3;
0939
0940 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] = totalArea - cutArea1 - cutArea2 - cutArea3;
0941 double xMag = ((0.0) * totalArea - (cutArea1 * x1) - (cutArea2 * x2) - (cutArea3 * x3)) /
0942 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0943 double yMag = ((-2 * cellX_[k] / 15) * totalArea - (cutArea1 * y1) - (cutArea2 * y2) - (cutArea3 * y3)) /
0944 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0945
0946 std::array<double, 6> tempOffsetX = {{(-sqrt3By2_ * xMag - 0.5 * yMag),
0947 (-sqrt3By2_ * xMag + 0.5 * yMag),
0948 yMag,
0949 (sqrt3By2_ * xMag + 0.5 * yMag),
0950 (sqrt3By2_ * xMag - 0.5 * yMag),
0951 -yMag}};
0952 std::array<double, 6> tempOffsetY = {{(0.5 * xMag - sqrt3By2_ * yMag),
0953 (-sqrt3By2_ * yMag - 0.5 * xMag),
0954 -xMag,
0955 (-0.5 * xMag + sqrt3By2_ * yMag),
0956 (0.5 * xMag + sqrt3By2_ * yMag),
0957 xMag}};
0958 for (int i = 0; i < 6; ++i) {
0959 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetX[i];
0960 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetY[i];
0961 }
0962 } else {
0963 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] = 0.0;
0964 for (int i = 0; i < 6; ++i) {
0965 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = 0.0;
0966 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = 0.0;
0967 }
0968 }
0969 } else if (j == (HGCalCell::LDPartial0815Cell)) {
0970 if (k == 1) {
0971 double totalArea = sqrt3_ * std::pow(cellX_[k], 2);
0972 double cutArea1 = (sqrt3_ * cellX_[k] * guardRingSizeOffset_) - std::pow(guardRingOffset_, 2) / (2 * sqrt3_);
0973 ;
0974 double cutArea2 = (sqrt3_ * cellX_[k] * guardRingOffset_) - std::pow(guardRingOffset_, 2) / (2 * sqrt3_) -
0975 guardRingOffset_ * guardRingSizeOffset_ / sqrt3By2_;
0976 double cutArea3 =
0977 sqrt3_ * std::pow((mouseBiteCut_ - guardRingSizeOffset_ / sqrt3By2_ - guardRingOffset_ / sqrt3_), 2) / 2;
0978
0979 double x2_0 = (1.5 * cellX_[k] * cellX_[k] - (0.5 * cellX_[k] * guardRingOffset_) +
0980 std::pow(guardRingOffset_, 2) / 18) /
0981 (sqrt3_ * cellX_[k] - guardRingOffset_ / (2 * sqrt3_));
0982 double y2_0 = (sqrt3By2_ * cellX_[k] * guardRingOffset_ - std::pow(guardRingOffset_, 2) / (sqrt3_ * 3)) /
0983 (sqrt3_ * cellX_[k] - guardRingOffset_ / (2 * sqrt3_));
0984 double x1 = 0;
0985 double y1 = 0.5 * cellX_[k] - guardRingOffset_ / 2;
0986 double x2 = x2_0 * 0.5 - y2_0 * sqrt3By2_;
0987 double y2 = -(cellX_[k] - (x2_0 * sqrt3By2_ + y2_0 * 0.5));
0988 double x3 = sqrt3By2_ * cellX_[k] - mouseBiteCut_ + (mouseBiteCut_ - guardRingOffset_ / sqrt3By2_) / 3;
0989 double y3 = cellX_[k] - (mouseBiteCut_ - guardRingOffset_ / sqrt3By2_) / sqrt3_ - guardRingOffset_;
0990
0991 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] = totalArea - cutArea1 - cutArea2 - cutArea3;
0992 double xMag = -((-sqrt3_ * cellX_[k] / 9) * totalArea - (cutArea1 * x1) - (cutArea2 * x2) - (cutArea3 * x3)) /
0993 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0994 double yMag = ((-cellX_[k] / 15) * totalArea - (cutArea1 * y1) - (cutArea2 * y2) - (cutArea3 * y3)) /
0995 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
0996
0997 std::array<double, 6> tempOffsetX = {{(-sqrt3By2_ * xMag - 0.5 * yMag),
0998 (-sqrt3By2_ * xMag + 0.5 * yMag),
0999 yMag,
1000 (sqrt3By2_ * xMag + 0.5 * yMag),
1001 (sqrt3By2_ * xMag - 0.5 * yMag),
1002 -yMag}};
1003 std::array<double, 6> tempOffsetY = {{(0.5 * xMag - sqrt3By2_ * yMag),
1004 (-sqrt3By2_ * yMag - 0.5 * xMag),
1005 -xMag,
1006 (-0.5 * xMag + sqrt3By2_ * yMag),
1007 (0.5 * xMag + sqrt3By2_ * yMag),
1008 xMag}};
1009 for (int i = 0; i < 6; ++i) {
1010 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetX[i];
1011 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetY[i];
1012 }
1013 } else {
1014 for (int i = 0; i < 6; ++i) {
1015 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] = 0.0;
1016 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = 0.0;
1017 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = 0.0;
1018 }
1019 }
1020 } else if (j == (HGCalCell::LDPartial1415Cell)) {
1021 if (k == 1) {
1022 double totalArea = 7 * sqrt3_ * std::pow(cellX_[k], 2) / 4;
1023 double cutArea1 = (3 * cellX_[k] - 2 * guardRingSizeOffset_ - guardRingOffset_ / sqrt3_) * guardRingOffset_;
1024 double cutArea2 =
1025 (2 * sqrt3_ * cellX_[k] * guardRingSizeOffset_) - std::pow(guardRingSizeOffset_, 2) * sqrt3By2_;
1026 double cutArea3 =
1027 std::pow(mouseBiteCut_, 2) / sqrt3_ -
1028 (2 * mouseBiteCut_ - sqrt3_ * guardRingSizeOffset_) * guardRingSizeOffset_ -
1029 (1 / sqrt3By2_ * mouseBiteCut_ - 2 * guardRingSizeOffset_ - guardRingOffset_ / sqrt3_) * guardRingOffset_;
1030
1031 double x2_0 = (6 * cellX_[k] * cellX_[k] - std::pow(guardRingOffset_, 2)) /
1032 (2 * sqrt3_ * cellX_[k] - guardRingOffset_ * sqrt3By2_);
1033 double y2_0 = (sqrt3_ * cellX_[k] * guardRingOffset_ - std::pow(guardRingOffset_, 2) / sqrt3_) /
1034 (2 * sqrt3_ * cellX_[k] - guardRingOffset_ * sqrt3By2_);
1035 double x1 = -sqrt3By2_ * cellX_[k] + guardRingOffset_ / 2;
1036 double y1 = -cellX_[k];
1037 double x2 = sqrt3By2_ * cellX_[k] - x2_0 * 0.5 - y2_0 * sqrt3By2_;
1038 double y2 = 0.5 * cellX_[k] - x2_0 * sqrt3By2_ + y2_0 * 0.5;
1039 double h = (mouseBiteCut_ - guardRingOffset_) / sqrt3By2_;
1040 double x3 = -(cellX_[k] - h / 3 - guardRingOffset_) * sqrt3By2_;
1041 double y3 = 5 * h / 6 - 5 * cellX_[k] / 2;
1042
1043 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] = totalArea - cutArea1 - cutArea2 - cutArea3;
1044 double xMag =
1045 ((-2 * cellX_[k] / (7 * sqrt3_)) * totalArea - (cutArea1 * x1) - (cutArea2 * x2) - (cutArea3 * x3)) /
1046 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
1047 double yMag = ((-cellX_[k] / 3) * totalArea - (cutArea1 * y1) - (cutArea2 * y2) - (cutArea3 * y3)) /
1048 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
1049
1050 std::array<double, 6> tempOffsetX = {{(-sqrt3By2_ * xMag - 0.5 * yMag),
1051 (-sqrt3By2_ * xMag + 0.5 * yMag),
1052 yMag,
1053 (sqrt3By2_ * xMag + 0.5 * yMag),
1054 (sqrt3By2_ * xMag - 0.5 * yMag),
1055 -yMag}};
1056 std::array<double, 6> tempOffsetY = {{(0.5 * xMag - sqrt3By2_ * yMag),
1057 (-sqrt3By2_ * yMag - 0.5 * xMag),
1058 -xMag,
1059 (-0.5 * xMag + sqrt3By2_ * yMag),
1060 (0.5 * xMag + sqrt3By2_ * yMag),
1061 xMag}};
1062 for (int i = 0; i < 6; ++i) {
1063 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetX[i];
1064 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetY[i];
1065 }
1066 } else {
1067 for (int i = 0; i < 6; ++i) {
1068 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] = 0.0;
1069 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = 0.0;
1070 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = 0.0;
1071 }
1072 }
1073 } else if (j == (HGCalCell::LDPartial1515Cell)) {
1074 if (k == 1) {
1075 double totalArea = 7 * sqrt3_ * std::pow(cellX_[k], 2) / 8;
1076 double cutArea1 = (2 * cellX_[k] * guardRingOffset_) - std::pow(guardRingOffset_, 2) / (2 * sqrt3_);
1077 double cutArea2 = (sqrt3By2_ * cellX_[k] - guardRingOffset_) * guardRingSizeOffset_;
1078 double cutArea3 = mouseBiteCut_ * cellX_[k] - sqrt3_ * std::pow(cellX_[k], 2) / 8 -
1079 (sqrt3By2_ * cellX_[k] - guardRingOffset_) * guardRingSizeOffset_ -
1080 (1 / sqrt3By2_ * mouseBiteCut_ - guardRingOffset_ / (2 * sqrt3_)) * guardRingOffset_;
1081
1082 double x1 = -guardRingOffset_ / 2;
1083 double y1 = 0;
1084 double x2 = -(sqrt3By2_ * cellX_[k] / 2);
1085 double y2 = -(cellX_[k] - 0.5 * guardRingOffset_);
1086 double x3 = (cellX_[k] * cellX_[k] / 8 - sqrt3_ * cellX_[k] * (mouseBiteCut_ - guardRingOffset_) / 4) /
1087 ((mouseBiteCut_ - guardRingOffset_) - sqrt3_ * cellX_[k] / 8);
1088 double y3 =
1089 (std::pow((mouseBiteCut_ - guardRingOffset_), 2) / sqrt3_ -
1090 (1.25 * cellX_[k] * (mouseBiteCut_ - guardRingOffset_)) + 7 * sqrt3_ * cellX_[k] * cellX_[k] / 48) /
1091 ((mouseBiteCut_ - guardRingOffset_) - sqrt3_ * cellX_[k] / 8);
1092
1093 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] = totalArea - cutArea1 - cutArea2 - cutArea3;
1094 double xMag = (-(cellX_[k] / (sqrt3_)) * totalArea - (cutArea1 * x1) - (cutArea2 * x2) - (cutArea3 * x3)) /
1095 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
1096 double yMag = ((-5 * cellX_[k] / 42) * totalArea - (cutArea1 * y1) - (cutArea2 * y2) - (cutArea3 * y3)) /
1097 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
1098
1099 std::array<double, 6> tempOffsetX = {{(-sqrt3By2_ * xMag - 0.5 * yMag),
1100 (-sqrt3By2_ * xMag + 0.5 * yMag),
1101 yMag,
1102 (sqrt3By2_ * xMag + 0.5 * yMag),
1103 (sqrt3By2_ * xMag - 0.5 * yMag),
1104 -yMag}};
1105 std::array<double, 6> tempOffsetY = {{(0.5 * xMag - sqrt3By2_ * yMag),
1106 (-sqrt3By2_ * yMag - 0.5 * xMag),
1107 -xMag,
1108 (-0.5 * xMag + sqrt3By2_ * yMag),
1109 (0.5 * xMag + sqrt3By2_ * yMag),
1110 xMag}};
1111 for (int i = 0; i < 6; ++i) {
1112 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetX[i];
1113 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetY[i];
1114 }
1115 } else {
1116 for (int i = 0; i < 6; ++i) {
1117 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] = 0.0;
1118 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = 0.0;
1119 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = 0.0;
1120 }
1121 }
1122 } else if (j == (HGCalCell::HDPartial0920Cell)) {
1123 if (k == 0) {
1124 double totalArea = 37 * sqrt3_ * std::pow(cellX_[k], 2) / 24;
1125 double cutArea1 =
1126 (4 * cellX_[k] - 2 * guardRingSizeOffset_ - 0.5 * guardRingOffset_) * guardRingOffset_ / sqrt3_;
1127 double cutArea2 =
1128 (7 * cellX_[k] * guardRingSizeOffset_) / (2 * sqrt3_) - std::pow(guardRingSizeOffset_, 2) / (2 * sqrt3_);
1129
1130 double x1 = cellX_[k] / (2 * sqrt3_);
1131 double y1 = -(0.5 * cellX_[k] - 0.5 * guardRingOffset_);
1132 double x2_0 = ((2.041 * cellX_[k] * cellX_[k]) - (cellX_[k] * 0.583 * guardRingOffset_) +
1133 (std::pow(guardRingOffset_, 2) / 18)) /
1134 ((7 * cellX_[k] / (2 * sqrt3_)) - (guardRingOffset_ / (2 * sqrt3_)));
1135 double y2_0 =
1136 ((7 * cellX_[k] * guardRingOffset_ / (4 * sqrt3_)) - std::pow(guardRingOffset_, 2) / (6 * sqrt3_)) /
1137 ((7 * cellX_[k] / (2 * sqrt3_)) - (guardRingOffset_ / (2 * sqrt3_)));
1138
1139 double x2 = (0.5 * x2_0) - (sqrt3By2_ * y2_0) + (cellX_[k] * 0.5 * sqrt3By2_);
1140 double y2 = -(0.5 * y2_0) - (sqrt3By2_ * x2_0) + (cellX_[k] * 1.25);
1141 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] = totalArea - cutArea1 - cutArea2;
1142 double xMag = ((25 * sqrt3_ * cellX_[k] / 148) * totalArea - (cutArea1 * x1) - (cutArea2 * x2)) /
1143 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
1144 double yMag = ((73 * cellX_[k] / 444) * totalArea - (cutArea1 * y1) - (cutArea2 * y2)) /
1145 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
1146
1147 std::array<double, 6> tempOffsetX = {{(-sqrt3By2_ * xMag - 0.5 * yMag),
1148 (-sqrt3By2_ * xMag + 0.5 * yMag),
1149 yMag,
1150 (sqrt3By2_ * xMag + 0.5 * yMag),
1151 (sqrt3By2_ * xMag - 0.5 * yMag),
1152 -yMag}};
1153 std::array<double, 6> tempOffsetY = {{(0.5 * xMag - sqrt3By2_ * yMag),
1154 (-sqrt3By2_ * yMag - 0.5 * xMag),
1155 -xMag,
1156 (-0.5 * xMag + sqrt3By2_ * yMag),
1157 (0.5 * xMag + sqrt3By2_ * yMag),
1158 xMag}};
1159 for (int i = 0; i < 6; ++i) {
1160 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetX[i];
1161 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetY[i];
1162 }
1163 } else {
1164 for (int i = 0; i < 6; ++i) {
1165 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] = 0.0;
1166 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = 0.0;
1167 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = 0.0;
1168 }
1169 }
1170 } else if (j == (HGCalCell::HDPartial1021Cell)) {
1171 if (k == 0) {
1172 double totalArea = 11 * sqrt3_ * std::pow(cellX_[k], 2) / 6;
1173 double cutArea1 = (5 * cellX_[k] * guardRingSizeOffset_ - std::pow(guardRingSizeOffset_, 2)) / (2 * sqrt3_);
1174 double cutArea2 = (5 * cellX_[k] * guardRingOffset_) / (2 * sqrt3_) -
1175 std::pow(guardRingOffset_, 2) / (2 * sqrt3_) -
1176 guardRingOffset_ * guardRingSizeOffset_ / sqrt3By2_;
1177
1178 double x1 = -cellX_[k] / (4 * sqrt3_);
1179 double y1 = cellX_[k] - 0.5 * guardRingOffset_;
1180 double x2_0 = ((1.041 * cellX_[k] * cellX_[k]) - (cellX_[k] * 0.416 * guardRingOffset_) +
1181 (std::pow(guardRingOffset_, 2) / 18.0)) /
1182 ((5.0 * cellX_[k] / (2.0 * sqrt3_)) - (guardRingOffset_ / (2.0 * sqrt3_)));
1183 double y2_0 =
1184 ((5.0 * cellX_[k] * guardRingOffset_ / (4.0 * sqrt3_)) - std::pow(guardRingOffset_, 2) / (6 * sqrt3_)) /
1185 ((5.0 * cellX_[k] / (2.0 * sqrt3_)) - (guardRingOffset_ / (2.0 * sqrt3_)));
1186
1187 double x2 = -(0.5 * x2_0) + (sqrt3By2_ * y2_0) + (cellX_[k] * 1.5 * sqrt3By2_);
1188 double y2 = -(0.5 * y2_0) + (sqrt3By2_ * x2_0) - cellX_[k];
1189 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] = totalArea - cutArea1 - cutArea2;
1190 double xMag = ((47.0 * cellX_[k] / (528.0 * sqrt3_)) * totalArea - (cutArea1 * x1) - (cutArea2 * x2)) /
1191 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
1192 double yMag = ((47.0 * cellX_[k] / 528.0) * totalArea - (cutArea1 * y1) - (cutArea2 * y2)) /
1193 (cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset]);
1194
1195 std::array<double, 6> tempOffsetX = {{(-sqrt3By2_ * xMag - 0.5 * yMag),
1196 (-sqrt3By2_ * xMag + 0.5 * yMag),
1197 yMag,
1198 (sqrt3By2_ * xMag + 0.5 * yMag),
1199 (sqrt3By2_ * xMag - 0.5 * yMag),
1200 -yMag}};
1201 std::array<double, 6> tempOffsetY = {{(0.5 * xMag - sqrt3By2_ * yMag),
1202 (-sqrt3By2_ * yMag - 0.5 * xMag),
1203 -xMag,
1204 (-0.5 * xMag + sqrt3By2_ * yMag),
1205 (0.5 * xMag + sqrt3By2_ * yMag),
1206 xMag}};
1207 for (int i = 0; i < 6; ++i) {
1208 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetX[i];
1209 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = tempOffsetY[i];
1210 }
1211 } else {
1212 for (int i = 0; i < 6; ++i) {
1213 cellAreaPartial[k][j - HGCalCell::partiaclWaferCellsOffset] = 0.0;
1214 offsetPartialX[k][j - HGCalCell::partiaclWaferCellsOffset][i] = 0.0;
1215 offsetPartialY[k][j - HGCalCell::partiaclWaferCellsOffset][i] = 0.0;
1216 }
1217 }
1218 }
1219 }
1220 }
1221 #ifdef EDM_ML_DEBUG
1222 edm::LogVerbatim("HGCalGeom") << "HGCalCellOffset initialized with waferSize " << waferSize << " number of cells "
1223 << nFine << ":" << nCoarse << " Guardring offset " << guardRingOffset_ << " Mousebite "
1224 << mouseBiteCut_;
1225 #endif
1226 }
1227
1228 std::pair<double, double> HGCalCellOffset::cellOffsetUV2XY1(int32_t u, int32_t v, int32_t placementIndex, int32_t type) {
1229 if (type != 0)
1230 type = 1;
1231 double x_off(0), y_off(0);
1232 std::pair<int, int> cell = hgcalcell_->cellType(u, v, ncell_[type], placementIndex);
1233 int cellPos = cell.first;
1234 int cellType = cell.second;
1235 if (cellType == HGCalCell::truncatedCell || cellType == HGCalCell::extendedCell) {
1236 x_off = offsetX[type][cellType][cellPos - HGCalCell::bottomLeftEdge];
1237 y_off = offsetY[type][cellType][cellPos - HGCalCell::bottomLeftEdge];
1238 } else if ((cellType == HGCalCell::cornerCell) || (cellType == HGCalCell::truncatedMBCell) ||
1239 (cellType == HGCalCell::extendedMBCell)) {
1240
1241
1242 if (((placementIndex >= HGCalCell::cellPlacementExtra) && (placementIndex % 2 == 0)) ||
1243 ((placementIndex < HGCalCell::cellPlacementExtra) && (placementIndex % 2 == 1))) {
1244 cellPos = HGCalCell::bottomCorner + (6 + HGCalCell::bottomCorner - cellPos) % 6;
1245 }
1246 x_off = offsetX[type][cellType][cellPos - HGCalCell::bottomCorner];
1247 y_off = offsetY[type][cellType][cellPos - HGCalCell::bottomCorner];
1248 if (((placementIndex >= HGCalCell::cellPlacementExtra) && (placementIndex % 2 == 0)) ||
1249 ((placementIndex < HGCalCell::cellPlacementExtra) && (placementIndex % 2 == 1))) {
1250 x_off = -1 * x_off;
1251 }
1252 }
1253 return std::make_pair(x_off, y_off);
1254 }
1255
1256 std::pair<double, double> HGCalCellOffset::cellOffsetUV2XY1(
1257 int32_t u, int32_t v, int32_t placementIndex, int32_t type, int32_t partialType) {
1258 if (type != 0)
1259 type = 1;
1260 std::pair<double, double> offset = HGCalCellOffset::cellOffsetUV2XY1(u, v, placementIndex, type);
1261 double x_off = offset.first;
1262 double y_off = offset.second;
1263 std::pair<int, int> cell = hgcalcell_->cellType(u, v, ncell_[type], placementIndex, partialType);
1264 int cellPos = cell.first;
1265 int cellType = cell.second;
1266 if ((cellType >= HGCalCell::partiaclWaferCellsOffset) || (cellPos >= HGCalCell::partiaclCellsPosOffset)) {
1267 if (cellType == HGCalCell::truncatedCell || cellType == HGCalCell::extendedCell) {
1268 if (cellPos == HGCalCell::topCell) {
1269 int Pos(0);
1270 Pos = (placementIndex + HGCalCell::topRightEdge - HGCalCell::bottomLeftEdge) % HGCalCell::cellPlacementExtra;
1271 x_off = (placementIndex >= HGCalCell::cellPlacementExtra) ? -offsetX[type][cellType][Pos]
1272 : offsetX[type][cellType][Pos];
1273 y_off = offsetY[type][cellType][Pos];
1274 } else if (cellPos == HGCalCell::bottomCell) {
1275 int Pos(0);
1276 Pos = (placementIndex) % HGCalCell::cellPlacementExtra;
1277 x_off = (placementIndex >= HGCalCell::cellPlacementExtra) ? -offsetX[type][cellType][Pos]
1278 : offsetX[type][cellType][Pos];
1279 y_off = offsetY[type][cellType][Pos];
1280 }
1281 } else if ((cellType == HGCalCell::halfCell) || (cellType == HGCalCell::LDPartial0714Cell) ||
1282 (cellType == HGCalCell::LDPartial0815Cell) || (cellType == HGCalCell::HDPartial0920Cell) ||
1283 (cellType == HGCalCell::HDPartial1021Cell)) {
1284 int cellType1 = cellType - HGCalCell::partiaclWaferCellsOffset;
1285 if (cellPos == HGCalCell::leftCell) {
1286 int placeIndex = placementIndex % HGCalCell::cellPlacementExtra;
1287 x_off = offsetPartialX[type][cellType1][placeIndex];
1288 y_off = offsetPartialY[type][cellType1][placeIndex];
1289 } else if (cellPos == HGCalCell::rightCell) {
1290 int placeIndex = (HGCalCell::cellPlacementExtra - placementIndex) % HGCalCell::cellPlacementExtra;
1291 x_off = -offsetPartialX[type][cellType1][placeIndex];
1292 y_off = offsetPartialY[type][cellType1][placeIndex];
1293 }
1294 x_off = placementIndex < HGCalCell::cellPlacementExtra ? x_off : -x_off;
1295 } else if ((cellType == HGCalCell::LDPartial0209Cell) || (cellType == HGCalCell::LDPartial0007Cell) ||
1296 (cellType == HGCalCell::LDPartial1415Cell) || (cellType == HGCalCell::LDPartial1515Cell)) {
1297 int cellType1 = cellType - HGCalCell::partiaclWaferCellsOffset;
1298 int placeIndex = placementIndex % HGCalCell::cellPlacementExtra;
1299 x_off = offsetPartialX[type][cellType1][placeIndex];
1300 y_off = offsetPartialY[type][cellType1][placeIndex];
1301 x_off = placementIndex < HGCalCell::cellPlacementExtra ? x_off : -x_off;
1302 }
1303 }
1304 return std::make_pair(x_off, y_off);
1305 }
1306
1307 double HGCalCellOffset::cellAreaUV(int32_t u, int32_t v, int32_t placementIndex, int32_t type, bool reco) {
1308 if (type != 0)
1309 type = 1;
1310 double area(0);
1311 std::pair<int, int> cell = hgcalcell_->cellType(u, v, ncell_[type], placementIndex);
1312 int cellType = cell.second;
1313 area = reco ? cellArea[type][cellType] : HGCalParameters::k_ScaleToDDD2 * cellArea[type][cellType];
1314 return area;
1315 }
1316
1317 double HGCalCellOffset::cellAreaUV(
1318 int32_t u, int32_t v, int32_t placementIndex, int32_t type, int32_t partialType, bool reco) {
1319 if (type != 0)
1320 type = 1;
1321 double area(0);
1322 area = cellAreaUV(u, v, placementIndex, type, reco);
1323 std::pair<int, int> cell = hgcalcell_->cellType(u, v, ncell_[type], placementIndex, partialType);
1324 int cellPos = cell.first;
1325 int cellType = cell.second;
1326 if ((cellType >= HGCalCell::partiaclWaferCellsOffset) || (cellPos >= HGCalCell::partiaclCellsPosOffset)) {
1327 if (cellType == HGCalCell::truncatedCell || cellType == HGCalCell::extendedCell) {
1328 area = reco ? cellArea[type][cellType] : HGCalParameters::k_ScaleToDDD2 * cellArea[type][cellType];
1329 } else {
1330 area = reco ? cellAreaPartial[type][cellType - HGCalCell::partiaclWaferCellsOffset]
1331 : HGCalParameters::k_ScaleToDDD2 * cellArea[type][cellType - HGCalCell::partiaclWaferCellsOffset];
1332 }
1333 }
1334 return area;
1335 }