50 mask = !((u > 2 *
v) && (
v <
n));
52 mask = ((u >=
n) && (
v >=
n) && ((u +
v) > (3 *
n - 2)));
58 mask = !((u +
v) <
n);
60 mask = ((u >=
n) && (u >
v) && ((2 * u -
v) > 2 *
n));
66 mask = !((u <
n) && (
v > u) && (
v > (2 * u - 1)));
68 mask = ((u > 2 *
v) && (
v <
n));
74 mask = !((
v >= u) && ((2 *
v - u) > (2 *
n - 2)));
82 mask = !((u >=
n) && (
v >=
n) && ((u +
v) > (3 *
n - 2)));
84 mask = ((u <
n) && (
v > u) && (
v > (2 * u - 1)));
90 mask = !((u >=
n) && (u >
v) && ((2 * u -
v) > 2 *
n));
92 mask = ((
v >= u) && ((2 *
v - u) > (2 *
n - 2)));
100 edm::LogVerbatim(
"HGCalGeom") <<
"Corners: " << ncor <<
":" << fcor <<
" N " <<
n <<
" u " << u <<
" v " <<
v
119 good = ((
v -
u2) <
n);
123 good = ((
v + u) < (3 *
n - 1));
127 int v2 = (
v + 1) / 2;
128 good = ((u - v2) <
n);
132 int u2 = (u + 1) / 2;
137 good = ((
v + u) >=
n);
151 good = (
v < (3 * n2));
155 good = (u < (3 * n2));
159 good = ((u -
v) <= n2);
171 good = ((
v - u) < n2);
180 good = (
v < (5 * n4));
184 good = (u < (5 * n4));
188 good = ((u -
v) <= n4);
192 good = (
v >= (3 * n4));
196 good = (u >= (3 * n4));
200 good = ((
v - u) < n4);
238 good = ((u +
v) < (2 *
n));
242 good = ((2 * u -
v) <
n);
246 good = ((2 *
v - u) >=
n);
250 good = ((u +
v) >= (2 *
n));
254 good = ((2 * u -
v) >
n);
258 good = ((2 *
v - u) <
n);
267 good = ((
v + u) <
n);
277 good = ((
v -
u2) >=
n);
281 good = ((
v + u) >= (3 *
n - 1));
285 int v2 = ((
v + 1) / 2);
286 good = ((u - v2) >=
n);
290 int u2 = ((u + 1) / 2);
300 int n3 = (
n + 1) / 3;
301 good = ((u +
v) < (4 * n3));
305 good = ((2 * u -
v) < n2);
309 int u2 = ((u + 1) / 2);
310 good = ((
v -
u2) >= (3 * n4));
314 good = ((u +
v) >= (5 * n2));
318 good = ((2 * u -
v) > (3 * n2));
322 int u2 = ((
n == 8) ? ((u + 1) / 2) : (u / 2));
323 good = ((
v -
u2) < n4);
331 edm::LogVerbatim(
"HGCalGeom") <<
"u|v " << u <<
":" <<
v <<
" N " <<
n <<
" type " <<
type <<
" rot " << rotn
349 newrotn = rot1[rotn];
358 newrotn = rot2[rotn];
366 newrotn = rot3[rotn];
387 static const int corners = 6;
388 static const int base = 10;
389 double rin2 = rin * rin;
390 double rout2 = rout * rout;
391 double dx0[corners] = {
399 double xc[corners], yc[corners];
400 for (
int k = 0;
k < corners; ++
k) {
401 xc[
k] = xpos + dx0[
k];
402 yc[
k] = ypos + dy0[
k];
403 double rpos2 = (xc[
k] * xc[
k] + yc[
k] * yc[
k]);
404 if (rpos2 <= rout2 && rpos2 >= rin2) {
406 iok = iok *
base + 1;
412 edm::LogVerbatim(
"HGCalGeom") <<
"I/p " << xpos <<
":" << ypos <<
":" << delX <<
":" << delY <<
":" << rin <<
":"
413 << rout <<
":" << wType <<
":" <<
mode <<
" Corners " << ncor <<
" iok " << iok;
415 static const int ipat5[corners] = {101111, 110111, 111011, 111101, 111110, 11111};
416 static const int ipat4[corners] = {100111, 110011, 111001, 111100, 11110, 1111};
417 static const int ipat3[corners] = {100011, 110001, 111000, 11100, 1110, 111};
424 double dy1[corners] = {
432 double dy2[corners] = {
434 double dx3[corners] = {
460 double dy5[corners] = {
477 rotn = static_cast<int>(
std::find(ipat5, ipat5 + 6, iok) - ipat5);
480 rotn = static_cast<int>(
std::find(ipat4, ipat4 + 6, iok) - ipat4);
482 double rpos12 = ((xpos + dx1[rotn]) * (xpos + dx1[rotn]) + (ypos + dy1[rotn]) * (ypos + dy1[rotn]));
484 if (rpos12 <= rout2 && rpos12 >= rin2) {
485 rpos22 = ((xpos + dx2[rotn]) * (xpos + dx2[rotn]) + (ypos + dy2[rotn]) * (ypos + dy2[rotn]));
486 if (rpos22 <= rout2 && rpos22 >= rin2)
493 rpos12 = ((xpos + dx3[rotn]) * (xpos + dx3[rotn]) + (ypos + dy3[rotn]) * (ypos + dy3[rotn]));
494 if (rpos12 <= rout2 && rpos12 >= rin2) {
495 rpos22 = ((xpos + dx4[rotn]) * (xpos + dx4[rotn]) + (ypos + dy4[rotn]) * (ypos + dy4[rotn]));
496 if (rpos22 <= rout2 && rpos22 >= rin2)
504 rotn = static_cast<int>(
std::find(ipat3, ipat3 + 6, iok) - ipat3);
506 double rpos12 = ((xpos + dx1[rotn]) * (xpos + dx1[rotn]) + (ypos + dy1[rotn]) * (ypos + dy1[rotn]));
508 if (rpos12 <= rout2 && rpos12 >= rin2) {
509 rpos22 = ((xpos + dx5[rotn]) * (xpos + dx5[rotn]) + (ypos + dy5[rotn]) * (ypos + dy5[rotn]));
510 if (rpos22 <= rout2 && rpos22 >= rin2)
517 rpos12 = ((xpos + dx3[rotn]) * (xpos + dx3[rotn]) + (ypos + dy3[rotn]) * (ypos + dy3[rotn]));
518 if (rpos12 <= rout2 && rpos12 >= rin2) {
519 rpos22 = ((xpos + dx6[rotn]) * (xpos + dx6[rotn]) + (ypos + dy6[rotn]) * (ypos + dy6[rotn]));
520 if (rpos22 <= rout2 && rpos22 >= rin2)
532 edm::LogVerbatim(
"HGCalGeom") <<
"I/p " << xpos <<
":" << ypos <<
":" << delX <<
":" << delY <<
":" << rin <<
":"
533 << rout <<
":" << wType <<
":" <<
mode <<
" o/p " << iok <<
":" << ncor <<
":" <<
type
539 double xpos,
double ypos,
double delX,
double delY,
double rin,
double rout,
int part,
int rotn,
bool debug) {
544 double rin2 = rin * rin;
545 double rout2 = rout * rout;
548 static const int base = 10;
549 static const int base2 = 100;
550 double dx0[corners] = {
564 double dy1[corners] = {
594 static const int nc0[corners] = {450, 150, 201, 312, 423, 534};
596 for (
int k1 = 0; k1 < 3; ++k1) {
598 double xc1 = xpos + dx0[
k];
599 double yc1 = ypos + dy0[
k];
600 double rpos2 = (xc1 * xc1 + yc1 * yc1);
601 if ((rpos2 > rout2) || (rpos2 < rin2)) {
611 static const int nc10[corners] = {450, 150, 201, 312, 423, 534};
612 static const int nc11[corners] = {700, 902, 1104, 106, 308, 510};
614 for (
int k1 = 0; k1 < 3; ++k1) {
616 double xc1 = xpos + dx0[
k];
617 double yc1 = ypos + dy0[
k];
618 double rpos2 = (xc1 * xc1 + yc1 * yc1);
619 if ((rpos2 > rout2) || (rpos2 < rin2)) {
627 for (
int k1 = 0; k1 < 2; ++k1) {
629 double xc1 = xpos + dx2[
k];
630 double yc1 = ypos + dy2[
k];
631 double rpos2 = (xc1 * xc1 + yc1 * yc1);
632 if ((rpos2 > rout2) || (rpos2 < rin2)) {
642 static const int nc20[corners] = {450, 150, 201, 312, 423, 534};
643 static const int nc21[corners] = {30, 14, 25, 30, 41, 52};
645 for (
int k1 = 0; k1 < 3; ++k1) {
647 double xc1 = xpos + dx0[
k];
648 double yc1 = ypos + dy0[
k];
649 double rpos2 = (xc1 * xc1 + yc1 * yc1);
650 if ((rpos2 > rout2) || (rpos2 < rin2)) {
658 for (
int k1 = 0; k1 < 2; ++k1) {
660 double xc1 = xpos + dx1[
k];
661 double yc1 = ypos + dy1[
k];
662 double rpos2 = (xc1 * xc1 + yc1 * yc1);
663 if ((rpos2 > rout2) || (rpos2 < rin2)) {
673 static const int nc3[corners] = {3450, 1450, 2501, 3012, 4123, 5234};
675 for (
int k1 = 0; k1 < 4; ++k1) {
677 double xc1 = xpos + dx0[
k];
678 double yc1 = ypos + dy0[
k];
679 double rpos2 = (xc1 * xc1 + yc1 * yc1);
680 if ((rpos2 > rout2) || (rpos2 < rin2)) {
690 static const int nc40[corners] = {3450, 1450, 2501, 3012, 4123, 5234};
691 static const int nc41[corners] = {500, 702, 904, 1106, 108, 310};
693 for (
int k1 = 0; k1 < 4; ++k1) {
695 double xc1 = xpos + dx0[
k];
696 double yc1 = ypos + dy0[
k];
697 double rpos2 = (xc1 * xc1 + yc1 * yc1);
698 if ((rpos2 > rout2) || (rpos2 < rin2)) {
706 for (
int k1 = 0; k1 < 2; ++k1) {
708 double xc1 = xpos + dx2[
k];
709 double yc1 = ypos + dy2[
k];
710 double rpos2 = (xc1 * xc1 + yc1 * yc1);
711 if ((rpos2 > rout2) || (rpos2 < rin2)) {
721 static const int nc50[corners] = {3450, 1450, 2501, 3012, 4123, 5234};
722 static const int nc51[corners] = {20, 13, 24, 35, 40, 51};
724 for (
int k1 = 0; k1 < 4; ++k1) {
726 double xc1 = xpos + dx0[
k];
727 double yc1 = ypos + dy0[
k];
728 double rpos2 = (xc1 * xc1 + yc1 * yc1);
729 if ((rpos2 > rout2) || (rpos2 < rin2)) {
737 for (
int k1 = 0; k1 < 2; ++k1) {
739 double xc1 = xpos + dx1[
k];
740 double yc1 = ypos + dy1[
k];
741 double rpos2 = (xc1 * xc1 + yc1 * yc1);
742 if ((rpos2 > rout2) || (rpos2 < rin2)) {
752 static const int nc6[corners] = {23450, 13450, 24501, 35012, 40123, 51234};
754 for (
int k1 = 0; k1 < 5; ++k1) {
756 double xc1 = xpos + dx0[
k];
757 double yc1 = ypos + dy0[
k];
758 double rpos2 = (xc1 * xc1 + yc1 * yc1);
759 if ((rpos2 > rout2) || (rpos2 < rin2)) {
768 for (
int k = 0;
k < corners; ++
k) {
769 double xc1 = xpos + dx0[
k];
770 double yc1 = ypos + dy0[
k];
771 double rpos2 = (xc1 * xc1 + yc1 * yc1);
772 if ((rpos2 > rout2) || (rpos2 < rin2)) {
783 <<
":" << xpos <<
":" << ypos <<
":" << delX <<
":" << delY <<
":" << rin <<
":"
784 << rout <<
":" <<
part <<
":" << rotn <<
" Results " <<
ok <<
":" << ncf;