51 mask = !((u > 2 *
v) && (
v <
n));
53 mask = ((u >=
n) && (
v >=
n) && ((u +
v) > (3 *
n - 2)));
59 mask = !((u +
v) <
n);
61 mask = ((u >=
n) && (u >
v) && ((2 * u -
v) > 2 *
n));
67 mask = !((u <
n) && (
v > u) && (
v > (2 * u - 1)));
69 mask = ((u > 2 *
v) && (
v <
n));
75 mask = !((
v >= u) && ((2 *
v - u) > (2 *
n - 2)));
83 mask = !((u >=
n) && (
v >=
n) && ((u +
v) > (3 *
n - 2)));
85 mask = ((u <
n) && (
v > u) && (
v > (2 * u - 1)));
91 mask = !((u >=
n) && (u >
v) && ((2 * u -
v) > 2 *
n));
93 mask = ((
v >= u) && ((2 *
v - u) > (2 *
n - 2)));
101 edm::LogVerbatim(
"HGCalGeom") <<
"Corners: " << ncor <<
":" << fcor <<
" N " <<
n <<
" u " << u <<
" v " <<
v
110 int n3 = (
n + 1) / 3;
121 good = ((
v -
u2) <
n);
125 good = ((
v + u) < (3 *
n - 1));
129 int v2 = (
v + 1) / 2;
130 good = ((u - v2) <
n);
134 int u2 = (u + 1) / 2;
139 good = ((
v + u) >=
n);
153 good = (
v < (3 * n2));
157 good = (u < (3 * n2));
161 good = ((u -
v) <= n2);
173 good = ((
v - u) < n2);
182 good = (
v < (5 * n4));
186 good = (u < (5 * n4));
190 good = ((u -
v) <= n4);
194 good = (
v >= (3 * n4));
198 good = (u >= (3 * n4));
202 good = ((
v - u) < n4);
240 good = ((u +
v) < (2 *
n));
244 good = ((2 * u -
v) <
n);
248 good = ((2 *
v - u) >=
n);
252 good = ((u +
v) >= (2 *
n));
256 good = ((2 * u -
v) >
n);
260 good = ((2 *
v - u) <
n);
269 good = ((
v + u) <
n);
279 good = ((
v -
u2) >=
n);
283 good = ((
v + u) >= (3 *
n - 1));
288 good = ((u - v2) >=
n);
292 int u2 = ((u + 1) / 2);
302 good = ((u +
v) < (4 * n3));
306 good = ((2 * u -
v) <= n2);
310 good = ((2 *
v - u) > (3 * n2));
314 good = ((u +
v) >= (5 * n2 - 1));
318 good = ((2 * u -
v) < (3 * n2));
322 good = ((2 *
v - u) <= n3);
330 edm::LogVerbatim(
"HGCalGeom") <<
"u|v " << u <<
":" <<
v <<
" N " <<
n <<
" type " <<
type <<
" rot " << rotn
348 static const int corners = 6;
349 static const int base = 10;
350 double dx0[corners] = {0.0, delX, delX, 0.0, -delX, -delX};
351 double dy0[corners] = {-delY, -0.5 * delY, 0.5 * delY, delY, 0.5 * delY, -0.5 * delY};
352 double xc[corners], yc[corners];
353 for (
int k = 0;
k < corners; ++
k) {
354 xc[
k] = xpos + dx0[
k];
355 yc[
k] = ypos + dy0[
k];
356 double rpos =
sqrt(xc[
k] * xc[
k] + yc[
k] * yc[
k]);
357 if (rpos <= rout && rpos >= rin) {
359 iok = iok *
base + 1;
365 edm::LogVerbatim(
"HGCalGeom") <<
"I/p " << xpos <<
":" << ypos <<
":" << delX <<
":" << delY <<
":" << rin <<
":"
366 << rout <<
":" << wType <<
":" <<
mode <<
" Corners " << ncor <<
" iok " << iok;
368 static const int ipat5[corners] = {101111, 110111, 111011, 111101, 111110, 11111};
369 static const int ipat4[corners] = {100111, 110011, 111001, 111100, 11110, 1111};
370 static const int ipat3[corners] = {100011, 110001, 111000, 11100, 1110, 111};
371 double dx1[corners] = {0.5 * delX, delX, 0.5 * delX, -0.5 * delX, -delX, -0.5 * delX};
372 double dy1[corners] = {-0.75 * delY, 0.0, 0.75 * delY, 0.75 * delY, 0.0, -0.75 * delY};
373 double dx2[corners] = {0.5 * delX, -0.5 * delX, -delX, -0.5 * delX, 0.5 * delX, delX};
374 double dy2[corners] = {0.75 * delY, 0.75 * delY, 0.0, -0.75 * delY, -0.75 * delY, 0.0};
375 double dx3[corners] = {0.25 * delX, delX, 0.75 * delX, -0.25 * delX, -delX, -0.75 * delX};
376 double dy3[corners] = {-0.875 * delY, -0.25 * delY, 0.625 * delY, 0.875 * delY, 0.25 * delY, -0.625 * delY};
377 double dx4[corners] = {0.25 * delX, -0.75 * delX, -delX, -0.25 * delX, 0.75 * delX, delX};
378 double dy4[corners] = {0.875 * delY, 0.625 * delY, -0.25 * delY, -0.875 * delY, -0.625 * delY, 0.25 * delY};
379 double dx5[corners] = {-0.5 * delX, -delX, -0.5 * delX, 0.5 * delX, delX, 0.5 * delX};
380 double dy5[corners] = {0.75 * delY, 0.0, -0.75 * delY, -0.75 * delY, 0.0, 0.75 * delY};
381 double dx6[corners] = {-0.75 * delX, -delX, -0.25 * delX, 0.75 * delX, delX, 0.25 * delX};
382 double dy6[corners] = {0.625 * delY, -0.25 * delY, -0.875 * delY, -0.625 * delY, 0.25 * delY, 0.875 * delY};
386 rotn = static_cast<int>(
std::find(ipat5, ipat5 + 6, iok) - ipat5);
389 rotn = static_cast<int>(
std::find(ipat4, ipat4 + 6, iok) - ipat4);
391 double rpos1 =
sqrt((xpos + dx1[rotn]) * (xpos + dx1[rotn]) + (ypos + dy1[rotn]) * (ypos + dy1[rotn]));
393 if (rpos1 <= rout && rpos1 >= rin) {
394 rpos2 =
sqrt((xpos + dx2[rotn]) * (xpos + dx2[rotn]) + (ypos + dy2[rotn]) * (ypos + dy2[rotn]));
395 if (rpos2 <= rout && rpos2 >= rin)
399 edm::LogVerbatim(
"HGCalGeom") <<
"Test for Chop2 " << rpos1 <<
":" << rpos2 <<
" Type " <<
type;
401 rpos1 =
sqrt((xpos + dx3[rotn]) * (xpos + dx3[rotn]) + (ypos + dy3[rotn]) * (ypos + dy3[rotn]));
402 if (rpos1 <= rout && rpos1 >= rin) {
403 rpos2 =
sqrt((xpos + dx4[rotn]) * (xpos + dx4[rotn]) + (ypos + dy4[rotn]) * (ypos + dy4[rotn]));
404 if (rpos2 <= rout && rpos2 >= rin)
408 edm::LogVerbatim(
"HGCalGeom") <<
"Test for Chop2M " << rpos1 <<
":" << rpos2 <<
" Type " <<
type;
411 rotn = static_cast<int>(
std::find(ipat3, ipat3 + 6, iok) - ipat3);
413 double rpos1 =
sqrt((xpos + dx1[rotn]) * (xpos + dx1[rotn]) + (ypos + dy1[rotn]) * (ypos + dy1[rotn]));
415 if (rpos1 <= rout && rpos1 >= rin) {
416 rpos2 =
sqrt((xpos + dx5[rotn]) * (xpos + dx5[rotn]) + (ypos + dy5[rotn]) * (ypos + dy5[rotn]));
417 if (rpos2 <= rout && rpos2 >= rin)
423 rpos1 =
sqrt((xpos + dx3[rotn]) * (xpos + dx3[rotn]) + (ypos + dy3[rotn]) * (ypos + dy3[rotn]));
424 if (rpos1 <= rout && rpos1 >= rin) {
425 rpos2 =
sqrt((xpos + dx6[rotn]) * (xpos + dx6[rotn]) + (ypos + dy6[rotn]) * (ypos + dy6[rotn]));
426 if (rpos2 <= rout && rpos2 >= rin)
430 edm::LogVerbatim(
"HGCalGeom") <<
"Test for SemiM " << rpos1 <<
":" << rpos2 <<
" Type " <<
type;
437 edm::LogVerbatim(
"HGCalGeom") <<
"I/p " << xpos <<
":" << ypos <<
":" << delX <<
":" << delY <<
":" << rin <<
":"
438 << rout <<
":" << wType <<
":" <<
mode <<
" o/p " << iok <<
":" << ncor <<
":" <<
type