169 for (
Int_t i = 0; i < 8; i++) {
185 for (
Int_t i = 0; i < 8; i++) {
186 fXY[i][0] = vertices[2 * i];
187 fXY[i][1] = vertices[2 * i + 1];
192 for (
Int_t i = 0; i < 8; i++) {
208 for (
Int_t i = 0; i < 8; i++) {
209 fXY[i][0] = vertices[2 * i];
210 fXY[i][1] = vertices[2 * i + 1];
215 for (
Int_t i = 0; i < 8; i++) {
253 for (i = 0; i < 4; i++) {
255 capacity += 0.25 *
fDz *
256 ((
fXY[i][0] +
fXY[i + 4][0]) * (
fXY[j][1] +
fXY[j + 4][1]) -
257 (
fXY[j][0] +
fXY[j + 4][0]) * (
fXY[i][1] +
fXY[i + 4][1]) +
258 (1. / 3) * ((
fXY[i + 4][0] -
fXY[i][0]) * (
fXY[j + 4][1] -
fXY[j][1]) -
259 (
fXY[j][0] -
fXY[j + 4][0]) * (
fXY[i][1] -
fXY[i + 4][1])));
273 for (
Int_t i = 1; i < 8; i++) {
305 for (i = 0; i < 4; i++) {
306 dx1 =
fXY[(i + 1) % 4][0] -
fXY[i][0];
307 dy1 =
fXY[(i + 1) % 4][1] -
fXY[i][1];
313 dx2 =
fXY[4 + (i + 1) % 4][0] -
fXY[4 + i][0];
314 dy2 =
fXY[4 + (i + 1) % 4][1] -
fXY[4 + i][1];
320 twist[i] = dy1 * dx2 - dx1 * dy2;
332 for (i = 0; i < 4; i++) {
333 fXY[i][0] += 1.E-8 *
fXY[i + 4][0];
334 fXY[i][1] += 1.E-8 *
fXY[i + 4][1];
338 for (i = 0; i < 4; i++) {
339 fXY[i + 4][0] += 1.E-8 *
fXY[i][0];
340 fXY[i + 4][1] += 1.E-8 *
fXY[i][1];
346 for (i = 0; i < 4; i++) {
349 sum2 +=
fXY[i + 4][0] *
fXY[j + 4][1] -
fXY[j + 4][0] *
fXY[i + 4][1];
352 Fatal(
"ComputeTwist",
"Shape %s type Arb8: Lower/upper faces defined with opposite clockwise",
GetName());
356 Error(
"ComputeTwist",
"Shape %s type Arb8: Vertices must be defined clockwise in XY planes. Re-ordering...",
380 Error(
"ComputeTwist",
"Shape %s type Arb8: Malformed polygon with crossing opposite segments",
GetName());
390 return (!
fTwist || iseg < 0 || iseg > 3) ? 0. :
fTwist[iseg];
404 Double_t lsq, ssq, dx, dy, dpx, dpy, u;
407 for (i1 = 0; i1 < 4; i1++) {
413 p1[0] = vert[2 * i1];
414 p1[1] = vert[2 * i1 + 1];
415 p2[0] = vert[2 * i2];
416 p2[1] = vert[2 * i2 + 1];
419 dpx = point[0] - p1[0];
420 dpy = point[1] - p1[1];
421 lsq = dx * dx + dy * dy;
424 ssq = dpx * dpx + dpy * dpy;
433 u = (dpx * dx + dpy * dy) / lsq;
437 dpx = point[0] - p2[0];
438 dpy = point[1] - p2[1];
450 ssq = dpx * dpx + dpy * dpy;
473 memset(norm, 0, 3 *
sizeof(
Double_t));
474 norm[2] = (dir[2] > 0) ? 1 : (-1);
484 Int_t jseg = (iseg + 1) % 4;
486 y0 = vert[2 * iseg + 1];
489 y2 = vert[2 * jseg + 1];
491 x0 += frac * (
x2 - x0);
492 y0 += frac * (
y2 - y0);
493 x1 =
fXY[iseg + 4][0];
494 y1 =
fXY[iseg + 4][1];
496 x1 += frac * (
fXY[jseg + 4][0] -
x1);
497 y1 += frac * (
fXY[jseg + 4][1] -
y1);
506 norm[0] = ay * bz - az * by;
507 norm[1] = az * bx - ax * bz;
508 norm[2] = ax * by - ay * bx;
509 fn =
TMath::Sqrt(norm[0] * norm[0] + norm[1] * norm[1] + norm[2] * norm[2]);
521 if (dir[0] > -2. && dir[0] * norm[0] + dir[1] * norm[1] + dir[2] * norm[2] < 0) {
542 for (i = 0; i < 4; i++) {
543 poly[2 * i] =
fXY[i + 4][0] + cf * (
fXY[i][0] -
fXY[i + 4][0]);
544 poly[2 * i + 1] =
fXY[i + 4][1] + cf * (
fXY[i][1] -
fXY[i + 4][1]);
564 Int_t j = (ipl + 1) % 4;
567 xb =
fXY[ipl + 4][0];
568 yb =
fXY[ipl + 4][1];
587 Double_t a = (dtx * dir[1] - dty * dir[0] + (tx1 * ty2 - tx2 * ty1) * dir[2]) * dir[2];
589 Double_t b = dxs * dir[1] - dys * dir[0] +
590 (dtx * point[1] - dty * point[0] + ty2 * xs1 - ty1 * xs2 + tx1 * ys2 - tx2 * ys1) * dir[2];
591 Double_t c = dxs * point[1] - dys * point[0] + xs1 * ys2 - xs2 * ys1;
599 memcpy(dirp, dir, 3 *
sizeof(
Double_t));
602 ((
TGeoArb8 *)
this)->ComputeNormal(point, dirp, norm);
603 ndotd = dir[0] * norm[0] + dir[1] * norm[1] + dir[2] * norm[2];
608 zi = (point[0] - xs1) * (point[0] - xs2) + (point[1] - ys1) * (point[1] - ys2);
624 memcpy(dirp, dir, 3 *
sizeof(
Double_t));
627 ((
TGeoArb8 *)
this)->ComputeNormal(point, dirp, norm);
628 ndotd = dir[0] * norm[0] + dir[1] * norm[1] + dir[2] * norm[2];
637 zi = point[2] + s * dir[2];
639 x1 = xs1 + tx1 * dir[2] * s;
640 x2 = xs2 + tx2 * dir[2] * s;
641 xp = point[0] + s * dir[0];
642 y1 = ys1 + ty1 * dir[2] * s;
643 y2 = ys2 + ty2 * dir[2] * s;
644 yp = point[1] + s * dir[1];
645 zi = (xp -
x1) * (xp -
x2) + (yp -
y1) * (yp -
y2);
653 memcpy(dirp, dir, 3 *
sizeof(
Double_t));
656 ((
TGeoArb8 *)
this)->ComputeNormal(point, dirp, norm);
657 ndotd = dir[0] * norm[0] + dir[1] * norm[1] + dir[2] * norm[2];
669 zi = point[2] + s * dir[2];
671 x1 = xs1 + tx1 * dir[2] * s;
672 x2 = xs2 + tx2 * dir[2] * s;
673 xp = point[0] + s * dir[0];
674 y1 = ys1 + ty1 * dir[2] * s;
675 y2 = ys2 + ty2 * dir[2] * s;
676 yp = point[1] + s * dir[1];
677 zi = (xp -
x1) * (xp -
x2) + (yp -
y1) * (yp -
y2);
698 if (point[2] * dir[2] < 0) {
701 for (
Int_t j = 0; j < 2; j++)
702 pt[j] = point[j] +
snext * dir[j];
710 for (
Int_t i = 0; i < 4; i++) {
730 distz = (-
fDz - point[2]) / dir[2];
734 distz = (
fDz - point[2]) / dir[2];
737 for (i = 0; i < 4; i++) {
743 pt[0] = point[0] + distz * dir[0];
744 pt[1] = point[1] + distz * dir[1];
749 if (dist < 0 || dist > 1.E10)
762 distmin = (-
fDz - point[2]) / dir[2];
765 distmin = (
fDz - point[2]) / dir[2];
773 for (
Int_t ipl = 0; ipl < 4; ipl++) {
774 Int_t j = (ipl + 1) % 4;
777 xb =
fXY[ipl + 4][0];
778 yb =
fXY[ipl + 4][1];
797 Double_t a = (dtx * dir[1] - dty * dir[0] + (tx1 * ty2 - tx2 * ty1) * dir[2]) * dir[2];
798 Double_t b = dxs * dir[1] - dys * dir[0] +
799 (dtx * point[1] - dty * point[0] + ty2 * xs1 - ty1 * xs2 + tx1 * ys2 - tx2 * ys1) * dir[2];
800 Double_t c = dxs * point[1] - dys * point[0] + xs1 * ys2 - xs2 * ys1;
806 if (s > eps && s < distmin) {
808 lateral_cross =
kTRUE;
821 lateral_cross =
kTRUE;
828 if (s > eps && s < distmin) {
830 lateral_cross =
kTRUE;
836 if (!lateral_cross) {
841 pt[0] = point[0] + distmin * dir[0];
842 pt[1] = point[1] + distmin * dir[1];
848 for (
Int_t j = 0; j < 4; j++) {
849 poly[2 * j] =
fXY[j + i][0];
850 poly[2 * j + 1] =
fXY[j + i][1];
865 Error(
"Divide",
"Division of an arbitrary trapezoid not implemented");
896 for (i = 0; i < 8; i++) {
913 Error(
"GetFittingBox",
"cannot handle parametrized rotated volumes");
920 Error(
"GetFittingBox",
"wrong matrix - parametrized box is outside this");
925 dd[0] = parambox->
GetDX();
926 dd[1] = parambox->
GetDY();
927 dd[2] = parambox->
GetDZ();
932 Error(
"GetFittingBox",
"wrong matrix");
936 if (dd[0] >= 0 && dd[1] >= 0) {
947 for (
Int_t iaxis = 0; iaxis < 2; iaxis++) {
951 for (
Int_t ivert = 0; ivert < 4; ivert++) {
971 for (i = 0; i < 3; i++) {
972 v1[i] = p2[i] - p1[i];
973 v2[i] = p3[i] - p1[i];
975 norm[0] =
v1[1] *
v2[2] -
v1[2] *
v2[1];
976 cross += norm[0] * norm[0];
977 norm[1] =
v1[2] *
v2[0] -
v1[0] *
v2[2];
978 cross += norm[1] * norm[1];
979 norm[2] =
v1[0] *
v2[1] -
v1[1] *
v2[0];
980 cross += norm[2] * norm[2];
984 for (i = 0; i < 3; i++)
1057 for (i = 0; i < 4; i++) {
1060 y1 = pts[(i << 1) + 1];
1062 y2 = pts[(j << 1) + 1];
1075 printf(
"*** Shape %s: TGeoArb8 ***\n",
GetName());
1077 printf(
" = TWISTED\n");
1078 for (
Int_t ip = 0; ip < 8; ip++) {
1079 printf(
" point #%i : x=%11.5f y=%11.5f z=%11.5f\n", ip,
fXY[ip][0],
fXY[ip][1],
fDz * ((ip < 4) ? -1 : 1));
1081 printf(
" Bounding box:\n");
1095 Double_t lsq, ssq, dx, dy, dpx, dpy, u;
1108 for (iseg = 0; iseg < 4; iseg++) {
1111 p1 = &vert[2 * iseg];
1112 p2 = &vert[2 * ((iseg + 1) % 4)];
1115 dpx = point[0] - p1[0];
1116 dpy = point[1] - p1[1];
1118 lsq = dx * dx + dy * dy;
1119 u = (dpx * dx + dpy * dy) / lsq;
1121 dpx = point[0] - p2[0];
1122 dpy = point[1] - p2[1];
1129 ssq = dpx * dpx + dpy * dpy;
1139 isegmin = (isegmin + 1) % 4;
1143 Int_t i2 = (isegmin + 1) % 4;
1148 dx = dx1 + umin * (dx2 - dx1);
1149 dy = dy1 + umin * (dy2 - dy1);
1150 safe *= 1. - 4. *
fDz *
fDz / (dx * dx + dy * dy + 4. *
fDz *
fDz);
1160 for (iseg = 0; iseg < 4; iseg++)
1178 Int_t ipln = (iseg + 1) % 4;
1180 vertices[0] =
fXY[iseg][0];
1181 vertices[1] =
fXY[iseg][1];
1184 vertices[3] =
fXY[ipln][0];
1185 vertices[4] =
fXY[ipln][1];
1188 vertices[6] =
fXY[ipln + 4][0];
1189 vertices[7] =
fXY[ipln + 4][1];
1192 vertices[9] =
fXY[iseg + 4][0];
1193 vertices[10] =
fXY[iseg + 4][1];
1207 safe = (point[0] - p1[0]) * norm[0] + (point[1] - p1[1]) * norm[1] + (point[2] - p1[2]) * norm[2];
1220 out <<
" // Shape: " <<
GetName() <<
" type: " <<
ClassName() << std::endl;
1221 out <<
" dz = " <<
fDz <<
";" << std::endl;
1222 out <<
" vert[0] = " <<
fXY[0][0] <<
";" << std::endl;
1223 out <<
" vert[1] = " <<
fXY[0][1] <<
";" << std::endl;
1224 out <<
" vert[2] = " <<
fXY[1][0] <<
";" << std::endl;
1225 out <<
" vert[3] = " <<
fXY[1][1] <<
";" << std::endl;
1226 out <<
" vert[4] = " <<
fXY[2][0] <<
";" << std::endl;
1227 out <<
" vert[5] = " <<
fXY[2][1] <<
";" << std::endl;
1228 out <<
" vert[6] = " <<
fXY[3][0] <<
";" << std::endl;
1229 out <<
" vert[7] = " <<
fXY[3][1] <<
";" << std::endl;
1230 out <<
" vert[8] = " <<
fXY[4][0] <<
";" << std::endl;
1231 out <<
" vert[9] = " <<
fXY[4][1] <<
";" << std::endl;
1232 out <<
" vert[10] = " <<
fXY[5][0] <<
";" << std::endl;
1233 out <<
" vert[11] = " <<
fXY[5][1] <<
";" << std::endl;
1234 out <<
" vert[12] = " <<
fXY[6][0] <<
";" << std::endl;
1235 out <<
" vert[13] = " <<
fXY[6][1] <<
";" << std::endl;
1236 out <<
" vert[14] = " <<
fXY[7][0] <<
";" << std::endl;
1237 out <<
" vert[15] = " <<
fXY[7][1] <<
";" << std::endl;
1238 out <<
" TGeoShape *" <<
GetPointerName() <<
" = new TGeoArb8(\"" <<
GetName() <<
"\", dz,vert);" << std::endl;
1248 for (
Int_t i = 0; i < 4; i++) {
1249 vertices[2 * i] =
fXY[i + 4][0] + cf * (
fXY[i][0] -
fXY[i + 4][0]);
1250 vertices[2 * i + 1] =
fXY[i + 4][1] + cf * (
fXY[i][1] -
fXY[i + 4][1]);
1264 for (
Int_t i = 0; i < 8; i++) {
1265 fXY[i][0] = param[2 * i + 1];
1266 fXY[i][1] = param[2 * i + 2];
1277 for (
Int_t i = 0; i < 8; i++) {
1289 for (
Int_t i = 0; i < 8; i++) {
1301 if (vnum < 0 || vnum > 7) {
1302 Error(
"SetVertex",
"Invalid vertex number");
1341 for (
Int_t i = 0; i < vecsize; i++)
1352 for (
Int_t i = 0; i < vecsize; i++)
1362 for (
Int_t i = 0; i < vecsize; i++)
1372 for (
Int_t i = 0; i < vecsize; i++)
1383 for (
Int_t i = 0; i < vecsize; i++)
1433 fXY[0][0] = -dz * tx -
h1 * ta1 - bl1;
1434 fXY[0][1] = -dz * ty -
h1;
1435 fXY[1][0] = -dz * tx +
h1 * ta1 - tl1;
1436 fXY[1][1] = -dz * ty +
h1;
1437 fXY[2][0] = -dz * tx +
h1 * ta1 + tl1;
1438 fXY[2][1] = -dz * ty +
h1;
1439 fXY[3][0] = -dz * tx -
h1 * ta1 + bl1;
1440 fXY[3][1] = -dz * ty -
h1;
1441 fXY[4][0] = dz * tx - h2 * ta2 - bl2;
1442 fXY[4][1] = dz * ty - h2;
1443 fXY[5][0] = dz * tx + h2 * ta2 - tl2;
1444 fXY[5][1] = dz * ty + h2;
1445 fXY[6][0] = dz * tx + h2 * ta2 + tl2;
1446 fXY[6][1] = dz * ty + h2;
1447 fXY[7][0] = dz * tx - h2 * ta2 + bl2;
1448 fXY[7][1] = dz * ty - h2;
1450 if ((dz < 0) || (
h1 < 0) || (bl1 < 0) || (tl1 < 0) || (h2 < 0) || (bl2 < 0) || (tl2 < 0)) {
1475 for (
Int_t i = 0; i < 8; i++) {
1483 fXY[0][0] = -dz * tx -
h1 * ta1 - bl1;
1484 fXY[0][1] = -dz * ty -
h1;
1485 fXY[1][0] = -dz * tx +
h1 * ta1 - tl1;
1486 fXY[1][1] = -dz * ty +
h1;
1487 fXY[2][0] = -dz * tx +
h1 * ta1 + tl1;
1488 fXY[2][1] = -dz * ty +
h1;
1489 fXY[3][0] = -dz * tx -
h1 * ta1 + bl1;
1490 fXY[3][1] = -dz * ty -
h1;
1491 fXY[4][0] = dz * tx - h2 * ta2 - bl2;
1492 fXY[4][1] = dz * ty - h2;
1493 fXY[5][0] = dz * tx + h2 * ta2 - tl2;
1494 fXY[5][1] = dz * ty + h2;
1495 fXY[6][0] = dz * tx + h2 * ta2 + tl2;
1496 fXY[6][1] = dz * ty + h2;
1497 fXY[7][0] = dz * tx - h2 * ta2 + bl2;
1498 fXY[7][1] = dz * ty - h2;
1500 if ((dz < 0) || (
h1 < 0) || (bl1 < 0) || (tl1 < 0) || (h2 < 0) || (bl2 < 0) || (tl2 < 0)) {
1517 if (iact < 3 && safe) {
1522 if (iact == 1 && step < *safe)
1535 distmin = (-
fDz - point[2]) / dir[2];
1538 distmin = (
fDz - point[2]) / dir[2];
1544 for (
Int_t ipl = 0; ipl < 4; ipl++) {
1545 Int_t j = (ipl + 1) % 4;
1548 xb =
fXY[ipl + 4][0];
1549 yb =
fXY[ipl + 4][1];
1559 Double_t ddotn = -dir[0] * az * by + dir[1] * az * bx + dir[2] * (ax * by - ay * bx);
1562 Double_t saf = -(point[0] - xa) * az * by + (point[1] - ya) * az * bx + (point[2] +
fDz) * (ax * by - ay * bx);
1578 if (iact < 3 && safe) {
1583 if (iact == 1 && step < *safe)
1600 xnew = point[0] + snxt * dir[0];
1601 ynew = point[1] + snxt * dir[1];
1602 for (i = 0; i < 4; i++) {
1605 pts[j + 1] =
fXY[i][1];
1614 xnew = point[0] + snxt * dir[0];
1615 ynew = point[1] + snxt * dir[1];
1616 for (i = 0; i < 4; i++) {
1618 pts[j] =
fXY[i + 4][0];
1619 pts[j + 1] =
fXY[i + 4][1];
1633 for (i = 0; i < 4; i++) {
1648 ddotn = -dir[0] * az * by + dir[1] * az * bx + dir[2] * (ax * by - ay * bx);
1649 saf = (point[0] - xa) * az * by - (point[1] - ya) * az * bx - (point[2] +
fDz) * (ax * by - ay * bx);
1657 znew = point[2] + snxt * dir[2];
1659 xnew = point[0] + snxt * dir[0];
1660 ynew = point[1] + snxt * dir[1];
1671 if ((xnew - xs1) * (xs2 - xnew) >= 0)
1674 if ((ynew - ys1) * (ys2 - ynew) >= 0)
1690 if (saf > 0 && saf < safmin)
1691 exiting = (point[2] * dir[2] > 0) ?
kTRUE :
kFALSE;
1715 Error(
"Divide",
"cannot divide trapezoids on other axis than Z");
1718 Double_t end = start + ndiv * step;
1729 for (
Int_t idiv = 0; idiv < ndiv; idiv++) {
1730 zmin = start + idiv * step;
1731 zmax = start + (idiv + 1) * step;
1732 oz = start + idiv * step + step / 2;
1738 for (
Int_t vert1 = 0; vert1 < 4; vert1++)
1739 ((
TGeoArb8 *)shape)->SetVertex(vert1, points_lo[2 * vert1] - ox, points_lo[2 * vert1 + 1] - oy);
1740 for (
Int_t vert2 = 0; vert2 < 4; vert2++)
1741 ((
TGeoArb8 *)shape)->SetVertex(vert2 + 4, points_hi[2 * vert2] - ox, points_hi[2 * vert2 + 1] - oy);
1759 Error(
"GetMakeRuntimeShape",
"invalid mother");
1764 dz = ((
TGeoTrap *)mother)->GetDz();
1774 h2 = ((
TGeoTrap *)mother)->GetH2();
1779 bl1 = ((
TGeoTrap *)mother)->GetBl1();
1784 bl2 = ((
TGeoTrap *)mother)->GetBl2();
1789 tl1 = ((
TGeoTrap *)mother)->GetTl1();
1794 tl2 = ((
TGeoTrap *)mother)->GetTl2();
1798 return (
new TGeoTrap(dz,
fTheta,
fPhi,
h1, bl1, tl1,
fAlpha1, h2, bl2, tl2,
fAlpha2));
1810 Double_t ax, ay, az = z1 - z0, bx, by;
1813 for (i = 0; i < 4; i++) {
1839 norm[2] = ax * by - ay * bx;
1840 fn =
TMath::Sqrt(norm[0] * norm[0] + norm[1] * norm[1] + norm[2] * norm[2]);
1843 saf[i] = (x0 - point[0]) * norm[0] + (y0 - point[1]) * norm[1] + (-
fDz - point[2]) * norm[2];
1847 saf[i] = -saf[i] / fn;
1853 for (j = 1; j < 5; j++)
1859 for (j = 1; j < 5; j++)
1873 out <<
" // Shape: " <<
GetName() <<
" type: " <<
ClassName() << std::endl;
1874 out <<
" dz = " <<
fDz <<
";" << std::endl;
1875 out <<
" theta = " <<
fTheta <<
";" << std::endl;
1876 out <<
" phi = " <<
fPhi <<
";" << std::endl;
1877 out <<
" h1 = " <<
fH1 <<
";" << std::endl;
1878 out <<
" bl1 = " <<
fBl1 <<
";" << std::endl;
1879 out <<
" tl1 = " <<
fTl1 <<
";" << std::endl;
1880 out <<
" alpha1 = " <<
fAlpha1 <<
";" << std::endl;
1881 out <<
" h2 = " <<
fH2 <<
";" << std::endl;
1882 out <<
" bl2 = " <<
fBl2 <<
";" << std::endl;
1883 out <<
" tl2 = " <<
fTl2 <<
";" << std::endl;
1884 out <<
" alpha2 = " <<
fAlpha2 <<
";" << std::endl;
1886 <<
"\", dz,theta,phi,h1,bl1,tl1,alpha1,h2,bl2,tl2,alpha2);" << std::endl;
1950 for (
Int_t i = 0; i < vecsize; i++)
1960 for (
Int_t i = 0; i < vecsize; i++)
1971 for (
Int_t i = 0; i < vecsize; i++)
1990 :
TGeoTrap(dz, theta, phi,
h1, bl1, tl1, alpha1, h2, bl2, tl2, alpha2)
2002 for (i = 0; i < 4; i++) {
2013 for (i = 4; i < 8; i++) {
2022 if ((dz < 0) || (
h1 < 0) || (bl1 < 0) || (tl1 < 0) || (h2 < 0) || (bl2 < 0) || (tl2 < 0))
2034 :
TGeoTrap(
name, dz, theta, phi,
h1, bl1, tl1, alpha1, h2, bl2, tl2, alpha2)
2046 for (i = 0; i < 4; i++) {
2057 for (i = 4; i < 8; i++) {
2066 if ((dz < 0) || (
h1 < 0) || (bl1 < 0) || (tl1 < 0) || (h2 < 0) || (bl2 < 0) || (tl2 < 0))
2083 if (iact < 3 && safe) {
2088 if (iact == 1 && step < *safe)
2101 if (iact < 3 && safe) {
2106 if (iact == 1 && step < *safe)
2122 Error(
"GetMakeRuntimeShape",
"invalid mother");
2127 dz = ((
TGeoTrap *)mother)->GetDz();
2135 h2 = ((
TGeoTrap *)mother)->GetH2();
2139 bl1 = ((
TGeoTrap *)mother)->GetBl1();
2143 bl2 = ((
TGeoTrap *)mother)->GetBl2();
2147 tl1 = ((
TGeoTrap *)mother)->GetTl1();
2151 tl2 = ((
TGeoTrap *)mother)->GetTl2();
2154 return (
new TGeoGtra(dz,
fTheta,
fPhi,
fTwistAngle,
h1, bl1, tl1,
fAlpha1, h2, bl2, tl2,
fAlpha2));
2172 out <<
" // Shape: " <<
GetName() <<
" type: " <<
ClassName() << std::endl;
2173 out <<
" dz = " <<
fDz <<
";" << std::endl;
2174 out <<
" theta = " <<
fTheta <<
";" << std::endl;
2175 out <<
" phi = " <<
fPhi <<
";" << std::endl;
2176 out <<
" twist = " <<
fTwistAngle <<
";" << std::endl;
2177 out <<
" h1 = " <<
fH1 <<
";" << std::endl;
2178 out <<
" bl1 = " <<
fBl1 <<
";" << std::endl;
2179 out <<
" tl1 = " <<
fTl1 <<
";" << std::endl;
2180 out <<
" alpha1 = " <<
fAlpha1 <<
";" << std::endl;
2181 out <<
" h2 = " <<
fH2 <<
";" << std::endl;
2182 out <<
" bl2 = " <<
fBl2 <<
";" << std::endl;
2183 out <<
" tl2 = " <<
fTl2 <<
";" << std::endl;
2184 out <<
" alpha2 = " <<
fAlpha2 <<
";" << std::endl;
2186 <<
"\", dz,theta,phi,twist,h1,bl1,tl1,alpha1,h2,bl2,tl2,alpha2);" << std::endl;
2219 for (i = 0; i < 4; i++) {
2230 for (i = 4; i < 8; i++) {
2251 for (
Int_t i = 0; i < vecsize; i++)
2261 for (
Int_t i = 0; i < vecsize; i++)
2272 for (
Int_t i = 0; i < vecsize; i++)
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t points
Option_t Option_t TPoint TPoint const char y1
R__EXTERN TGeoManager * gGeoManager
Buffer base class used for serializing objects.
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=nullptr)=0
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
An arbitrary trapezoid with less than 8 vertices standing on two parallel planes perpendicular to Z a...
void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override
Compute safe distance from each of the points in the input array.
virtual void SetVertex(Int_t vnum, Double_t x, Double_t y)
Set values for a given vertex.
void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
Compute distance from array of input points having directions specified by dirs. Store output in dist...
Double_t GetClosestEdge(const Double_t *point, Double_t *vert, Int_t &isegment) const
Get index of the edge of the quadrilater represented by vert closest to point.
Double_t fXY[8][2]
[4] tangents of twist angles
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
void SetPoints(Double_t *points) const override
Creates arb8 mesh points.
void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) override
Compute normal to closest surface from POINT.
void CopyTwist(Double_t *twist=nullptr)
Copy twist values from source array.
void SetDimensions(Double_t *param) override
Set all arb8 params in one step.
Bool_t Contains(const Double_t *point) const override
Test if point is inside this shape.
static void GetPlaneNormal(Double_t *p1, Double_t *p2, Double_t *p3, Double_t *norm)
Computes normal to plane defined by P1, P2 and P3.
Bool_t GetPointsOnFacet(Int_t, Int_t, Double_t *) const override
Fills array with n random points located on the surface of indexed facet.
void ComputeTwist()
Computes tangents of twist angles (angles between projections on XY plane of corresponding -dz +dz ed...
Double_t DistToPlane(const Double_t *point, const Double_t *dir, Int_t ipl, Bool_t in) const
Computes distance to plane ipl :
void Streamer(TBuffer &) override
Stream an object of class TGeoManager.
static Bool_t InsidePolygon(Double_t x, Double_t y, Double_t *pts)
Finds if a point in XY plane is inside the polygon defines by PTS.
TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override
Divide this shape along one axis.
void GetBoundingCylinder(Double_t *param) const override
Fill vector param[4] with the bounding cylinder parameters.
Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const override
Get shape range on a given axis.
Double_t Capacity() const override
Computes capacity of the shape in [length^3].
Double_t SafetyToFace(const Double_t *point, Int_t iseg, Bool_t in) const
Estimate safety to lateral plane defined by segment iseg in range [0,3] Might be negative: plane seen...
void Sizeof3D() const override
Fill size of this 3-D object.
Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=nullptr) const override
Computes distance from outside point to surface of the shape.
void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const override
Check the inside status for each of the points in the array.
void InspectShape() const override
Prints shape parameters.
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const override
Computes the closest distance from given point to this shape.
TGeoArb8()
Default constructor.
Double_t GetTwist(Int_t iseg) const
Get twist for segment I in range [0,3].
Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=nullptr) const override
Compute distance from inside point to surface of the shape.
void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize) override
Compute the normal for an array o points so that norm.dot.dir is positive Input: Arrays of point coor...
static Bool_t IsSamePoint(const Double_t *p1, const Double_t *p2)
~TGeoArb8() override
Destructor.
void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
Compute distance from array of input points having directions specified by dirs. Store output in dist...
void SetPlaneVertices(Double_t zpl, Double_t *vertices) const
Computes intersection points between plane at zpl and non-horizontal edges.
void ComputeBBox() override
Computes bounding box for an Arb8 shape.
Int_t GetFittingBox(const TGeoBBox *parambox, TGeoMatrix *mat, Double_t &dx, Double_t &dy, Double_t &dz) const override
Fills real parameters of a positioned box inside this arb8. Returns 0 if successful.
virtual const Double_t * GetOrigin() const
Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=nullptr) const override
Compute distance from outside point to surface of the box.
virtual Double_t GetDX() const
virtual Double_t GetDZ() const
virtual Double_t GetDY() const
void InspectShape() const override
Prints shape parameters.
Bool_t Contains(const Double_t *point) const override
Test if point is inside this shape.
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const override
Computes the closest distance from given point to this shape.
void Sizeof3D() const override
void SetDimensions(Double_t *param) override
Set all arb8 params in one step.
Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=nullptr) const override
Compute distance from inside point to surface of the shape.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
Compute distance from array of input points having directions specified by dirs. Store output in dist...
TGeoShape * GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const override
In case shape has some negative parameters, these has to be computed in order to fit the mother.
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const override
Computes the closest distance from given point to this shape.
void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override
Compute safe distance from each of the points in the input array.
void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
Compute distance from array of input points having directions specified by dirs. Store output in dist...
Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=nullptr) const override
Compute distance from inside point to surface of the shape.
~TGeoGtra() override
Destructor.
TGeoVolumeMulti * MakeVolumeMulti(const char *name, TGeoMedium *medium)
Make a TGeoVolumeMulti handling a list of volumes.
Geometrical transformation package.
Bool_t IsRotation() const
virtual void LocalToMaster(const Double_t *local, Double_t *master) const
convert a point by multiplying its column vector (x, y, z, 1) to matrix inverse
Node containing an offset.
Base finder class for patterns.
void SetDivIndex(Int_t index)
Base abstract class for all shapes.
static Bool_t IsSegCrossing(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Double_t x3, Double_t y3, Double_t x4, Double_t y4)
Check if segments (A,B) and (C,D) are crossing, where: A(x1,y1), B(x2,y2), C(x3,y3),...
void SetShapeBit(UInt_t f, Bool_t set)
Equivalent of TObject::SetBit.
static Bool_t IsSameWithinTolerance(Double_t a, Double_t b)
Check if two numbers differ with less than a tolerance.
Bool_t IsRunTimeShape() const
const char * GetPointerName() const
Provide a pointer name containing uid.
const char * GetName() const override
Get the shape name.
static Double_t Tolerance()
Bool_t TestShapeBit(UInt_t f) const
~TGeoTrap() override
Destructor.
void SetDimensions(Double_t *param) override
Set all arb8 params in one step.
Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=nullptr) const override
Compute distance from inside point to surface of the trapezoid.
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const override
Computes the closest distance from given point to this shape.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
Compute distance from array of input points having directions specified by dirs. Store output in dist...
void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override
Compute safe distance from each of the points in the input array.
TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override
Divide this trapezoid shape belonging to volume "voldiv" into ndiv volumes called divname,...
void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
Compute distance from array of input points having directions specified by dirs. Store output in dist...
TGeoShape * GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const override
In case shape has some negative parameters, these have to be computed in order to fit the mother.
Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=nullptr) const override
Compute distance from outside point to surface of the trapezoid.
void AddVolume(TGeoVolume *vol)
Add a volume with valid shape to the list of volumes.
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
void AddNodeOffset(TGeoVolume *vol, Int_t copy_no, Double_t offset=0, Option_t *option="")
Add a division node to the list of nodes.
TGeoMedium * GetMedium() const
void SetFinder(TGeoPatternFinder *finder)
Int_t GetNdaughters() const
virtual void SetName(const char *name)
Set the name of the TNamed.
TObject * At(Int_t idx) const override
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual const char * ClassName() const
Returns name of class to which the object belongs.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
const char * Data() const
Long64_t LocMin(Long64_t n, const T *a)
Returns index of array with the minimum element.
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
T1 Sign(T1 a, T2 b)
Returns a value with the magnitude of a and the sign of b.
Long64_t LocMax(Long64_t n, const T *a)
Returns index of array with the maximum element.
constexpr Double_t DegToRad()
Conversion from degree to radian: .
Double_t Sqrt(Double_t x)
Returns the square root of x.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Double_t Tan(Double_t)
Returns the tangent of an angle of x radians.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
#define snext(osub1, osub2)