161 SetTubeDimensions(rmin, rmax, dz);
162 if ((fDz < 0) || (fRmin < 0) || (fRmax < 0)) {
163 SetShapeBit(kGeoRunTimeShape);
175 SetTubeDimensions(rmin, rmax, dz);
176 if ((fDz < 0) || (fRmin < 0) || (fRmax < 0)) {
177 SetShapeBit(kGeoRunTimeShape);
193 SetDimensions(param);
194 if ((fDz < 0) || (fRmin < 0) || (fRmax < 0))
195 SetShapeBit(kGeoRunTimeShape);
236 Double_t rsq = point[0] * point[0] + point[1] * point[1];
243 norm[0] = norm[1] = 0.;
251 if (norm[0] * dir[0] + norm[1] * dir[1] < 0) {
267 if (norm[0] * dir[0] + norm[1] * dir[1] < 0) {
280 Double_t r2 = point[0] * point[0] + point[1] * point[1];
294 numPoints = 2 * (
n + 1);
309 sz = (
TMath::Sign(dz, dir[2]) - point[2]) / dir[2];
314 Double_t nsq = dir[0] * dir[0] + dir[1] * dir[1];
317 Double_t rsq = point[0] * point[0] + point[1] * point[1];
318 Double_t rdotn = point[0] * dir[0] + point[1] * dir[1];
358 if (iact < 3 && safe) {
362 if ((iact == 1) && (*safe > step))
384 if (point[2] * dir[2] >= 0)
387 xi = point[0] + s * dir[0];
388 yi = point[1] + s * dir[1];
390 if ((rminsq <= r2) && (r2 <= rmaxsq))
394 Double_t rsq = point[0] * point[0] + point[1] * point[1];
396 Double_t nsq = dir[0] * dir[0] + dir[1] * dir[1];
397 Double_t rdotn = point[0] * dir[0] + point[1] * dir[1];
405 in = inz & inrmin & inrmax;
412 if (point[2] * dir[2] < 0)
417 if ((rmaxsq - rsq) < (rsq - rminsq))
435 zi = point[2] + s * dir[2];
450 zi = point[2] + s * dir[2];
462 zi = point[2] + s * dir[2];
479 if (iact < 3 && safe) {
483 if ((iact == 1) && (step <= *safe))
507 Double_t t3 = rsq - (radius * radius);
542 for (
id = 0;
id < ndiv;
id++) {
543 shape =
new TGeoTube(start +
id * step, start + (
id + 1) * step,
fDz);
560 for (
id = 0;
id < ndiv;
id++) {
566 finder =
new TGeoPatternZ(voldiv, ndiv, start, start + ndiv * step);
574 for (
id = 0;
id < ndiv;
id++) {
579 default:
Error(
"Divide",
"In shape %s wrong axis type for division",
GetName());
return nullptr;
590 case 2:
return "PHI";
592 default:
return "UNDEFINED";
631 param[0] *= param[0];
633 param[1] *= param[1];
677 printf(
"*** Shape %s: TGeoTube ***\n",
GetName());
678 printf(
" Rmin = %11.5f\n",
fRmin);
679 printf(
" Rmax = %11.5f\n",
fRmax);
680 printf(
" dz = %11.5f\n",
fDz);
681 printf(
" Bounding box:\n");
696 nbPnts = 2 * (
n + 1);
727 for (i = 0; i < 4; i++) {
728 for (j = 0; j <
n; j++) {
729 indx = 3 * (i *
n + j);
731 buffer.
fSegs[indx + 1] = i *
n + j;
732 buffer.
fSegs[indx + 2] = i *
n + (j + 1) %
n;
738 for (i = 4; i < 6; i++) {
739 for (j = 0; j <
n; j++) {
740 indx = 3 * (i *
n + j);
741 buffer.
fSegs[indx] =
c + 1;
742 buffer.
fSegs[indx + 1] = (i - 4) *
n + j;
743 buffer.
fSegs[indx + 2] = (i - 2) *
n + j;
749 for (i = 6; i < 8; i++) {
750 for (j = 0; j <
n; j++) {
751 indx = 3 * (i *
n + j);
753 buffer.
fSegs[indx + 1] = 2 * (i - 6) *
n + j;
754 buffer.
fSegs[indx + 2] = (2 * (i - 6) + 1) *
n + j;
760 for (j = 0; j <
n; j++) {
761 indx = 6 * (i *
n + j);
763 buffer.
fPols[indx + 1] = 4;
764 buffer.
fPols[indx + 2] = j;
765 buffer.
fPols[indx + 3] = 4 *
n + (j + 1) %
n;
766 buffer.
fPols[indx + 4] = 2 *
n + j;
767 buffer.
fPols[indx + 5] = 4 *
n + j;
771 for (j = 0; j <
n; j++) {
772 indx = 6 * (i *
n + j);
773 buffer.
fPols[indx] =
c + 1;
774 buffer.
fPols[indx + 1] = 4;
775 buffer.
fPols[indx + 2] =
n + j;
776 buffer.
fPols[indx + 3] = 5 *
n + j;
777 buffer.
fPols[indx + 4] = 3 *
n + j;
778 buffer.
fPols[indx + 5] = 5 *
n + (j + 1) %
n;
782 for (j = 0; j <
n; j++) {
783 indx = 6 * (i *
n + j);
785 buffer.
fPols[indx + 1] = 4;
786 buffer.
fPols[indx + 2] = j;
787 buffer.
fPols[indx + 3] = 6 *
n + j;
788 buffer.
fPols[indx + 4] =
n + j;
789 buffer.
fPols[indx + 5] = 6 *
n + (j + 1) %
n;
793 for (j = 0; j <
n; j++) {
794 indx = 6 * (i *
n + j);
796 buffer.
fPols[indx + 1] = 4;
797 buffer.
fPols[indx + 2] = 2 *
n + j;
798 buffer.
fPols[indx + 3] = 7 *
n + (j + 1) %
n;
799 buffer.
fPols[indx + 4] = 3 *
n + j;
800 buffer.
fPols[indx + 5] = 7 *
n + j;
808 for (i = 0; i < 2; i++) {
809 for (j = 0; j <
n; j++) {
810 indx = 3 * (i *
n + j);
812 buffer.
fSegs[indx + 1] = 2 + i *
n + j;
813 buffer.
fSegs[indx + 2] = 2 + i *
n + (j + 1) %
n;
817 for (j = 0; j <
n; j++) {
818 indx = 3 * (2 *
n + j);
819 buffer.
fSegs[indx] =
c + 1;
820 buffer.
fSegs[indx + 1] = 2 + j;
821 buffer.
fSegs[indx + 2] = 2 +
n + j;
826 for (i = 3; i < 5; i++) {
827 for (j = 0; j <
n; j++) {
828 indx = 3 * (i *
n + j);
830 buffer.
fSegs[indx + 1] = i - 3;
831 buffer.
fSegs[indx + 2] = 2 + (i - 3) *
n + j;
836 for (j = 0; j <
n; j++) {
838 buffer.
fPols[indx] =
c + 1;
839 buffer.
fPols[indx + 1] = 4;
840 buffer.
fPols[indx + 2] = j;
841 buffer.
fPols[indx + 3] = 2 *
n + j;
842 buffer.
fPols[indx + 4] =
n + j;
843 buffer.
fPols[indx + 5] = 2 *
n + (j + 1) %
n;
846 for (j = 0; j <
n; j++) {
847 indx = 6 *
n + 5 * j;
849 buffer.
fPols[indx + 1] = 3;
850 buffer.
fPols[indx + 2] = j;
851 buffer.
fPols[indx + 3] = 3 *
n + (j + 1) %
n;
852 buffer.
fPols[indx + 4] = 3 *
n + j;
855 for (j = 0; j <
n; j++) {
856 indx = 6 *
n + 5 *
n + 5 * j;
858 buffer.
fPols[indx + 1] = 3;
859 buffer.
fPols[indx + 2] =
n + j;
860 buffer.
fPols[indx + 3] = 4 *
n + j;
861 buffer.
fPols[indx + 4] = 4 *
n + (j + 1) %
n;
898 Double_t rsq = point[0] * point[0] + point[1] * point[1];
905 for (
Int_t i = 0; i < 3; i++)
918 Double_t rsq = point[0] * point[0] + point[1] * point[1];
922 saf[0] = dz - point[2];
925 saf[0] = dz + point[2];
937 for (
Int_t i = 0; i < 3; i++)
950 out <<
" rmin = " <<
fRmin <<
";" << std::endl;
951 out <<
" rmax = " <<
fRmax <<
";" << std::endl;
952 out <<
" dz = " <<
fDz <<
";" << std::endl;
966 Error(
"SetTubeDimensions",
"In shape %s wrong rmin=%g rmax=%g",
GetName(), rmin, rmax);
987 if (npoints > (npoints / 2) * 2) {
988 Error(
"GetPointsOnSegments",
"Npoints must be even number");
1000 ntop = npoints / 2 - nc * (nc - 1);
1002 ntop = npoints - nc * (nc - 1);
1008 for (
Int_t i = 0; i < nc; i++) {
1013 for (
Int_t j = 0; j < nphi; j++) {
1045 for (j = 0; j <
n; j++) {
1057 for (j = 0; j <
n; j++) {
1077 for (j = 0; j <
n; j++) {
1108 for (j = 0; j <
n; j++) {
1120 for (j = 0; j <
n; j++) {
1140 for (j = 0; j <
n; j++) {
1162 numPoints = 2 * (
n + 1);
1176 nvert = 2 * (
n + 1);
1211 nbPnts = 2 * (
n + 1);
1215 if (buffer.
SetRawSizes(nbPnts, 3 * nbPnts, nbSegs, 3 * nbSegs, nbPols, 6 * nbPols)) {
1238 for (
Int_t i = 0; i < vecsize; i++)
1249 for (
Int_t i = 0; i < vecsize; i++)
1259 for (
Int_t i = 0; i < vecsize; i++)
1269 for (
Int_t i = 0; i < vecsize; i++)
1280 for (
Int_t i = 0; i < vecsize; i++)
1290 :
TGeoTube(), fPhi1(0.), fPhi2(0.), fS1(0.), fC1(0.), fS2(0.), fC2(0.), fSm(0.), fCm(0.), fCdfi(0.)
1300 :
TGeoTube(rmin, rmax, dz), fPhi1(0.), fPhi2(0.), fS1(0.), fC1(0.), fS2(0.), fC2(0.), fSm(0.), fCm(0.), fCdfi(0.)
1303 SetTubsDimensions(rmin, rmax, dz, phiStart, phiEnd);
1316 SetTubsDimensions(rmin, rmax, dz, phiStart, phiEnd);
1331 SetDimensions(param);
1359 Double_t fio = 0.5 * (phi1 + phi2);
1362 Double_t dfi = 0.5 * (phi2 - phi1);
1449 Double_t rsq = point[0] * point[0] + point[1] * point[1];
1460 norm[0] = norm[1] = 0.;
1468 if (norm[0] * dir[0] + norm[1] * dir[1] < 0) {
1481 Double_t rsq = point[0] * point[0] + point[1] * point[1];
1494 if (norm[0] * dir[0] + norm[1] * dir[1] < 0) {
1517 const Int_t numPoints = 4 *
n;
1533 Double_t rsq = point[0] * point[0] + point[1] * point[1];
1535 Double_t cpsi = point[0] * cm + point[1] * sm;
1544 ddotn =
s1 * dir[0] -
c1 * dir[1];
1547 ddotn = -s2 * dir[0] +
c2 * dir[1];
1550 Double_t sfmin = s2 * point[0] -
c2 * point[1];
1556 xi = point[0] + sfmin * dir[0];
1557 yi = point[1] + sfmin * dir[1];
1558 if (yi * cm - xi * sm < 0)
1562 ddotn = -s2 * dir[0] +
c2 * dir[1];
1565 ddotn =
s1 * dir[0] -
c1 * dir[1];
1574 xi = point[0] + sfmin * dir[0];
1575 yi = point[1] + sfmin * dir[1];
1576 if (yi * cm - xi * sm > 0)
1588 if (iact < 3 && safe) {
1592 if ((iact == 1) && (*safe > step))
1599 return TGeoTubeSeg::DistFromInsideS(point, dir,
fRmin,
fRmax,
fDz,
fC1,
fS1,
fC2,
fS2,
fCm,
fSm,
fCdfi);
1620 if (point[2] * dir[2] >= 0)
1623 xi = point[0] + s * dir[0];
1624 yi = point[1] + s * dir[1];
1625 r2 = xi * xi + yi * yi;
1626 if ((rminsq <= r2) && (r2 <= rmaxsq)) {
1634 Double_t rsq = point[0] * point[0] + point[1] * point[1];
1636 Double_t nsq = dir[0] * dir[0] + dir[1] * dir[1];
1637 Double_t rdotn = point[0] * dir[0] + point[1] * dir[1];
1646 cpsi = point[0] * cm + point[1] * sm;
1649 in = inz & inrmin & inrmax & inphi;
1656 if (zi < rmax -
r) {
1659 if (point[2] * dir[2] < 0)
1665 if ((rmaxsq - rsq) < (rsq - rminsq))
1668 if (checkout && (rmax -
r < safphi)) {
1680 if (point[0] *
c1 + point[1] *
s1 > point[0] *
c2 + point[1] * s2) {
1681 un = dir[0] *
s1 - dir[1] *
c1;
1686 un = -dir[0] * s2 + dir[1] *
c2;
1688 s = -point[0] * s2 + point[1] *
c2;
1691 zi = point[2] + s * dir[2];
1693 xi = point[0] + s * dir[0];
1694 yi = point[1] + s * dir[1];
1695 r2 = xi * xi + yi * yi;
1696 if ((rminsq <= r2) && (r2 <= rmaxsq)) {
1697 if ((yi * cm - xi * sm) > 0)
1704 un = -dir[0] * s2 + dir[1] *
c2;
1709 un = dir[0] *
s1 - dir[1] *
c1;
1711 s = point[0] *
s1 - point[1] *
c1;
1714 zi = point[2] + s * dir[2];
1716 xi = point[0] + s * dir[0];
1717 yi = point[1] + s * dir[1];
1718 r2 = xi * xi + yi * yi;
1719 if ((rminsq <= r2) && (r2 <= rmaxsq)) {
1720 if ((yi * cm - xi * sm) < 0)
1736 zi = point[2] + s * dir[2];
1738 xi = point[0] + s * dir[0];
1739 yi = point[1] + s * dir[1];
1740 if ((xi * cm + yi * sm) >= rmin * cdfi)
1754 zi = point[2] + s * dir[2];
1757 xi = point[0] + s * dir[0];
1758 yi = point[1] + s * dir[1];
1759 if ((xi * cm + yi * sm) >= rmin * cdfi)
1764 s = point[0] *
s1 - point[1] *
c1;
1767 zi = point[2] + s * dir[2];
1769 xi = point[0] + s * dir[0];
1770 yi = point[1] + s * dir[1];
1771 r2 = xi * xi + yi * yi;
1772 if ((rminsq <= r2) && (r2 <= rmaxsq)) {
1773 if ((yi * cm - xi * sm) <= 0) {
1781 un = dir[0] * s2 - dir[1] *
c2;
1783 s = (point[1] *
c2 - point[0] * s2) / un;
1784 if (s >= 0 && s < snxt) {
1785 zi = point[2] + s * dir[2];
1787 xi = point[0] + s * dir[0];
1788 yi = point[1] + s * dir[1];
1789 r2 = xi * xi + yi * yi;
1790 if ((rminsq <= r2) && (r2 <= rmaxsq)) {
1791 if ((yi * cm - xi * sm) >= 0) {
1807 if (rsq >= rmax * rmax) {
1814 zi = point[2] + s * dir[2];
1816 xi = point[0] + s * dir[0];
1817 yi = point[1] + s * dir[1];
1818 cpsi = xi * cm + yi * sm;
1819 if (cpsi >= rmax * cdfi)
1831 zi = point[2] + s * dir[2];
1833 xi = point[0] + s * dir[0];
1834 yi = point[1] + s * dir[1];
1835 cpsi = xi * cm + yi * sm;
1836 if (cpsi >= rmin * cdfi)
1845 s = point[0] *
s1 - point[1] *
c1;
1848 zi = point[2] + s * dir[2];
1850 xi = point[0] + s * dir[0];
1851 yi = point[1] + s * dir[1];
1852 r2 = xi * xi + yi * yi;
1853 if ((rminsq <= r2) && (r2 <= rmaxsq)) {
1854 if ((yi * cm - xi * sm) <= 0) {
1862 un = dir[0] * s2 - dir[1] *
c2;
1864 s = point[1] *
c2 - point[0] * s2;
1867 zi = point[2] + s * dir[2];
1869 xi = point[0] + s * dir[0];
1870 yi = point[1] + s * dir[1];
1871 r2 = xi * xi + yi * yi;
1872 if ((rminsq <= r2) && (r2 <= rmaxsq)) {
1873 if ((yi * cm - xi * sm) >= 0) {
1891 if (iact < 3 && safe) {
1895 if ((iact == 1) && (step <= *safe))
1906 return TGeoTubeSeg::DistFromOutsideS(point, dir,
fRmin,
fRmax,
fDz,
fC1,
fS1,
fC2,
fS2,
fCm,
fSm,
fCdfi);
1934 for (
id = 0;
id < ndiv;
id++) {
1960 for (
id = 0;
id < ndiv;
id++) {
1974 for (
id = 0;
id < ndiv;
id++) {
1979 default:
Error(
"Divide",
"In shape %s wrong axis type for division",
GetName());
return nullptr;
2018 param[0] *= param[0];
2020 param[1] *= param[1];
2034 Error(
"GetMakeRuntimeShape",
"Invalid mother for shape %s",
GetName());
2042 dz = ((
TGeoTube *)mother)->GetDz();
2044 rmin = ((
TGeoTube *)mother)->GetRmin();
2046 rmax = ((
TGeoTube *)mother)->GetRmax();
2056 printf(
"*** Shape %s: TGeoTubeSeg ***\n",
GetName());
2057 printf(
" Rmin = %11.5f\n",
fRmin);
2058 printf(
" Rmax = %11.5f\n",
fRmax);
2059 printf(
" dz = %11.5f\n",
fDz);
2060 printf(
" phi1 = %11.5f\n",
fPhi1);
2061 printf(
" phi2 = %11.5f\n",
fPhi2);
2062 printf(
" Bounding box:\n");
2074 Int_t nbSegs = 2 * nbPnts;
2075 Int_t nbPols = nbPnts - 2;
2097 for (i = 0; i < 4; i++) {
2098 for (j = 1; j <
n; j++) {
2099 buff.
fSegs[(i *
n + j - 1) * 3] =
c;
2100 buff.
fSegs[(i *
n + j - 1) * 3 + 1] = i *
n + j - 1;
2101 buff.
fSegs[(i *
n + j - 1) * 3 + 2] = i *
n + j;
2104 for (i = 4; i < 6; i++) {
2105 for (j = 0; j <
n; j++) {
2106 buff.
fSegs[(i *
n + j) * 3] =
c + 1;
2107 buff.
fSegs[(i *
n + j) * 3 + 1] = (i - 4) *
n + j;
2108 buff.
fSegs[(i *
n + j) * 3 + 2] = (i - 2) *
n + j;
2111 for (i = 6; i < 8; i++) {
2112 for (j = 0; j <
n; j++) {
2113 buff.
fSegs[(i *
n + j) * 3] =
c;
2114 buff.
fSegs[(i *
n + j) * 3 + 1] = 2 * (i - 6) *
n + j;
2115 buff.
fSegs[(i *
n + j) * 3 + 2] = (2 * (i - 6) + 1) *
n + j;
2122 for (j = 0; j <
n - 1; j++) {
2124 buff.
fPols[indx++] = 4;
2125 buff.
fPols[indx++] = (4 + i) *
n + j + 1;
2126 buff.
fPols[indx++] = (2 + i) *
n + j;
2127 buff.
fPols[indx++] = (4 + i) *
n + j;
2128 buff.
fPols[indx++] = i *
n + j;
2131 for (j = 0; j <
n - 1; j++) {
2133 buff.
fPols[indx++] = 4;
2134 buff.
fPols[indx++] = i *
n + j;
2135 buff.
fPols[indx++] = (4 + i) *
n + j;
2136 buff.
fPols[indx++] = (2 + i) *
n + j;
2137 buff.
fPols[indx++] = (4 + i) *
n + j + 1;
2140 for (j = 0; j <
n - 1; j++) {
2141 buff.
fPols[indx++] =
c + i;
2142 buff.
fPols[indx++] = 4;
2143 buff.
fPols[indx++] = (i - 2) * 2 *
n + j;
2144 buff.
fPols[indx++] = (4 + i) *
n + j;
2145 buff.
fPols[indx++] = ((i - 2) * 2 + 1) *
n + j;
2146 buff.
fPols[indx++] = (4 + i) *
n + j + 1;
2149 for (j = 0; j <
n - 1; j++) {
2150 buff.
fPols[indx++] =
c + i;
2151 buff.
fPols[indx++] = 4;
2152 buff.
fPols[indx++] = (4 + i) *
n + j + 1;
2153 buff.
fPols[indx++] = ((i - 2) * 2 + 1) *
n + j;
2154 buff.
fPols[indx++] = (4 + i) *
n + j;
2155 buff.
fPols[indx++] = (i - 2) * 2 *
n + j;
2157 buff.
fPols[indx++] =
c + 2;
2158 buff.
fPols[indx++] = 4;
2159 buff.
fPols[indx++] = 6 *
n;
2160 buff.
fPols[indx++] = 4 *
n;
2161 buff.
fPols[indx++] = 7 *
n;
2162 buff.
fPols[indx++] = 5 *
n;
2163 buff.
fPols[indx++] =
c + 2;
2164 buff.
fPols[indx++] = 4;
2165 buff.
fPols[indx++] = 6 *
n - 1;
2166 buff.
fPols[indx++] = 8 *
n - 1;
2167 buff.
fPols[indx++] = 5 *
n - 1;
2168 buff.
fPols[indx++] = 7 *
n - 1;
2178 Double_t rsq = point[0] * point[0] + point[1] * point[1];
2207 saf[1] =
fRmin - rproj;
2208 saf[2] = rproj -
fRmax;
2214 safe =
TMath::Sqrt(rsq - rproj * rproj + safe * safe);
2215 return (saf[0] < 0) ? safe :
TMath::Sqrt(safe * safe + saf[0] * saf[0]);
2218 return (saf[0] < 0) ? safphi :
TMath::Sqrt(saf[0] * saf[0] + safphi * safphi);
2228 Double_t rsq = point[0] * point[0] + point[1] * point[1];
2233 saf[0] = dz - point[2];
2236 saf[0] = dz + point[2];
2248 if ((phi2d - phi1d) >= 360.)
2259 Double_t fio = 0.5 * (phi1 + phi2);
2262 Double_t cpsi = point[0] * cm + point[1] * sm;
2263 Double_t dfi = 0.5 * (phi2 - phi1);
2283 saf[1] = rmin - rproj;
2284 saf[2] = rproj - rmax;
2286 if ((phi2d - phi1d) >= 360.)
2290 safe =
TMath::Sqrt(rsq - rproj * rproj + safe * safe);
2291 return (saf[0] < 0) ? safe :
TMath::Sqrt(safe * safe + saf[0] * saf[0]);
2294 return (saf[0] < 0) ? safphi :
TMath::Sqrt(saf[0] * saf[0] + safphi * safphi);
2305 out <<
" rmin = " <<
fRmin <<
";" << std::endl;
2306 out <<
" rmax = " <<
fRmax <<
";" << std::endl;
2307 out <<
" dz = " <<
fDz <<
";" << std::endl;
2308 out <<
" phi1 = " <<
fPhi1 <<
";" << std::endl;
2309 out <<
" phi2 = " <<
fPhi2 <<
";" << std::endl;
2355 if (npoints > (npoints / 2) * 2) {
2356 Error(
"GetPointsOnSegments",
"Npoints must be even number");
2363 Int_t ntop = npoints / 2 - nc * (nc - 1);
2369 for (
Int_t i = 0; i < nc; i++) {
2370 if (i == (nc - 1)) {
2376 for (
Int_t j = 0; j < nphi; j++) {
2377 phi = phi1 + j * dphi;
2403 dphi = (phi2 - phi1) / (
n - 1);
2409 for (j = 0; j <
n; j++) {
2419 for (j = 0; j <
n; j++) {
2446 dphi = (phi2 - phi1) / (
n - 1);
2452 for (j = 0; j <
n; j++) {
2462 for (j = 0; j <
n; j++) {
2521 Int_t nbSegs = 2 * nbPnts;
2522 Int_t nbPols = nbPnts - 2;
2523 if (buffer.
SetRawSizes(nbPnts, 3 * nbPnts, nbSegs, 3 * nbSegs, nbPols, 6 * nbPols)) {
2546 for (
Int_t i = 0; i < vecsize; i++)
2557 for (
Int_t i = 0; i < vecsize; i++)
2567 for (
Int_t i = 0; i < vecsize; i++)
2577 for (
Int_t i = 0; i < vecsize; i++)
2588 for (
Int_t i = 0; i < vecsize; i++)
2615 SetShapeBit(kGeoCtub);
2632 SetShapeBit(kGeoCtub);
2641 SetCtubDimensions(params[0], params[1], params[2], params[3], params[4], params[5], params[6], params[7], params[8],
2642 params[9], params[10]);
2643 SetShapeBit(kGeoCtub);
2666 if ((
fNlow[2] > -(1E-10)) || (
fNhigh[2] < 1E-10)) {
2667 Error(
"ComputeBBox",
"In shape %s wrong definition of cut planes",
GetName());
2681 for (i = 0; i < 2; i++) {
2701 in_range_low =
kTRUE;
2708 for (i = 0; i < 2; i++) {
2728 in_range_hi =
kTRUE;
2767 fDZ = 0.5 * (zmax - zmin);
2768 fOrigin[2] = 0.5 * (zmax + zmin);
2780 Double_t rsq = point[0] * point[0] + point[1] * point[1];
2796 if (norm[0] * dir[0] + norm[1] * dir[1] + norm[2] * dir[2] < 0) {
2805 if (norm[0] * dir[0] + norm[1] * dir[1] + norm[2] * dir[2] < 0) {
2817 if (norm[0] * dir[0] + norm[1] * dir[1] < 0) {
2837 Double_t r2 = point[0] * point[0] + point[1] * point[1];
2897 if (iact < 3 && safe) {
2901 if ((iact == 1) && (step <= *safe))
2911 Double_t rsq = point[0] * point[0] + point[1] * point[1];
2926 xi = point[0] + s * dir[0];
2927 yi = point[1] + s * dir[1];
2928 r2 = xi * xi + yi * yi;
2942 xi = point[0] + s * dir[0];
2943 yi = point[1] + s * dir[1];
2944 r2 = xi * xi + yi * yi;
2956 Double_t nsq = dir[0] * dir[0] + dir[1] * dir[1];
2959 Double_t rdotn = point[0] * dir[0] + point[1] * dir[1];
2962 if (
r >
fRmax && rdotn < 0) {
2967 xi = point[0] + s * dir[0];
2968 yi = point[1] + s * dir[1];
2969 zi = point[2] + s * dir[2];
2989 xi = point[0] + s * dir[0];
2990 yi = point[1] + s * dir[1];
2991 zi = point[2] + s * dir[2];
3009 s = (point[1] *
fC1 - point[0] *
fS1) / un;
3011 xi = point[0] + s * dir[0];
3012 yi = point[1] + s * dir[1];
3013 zi = point[2] + s * dir[2];
3016 r2 = xi * xi + yi * yi;
3018 if ((yi *
fCm - xi *
fSm) <= 0) {
3027 un = dir[0] *
fS2 - dir[1] *
fC2;
3029 s = (point[1] *
fC2 - point[0] *
fS2) / un;
3031 xi = point[0] + s * dir[0];
3032 yi = point[1] + s * dir[1];
3033 zi = point[2] + s * dir[2];
3036 r2 = xi * xi + yi * yi;
3038 if ((yi *
fCm - xi *
fSm) >= 0) {
3056 if (iact < 3 && safe)
3060 if ((iact == 1) && (*safe > step))
3062 Double_t rsq = point[0] * point[0] + point[1] * point[1];
3084 Double_t nsq = dir[0] * dir[0] + dir[1] * dir[1];
3088 Double_t rdotn = point[0] * dir[0] + point[1] * dir[1];
3093 if (
fRmin > 1E-10) {
3125 Warning(
"Divide",
"In shape %s division of a cut tube not implemented",
GetName());
3138 Error(
"GetMakeRuntimeShape",
"Invalid mother for shape %s",
GetName());
3146 dz = ((
TGeoTube *)mother)->GetDz();
3148 rmin = ((
TGeoTube *)mother)->GetRmin();
3150 rmax = ((
TGeoTube *)mother)->GetRmax();
3152 return (
new TGeoCtub(rmin, rmax, dz,
fPhi1,
fPhi2,
fNlow[0],
fNlow[1],
fNlow[2],
fNhigh[0],
fNhigh[1],
fNhigh[2]));
3160 printf(
"*** Shape %s: TGeoCtub ***\n",
GetName());
3161 printf(
" lx = %11.5f\n",
fNlow[0]);
3162 printf(
" ly = %11.5f\n",
fNlow[1]);
3163 printf(
" lz = %11.5f\n",
fNlow[2]);
3164 printf(
" tx = %11.5f\n",
fNhigh[0]);
3165 printf(
" ty = %11.5f\n",
fNhigh[1]);
3166 printf(
" tz = %11.5f\n",
fNhigh[2]);
3177 Double_t rsq = point[0] * point[0] + point[1] * point[1];
3195 for (
Int_t i = 0; i < 4; i++)
3227 out <<
" rmin = " <<
fRmin <<
";" << std::endl;
3228 out <<
" rmax = " <<
fRmax <<
";" << std::endl;
3229 out <<
" dz = " <<
fDz <<
";" << std::endl;
3230 out <<
" phi1 = " <<
fPhi1 <<
";" << std::endl;
3231 out <<
" phi2 = " <<
fPhi2 <<
";" << std::endl;
3232 out <<
" lx = " <<
fNlow[0] <<
";" << std::endl;
3233 out <<
" ly = " <<
fNlow[1] <<
";" << std::endl;
3234 out <<
" lz = " <<
fNlow[2] <<
";" << std::endl;
3235 out <<
" tx = " <<
fNhigh[0] <<
";" << std::endl;
3236 out <<
" ty = " <<
fNhigh[1] <<
";" << std::endl;
3237 out <<
" tz = " <<
fNhigh[2] <<
";" << std::endl;
3239 <<
"\",rmin,rmax,dz,phi1,phi2,lx,ly,lz,tx,ty,tz);" << std::endl;
3248 SetCtubDimensions(param[0], param[1], param[2], param[3], param[4], param[5], param[6], param[7], param[8], param[9],
3277 dphi = (phi2 - phi1) / (
n - 1);
3283 for (j = 0; j <
n; j++) {
3293 for (j = 0; j <
n; j++) {
3320 dphi = (phi2 - phi1) / (
n - 1);
3326 for (j = 0; j <
n; j++) {
3336 for (j = 0; j <
n; j++) {
3384 for (
UInt_t i = 0; i < 3; i++) {
3393 Int_t nbSegs = 2 * nbPnts;
3394 Int_t nbPols = nbPnts - 2;
3395 if (buffer.
SetRawSizes(nbPnts, 3 * nbPnts, nbSegs, 3 * nbSegs, nbPols, 6 * nbPols)) {
3418 for (
Int_t i = 0; i < vecsize; i++)
3429 for (
Int_t i = 0; i < vecsize; i++)
3439 for (
Int_t i = 0; i < vecsize; i++)
3449 for (
Int_t i = 0; i < vecsize; i++)
3460 for (
Int_t i = 0; i < vecsize; i++)
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
void Fatal(const char *location, const char *msgfmt,...)
Use this function in case of a fatal error. It will abort the program.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t points
R__EXTERN TGeoManager * gGeoManager
Cut tube segment description class - see TBuffer3DTypes for producer classes.
Double_t fLowPlaneNorm[3]
Double_t fHighPlaneNorm[3]
Tube segment description class - see TBuffer3DTypes for producer classes.
Complete tube description class - see TBuffer3DTypes for producer classes.
Generic 3D primitive description class.
Bool_t SectionsValid(UInt_t mask) const
void SetSectionsValid(UInt_t mask)
Bool_t SetRawSizes(UInt_t reqPnts, UInt_t reqPntsCapacity, UInt_t reqSegs, UInt_t reqSegsCapacity, UInt_t reqPols, UInt_t reqPolsCapacity)
Set kRaw tessellation section of buffer with supplied sizes.
void FillBuffer3D(TBuffer3D &buffer, Int_t reqSections, Bool_t localFrame) const override
Fill the supplied buffer, with sections in desired frame See TBuffer3D.h for explanation of sections,...
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
void InspectShape() const override
void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override
void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize) override
Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const override
void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const override
const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const override
Stub implementation to avoid forcing implementation at this stage.
void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) override
TGeoShape * GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const override
void SetDimensions(Double_t *param) override
Double_t Capacity() const override
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
Bool_t Contains(const Double_t *point) const override
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const override
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
TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override
Double_t GetZcoord(Double_t xc, Double_t yc, Double_t zc) const
void InspectShape() const override
void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const override
void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const override
void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
Int_t GetNmeshVertices() const override
void SetPoints(Double_t *points) const override
void SetCtubDimensions(Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1, Double_t phi2, Double_t lx, Double_t ly, Double_t lz, Double_t tx, Double_t ty, Double_t tz)
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
void ComputeBBox() override
TGeoVolumeMulti * MakeVolumeMulti(const char *name, TGeoMedium *medium)
Make a TGeoVolumeMulti handling a list of volumes.
Int_t GetNsegments() const
Get number of segments approximating circles.
Geometrical transformation package.
Node containing an offset.
Base finder class for patterns.
void SetDivIndex(Int_t index)
Base abstract class for all shapes.
virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const =0
Int_t GetBasicColor() const
Get the basic color (0-7).
void TransformPoints(Double_t *points, UInt_t NbPoints) const
Tranform a set of points (LocalToMaster)
void SetShapeBit(UInt_t f, Bool_t set)
Equivalent of TObject::SetBit.
static Double_t DistToPhiMin(const Double_t *point, const Double_t *dir, Double_t s1, Double_t c1, Double_t s2, Double_t c2, Double_t sm, Double_t cm, Bool_t in=kTRUE)
compute distance from point (inside phi) to both phi planes. Return minimum.
static Double_t SafetyPhi(const Double_t *point, Bool_t in, Double_t phi1, Double_t phi2)
Static method to compute safety w.r.t a phi corner defined by cosines/sines of the angles phi1,...
static Bool_t IsSameWithinTolerance(Double_t a, Double_t b)
Check if two numbers differ with less than a tolerance.
const char * GetPointerName() const
Provide a pointer name containing uid.
static Bool_t IsInPhiRange(const Double_t *point, Double_t phi1, Double_t phi2)
Static method to check if a point is in the phi range (phi1, phi2) [degrees].
Int_t ShapeDistancetoPrimitive(Int_t numpoints, Int_t px, Int_t py) const
Returns distance to shape primitive mesh.
static void NormalPhi(const Double_t *point, const Double_t *dir, Double_t *norm, Double_t c1, Double_t s1, Double_t c2, Double_t s2)
Static method to compute normal to phi planes.
const char * GetName() const override
Get the shape name.
static Double_t Tolerance()
static Bool_t IsCloseToPhi(Double_t epsil, const Double_t *point, Double_t c1, Double_t s1, Double_t c2, Double_t s2)
True if point is closer than epsil to one of the phi planes defined by c1,s1 or c2,...
Bool_t TestShapeBit(UInt_t f) 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
void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize) override
void SetPoints(Double_t *points) const override
Double_t Capacity() const override
static Double_t DistFromInsideS(const Double_t *point, const Double_t *dir, Double_t rmin, Double_t rmax, Double_t dz, Double_t c1, Double_t s1, Double_t c2, Double_t s2, Double_t cm, Double_t sm, Double_t cdfi)
void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override
TBuffer3D * MakeBuffer3D() const override
void Sizeof3D() const override
Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const override
TGeoShape * GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const override
void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) override
void InspectShape() const override
static void ComputeNormalS(const Double_t *point, const Double_t *dir, Double_t *norm, Double_t rmin, Double_t rmax, Double_t dz, Double_t c1, Double_t s1, Double_t c2, Double_t s2)
void SetDimensions(Double_t *param) override
void AfterStreamer() override
static Double_t DistFromOutsideS(const Double_t *point, const Double_t *dir, Double_t rmin, Double_t rmax, Double_t dz, Double_t c1, Double_t s1, Double_t c2, Double_t s2, Double_t cm, Double_t sm, Double_t cdfi)
Bool_t Contains(const Double_t *point) const override
void ComputeBBox() override
void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
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
void GetBoundingCylinder(Double_t *param) const override
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Computes distance from point (px,py) to the object.
TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const override
void SetTubsDimensions(Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1, Double_t phi2)
Int_t GetNmeshVertices() const override
const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const override
Stub implementation to avoid forcing implementation at this stage.
Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const override
void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const override
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
static Double_t SafetyS(const Double_t *point, Bool_t in, Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1, Double_t phi2, Int_t skipz=0)
void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const override
void SetSegsAndPols(TBuffer3D &buff) const override
Int_t GetNmeshVertices() const override
static void DistToTube(Double_t rsq, Double_t nsq, Double_t rdotn, Double_t radius, Double_t &b, Double_t &delta)
void GetBoundingCylinder(Double_t *param) const override
void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override
void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const override
Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const override
void SetTubeDimensions(Double_t rmin, Double_t rmax, Double_t dz)
TBuffer3D * MakeBuffer3D() const override
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Computes distance from point (px,py) to the object.
static Double_t DistFromInsideS(const Double_t *point, const Double_t *dir, Double_t rmin, Double_t rmax, Double_t dz)
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
void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize) override
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
void ComputeBBox() override
static Double_t DistFromOutsideS(const Double_t *point, const Double_t *dir, Double_t rmin, Double_t rmax, Double_t dz)
void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
static void ComputeNormalS(const Double_t *point, const Double_t *dir, Double_t *norm, Double_t rmin, Double_t rmax, Double_t dz)
void InspectShape() const override
Bool_t Contains(const Double_t *point) const override
void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
void SetSegsAndPols(TBuffer3D &buff) const override
Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const override
void SetPoints(Double_t *points) const override
void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) override
TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override
void SetDimensions(Double_t *param) override
Double_t Capacity() const override
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const override
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
void Sizeof3D() const override
TGeoShape * GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const override
const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const override
Stub implementation to avoid forcing implementation at this stage.
const char * GetAxisName(Int_t iaxis) const override
void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const override
static Double_t SafetyS(const Double_t *point, Bool_t in, Double_t rmin, Double_t rmax, Double_t dz, Int_t skipz=0)
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
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.
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.
Double_t ATan2(Double_t y, Double_t x)
Returns the principal value of the arc tangent of y/x, expressed in radians.
Long64_t LocMax(Long64_t n, const T *a)
Returns index of array with the maximum element.
constexpr Double_t E()
Base of natural log: .
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.
constexpr Double_t RadToDeg()
Conversion from radian to degree: .
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
constexpr Double_t TwoPi()