Skip to content

Commit

Permalink
Code check
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunanda committed Jan 23, 2022
1 parent 84786d7 commit efad9fc
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 91 deletions.
4 changes: 2 additions & 2 deletions Geometry/HGCalCommonData/interface/HGCalWafer.h
Expand Up @@ -31,9 +31,9 @@ class HGCalWafer {
static constexpr int32_t WaferPlacementExtra = 6;
static constexpr int32_t WaferPlacementOld = 7;

std::pair<double,double> HGCalWaferUV2XY(int32_t u, int32_t v, int32_t placementIndex, int32_t type);
std::pair<double, double> HGCalWaferUV2XY(int32_t u, int32_t v, int32_t placementIndex, int32_t type);
int32_t HGCalWaferUV2Cell(int32_t u, int32_t v, int32_t placementIndex, int32_t type);
static int32_t HGCalWaferPlacementIndex(int32_t iz, int32_t fwdBack, int32_t orient);
static int32_t HGCalWaferPlacementIndex(int32_t iz, int32_t fwdBack, int32_t orient);

private:
const double factor_;
Expand Down
178 changes: 89 additions & 89 deletions Geometry/HGCalCommonData/src/HGCalWafer.cc
Expand Up @@ -5,64 +5,64 @@ HGCalWafer::HGCalWafer(double waferSize, int32_t nFine, int32_t nCoarse) : facto
N_[0] = nFine;
N_[1] = nCoarse;
for (int k = 0; k < 2; ++k) {
R_[k] = waferSize / (3 * N_[k]);
R_[k] = waferSize / (3 * N_[k]);
r_[k] = factor_ * R_[k];
}
}

std::pair<double,double> HGCalWafer::HGCalWaferUV2XY(int32_t u, int32_t v, int32_t placementIndex, int32_t type) {
std::pair<double, double> HGCalWafer::HGCalWaferUV2XY(int32_t u, int32_t v, int32_t placementIndex, int32_t type) {
if (type != 0)
type = 1;
double x(0), y(0);
switch (placementIndex) {
case (HGCalWafer::WaferPlacementIndex6):
x = (1.5 * (v - u) + 0.5) * R_[type];
y = (v + u - 2 * N_[type] + 1) * r_[type];
break;
case (HGCalWafer::WaferPlacementIndex7):
x = (1.5 * (v - N_[type]) + 1.0) * R_[type];
y = (2 * u - v - N_[type]) * r_[type];
break;
case (HGCalWafer::WaferPlacementIndex8):
x = (1.5 * (u - N_[type]) + 0.5) * R_[type];
y =-(2 * v - u - N_[type] + 1) * r_[type];
break;
case (HGCalWafer::WaferPlacementIndex9):
x =-(1.5 * (v - u) + 0.5) * R_[type];
y =-(v + u - 2 * N_[type] + 1) * r_[type];
break;
case (HGCalWafer::WaferPlacementIndex10):
x =-(1.5 * (v - N_[type]) + 1) * R_[type];
y =-(2 * u - v - N_[type]) * r_[type];
break;
case (HGCalWafer::WaferPlacementIndex11):
x =-(1.5 * (u - N_[type]) + 0.5) * R_[type];
y = (2 * v - u - N_[type] + 1) * r_[type];
break;
case (HGCalWafer::WaferPlacementIndex0):
x = (1.5 * (u - v) + 0.5) * R_[type];
y = (v + u - 2 * N_[type] + 1) * r_[type];
break;
case (HGCalWafer::WaferPlacementIndex1):
x = (1.5 * (v - N_[type]) + 0.5) * R_[type];
y =-(2 * v - u - N_[type] + 1) * r_[type];
break;
case (HGCalWafer::WaferPlacementIndex2):
x =-(1.5 * (u - N_[type]) + 1) * R_[type];
y =-(2 * v - u - N_[type]) * r_[type];
break;
case (HGCalWafer::WaferPlacementIndex3):
x =-(1.5 * (u - v) + 0.5) * R_[type];
y =-(v + u - 2 * N_[type] + 1) * r_[type];
break;
case (HGCalWafer::WaferPlacementIndex4):
x = (1.5 * (u - N_[type]) + 0.5) * R_[type];
y =-(2 * u - v - N_[type] + 1) * r_[type];
break;
default:
x = (1.5 * (u - N_[type]) + 1) * R_[type];
y = (2 * v - u - N_[type]) * r_[type];
break;
case (HGCalWafer::WaferPlacementIndex6):
x = (1.5 * (v - u) + 0.5) * R_[type];
y = (v + u - 2 * N_[type] + 1) * r_[type];
break;
case (HGCalWafer::WaferPlacementIndex7):
x = (1.5 * (v - N_[type]) + 1.0) * R_[type];
y = (2 * u - v - N_[type]) * r_[type];
break;
case (HGCalWafer::WaferPlacementIndex8):
x = (1.5 * (u - N_[type]) + 0.5) * R_[type];
y = -(2 * v - u - N_[type] + 1) * r_[type];
break;
case (HGCalWafer::WaferPlacementIndex9):
x = -(1.5 * (v - u) + 0.5) * R_[type];
y = -(v + u - 2 * N_[type] + 1) * r_[type];
break;
case (HGCalWafer::WaferPlacementIndex10):
x = -(1.5 * (v - N_[type]) + 1) * R_[type];
y = -(2 * u - v - N_[type]) * r_[type];
break;
case (HGCalWafer::WaferPlacementIndex11):
x = -(1.5 * (u - N_[type]) + 0.5) * R_[type];
y = (2 * v - u - N_[type] + 1) * r_[type];
break;
case (HGCalWafer::WaferPlacementIndex0):
x = (1.5 * (u - v) + 0.5) * R_[type];
y = (v + u - 2 * N_[type] + 1) * r_[type];
break;
case (HGCalWafer::WaferPlacementIndex1):
x = (1.5 * (v - N_[type]) + 0.5) * R_[type];
y = -(2 * v - u - N_[type] + 1) * r_[type];
break;
case (HGCalWafer::WaferPlacementIndex2):
x = -(1.5 * (u - N_[type]) + 1) * R_[type];
y = -(2 * v - u - N_[type]) * r_[type];
break;
case (HGCalWafer::WaferPlacementIndex3):
x = -(1.5 * (u - v) + 0.5) * R_[type];
y = -(v + u - 2 * N_[type] + 1) * r_[type];
break;
case (HGCalWafer::WaferPlacementIndex4):
x = (1.5 * (u - N_[type]) + 0.5) * R_[type];
y = -(2 * u - v - N_[type] + 1) * r_[type];
break;
default:
x = (1.5 * (u - N_[type]) + 1) * R_[type];
y = (2 * v - u - N_[type]) * r_[type];
break;
}
return std::make_pair(x, y);
}
Expand All @@ -78,7 +78,7 @@ int HGCalWafer::HGCalWaferUV2Cell(int32_t u, int32_t v, int32_t placementIndex,
const std::vector<int> itype3 = {0, 4, 5, 0, 1, 2, 3, 2, 0, 1, 2, 0, 1};
const std::vector<int> itype4 = {0, 8, 9, 10, 11, 6, 7, 4, 5, 3, 4, 5, 3};
const std::vector<int> itype5 = {0, 2, 3, 4, 5, 0, 1, 1, 2, 0, 1, 2, 0};
if (u == 0 && v == 0)
if (u == 0 && v == 0)
cellx = 1;
else if (u == 0 && (v - u) == (2 * N_[type] - 1))
cellx = 2;
Expand All @@ -103,24 +103,24 @@ int HGCalWafer::HGCalWaferUV2Cell(int32_t u, int32_t v, int32_t placementIndex,
else if (v == 0)
cellx = 11;
switch (placementIndex) {
case (HGCalWafer::WaferPlacementIndex6):
cell = itype0[cellx];
break;
case (HGCalWafer::WaferPlacementIndex7):
cell = itype1[cellx];
break;
case (HGCalWafer::WaferPlacementIndex8):
cell = itype2[cellx];
break;
case (HGCalWafer::WaferPlacementIndex9):
cell = itype3[cellx];
break;
case (HGCalWafer::WaferPlacementIndex10):
cell = itype4[cellx];
break;
default:
cell = itype5[cellx];
break;
case (HGCalWafer::WaferPlacementIndex6):
cell = itype0[cellx];
break;
case (HGCalWafer::WaferPlacementIndex7):
cell = itype1[cellx];
break;
case (HGCalWafer::WaferPlacementIndex8):
cell = itype2[cellx];
break;
case (HGCalWafer::WaferPlacementIndex9):
cell = itype3[cellx];
break;
case (HGCalWafer::WaferPlacementIndex10):
cell = itype4[cellx];
break;
default:
cell = itype5[cellx];
break;
}
} else {
const std::vector<int> itype0 = {0, 1, 2, 3, 4, 5, 0, 1, 2, 0, 0, 1, 2};
Expand All @@ -129,7 +129,7 @@ int HGCalWafer::HGCalWaferUV2Cell(int32_t u, int32_t v, int32_t placementIndex,
const std::vector<int> itype3 = {0, 9, 10, 11, 6, 7, 8, 5, 3, 4, 4, 5, 3};
const std::vector<int> itype4 = {0, 5, 0, 1, 2, 3, 4, 0, 1, 2, 2, 0, 1};
const std::vector<int> itype5 = {0, 11, 6, 7, 8, 9, 10, 3, 4, 5, 3, 4, 5};
if (u == 0 && v == 0)
if (u == 0 && v == 0)
cellx = 1;
else if (v == 0 && (u - v) == (N_[type] - 1))
cellx = 2;
Expand All @@ -154,30 +154,30 @@ int HGCalWafer::HGCalWaferUV2Cell(int32_t u, int32_t v, int32_t placementIndex,
else if (u == 0)
cellx = 11;
switch (placementIndex) {
case (HGCalWafer::WaferPlacementIndex0):
cell = itype0[cellx];
break;
case (HGCalWafer::WaferPlacementIndex1):
cell = itype1[cellx];
break;
case (HGCalWafer::WaferPlacementIndex2):
cell = itype2[cellx];
break;
case (HGCalWafer::WaferPlacementIndex3):
cell = itype3[cellx];
break;
case (HGCalWafer::WaferPlacementIndex4):
cell = itype4[cellx];
break;
default:
cell = itype5[cellx];
break;
case (HGCalWafer::WaferPlacementIndex0):
cell = itype0[cellx];
break;
case (HGCalWafer::WaferPlacementIndex1):
cell = itype1[cellx];
break;
case (HGCalWafer::WaferPlacementIndex2):
cell = itype2[cellx];
break;
case (HGCalWafer::WaferPlacementIndex3):
cell = itype3[cellx];
break;
case (HGCalWafer::WaferPlacementIndex4):
cell = itype4[cellx];
break;
default:
cell = itype5[cellx];
break;
}
}
return cell;
}

int HGCalWafer::HGCalWaferPlacementIndex(int32_t iz, int32_t fwdBack, int32_t orient) {
int HGCalWafer::HGCalWaferPlacementIndex(int32_t iz, int32_t fwdBack, int32_t orient) {
int32_t indx = ((iz * fwdBack) > 0) ? orient : (orient + HGCalWafer::WaferPlacementExtra);
return indx;
}

0 comments on commit efad9fc

Please sign in to comment.