114 SetConeDimensions(dz, rmin1, rmax1, rmin2, rmax2);
115 if ((dz < 0) || (rmin1 < 0) || (rmax1 < 0) || (rmin2 < 0) || (rmax2 < 0)) {
116 SetShapeBit(kGeoRunTimeShape);
128 SetConeDimensions(dz, rmin1, rmax1, rmin2, rmax2);
129 if ((dz < 0) || (rmin1 < 0) || (rmax1 < 0) || (rmin2 < 0) || (rmax2 < 0)) {
130 SetShapeBit(kGeoRunTimeShape);
146 SetDimensions(param);
147 if ((fDz < 0) || (fRmin1 < 0) || (fRmax1 < 0) || (fRmin2 < 0) || (fRmax2 < 0))
148 SetShapeBit(kGeoRunTimeShape);
167 (rmax1 * rmax1 + rmax2 * rmax2 + rmax1 * rmax2 - rmin1 * rmin1 - rmin2 * rmin2 - rmin1 * rmin2);
192 memset(norm, 0, 3 *
sizeof(
Double_t));
204 Double_t rin = tg1 * point[2] + ro1;
205 Double_t rout = tg2 * point[2] + ro2;
212 norm[0] = cr1 * cphi;
213 norm[1] = cr1 * sphi;
214 norm[2] = -tg1 * cr1;
218 norm[0] = cr2 * cphi;
219 norm[1] = cr2 * sphi;
220 norm[2] = -tg2 * cr2;
222 if (norm[0] * dir[0] + norm[1] * dir[1] + norm[2] * dir[2] < 0) {
236 memset(norm, 0, 3 *
sizeof(
Double_t));
240 Double_t ro1 = 0.5 * (rmin1 + rmin2);
241 Double_t tg1 = 0.5 * (rmin2 - rmin1) / dz;
243 Double_t ro2 = 0.5 * (rmax1 + rmax2);
244 Double_t tg2 = 0.5 * (rmax2 - rmax1) / dz;
248 Double_t rin = tg1 * point[2] + ro1;
249 Double_t rout = tg2 * point[2] + ro2;
251 norm[0] = cr1 * cphi;
252 norm[1] = cr1 * sphi;
253 norm[2] = -tg1 * cr1;
255 norm[0] = cr2 * cphi;
256 norm[1] = cr2 * sphi;
257 norm[2] = -tg2 * cr2;
259 if (norm[0] * dir[0] + norm[1] * dir[1] + norm[2] * dir[2] < 0) {
273 Double_t r2 = point[0] * point[0] + point[1] * point[1];
276 if ((r2 < rl * rl) || (r2 > rh * rh))
294 sz = (
TMath::Sign(dz, dir[2]) - point[2]) / dir[2];
298 Double_t rsq = point[0] * point[0] + point[1] * point[1];
300 Double_t rin = 0.5 * (rmin1 + rmin2 + (rmin2 - rmin1) * point[2] * zinv);
307 point[0] * dir[0] + point[1] * dir[1] + 0.5 * (rmin1 - rmin2) * dir[2] * zinv *
TMath::Sqrt(rsq);
315 zi = point[2] + sr * dir[2];
321 zi = point[2] + sr * dir[2];
329 Double_t rout = 0.5 * (rmax1 + rmax2 + (rmax2 - rmax1) * point[2] * zinv);
331 Double_t ddotn = point[0] * dir[0] + point[1] * dir[1] + 0.5 * (rmax1 - rmax2) * dir[2] * zinv *
TMath::Sqrt(rsq);
342 zi = point[2] + sr * dir[2];
351 zi = point[2] + sr * dir[2];
357 zi = point[2] + sr * dir[2];
372 if (iact < 3 && safe) {
376 if ((iact == 1) && (*safe > step))
397 if (point[2] <= -dz) {
400 snxt = (-dz - point[2]) / dir[2];
401 xp = point[0] + snxt * dir[0];
402 yp = point[1] + snxt * dir[1];
404 if ((r2 >= rmin1 * rmin1) && (r2 <= rmax1 * rmax1))
408 if (point[2] >= dz) {
411 snxt = (dz - point[2]) / dir[2];
412 xp = point[0] + snxt * dir[0];
413 yp = point[1] + snxt * dir[1];
415 if ((r2 >= rmin2 * rmin2) && (r2 <= rmax2 * rmax2))
421 Double_t rsq = point[0] * point[0] + point[1] * point[1];
423 Double_t ro1 = 0.5 * (rmin1 + rmin2);
429 tg1 = 0.5 * (rmin2 - rmin1) * dzinv;
430 rin = ro1 + tg1 * point[2];
434 Double_t ro2 = 0.5 * (rmax1 + rmax2);
435 Double_t tg2 = 0.5 * (rmax2 - rmax1) * dzinv;
436 Double_t rout = tg2 * point[2] + ro2;
440 Bool_t in = inz & inrmin & inrmax;
448 if (safz <= safrmin && safz <= safrmax) {
450 if (point[2] * dir[2] < 0)
454 if (safrmax < safrmin) {
456 Double_t ddotn = point[0] * dir[0] + point[1] * dir[1] - tg2 * dir[2] *
r;
462 Double_t ddotn = point[0] * dir[0] + point[1] * dir[1] - tg1 * dir[2] *
r;
475 zp = point[2] + snxt * dir[2];
490 zp = point[2] + snxt * dir[2];
496 zp = point[2] + snxt * dir[2];
507 zp = point[2] + din * dir[2];
523 if (dout > 0 && dout < snxt) {
524 zp = point[2] + dout * dir[2];
529 if (dout <= 0 || dout > snxt)
531 zp = point[2] + dout * dir[2];
544 if (iact < 3 && safe) {
548 if ((iact == 1) && (*safe > step))
573 Double_t rsq = point[0] * point[0] + point[1] * point[1];
576 Double_t a = dir[0] * dir[0] + dir[1] * dir[1] - tz * tz * dir[2] * dir[2];
577 b = point[0] * dir[0] + point[1] * dir[1] - tz * rc * dir[2];
604 const Int_t numPoints = 4 *
n;
621 TGeoVolumeMulti *vmulti;
622 TGeoPatternFinder *finder;
628 Error(
"Divide",
"division of a cone on R not implemented");
631 finder =
new TGeoPatternCylPhi(voldiv, ndiv,
start, end);
635 vol =
new TGeoVolume(divname, shape, voldiv->
GetMedium());
639 for (
id = 0;
id < ndiv;
id++) {
646 finder =
new TGeoPatternZ(voldiv, ndiv,
start, end);
649 for (
id = 0;
id < ndiv;
id++) {
656 shape =
new TGeoCone(0.5 * step, rmin1n, rmax1n, rmin2n, rmax2n);
657 vol =
new TGeoVolume(divname, shape, voldiv->
GetMedium());
664 default:
Error(
"Divide",
"Wrong axis type for division");
return nullptr;
675 case 2:
return "PHI";
677 default:
return "undefined";
710 param[0] *= param[0];
712 param[1] *= param[1];
726 Error(
"GetMakeRuntimeShape",
"invalid mother");
729 Double_t rmin1, rmax1, rmin2, rmax2, dz;
738 rmin1 = ((
TGeoCone *)mother)->GetRmin1();
740 rmax1 = ((
TGeoCone *)mother)->GetRmax1();
742 rmin2 = ((
TGeoCone *)mother)->GetRmin2();
744 rmax2 = ((
TGeoCone *)mother)->GetRmax2();
756 if (!array || npoints <= 0)
769 Int_t outPoints = npoints;
772 outPoints = (npoints + 1) / 2;
773 inPoints = npoints - outPoints;
777 if (nSurfPoints <= 0)
784 if (nGen > nSurfPoints)
790 const Int_t q = nSurfPoints / nGen;
791 const Int_t r = nSurfPoints % nGen;
793 for (
Int_t ig = 0; ig < nGen; ++ig) {
794 const Int_t m =
q + (ig <
r ? 1 : 0);
804 for (
Int_t j = 0; j <
m; ++j) {
805 if (iCrt >= 3 * npoints)
812 const Double_t rz = 0.5 * (r1 + r2) + 0.5 * (r2 - r1) * (z /
fDz);
814 array[iCrt++] = rz *
c;
815 array[iCrt++] = rz * s;
836 if (icrt != 3 * npoints)
847 printf(
"*** Shape %s TGeoCone ***\n",
GetName());
848 printf(
" dz =: %11.5f\n",
fDz);
849 printf(
" Rmin1 = %11.5f\n",
fRmin1);
850 printf(
" Rmax1 = %11.5f\n",
fRmax1);
851 printf(
" Rmin2 = %11.5f\n",
fRmin2);
852 printf(
" Rmax2 = %11.5f\n",
fRmax2);
853 printf(
" Bounding box:\n");
866 for (i = 0; i < 4; i++) {
867 for (j = 0; j <
n; j++) {
868 buffer.
fSegs[(i *
n + j) * 3] =
c;
869 buffer.
fSegs[(i *
n + j) * 3 + 1] = i *
n + j;
870 buffer.
fSegs[(i *
n + j) * 3 + 2] = i *
n + j + 1;
872 buffer.
fSegs[(i *
n + j - 1) * 3 + 2] = i *
n;
874 for (i = 4; i < 6; i++) {
875 for (j = 0; j <
n; j++) {
876 buffer.
fSegs[(i *
n + j) * 3] =
c + 1;
877 buffer.
fSegs[(i *
n + j) * 3 + 1] = (i - 4) *
n + j;
878 buffer.
fSegs[(i *
n + j) * 3 + 2] = (i - 2) *
n + j;
881 for (i = 6; i < 8; i++) {
882 for (j = 0; j <
n; j++) {
883 buffer.
fSegs[(i *
n + j) * 3] =
c;
884 buffer.
fSegs[(i *
n + j) * 3 + 1] = 2 * (i - 6) *
n + j;
885 buffer.
fSegs[(i *
n + j) * 3 + 2] = (2 * (i - 6) + 1) *
n + j;
891 for (j = 0; j <
n; j++) {
892 indx = 6 * (i *
n + j);
894 buffer.
fPols[indx + 1] = 4;
895 buffer.
fPols[indx + 5] = i *
n + j;
896 buffer.
fPols[indx + 4] = (4 + i) *
n + j;
897 buffer.
fPols[indx + 3] = (2 + i) *
n + j;
898 buffer.
fPols[indx + 2] = (4 + i) *
n + j + 1;
900 buffer.
fPols[indx + 2] = (4 + i) *
n;
902 for (j = 0; j <
n; j++) {
903 indx = 6 * (i *
n + j);
905 buffer.
fPols[indx + 1] = 4;
906 buffer.
fPols[indx + 2] = i *
n + j;
907 buffer.
fPols[indx + 3] = (4 + i) *
n + j;
908 buffer.
fPols[indx + 4] = (2 + i) *
n + j;
909 buffer.
fPols[indx + 5] = (4 + i) *
n + j + 1;
911 buffer.
fPols[indx + 5] = (4 + i) *
n;
913 for (j = 0; j <
n; j++) {
914 indx = 6 * (i *
n + j);
915 buffer.
fPols[indx] =
c + i;
916 buffer.
fPols[indx + 1] = 4;
917 buffer.
fPols[indx + 2] = (i - 2) * 2 *
n + j;
918 buffer.
fPols[indx + 3] = (4 + i) *
n + j;
919 buffer.
fPols[indx + 4] = ((i - 2) * 2 + 1) *
n + j;
920 buffer.
fPols[indx + 5] = (4 + i) *
n + j + 1;
922 buffer.
fPols[indx + 5] = (4 + i) *
n;
924 for (j = 0; j <
n; j++) {
925 indx = 6 * (i *
n + j);
926 buffer.
fPols[indx] =
c + i;
927 buffer.
fPols[indx + 1] = 4;
928 buffer.
fPols[indx + 5] = (i - 2) * 2 *
n + j;
929 buffer.
fPols[indx + 4] = (4 + i) *
n + j;
930 buffer.
fPols[indx + 3] = ((i - 2) * 2 + 1) *
n + j;
931 buffer.
fPols[indx + 2] = (4 + i) *
n + j + 1;
933 buffer.
fPols[indx + 2] = (4 + i) *
n;
982 if (rmin1 > 0 || rmin2 > 0)
998 out <<
" dz = " <<
fDz <<
";" << std::endl;
999 out <<
" rmin1 = " <<
fRmin1 <<
";" << std::endl;
1000 out <<
" rmax1 = " <<
fRmax1 <<
";" << std::endl;
1001 out <<
" rmin2 = " <<
fRmin2 <<
";" << std::endl;
1002 out <<
" rmax2 = " <<
fRmax2 <<
";" << std::endl;
1004 <<
"\", dz,rmin1,rmax1,rmin2,rmax2);" << std::endl;
1015 if (rmin1 <= rmax1) {
1022 Warning(
"SetConeDimensions",
"rmin1>rmax1 Switch rmin1<->rmax1");
1037 if (rmin2 <= rmax2) {
1044 Warning(
"SetConeDimensions",
"rmin2>rmax2 Switch rmin2<->rmax2");
1088 for (j = 0; j <
n; j++) {
1095 for (j = 0; j <
n; j++) {
1102 for (j = 0; j <
n; j++) {
1109 for (j = 0; j <
n; j++) {
1132 for (j = 0; j <
n; j++) {
1139 for (j = 0; j <
n; j++) {
1146 for (j = 0; j <
n; j++) {
1153 for (j = 0; j <
n; j++) {
1202 if (buffer.
SetRawSizes(nbPnts, 3 * nbPnts, nbSegs, 3 * nbSegs, nbPols, 6 * nbPols)) {
1228 for (
Int_t i = 0; i < vecsize; i++)
1239 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++)
1270 for (
Int_t i = 0; i < vecsize; i++)
1278 :
TGeoCone(), fPhi1(0.), fPhi2(0.), fS1(0.), fC1(0.), fS2(0.), fC2(0.), fSm(0.), fCm(0.), fCdfi(0.)
1281 fPhi1 = fPhi2 = 0.0;
1289 :
TGeoCone(dz, rmin1, rmax1, rmin2, rmax2),
1302 SetConsDimensions(dz, rmin1, rmax1, rmin2, rmax2, phi1, phi2);
1323 SetConsDimensions(dz, rmin1, rmax1, rmin2, rmax2, phi1, phi2);
1338 :
TGeoCone(0, 0, 0, 0, 0), fPhi1(0.), fPhi2(0.), fS1(0.), fC1(0.), fS2(0.), fC2(0.), fSm(0.), fCm(0.), fCdfi(0.)
1341 SetDimensions(param);
1369 Double_t fio = 0.5 * (phi1 + phi2);
1372 Double_t dfi = 0.5 * (phi2 - phi1);
1391 (rmax1 * rmax1 + rmax2 * rmax2 + rmax1 * rmax2 - rmin1 * rmin1 - rmin2 * rmin2 - rmin1 * rmin2);
1463 Double_t rin = tg1 * point[2] + ro1;
1464 Double_t rout = tg2 * point[2] + ro2;
1474 norm[0] = norm[1] = 0.;
1484 norm[0] = cr1 * cphi;
1485 norm[1] = cr1 * sphi;
1486 norm[2] = -tg1 * cr1;
1488 norm[0] = cr2 * cphi;
1489 norm[1] = cr2 * sphi;
1490 norm[2] = -tg2 * cr2;
1493 if (norm[0] * dir[0] + norm[1] * dir[1] + norm[2] * dir[2] < 0) {
1508 Double_t ro1 = 0.5 * (rmin1 + rmin2);
1509 Double_t tg1 = 0.5 * (rmin2 - rmin1) / dz;
1511 Double_t ro2 = 0.5 * (rmax1 + rmax2);
1512 Double_t tg2 = 0.5 * (rmax2 - rmax1) / dz;
1516 Double_t rin = tg1 * point[2] + ro1;
1517 Double_t rout = tg2 * point[2] + ro2;
1531 norm[0] = cr1 * cphi;
1532 norm[1] = cr1 * sphi;
1533 norm[2] = -tg1 * cr1;
1535 norm[0] = cr2 * cphi;
1536 norm[1] = cr2 * sphi;
1537 norm[2] = -tg2 * cr2;
1540 if (norm[0] * dir[0] + norm[1] * dir[1] + norm[2] * dir[2] < 0) {
1593 Double_t r0sq = point[0] * point[0] + point[1] * point[1];
1594 Double_t rc = ro0 + fz * (point[2] - 0.5 * (z1 + z2));
1596 Double_t a = dir[0] * dir[0] + dir[1] * dir[1] - fz * fz * dir[2] * dir[2];
1597 Double_t b = point[0] * dir[0] + point[1] * dir[1] - fz * rc * dir[2];
1615 ptnew[2] = point[2] + snxt * dir[2];
1616 if (((ptnew[2] - z1) * (ptnew[2] - z2)) < 0) {
1620 ptnew[0] = point[0] + snxt * dir[0];
1621 ptnew[1] = point[1] + snxt * dir[1];
1636 ptnew[2] = point[2] + snxt * dir[2];
1637 if (((ptnew[2] - z1) * (ptnew[2] - z2)) < 0) {
1641 ptnew[0] = point[0] + snxt * dir[0];
1642 ptnew[1] = point[1] + snxt * dir[1];
1671 Double_t rsq = point[0] * point[0] + point[1] * point[1];
1673 Double_t cpsi = point[0] * cm + point[1] * sm;
1682 ddotn =
s1 * dir[0] -
c1 * dir[1];
1685 ddotn = -s2 * dir[0] +
c2 * dir[1];
1688 sfmin = s2 * point[0] -
c2 * point[1];
1694 xi = point[0] + sfmin * dir[0];
1695 yi = point[1] + sfmin * dir[1];
1696 if (yi * cm - xi * sm < 0)
1700 ddotn = -s2 * dir[0] +
c2 * dir[1];
1703 ddotn =
s1 * dir[0] -
c1 * dir[1];
1706 sfmin = -
s1 * point[0] +
c1 * point[1];
1712 xi = point[0] + sfmin * dir[0];
1713 yi = point[1] + sfmin * dir[1];
1714 if (yi * cm - xi * sm > 0)
1725 if (iact < 3 && safe) {
1729 if ((iact == 1) && (*safe > step))
1736 return TGeoConeSeg::DistFromInsideS(point, dir,
fDz,
fRmin1,
fRmax1,
fRmin2,
fRmax2,
fC1,
fS1,
fC2,
fS2,
fCm,
fSm,
1760 if (point[2] * dir[2] >= 0)
1763 xi = point[0] + s * dir[0];
1764 yi = point[1] + s * dir[1];
1765 r2 = xi * xi + yi * yi;
1773 if ((rin * rin <= r2) && (r2 <= rout * rout)) {
1774 cpsi = xi * cm + yi * sm;
1780 Double_t rsq = point[0] * point[0] + point[1] * point[1];
1782 Double_t ro1 = 0.5 * (rmin1 + rmin2);
1788 tg1 = 0.5 * (rmin2 - rmin1) * zinv;
1789 rin = ro1 + tg1 * point[2];
1795 Double_t ro2 = 0.5 * (rmax1 + rmax2);
1796 Double_t tg2 = 0.5 * (rmax2 - rmax1) * zinv;
1797 rout = ro2 + tg2 * point[2];
1802 cpsi = point[0] * cm + point[1] * sm;
1805 in = inz & inrmin & inrmax & inphi;
1812 if (zi < safrmax && zi < safrmin && zi < safphi) {
1813 if (point[2] * dir[2] < 0)
1818 if (safrmax < safrmin && safrmax < safphi) {
1819 Double_t ddotn = point[0] * dir[0] + point[1] * dir[1] - tg2 * dir[2] *
r;
1825 if (safphi < safrmin) {
1829 if (point[0] *
c1 + point[1] *
s1 > point[0] *
c2 + point[1] * s2) {
1830 un = dir[0] *
s1 - dir[1] *
c1;
1835 un = -dir[0] * s2 + dir[1] *
c2;
1837 s = -point[0] * s2 + point[1] *
c2;
1840 zi = point[2] + s * dir[2];
1842 xi = point[0] + s * dir[0];
1843 yi = point[1] + s * dir[1];
1844 if ((yi * cm - xi * sm) > 0) {
1845 r2 = xi * xi + yi * yi;
1846 rin = ro1 + tg1 * zi;
1847 rout = ro2 + tg2 * zi;
1848 if ((rin * rin <= r2) && (rout * rout >= r2))
1855 un = -dir[0] * s2 + dir[1] *
c2;
1860 un = dir[0] *
s1 - dir[1] *
c1;
1862 s = point[0] *
s1 - point[1] *
c1;
1865 zi = point[2] + s * dir[2];
1867 xi = point[0] + s * dir[0];
1868 yi = point[1] + s * dir[1];
1869 if ((yi * cm - xi * sm) < 0) {
1870 r2 = xi * xi + yi * yi;
1871 rin = ro1 + tg1 * zi;
1872 rout = ro2 + tg2 * zi;
1873 if ((rin * rin <= r2) && (rout * rout >= r2))
1881 Double_t ddotn = point[0] * dir[0] + point[1] * dir[1] - tg1 * dir[2] *
r;
1893 zi = point[2] + snxt * dir[2];
1896 xi = point[0] + snxt * dir[0];
1897 yi = point[1] + snxt * dir[1];
1898 r2 = xi * xi + yi * yi;
1899 cpsi = xi * cm + yi * sm;
1905 Double_t ddotn = point[0] * dir[0] + point[1] * dir[1] - tg1 * dir[2] *
r;
1916 zi = point[2] + snxt * dir[2];
1920 xi = point[0] + snxt * dir[0];
1921 yi = point[1] + snxt * dir[1];
1922 r2 = xi * xi + yi * yi;
1923 cpsi = xi * cm + yi * sm;
1931 s = point[0] *
s1 - point[1] *
c1;
1934 zi = point[2] + s * dir[2];
1936 xi = point[0] + s * dir[0];
1937 yi = point[1] + s * dir[1];
1938 if ((yi * cm - xi * sm) <= 0) {
1939 r2 = xi * xi + yi * yi;
1940 rin = ro1 + tg1 * zi;
1941 rout = ro2 + tg2 * zi;
1942 if ((rin * rin <= r2) && (rout * rout >= r2))
1948 un = dir[0] * s2 - dir[1] *
c2;
1950 s = (point[1] *
c2 - point[0] * s2) / un;
1952 zi = point[2] + s * dir[2];
1954 xi = point[0] + s * dir[0];
1955 yi = point[1] + s * dir[1];
1956 if ((yi * cm - xi * sm) >= 0) {
1957 r2 = xi * xi + yi * yi;
1958 rin = ro1 + tg1 * zi;
1959 rout = ro2 + tg2 * zi;
1960 if ((rin * rin <= r2) && (rout * rout >= r2))
1977 zi = point[2] + s * dir[2];
1979 xi = point[0] + s * dir[0];
1980 yi = point[1] + s * dir[1];
1981 r2 = xi * xi + yi * yi;
1982 cpsi = xi * cm + yi * sm;
1989 zi = point[2] + s * dir[2];
1991 xi = point[0] + s * dir[0];
1992 yi = point[1] + s * dir[1];
1993 r2 = xi * xi + yi * yi;
1994 cpsi = xi * cm + yi * sm;
2007 zi = point[2] + s * dir[2];
2009 xi = point[0] + s * dir[0];
2010 yi = point[1] + s * dir[1];
2011 r2 = xi * xi + yi * yi;
2012 cpsi = xi * cm + yi * sm;
2020 zi = point[2] + s * dir[2];
2022 xi = point[0] + s * dir[0];
2023 yi = point[1] + s * dir[1];
2024 r2 = xi * xi + yi * yi;
2025 cpsi = xi * cm + yi * sm;
2037 zi = point[2] + s * dir[2];
2040 xi = point[0] + s * dir[0];
2041 yi = point[1] + s * dir[1];
2042 r2 = xi * xi + yi * yi;
2043 rout = ro2 + tg2 * zi;
2044 if (r2 > rout * rout)
2046 rin = ro1 + tg1 * zi;
2047 if (r2 >= rin * rin)
2059 if (iact < 3 && safe) {
2063 if ((iact == 1) && (*safe > step))
2072 return TGeoConeSeg::DistFromOutsideS(point, dir,
fDz,
fRmin1,
fRmax1,
fRmin2,
fRmax2,
fC1,
fS1,
fC2,
fS2,
fCm,
fSm,
2082 const Int_t numPoints = 4 *
n;
2099 TGeoVolumeMulti *vmulti;
2100 TGeoPatternFinder *finder;
2107 Error(
"Divide",
"division of a cone segment on R not implemented");
2113 finder =
new TGeoPatternCylPhi(voldiv, ndiv,
start, end);
2117 vol =
new TGeoVolume(divname, shape, voldiv->
GetMedium());
2121 for (
id = 0;
id < ndiv;
id++) {
2127 finder =
new TGeoPatternZ(voldiv, ndiv,
start, end);
2131 for (
id = 0;
id < ndiv;
id++) {
2139 vol =
new TGeoVolume(divname, shape, voldiv->
GetMedium());
2146 default:
Error(
"Divide",
"Wrong axis type for division");
return nullptr;
2180 param[0] *= param[0];
2182 param[1] *= param[1];
2185 while (param[3] < param[2])
2198 Error(
"GetMakeRuntimeShape",
"invalid mother");
2201 Double_t rmin1, rmax1, rmin2, rmax2, dz;
2210 rmin1 = ((
TGeoCone *)mother)->GetRmin1();
2212 rmax1 = ((
TGeoCone *)mother)->GetRmax1();
2214 rmin2 = ((
TGeoCone *)mother)->GetRmin2();
2216 rmax2 = ((
TGeoCone *)mother)->GetRmax2();
2226 printf(
"*** Shape %s: TGeoConeSeg ***\n",
GetName());
2227 printf(
" dz = %11.5f\n",
fDz);
2228 printf(
" Rmin1 = %11.5f\n",
fRmin1);
2229 printf(
" Rmax1 = %11.5f\n",
fRmax1);
2230 printf(
" Rmin2 = %11.5f\n",
fRmin2);
2231 printf(
" Rmax2 = %11.5f\n",
fRmax2);
2232 printf(
" phi1 = %11.5f\n",
fPhi1);
2233 printf(
" phi2 = %11.5f\n",
fPhi2);
2234 printf(
" Bounding box:\n");
2248 for (i = 0; i < 4; i++) {
2249 for (j = 1; j <
n; j++) {
2250 buffer.
fSegs[(i *
n + j - 1) * 3] =
c;
2251 buffer.
fSegs[(i *
n + j - 1) * 3 + 1] = i *
n + j - 1;
2252 buffer.
fSegs[(i *
n + j - 1) * 3 + 2] = i *
n + j;
2255 for (i = 4; i < 6; i++) {
2256 for (j = 0; j <
n; j++) {
2257 buffer.
fSegs[(i *
n + j) * 3] =
c + 1;
2258 buffer.
fSegs[(i *
n + j) * 3 + 1] = (i - 4) *
n + j;
2259 buffer.
fSegs[(i *
n + j) * 3 + 2] = (i - 2) *
n + j;
2262 for (i = 6; i < 8; i++) {
2263 for (j = 0; j <
n; j++) {
2264 buffer.
fSegs[(i *
n + j) * 3] =
c;
2265 buffer.
fSegs[(i *
n + j) * 3 + 1] = 2 * (i - 6) *
n + j;
2266 buffer.
fSegs[(i *
n + j) * 3 + 2] = (2 * (i - 6) + 1) *
n + j;
2273 for (j = 0; j <
n - 1; j++) {
2274 buffer.
fPols[indx++] =
c;
2275 buffer.
fPols[indx++] = 4;
2276 buffer.
fPols[indx++] = (4 + i) *
n + j + 1;
2277 buffer.
fPols[indx++] = (2 + i) *
n + j;
2278 buffer.
fPols[indx++] = (4 + i) *
n + j;
2279 buffer.
fPols[indx++] = i *
n + j;
2282 for (j = 0; j <
n - 1; j++) {
2283 buffer.
fPols[indx++] =
c;
2284 buffer.
fPols[indx++] = 4;
2285 buffer.
fPols[indx++] = i *
n + j;
2286 buffer.
fPols[indx++] = (4 + i) *
n + j;
2287 buffer.
fPols[indx++] = (2 + i) *
n + j;
2288 buffer.
fPols[indx++] = (4 + i) *
n + j + 1;
2291 for (j = 0; j <
n - 1; j++) {
2292 buffer.
fPols[indx++] =
c + i;
2293 buffer.
fPols[indx++] = 4;
2294 buffer.
fPols[indx++] = (i - 2) * 2 *
n + j;
2295 buffer.
fPols[indx++] = (4 + i) *
n + j;
2296 buffer.
fPols[indx++] = ((i - 2) * 2 + 1) *
n + j;
2297 buffer.
fPols[indx++] = (4 + i) *
n + j + 1;
2300 for (j = 0; j <
n - 1; j++) {
2301 buffer.
fPols[indx++] =
c + i;
2302 buffer.
fPols[indx++] = 4;
2303 buffer.
fPols[indx++] = (4 + i) *
n + j + 1;
2304 buffer.
fPols[indx++] = ((i - 2) * 2 + 1) *
n + j;
2305 buffer.
fPols[indx++] = (4 + i) *
n + j;
2306 buffer.
fPols[indx++] = (i - 2) * 2 *
n + j;
2308 buffer.
fPols[indx++] =
c + 2;
2309 buffer.
fPols[indx++] = 4;
2310 buffer.
fPols[indx++] = 6 *
n;
2311 buffer.
fPols[indx++] = 4 *
n;
2312 buffer.
fPols[indx++] = 7 *
n;
2313 buffer.
fPols[indx++] = 5 *
n;
2314 buffer.
fPols[indx++] =
c + 2;
2315 buffer.
fPols[indx++] = 4;
2316 buffer.
fPols[indx++] = 6 *
n - 1;
2317 buffer.
fPols[indx++] = 8 *
n - 1;
2318 buffer.
fPols[indx++] = 5 *
n - 1;
2319 buffer.
fPols[indx++] = 7 *
n - 1;
2346 if ((phi2 - phi1) >= 360.)
2363 out <<
" // Shape: " <<
GetName() <<
" type: " <<
ClassName() << std::endl;
2364 out <<
" dz = " <<
fDz <<
";" << std::endl;
2365 out <<
" rmin1 = " <<
fRmin1 <<
";" << std::endl;
2366 out <<
" rmax1 = " <<
fRmax1 <<
";" << std::endl;
2367 out <<
" rmin2 = " <<
fRmin2 <<
";" << std::endl;
2368 out <<
" rmax2 = " <<
fRmax2 <<
";" << std::endl;
2369 out <<
" phi1 = " <<
fPhi1 <<
";" << std::endl;
2370 out <<
" phi2 = " <<
fPhi2 <<
";" << std::endl;
2372 <<
"\", dz,rmin1,rmax1,rmin2,rmax2,phi1,phi2);" << std::endl;
2419 Float_t dphi, phi, phi1, phi2, dz;
2426 dphi = (phi2 - phi1) / (
n - 1);
2431 for (j = 0; j <
n; j++) {
2437 for (j = 0; j <
n; j++) {
2443 for (j = 0; j <
n; j++) {
2449 for (j = 0; j <
n; j++) {
2464 Float_t dphi, phi, phi1, phi2, dz;
2471 dphi = (phi2 - phi1) / (
n - 1);
2476 for (j = 0; j <
n; j++) {
2482 for (j = 0; j <
n; j++) {
2488 for (j = 0; j <
n; j++) {
2494 for (j = 0; j <
n; j++) {
2541 Int_t nbSegs = 2 * nbPnts;
2542 Int_t nbPols = nbPnts - 2;
2543 if (buffer.
SetRawSizes(nbPnts, 3 * nbPnts, nbSegs, 3 * nbSegs, nbPols, 6 * nbPols)) {
2567 if (!array || npoints <= 0)
2580 if (dphiSpan <= 0.0) {
2583 if (dphiSpan <= 0.0)
2590 Int_t outPoints = npoints;
2593 outPoints = (npoints + 1) / 2;
2594 inPoints = npoints - outPoints;
2599 return 0.5 * (r1 + r2) + 0.5 * (r2 - r1) * (z /
fDz);
2603 if (nSurfPoints <= 0)
2610 if (nGen > nSurfPoints)
2614 const Int_t q = nSurfPoints / nGen;
2615 const Int_t r = nSurfPoints % nGen;
2620 for (
Int_t ig = 0; ig < nGen; ++ig) {
2621 const Int_t m =
q + (ig <
r ? 1 : 0);
2626 const Double_t phi = phi1 + (ig + 0.5) * dphi;
2631 for (
Int_t j = 0; j <
m; ++j) {
2632 if (icrt + 3 > 3 * npoints)
2638 const Double_t rz = radiusAtZ(r1, r2, z);
2640 array[icrt++] = rz *
c;
2641 array[icrt++] = rz * s;
2662 if (icrt != 3 * npoints)
2675 for (
Int_t i = 0; i < vecsize; i++)
2686 for (
Int_t i = 0; i < vecsize; i++)
2696 for (
Int_t i = 0; i < vecsize; i++)
2706 for (
Int_t i = 0; i < vecsize; i++)
2717 for (
Int_t i = 0; i < vecsize; i++)
int Int_t
Signed integer 4 bytes (int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
float Float_t
Float 4 bytes (float).
const char Option_t
Option string (const char).
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
void Fatal(const char *location, const char *msgfmt,...)
Use this function in case of a fatal error. It will abort the program.
externTGeoManager * 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
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
TGeoBBox(const TGeoBBox &)=delete
void InspectShape() 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 InspectShape() const override
TGeoShape * GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const override
Double_t Capacity() const override
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)
void Sizeof3D() const override
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)
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const override
TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override
void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) const override
void ComputeBBox() override
Bool_t Contains(const Double_t *point) const override
void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
void SetSegsAndPols(TBuffer3D &buffer) const override
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Computes distance from point (px,py) to the object.
void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const override
void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const override
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.
void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize) override
void SetConsDimensions(Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2, Double_t phi1, Double_t phi2)
void AfterStreamer() override
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)
void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) 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
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)
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const override
void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override
Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const override
void SetPoints(Double_t *points) const override
void SetDimensions(Double_t *param) override
void GetBoundingCylinder(Double_t *param) const override
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)
void SetDimensions(Double_t *param) override
Double_t Capacity() const override
const char * GetAxisName(Int_t iaxis) const override
Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const override
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)
void SetConeDimensions(Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2)
void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
void SetPoints(Double_t *points) const override
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Computes distance from point (px,py) to the object.
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) 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
void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
void ComputeBBox() override
TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override
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)
void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const override
TGeoShape * GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const override
void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const override
Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const override
TGeoCone(const TGeoCone &)=delete
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)
Bool_t Contains(const Double_t *point) const override
void Sizeof3D() const override
void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override
void InspectShape() const override
void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize) override
void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) const override
const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const override
Stub implementation to avoid forcing implementation at this stage.
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)
Int_t GetNmeshVertices() 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 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
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)
void SetSegsAndPols(TBuffer3D &buffer) const override
Geometrical transformation package.
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.
TGeoShape()
Default constructor.
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
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()