117 if ((dz < 0) || (rmin1 < 0) || (rmax1 < 0) || (rmin2 < 0) || (rmax2 < 0)) {
131 if ((dz < 0) || (rmin1 < 0) || (rmax1 < 0) || (rmin2 < 0) || (rmax2 < 0)) {
169 (rmax1 * rmax1 + rmax2 * rmax2 + rmax1 * rmax2 - rmin1 * rmin1 - rmin2 * rmin2 - rmin1 * rmin2);
194 memset(norm, 0, 3 *
sizeof(
Double_t));
206 Double_t rin = tg1 * point[2] + ro1;
207 Double_t rout = tg2 * point[2] + ro2;
214 norm[0] = cr1 * cphi;
215 norm[1] = cr1 * sphi;
216 norm[2] = -tg1 * cr1;
220 norm[0] = cr2 * cphi;
221 norm[1] = cr2 * sphi;
222 norm[2] = -tg2 * cr2;
224 if (norm[0] * dir[0] + norm[1] * dir[1] + norm[2] * dir[2] < 0) {
238 memset(norm, 0, 3 *
sizeof(
Double_t));
242 Double_t ro1 = 0.5 * (rmin1 + rmin2);
243 Double_t tg1 = 0.5 * (rmin2 - rmin1) / dz;
245 Double_t ro2 = 0.5 * (rmax1 + rmax2);
246 Double_t tg2 = 0.5 * (rmax2 - rmax1) / dz;
250 Double_t rin = tg1 * point[2] + ro1;
251 Double_t rout = tg2 * point[2] + ro2;
253 norm[0] = cr1 * cphi;
254 norm[1] = cr1 * sphi;
255 norm[2] = -tg1 * cr1;
257 norm[0] = cr2 * cphi;
258 norm[1] = cr2 * sphi;
259 norm[2] = -tg2 * cr2;
261 if (norm[0] * dir[0] + norm[1] * dir[1] + norm[2] * dir[2] < 0) {
275 Double_t r2 = point[0] * point[0] + point[1] * point[1];
278 if ((r2 < rl * rl) || (r2 > rh * rh))
296 sz = (
TMath::Sign(dz, dir[2]) - point[2]) / dir[2];
300 Double_t rsq = point[0] * point[0] + point[1] * point[1];
302 Double_t rin = 0.5 * (rmin1 + rmin2 + (rmin2 - rmin1) * point[2] * zinv);
309 point[0] * dir[0] + point[1] * dir[1] + 0.5 * (rmin1 - rmin2) * dir[2] * zinv *
TMath::Sqrt(rsq);
317 zi = point[2] + sr * dir[2];
323 zi = point[2] + sr * dir[2];
331 Double_t rout = 0.5 * (rmax1 + rmax2 + (rmax2 - rmax1) * point[2] * zinv);
333 Double_t ddotn = point[0] * dir[0] + point[1] * dir[1] + 0.5 * (rmax1 - rmax2) * dir[2] * zinv *
TMath::Sqrt(rsq);
344 zi = point[2] + sr * dir[2];
353 zi = point[2] + sr * dir[2];
359 zi = point[2] + sr * dir[2];
374 if (iact < 3 && safe) {
378 if ((iact == 1) && (*safe > step))
399 if (point[2] <= -dz) {
402 snxt = (-dz - point[2]) / dir[2];
403 xp = point[0] + snxt * dir[0];
404 yp = point[1] + snxt * dir[1];
406 if ((r2 >= rmin1 * rmin1) && (r2 <= rmax1 * rmax1))
410 if (point[2] >= dz) {
413 snxt = (dz - point[2]) / dir[2];
414 xp = point[0] + snxt * dir[0];
415 yp = point[1] + snxt * dir[1];
417 if ((r2 >= rmin2 * rmin2) && (r2 <= rmax2 * rmax2))
423 Double_t rsq = point[0] * point[0] + point[1] * point[1];
425 Double_t ro1 = 0.5 * (rmin1 + rmin2);
431 tg1 = 0.5 * (rmin2 - rmin1) * dzinv;
432 rin = ro1 + tg1 * point[2];
436 Double_t ro2 = 0.5 * (rmax1 + rmax2);
437 Double_t tg2 = 0.5 * (rmax2 - rmax1) * dzinv;
438 Double_t rout = tg2 * point[2] + ro2;
442 Bool_t in = inz & inrmin & inrmax;
450 if (safz <= safrmin && safz <= safrmax) {
452 if (point[2] * dir[2] < 0)
456 if (safrmax < safrmin) {
458 Double_t ddotn = point[0] * dir[0] + point[1] * dir[1] - tg2 * dir[2] *
r;
464 Double_t ddotn = point[0] * dir[0] + point[1] * dir[1] - tg1 * dir[2] *
r;
477 zp = point[2] + snxt * dir[2];
492 zp = point[2] + snxt * dir[2];
498 zp = point[2] + snxt * dir[2];
509 zp = point[2] + din * dir[2];
525 if (dout > 0 && dout < snxt) {
526 zp = point[2] + dout * dir[2];
531 if (dout <= 0 || dout > snxt)
533 zp = point[2] + dout * dir[2];
546 if (iact < 3 && safe) {
550 if ((iact == 1) && (*safe > step))
575 Double_t rsq = point[0] * point[0] + point[1] * point[1];
578 Double_t a = dir[0] * dir[0] + dir[1] * dir[1] - tz * tz * dir[2] * dir[2];
579 b = point[0] * dir[0] + point[1] * dir[1] - tz * rc * dir[2];
606 const Int_t numPoints = 4 *
n;
630 Error(
"Divide",
"division of a cone on R not implemented");
641 for (
id = 0;
id < ndiv;
id++) {
651 for (
id = 0;
id < ndiv;
id++) {
653 Double_t z2 = start + (
id + 1) * step;
658 shape =
new TGeoCone(0.5 * step, rmin1n, rmax1n, rmin2n, rmax2n);
666 default:
Error(
"Divide",
"Wrong axis type for division");
return nullptr;
677 case 2:
return "PHI";
679 default:
return "undefined";
712 param[0] *= param[0];
714 param[1] *= param[1];
728 Error(
"GetMakeRuntimeShape",
"invalid mother");
731 Double_t rmin1, rmax1, rmin2, rmax2, dz;
740 rmin1 = ((
TGeoCone *)mother)->GetRmin1();
742 rmax1 = ((
TGeoCone *)mother)->GetRmax1();
744 rmin2 = ((
TGeoCone *)mother)->GetRmin2();
746 rmax2 = ((
TGeoCone *)mother)->GetRmax2();
758 if (npoints > (npoints / 2) * 2) {
759 Error(
"GetPointsOnSegments",
"Npoints must be even number");
772 ntop = npoints / 2 - nc * (nc - 1);
774 ntop = npoints - nc * (nc - 1);
782 for (
Int_t i = 0; i < nc; i++) {
790 for (
Int_t j = 0; j < nphi; j++) {
810 printf(
"*** Shape %s TGeoCone ***\n",
GetName());
811 printf(
" dz =: %11.5f\n",
fDz);
812 printf(
" Rmin1 = %11.5f\n",
fRmin1);
813 printf(
" Rmax1 = %11.5f\n",
fRmax1);
814 printf(
" Rmin2 = %11.5f\n",
fRmin2);
815 printf(
" Rmax2 = %11.5f\n",
fRmax2);
816 printf(
" Bounding box:\n");
849 for (i = 0; i < 4; i++) {
850 for (j = 0; j <
n; j++) {
851 buffer.
fSegs[(i *
n + j) * 3] =
c;
852 buffer.
fSegs[(i *
n + j) * 3 + 1] = i *
n + j;
853 buffer.
fSegs[(i *
n + j) * 3 + 2] = i *
n + j + 1;
855 buffer.
fSegs[(i *
n + j - 1) * 3 + 2] = i *
n;
857 for (i = 4; i < 6; i++) {
858 for (j = 0; j <
n; j++) {
859 buffer.
fSegs[(i *
n + j) * 3] =
c + 1;
860 buffer.
fSegs[(i *
n + j) * 3 + 1] = (i - 4) *
n + j;
861 buffer.
fSegs[(i *
n + j) * 3 + 2] = (i - 2) *
n + j;
864 for (i = 6; i < 8; i++) {
865 for (j = 0; j <
n; j++) {
866 buffer.
fSegs[(i *
n + j) * 3] =
c;
867 buffer.
fSegs[(i *
n + j) * 3 + 1] = 2 * (i - 6) *
n + j;
868 buffer.
fSegs[(i *
n + j) * 3 + 2] = (2 * (i - 6) + 1) *
n + j;
874 for (j = 0; j <
n; j++) {
875 indx = 6 * (i *
n + j);
877 buffer.
fPols[indx + 1] = 4;
878 buffer.
fPols[indx + 5] = i *
n + j;
879 buffer.
fPols[indx + 4] = (4 + i) *
n + j;
880 buffer.
fPols[indx + 3] = (2 + i) *
n + j;
881 buffer.
fPols[indx + 2] = (4 + i) *
n + j + 1;
883 buffer.
fPols[indx + 2] = (4 + i) *
n;
885 for (j = 0; j <
n; j++) {
886 indx = 6 * (i *
n + j);
888 buffer.
fPols[indx + 1] = 4;
889 buffer.
fPols[indx + 2] = i *
n + j;
890 buffer.
fPols[indx + 3] = (4 + i) *
n + j;
891 buffer.
fPols[indx + 4] = (2 + i) *
n + j;
892 buffer.
fPols[indx + 5] = (4 + i) *
n + j + 1;
894 buffer.
fPols[indx + 5] = (4 + i) *
n;
896 for (j = 0; j <
n; j++) {
897 indx = 6 * (i *
n + j);
898 buffer.
fPols[indx] =
c + i;
899 buffer.
fPols[indx + 1] = 4;
900 buffer.
fPols[indx + 2] = (i - 2) * 2 *
n + j;
901 buffer.
fPols[indx + 3] = (4 + i) *
n + j;
902 buffer.
fPols[indx + 4] = ((i - 2) * 2 + 1) *
n + j;
903 buffer.
fPols[indx + 5] = (4 + i) *
n + j + 1;
905 buffer.
fPols[indx + 5] = (4 + i) *
n;
907 for (j = 0; j <
n; j++) {
908 indx = 6 * (i *
n + j);
909 buffer.
fPols[indx] =
c + i;
910 buffer.
fPols[indx + 1] = 4;
911 buffer.
fPols[indx + 5] = (i - 2) * 2 *
n + j;
912 buffer.
fPols[indx + 4] = (4 + i) *
n + j;
913 buffer.
fPols[indx + 3] = ((i - 2) * 2 + 1) *
n + j;
914 buffer.
fPols[indx + 2] = (4 + i) *
n + j + 1;
916 buffer.
fPols[indx + 2] = (4 + i) *
n;
965 if (rmin1 > 0 || rmin2 > 0)
981 out <<
" dz = " <<
fDz <<
";" << std::endl;
982 out <<
" rmin1 = " <<
fRmin1 <<
";" << std::endl;
983 out <<
" rmax1 = " <<
fRmax1 <<
";" << std::endl;
984 out <<
" rmin2 = " <<
fRmin2 <<
";" << std::endl;
985 out <<
" rmax2 = " <<
fRmax2 <<
";" << std::endl;
987 <<
"\", dz,rmin1,rmax1,rmin2,rmax2);" << std::endl;
998 if (rmin1 <= rmax1) {
1005 Warning(
"SetConeDimensions",
"rmin1>rmax1 Switch rmin1<->rmax1");
1020 if (rmin2 <= rmax2) {
1027 Warning(
"SetConeDimensions",
"rmin2>rmax2 Switch rmin2<->rmax2");
1071 for (j = 0; j <
n; j++) {
1078 for (j = 0; j <
n; j++) {
1085 for (j = 0; j <
n; j++) {
1092 for (j = 0; j <
n; j++) {
1115 for (j = 0; j <
n; j++) {
1122 for (j = 0; j <
n; j++) {
1129 for (j = 0; j <
n; j++) {
1136 for (j = 0; j <
n; j++) {
1185 if (buffer.
SetRawSizes(nbPnts, 3 * nbPnts, nbSegs, 3 * nbSegs, nbPols, 6 * nbPols)) {
1211 for (
Int_t i = 0; i < vecsize; i++)
1222 for (
Int_t i = 0; i < vecsize; i++)
1232 for (
Int_t i = 0; i < vecsize; i++)
1242 for (
Int_t i = 0; i < vecsize; i++)
1253 for (
Int_t i = 0; i < vecsize; i++)
1263 :
TGeoCone(), fPhi1(0.), fPhi2(0.), fS1(0.), fC1(0.), fS2(0.), fC2(0.), fSm(0.), fCm(0.), fCdfi(0.)
1274 :
TGeoCone(dz, rmin1, rmax1, rmin2, rmax2),
1323 :
TGeoCone(0, 0, 0, 0, 0), fPhi1(0.), fPhi2(0.), fS1(0.), fC1(0.), fS2(0.), fC2(0.), fSm(0.), fCm(0.), fCdfi(0.)
1354 Double_t fio = 0.5 * (phi1 + phi2);
1357 Double_t dfi = 0.5 * (phi2 - phi1);
1376 (rmax1 * rmax1 + rmax2 * rmax2 + rmax1 * rmax2 - rmin1 * rmin1 - rmin2 * rmin2 - rmin1 * rmin2);
1448 Double_t rin = tg1 * point[2] + ro1;
1449 Double_t rout = tg2 * point[2] + ro2;
1459 norm[0] = norm[1] = 0.;
1469 norm[0] = cr1 * cphi;
1470 norm[1] = cr1 * sphi;
1471 norm[2] = -tg1 * cr1;
1473 norm[0] = cr2 * cphi;
1474 norm[1] = cr2 * sphi;
1475 norm[2] = -tg2 * cr2;
1478 if (norm[0] * dir[0] + norm[1] * dir[1] + norm[2] * dir[2] < 0) {
1493 Double_t ro1 = 0.5 * (rmin1 + rmin2);
1494 Double_t tg1 = 0.5 * (rmin2 - rmin1) / dz;
1496 Double_t ro2 = 0.5 * (rmax1 + rmax2);
1497 Double_t tg2 = 0.5 * (rmax2 - rmax1) / dz;
1501 Double_t rin = tg1 * point[2] + ro1;
1502 Double_t rout = tg2 * point[2] + ro2;
1516 norm[0] = cr1 * cphi;
1517 norm[1] = cr1 * sphi;
1518 norm[2] = -tg1 * cr1;
1520 norm[0] = cr2 * cphi;
1521 norm[1] = cr2 * sphi;
1522 norm[2] = -tg2 * cr2;
1525 if (norm[0] * dir[0] + norm[1] * dir[1] + norm[2] * dir[2] < 0) {
1578 Double_t r0sq = point[0] * point[0] + point[1] * point[1];
1579 Double_t rc = ro0 + fz * (point[2] - 0.5 * (z1 + z2));
1581 Double_t a = dir[0] * dir[0] + dir[1] * dir[1] - fz * fz * dir[2] * dir[2];
1582 Double_t b = point[0] * dir[0] + point[1] * dir[1] - fz * rc * dir[2];
1600 ptnew[2] = point[2] + snxt * dir[2];
1601 if (((ptnew[2] - z1) * (ptnew[2] - z2)) < 0) {
1605 ptnew[0] = point[0] + snxt * dir[0];
1606 ptnew[1] = point[1] + snxt * dir[1];
1621 ptnew[2] = point[2] + snxt * dir[2];
1622 if (((ptnew[2] - z1) * (ptnew[2] - z2)) < 0) {
1626 ptnew[0] = point[0] + snxt * dir[0];
1627 ptnew[1] = point[1] + snxt * dir[1];
1656 Double_t rsq = point[0] * point[0] + point[1] * point[1];
1658 Double_t cpsi = point[0] * cm + point[1] * sm;
1667 ddotn =
s1 * dir[0] -
c1 * dir[1];
1670 ddotn = -s2 * dir[0] +
c2 * dir[1];
1673 sfmin = s2 * point[0] -
c2 * point[1];
1679 xi = point[0] + sfmin * dir[0];
1680 yi = point[1] + sfmin * dir[1];
1681 if (yi * cm - xi * sm < 0)
1685 ddotn = -s2 * dir[0] +
c2 * dir[1];
1688 ddotn =
s1 * dir[0] -
c1 * dir[1];
1691 sfmin = -
s1 * point[0] +
c1 * point[1];
1697 xi = point[0] + sfmin * dir[0];
1698 yi = point[1] + sfmin * dir[1];
1699 if (yi * cm - xi * sm > 0)
1710 if (iact < 3 && safe) {
1714 if ((iact == 1) && (*safe > step))
1721 return TGeoConeSeg::DistFromInsideS(point, dir,
fDz,
fRmin1,
fRmax1,
fRmin2,
fRmax2,
fC1,
fS1,
fC2,
fS2,
fCm,
fSm,
1745 if (point[2] * dir[2] >= 0)
1748 xi = point[0] + s * dir[0];
1749 yi = point[1] + s * dir[1];
1750 r2 = xi * xi + yi * yi;
1758 if ((rin * rin <= r2) && (r2 <= rout * rout)) {
1759 cpsi = xi * cm + yi * sm;
1765 Double_t rsq = point[0] * point[0] + point[1] * point[1];
1767 Double_t ro1 = 0.5 * (rmin1 + rmin2);
1773 tg1 = 0.5 * (rmin2 - rmin1) * zinv;
1774 rin = ro1 + tg1 * point[2];
1780 Double_t ro2 = 0.5 * (rmax1 + rmax2);
1781 Double_t tg2 = 0.5 * (rmax2 - rmax1) * zinv;
1782 rout = ro2 + tg2 * point[2];
1787 cpsi = point[0] * cm + point[1] * sm;
1790 in = inz & inrmin & inrmax & inphi;
1797 if (zi < safrmax && zi < safrmin && zi < safphi) {
1798 if (point[2] * dir[2] < 0)
1803 if (safrmax < safrmin && safrmax < safphi) {
1804 Double_t ddotn = point[0] * dir[0] + point[1] * dir[1] - tg2 * dir[2] *
r;
1810 if (safphi < safrmin) {
1814 if (point[0] *
c1 + point[1] *
s1 > point[0] *
c2 + point[1] * s2) {
1815 un = dir[0] *
s1 - dir[1] *
c1;
1820 un = -dir[0] * s2 + dir[1] *
c2;
1822 s = -point[0] * s2 + point[1] *
c2;
1825 zi = point[2] + s * dir[2];
1827 xi = point[0] + s * dir[0];
1828 yi = point[1] + s * dir[1];
1829 if ((yi * cm - xi * sm) > 0) {
1830 r2 = xi * xi + yi * yi;
1831 rin = ro1 + tg1 * zi;
1832 rout = ro2 + tg2 * zi;
1833 if ((rin * rin <= r2) && (rout * rout >= r2))
1840 un = -dir[0] * s2 + dir[1] *
c2;
1845 un = dir[0] *
s1 - dir[1] *
c1;
1847 s = point[0] *
s1 - point[1] *
c1;
1850 zi = point[2] + s * dir[2];
1852 xi = point[0] + s * dir[0];
1853 yi = point[1] + s * dir[1];
1854 if ((yi * cm - xi * sm) < 0) {
1855 r2 = xi * xi + yi * yi;
1856 rin = ro1 + tg1 * zi;
1857 rout = ro2 + tg2 * zi;
1858 if ((rin * rin <= r2) && (rout * rout >= r2))
1866 Double_t ddotn = point[0] * dir[0] + point[1] * dir[1] - tg1 * dir[2] *
r;
1878 zi = point[2] + snxt * dir[2];
1881 xi = point[0] + snxt * dir[0];
1882 yi = point[1] + snxt * dir[1];
1883 r2 = xi * xi + yi * yi;
1884 cpsi = xi * cm + yi * sm;
1890 Double_t ddotn = point[0] * dir[0] + point[1] * dir[1] - tg1 * dir[2] *
r;
1901 zi = point[2] + snxt * dir[2];
1905 xi = point[0] + snxt * dir[0];
1906 yi = point[1] + snxt * dir[1];
1907 r2 = xi * xi + yi * yi;
1908 cpsi = xi * cm + yi * sm;
1916 s = point[0] *
s1 - point[1] *
c1;
1919 zi = point[2] + s * dir[2];
1921 xi = point[0] + s * dir[0];
1922 yi = point[1] + s * dir[1];
1923 if ((yi * cm - xi * sm) <= 0) {
1924 r2 = xi * xi + yi * yi;
1925 rin = ro1 + tg1 * zi;
1926 rout = ro2 + tg2 * zi;
1927 if ((rin * rin <= r2) && (rout * rout >= r2))
1933 un = dir[0] * s2 - dir[1] *
c2;
1935 s = (point[1] *
c2 - point[0] * s2) / un;
1937 zi = point[2] + s * dir[2];
1939 xi = point[0] + s * dir[0];
1940 yi = point[1] + s * dir[1];
1941 if ((yi * cm - xi * sm) >= 0) {
1942 r2 = xi * xi + yi * yi;
1943 rin = ro1 + tg1 * zi;
1944 rout = ro2 + tg2 * zi;
1945 if ((rin * rin <= r2) && (rout * rout >= r2))
1962 zi = point[2] + s * dir[2];
1964 xi = point[0] + s * dir[0];
1965 yi = point[1] + s * dir[1];
1966 r2 = xi * xi + yi * yi;
1967 cpsi = xi * cm + yi * sm;
1974 zi = point[2] + s * dir[2];
1976 xi = point[0] + s * dir[0];
1977 yi = point[1] + s * dir[1];
1978 r2 = xi * xi + yi * yi;
1979 cpsi = xi * cm + yi * sm;
1992 zi = point[2] + s * dir[2];
1994 xi = point[0] + s * dir[0];
1995 yi = point[1] + s * dir[1];
1996 r2 = xi * xi + yi * yi;
1997 cpsi = xi * cm + yi * sm;
2005 zi = point[2] + s * dir[2];
2007 xi = point[0] + s * dir[0];
2008 yi = point[1] + s * dir[1];
2009 r2 = xi * xi + yi * yi;
2010 cpsi = xi * cm + yi * sm;
2022 zi = point[2] + s * dir[2];
2025 xi = point[0] + s * dir[0];
2026 yi = point[1] + s * dir[1];
2027 r2 = xi * xi + yi * yi;
2028 rout = ro2 + tg2 * zi;
2029 if (r2 > rout * rout)
2031 rin = ro1 + tg1 * zi;
2032 if (r2 >= rin * rin)
2044 if (iact < 3 && safe) {
2048 if ((iact == 1) && (*safe > step))
2057 return TGeoConeSeg::DistFromOutsideS(point, dir,
fDz,
fRmin1,
fRmax1,
fRmin2,
fRmax2,
fC1,
fS1,
fC2,
fS2,
fCm,
fSm,
2067 const Int_t numPoints = 4 *
n;
2089 Double_t end = start + ndiv * step;
2092 Error(
"Divide",
"division of a cone segment on R not implemented");
2106 for (
id = 0;
id < ndiv;
id++) {
2116 for (
id = 0;
id < ndiv;
id++) {
2118 Double_t z2 = start + (
id + 1) * step;
2131 default:
Error(
"Divide",
"Wrong axis type for division");
return nullptr;
2165 param[0] *= param[0];
2167 param[1] *= param[1];
2170 while (param[3] < param[2])
2183 Error(
"GetMakeRuntimeShape",
"invalid mother");
2186 Double_t rmin1, rmax1, rmin2, rmax2, dz;
2193 dz = ((
TGeoCone *)mother)->GetDz();
2195 rmin1 = ((
TGeoCone *)mother)->GetRmin1();
2197 rmax1 = ((
TGeoCone *)mother)->GetRmax1();
2199 rmin2 = ((
TGeoCone *)mother)->GetRmin2();
2201 rmax2 = ((
TGeoCone *)mother)->GetRmax2();
2211 printf(
"*** Shape %s: TGeoConeSeg ***\n",
GetName());
2212 printf(
" dz = %11.5f\n",
fDz);
2213 printf(
" Rmin1 = %11.5f\n",
fRmin1);
2214 printf(
" Rmax1 = %11.5f\n",
fRmax1);
2215 printf(
" Rmin2 = %11.5f\n",
fRmin2);
2216 printf(
" Rmax2 = %11.5f\n",
fRmax2);
2217 printf(
" phi1 = %11.5f\n",
fPhi1);
2218 printf(
" phi2 = %11.5f\n",
fPhi2);
2219 printf(
" Bounding box:\n");
2231 Int_t nbSegs = 2 * nbPnts;
2232 Int_t nbPols = nbPnts - 2;
2254 for (i = 0; i < 4; i++) {
2255 for (j = 1; j <
n; j++) {
2256 buffer.
fSegs[(i *
n + j - 1) * 3] =
c;
2257 buffer.
fSegs[(i *
n + j - 1) * 3 + 1] = i *
n + j - 1;
2258 buffer.
fSegs[(i *
n + j - 1) * 3 + 2] = i *
n + j;
2261 for (i = 4; i < 6; i++) {
2262 for (j = 0; j <
n; j++) {
2263 buffer.
fSegs[(i *
n + j) * 3] =
c + 1;
2264 buffer.
fSegs[(i *
n + j) * 3 + 1] = (i - 4) *
n + j;
2265 buffer.
fSegs[(i *
n + j) * 3 + 2] = (i - 2) *
n + j;
2268 for (i = 6; i < 8; i++) {
2269 for (j = 0; j <
n; j++) {
2270 buffer.
fSegs[(i *
n + j) * 3] =
c;
2271 buffer.
fSegs[(i *
n + j) * 3 + 1] = 2 * (i - 6) *
n + j;
2272 buffer.
fSegs[(i *
n + j) * 3 + 2] = (2 * (i - 6) + 1) *
n + j;
2279 for (j = 0; j <
n - 1; j++) {
2280 buffer.
fPols[indx++] =
c;
2281 buffer.
fPols[indx++] = 4;
2282 buffer.
fPols[indx++] = (4 + i) *
n + j + 1;
2283 buffer.
fPols[indx++] = (2 + i) *
n + j;
2284 buffer.
fPols[indx++] = (4 + i) *
n + j;
2285 buffer.
fPols[indx++] = i *
n + j;
2288 for (j = 0; j <
n - 1; j++) {
2289 buffer.
fPols[indx++] =
c;
2290 buffer.
fPols[indx++] = 4;
2291 buffer.
fPols[indx++] = i *
n + j;
2292 buffer.
fPols[indx++] = (4 + i) *
n + j;
2293 buffer.
fPols[indx++] = (2 + i) *
n + j;
2294 buffer.
fPols[indx++] = (4 + i) *
n + j + 1;
2297 for (j = 0; j <
n - 1; j++) {
2298 buffer.
fPols[indx++] =
c + i;
2299 buffer.
fPols[indx++] = 4;
2300 buffer.
fPols[indx++] = (i - 2) * 2 *
n + j;
2301 buffer.
fPols[indx++] = (4 + i) *
n + j;
2302 buffer.
fPols[indx++] = ((i - 2) * 2 + 1) *
n + j;
2303 buffer.
fPols[indx++] = (4 + i) *
n + j + 1;
2306 for (j = 0; j <
n - 1; j++) {
2307 buffer.
fPols[indx++] =
c + i;
2308 buffer.
fPols[indx++] = 4;
2309 buffer.
fPols[indx++] = (4 + i) *
n + j + 1;
2310 buffer.
fPols[indx++] = ((i - 2) * 2 + 1) *
n + j;
2311 buffer.
fPols[indx++] = (4 + i) *
n + j;
2312 buffer.
fPols[indx++] = (i - 2) * 2 *
n + j;
2314 buffer.
fPols[indx++] =
c + 2;
2315 buffer.
fPols[indx++] = 4;
2316 buffer.
fPols[indx++] = 6 *
n;
2317 buffer.
fPols[indx++] = 4 *
n;
2318 buffer.
fPols[indx++] = 7 *
n;
2319 buffer.
fPols[indx++] = 5 *
n;
2320 buffer.
fPols[indx++] =
c + 2;
2321 buffer.
fPols[indx++] = 4;
2322 buffer.
fPols[indx++] = 6 *
n - 1;
2323 buffer.
fPols[indx++] = 8 *
n - 1;
2324 buffer.
fPols[indx++] = 5 *
n - 1;
2325 buffer.
fPols[indx++] = 7 *
n - 1;
2352 if ((phi2 - phi1) >= 360.)
2369 out <<
" // Shape: " <<
GetName() <<
" type: " <<
ClassName() << std::endl;
2370 out <<
" dz = " <<
fDz <<
";" << std::endl;
2371 out <<
" rmin1 = " <<
fRmin1 <<
";" << std::endl;
2372 out <<
" rmax1 = " <<
fRmax1 <<
";" << std::endl;
2373 out <<
" rmin2 = " <<
fRmin2 <<
";" << std::endl;
2374 out <<
" rmax2 = " <<
fRmax2 <<
";" << std::endl;
2375 out <<
" phi1 = " <<
fPhi1 <<
";" << std::endl;
2376 out <<
" phi2 = " <<
fPhi2 <<
";" << std::endl;
2378 <<
"\", dz,rmin1,rmax1,rmin2,rmax2,phi1,phi2);" << std::endl;
2425 Float_t dphi, phi, phi1, phi2, dz;
2432 dphi = (phi2 - phi1) / (
n - 1);
2437 for (j = 0; j <
n; j++) {
2443 for (j = 0; j <
n; j++) {
2449 for (j = 0; j <
n; j++) {
2455 for (j = 0; j <
n; j++) {
2470 Float_t dphi, phi, phi1, phi2, dz;
2477 dphi = (phi2 - phi1) / (
n - 1);
2482 for (j = 0; j <
n; j++) {
2488 for (j = 0; j <
n; j++) {
2494 for (j = 0; j <
n; j++) {
2500 for (j = 0; j <
n; j++) {
2547 Int_t nbSegs = 2 * nbPnts;
2548 Int_t nbPols = nbPnts - 2;
2549 if (buffer.
SetRawSizes(nbPnts, 3 * nbPnts, nbSegs, 3 * nbSegs, nbPols, 6 * nbPols)) {
2573 if (npoints > (npoints / 2) * 2) {
2574 Error(
"GetPointsOnSegments",
"Npoints must be even number");
2581 Int_t ntop = npoints / 2 - nc * (nc - 1);
2589 for (
Int_t i = 0; i < nc; i++) {
2590 if (i == (nc - 1)) {
2598 for (
Int_t j = 0; j < nphi; j++) {
2599 phi = phi1 + j * dphi;
2618 for (
Int_t i = 0; i < vecsize; i++)
2629 for (
Int_t i = 0; i < vecsize; i++)
2639 for (
Int_t i = 0; i < vecsize; i++)
2649 for (
Int_t i = 0; i < vecsize; i++)
2660 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 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
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
Fills the supplied buffer, with sections in desired frame See TBuffer3D.h for explanation of sections...
void SetBoxDimensions(Double_t dx, Double_t dy, Double_t dz, Double_t *origin=nullptr)
Set parameters of the box.
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.
void InspectShape() const override
Prints shape parameters.
A cone segment is a cone having a range in phi.
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 tube segment
void InspectShape() const override
print shape parameters
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
static void ComputeNormalS(const Double_t *point, const Double_t *dir, Double_t *norm, Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2, Double_t c1, Double_t s1, Double_t c2, Double_t s2)
Compute normal to closest surface from POINT.
Double_t Capacity() const override
Computes capacity of the shape in [length^3].
void Sizeof3D() const override
Fill size of this 3-D object.
static Double_t DistFromOutsideS(const Double_t *point, const Double_t *dir, Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2, Double_t c1, Double_t s1, Double_t c2, Double_t s2, Double_t cm, Double_t sm, Double_t cdfi)
compute distance from outside point to surface of arbitrary tube
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
TGeoConeSeg()
Default constructor.
Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const override
Get range of shape for a given axis.
TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override
Divide this cone segment shape belonging to volume "voldiv" into ndiv volumes called divname,...
void ComputeBBox() override
compute bounding box of the tube segment
Bool_t Contains(const Double_t *point) const override
test if point is inside this sphere
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 SetSegsAndPols(TBuffer3D &buffer) const override
Fill TBuffer3D structure for segments and polygons.
void InitTrigonometry()
Init frequently used trigonometric values.
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
compute closest distance from point px,py to each corner
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 GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const override
Returns numbers of vertices, segments and polygons composing the shape mesh.
static Double_t SafetyS(const Double_t *point, Bool_t in, Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2, Double_t phi1, Double_t phi2, Int_t skipz=0)
Static method to compute the closest distance from given point to this shape.
Int_t GetNmeshVertices() const override
Return number of vertices of the mesh representation.
void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) override
Compute normal to closest surface from POINT.
const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const override
Fills a static 3D buffer and returns a reference.
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...
void SetConsDimensions(Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2, Double_t phi1, Double_t phi2)
Set dimensions of the cone segment.
void AfterStreamer() override
Function called after streaming an object of this class.
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...
~TGeoConeSeg() override
destructor
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 tube
static Double_t DistFromInsideS(const Double_t *point, const Double_t *dir, Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2, Double_t c1, Double_t s1, Double_t c2, Double_t s2, Double_t cm, Double_t sm, Double_t cdfi)
compute distance from inside point to surface of the tube segment
static Double_t DistToCons(const Double_t *point, const Double_t *dir, Double_t r1, Double_t z1, Double_t r2, Double_t z2, Double_t phi1, Double_t phi2)
Static method to compute distance to a conical surface with :
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const override
computes the closest distance from given point to this shape, according to option.
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.
Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const override
Fills array with n random points located on the line segments of the shape mesh.
void SetPoints(Double_t *points) const override
Create cone segment mesh points.
void SetDimensions(Double_t *param) override
Set dimensions of the cone segment from an array.
void GetBoundingCylinder(Double_t *param) const override
Fill vector param[4] with the bounding cylinder parameters.
TBuffer3D * MakeBuffer3D() const override
Creates a TBuffer3D describing this shape.
The cones are defined by 5 parameters:
void SetDimensions(Double_t *param) override
Set cone dimensions from an array.
Double_t Capacity() const override
Computes capacity of the shape in [length^3].
const char * GetAxisName(Int_t iaxis) const override
Returns name of axis IAXIS.
Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const override
Get range of shape for a given axis.
static void ComputeNormalS(const Double_t *point, const Double_t *dir, Double_t *norm, Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2)
Compute normal to closest surface from POINT.
void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) override
Compute normal to closest surface from POINT.
void SetConeDimensions(Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2)
Set cone dimensions.
static Double_t DistFromInsideS(const Double_t *point, const Double_t *dir, Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2)
Compute distance from inside point to surface of the cone (static) Boundary safe algorithm.
~TGeoCone() override
destructor
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...
void SetPoints(Double_t *points) const override
Create cone mesh points.
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
compute closest distance from point px,py to each corner
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const override
computes the closest distance from given point to this shape, according to option.
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 tube
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 ComputeBBox() override
compute bounding box of the sphere
TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override
Divide this cone shape belonging to volume "voldiv" into ndiv volumes called divname,...
static Double_t DistFromOutsideS(const Double_t *point, const Double_t *dir, Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2)
Compute distance from outside point to surface of the tube Boundary safe algorithm.
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.
TGeoCone()
Default constructor.
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
void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const override
Returns numbers of vertices, segments and polygons composing the shape mesh.
Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const override
Fills array with n random points located on the line segments of the shape mesh.
Bool_t Contains(const Double_t *point) const override
test if point is inside this cone
static void DistToCone(const Double_t *point, const Double_t *dir, Double_t dz, Double_t r1, Double_t r2, Double_t &b, Double_t &delta)
Static method to compute distance to a conical surface with :
static Double_t SafetyS(const Double_t *point, Bool_t in, Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2, Int_t skipz=0)
computes the closest distance from given point to this shape, according to option.
void Sizeof3D() const override
Fill size of this 3-D object.
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.
TBuffer3D * MakeBuffer3D() const override
Creates a TBuffer3D describing this shape.
void InspectShape() const override
print shape parameters
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...
const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const override
Fills a static 3D buffer and returns a reference.
Int_t GetNmeshVertices() const override
Return number of vertices of the mesh representation.
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 cone Boundary safe algorithm.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
void GetBoundingCylinder(Double_t *param) const override
Fill vector param[4] with the bounding cylinder parameters.
void SetSegsAndPols(TBuffer3D &buffer) const override
Fill TBuffer3D structure for segments and polygons.
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.
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.
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.
static Double_t SafetySeg(Double_t r, Double_t z, Double_t r1, Double_t z1, Double_t r2, Double_t z2, Bool_t outer)
Compute distance from point of coordinates (r,z) to segment (r1,z1):(r2,z2)
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
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.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
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
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
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 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()