120 if ((dz<0) || (rmin1<0) || (rmax1<0) || (rmin2<0) || (rmax2<0)) {
135 if ((dz<0) || (rmin1<0) || (rmax1<0) || (rmin2<0) || (rmax2<0)) {
173 rmin1*rmin1-rmin2*rmin2-rmin1*rmin2);
230 if (norm[0]*dir[0]+norm[1]*dir[1]+norm[2]*dir[2]<0) {
249 Double_t tg1 = 0.5*(rmin2-rmin1)/dz;
252 Double_t tg2 = 0.5*(rmax2-rmax1)/dz;
267 if (norm[0]*dir[0]+norm[1]*dir[1]+norm[2]*dir[2]<0) {
280 Double_t r2 = point[0]*point[0]+point[1]*point[1];
283 if ((r2<rl*rl) || (r2>rh*rh))
return kFALSE;
300 if (sz<=0)
return 0.0;
302 Double_t rsq=point[0]*point[0]+point[1]*point[1];
304 Double_t rin = 0.5*(rmin1+rmin2+(rmin2-rmin1)*point[2]*zinv);
310 Double_t ddotn = point[0]*dir[0]+point[1]*dir[1]+0.5*(rmin1-rmin2)*dir[2]*zinv*
TMath::Sqrt(rsq);
311 if (ddotn<=0)
return 0.0;
317 zi = point[2]+sr*dir[2];
322 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);
332 if (ddotn>=0)
return 0.0;
334 if (delta<0)
return 0.0;
338 zi = point[2]+sr*dir[2];
346 zi = point[2]+sr*dir[2];
351 zi = point[2]+sr*dir[2];
364 if (iact<3 && safe) {
388 snxt = (-dz-point[2])/dir[2];
389 xp = point[0]+snxt*dir[0];
390 yp = point[1]+snxt*dir[1];
392 if ((r2>=rmin1*rmin1) && (r2<=rmax1*rmax1))
return snxt;
397 snxt = (dz-point[2])/dir[2];
398 xp = point[0]+snxt*dir[0];
399 yp = point[1]+snxt*dir[1];
401 if ((r2>=rmin2*rmin2) && (r2<=rmax2*rmax2))
return snxt;
406 Double_t rsq = point[0]*point[0]+point[1]*point[1];
414 tg1=0.5*(rmin2-rmin1)*dzinv;
415 rin=ro1+tg1*point[2];
419 Double_t tg2=0.5*(rmax2-rmax1)*dzinv;
423 Bool_t in = inz & inrmin & inrmax;
431 if (safz<=safrmin && safz<=safrmax) {
433 if (point[2]*dir[2]<0)
return 0.0;
436 if (safrmax<safrmin) {
438 Double_t ddotn = point[0]*dir[0]+point[1]*dir[1]-tg2*dir[2]*
r;
439 if (ddotn<=0)
return 0.0;
443 Double_t ddotn = point[0]*dir[0]+point[1]*dir[1]-tg1*dir[2]*
r;
444 if (ddotn>=0)
return 0.0;
448 if (delta<0)
return 0.0;
452 zp = point[2]+snxt*dir[2];
465 zp = point[2]+snxt*dir[2];
470 zp = point[2]+snxt*dir[2];
480 zp = point[2]+din*dir[2];
487 if (inrmax)
return snxt;
491 if (delta<0)
return snxt;
493 if (dout>0 && dout<snxt) {
494 zp = point[2]+dout*dir[2];
498 if (dout<=0 || dout>snxt)
return snxt;
499 zp = point[2]+dout*dir[2];
510 if (iact<3 && safe) {
535 Double_t rsq = point[0]*point[0] + point[1]*point[1];
538 Double_t a = dir[0]*dir[0] + dir[1]*dir[1] - tz*tz*dir[2]*dir[2];
539 b = point[0]*dir[0] + point[1]*dir[1] - tz*rc*dir[2];
565 const Int_t numPoints = 4*
n;
589 Error(
"Divide",
"division of a cone on R not implemented");
600 for (
id=0;
id<ndiv;
id++) {
610 for (
id=0;
id<ndiv;
id++) {
617 shape =
new TGeoCone(0.5*step,rmin1n, rmax1n, rmin2n, rmax2n);
626 Error(
"Divide",
"Wrong axis type for division");
677 param[0] *= param[0];
679 param[1] *= param[1];
692 Error(
"GetMakeRuntimeShape",
"invalid mother");
695 Double_t rmin1, rmax1, rmin2, rmax2, dz;
703 rmin1 = ((
TGeoCone*)mother)->GetRmin1();
705 rmax1 = ((
TGeoCone*)mother)->GetRmax1();
707 rmin2 = ((
TGeoCone*)mother)->GetRmin2();
709 rmax2 = ((
TGeoCone*)mother)->GetRmax2();
721 if (npoints > (npoints/2)*2) {
722 Error(
"GetPointsOnSegments",
"Npoints must be even number");
732 if (hasrmin) ntop = npoints/2 - nc*(nc-1);
733 else ntop = npoints - nc*(nc-1);
741 for (
Int_t i=0; i<nc; i++) {
742 if (i == (nc-1)) nphi = ntop;
747 for (
Int_t j=0; j<nphi; j++) {
768 printf(
"*** Shape %s TGeoCone ***\n",
GetName());
769 printf(
" dz =: %11.5f\n",
fDz);
770 printf(
" Rmin1 = %11.5f\n",
fRmin1);
771 printf(
" Rmax1 = %11.5f\n",
fRmax1);
772 printf(
" Rmin2 = %11.5f\n",
fRmin2);
773 printf(
" Rmax2 = %11.5f\n",
fRmax2);
774 printf(
" Bounding box:\n");
810 for (i = 0; i < 4; i++) {
811 for (j = 0; j <
n; j++) {
813 buffer.
fSegs[(i*
n+j)*3+1] = i*
n+j;
814 buffer.
fSegs[(i*
n+j)*3+2] = i*
n+j+1;
816 buffer.
fSegs[(i*
n+j-1)*3+2] = i*
n;
818 for (i = 4; i < 6; i++) {
819 for (j = 0; j <
n; j++) {
820 buffer.
fSegs[(i*
n+j)*3 ] =
c+1;
821 buffer.
fSegs[(i*
n+j)*3+1] = (i-4)*
n+j;
822 buffer.
fSegs[(i*
n+j)*3+2] = (i-2)*
n+j;
825 for (i = 6; i < 8; i++) {
826 for (j = 0; j <
n; j++) {
828 buffer.
fSegs[(i*
n+j)*3+1] = 2*(i-6)*
n+j;
829 buffer.
fSegs[(i*
n+j)*3+2] = (2*(i-6)+1)*
n+j;
835 for (j = 0; j <
n; j++) {
838 buffer.
fPols[indx+1] = 4;
839 buffer.
fPols[indx+5] = i*
n+j;
840 buffer.
fPols[indx+4] = (4+i)*
n+j;
841 buffer.
fPols[indx+3] = (2+i)*
n+j;
842 buffer.
fPols[indx+2] = (4+i)*
n+j+1;
844 buffer.
fPols[indx+2] = (4+i)*
n;
846 for (j = 0; j <
n; j++) {
849 buffer.
fPols[indx+1] = 4;
850 buffer.
fPols[indx+2] = i*
n+j;
851 buffer.
fPols[indx+3] = (4+i)*
n+j;
852 buffer.
fPols[indx+4] = (2+i)*
n+j;
853 buffer.
fPols[indx+5] = (4+i)*
n+j+1;
855 buffer.
fPols[indx+5] = (4+i)*
n;
857 for (j = 0; j <
n; j++) {
859 buffer.
fPols[indx ] =
c+i;
860 buffer.
fPols[indx+1] = 4;
861 buffer.
fPols[indx+2] = (i-2)*2*
n+j;
862 buffer.
fPols[indx+3] = (4+i)*
n+j;
863 buffer.
fPols[indx+4] = ((i-2)*2+1)*
n+j;
864 buffer.
fPols[indx+5] = (4+i)*
n+j+1;
866 buffer.
fPols[indx+5] = (4+i)*
n;
868 for (j = 0; j <
n; j++) {
870 buffer.
fPols[indx ] =
c+i;
871 buffer.
fPols[indx+1] = 4;
872 buffer.
fPols[indx+5] = (i-2)*2*
n+j;
873 buffer.
fPols[indx+4] = (4+i)*
n+j;
874 buffer.
fPols[indx+3] = ((i-2)*2+1)*
n+j;
875 buffer.
fPols[indx+2] = (4+i)*
n+j+1;
877 buffer.
fPols[indx+2] = (4+i)*
n;
893 if (safety>1.E20) safety = 0.;
925 if (rmin1>0 || rmin2>0)
940 out <<
" dz = " <<
fDz <<
";" << std::endl;
941 out <<
" rmin1 = " <<
fRmin1 <<
";" << std::endl;
942 out <<
" rmax1 = " <<
fRmax1 <<
";" << std::endl;
943 out <<
" rmin2 = " <<
fRmin2 <<
";" << std::endl;
944 out <<
" rmax2 = " <<
fRmax2 <<
";" << std::endl;
945 out <<
" TGeoShape *" <<
GetPointerName() <<
" = new TGeoCone(\"" <<
GetName() <<
"\", dz,rmin1,rmax1,rmin2,rmax2);" << std::endl;
964 Warning(
"SetConeDimensions",
"rmin1>rmax1 Switch rmin1<->rmax1");
986 Warning(
"SetConeDimensions",
"rmin2>rmax2 Switch rmin2<->rmax2");
1030 for (j = 0; j <
n; j++) {
1037 for (j = 0; j <
n; j++) {
1044 for (j = 0; j <
n; j++) {
1051 for (j = 0; j <
n; j++) {
1074 for (j = 0; j <
n; j++) {
1081 for (j = 0; j <
n; j++) {
1088 for (j = 0; j <
n; j++) {
1095 for (j = 0; j <
n; j++) {
1146 if (buffer.
SetRawSizes(nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, nbPols, 6*nbPols)) {
1218 fPhi1(0.), fPhi2(0.), fS1(0.), fC1(0.), fS2(0.), fC2(0.), fSm(0.), fCm(0.), fCdfi(0.)
1229 :
TGeoCone(dz, rmin1, rmax1, rmin2, rmax2),
1230 fPhi1(0.), fPhi2(0.), fS1(0.), fC1(0.), fS2(0.), fC2(0.), fSm(0.), fCm(0.), fCdfi(0.)
1244 fPhi1(0.), fPhi2(0.), fS1(0.), fC1(0.), fS2(0.), fC2(0.), fSm(0.), fCm(0.), fCdfi(0.)
1263 fPhi1(0.), fPhi2(0.), fS1(0.), fC1(0.), fS2(0.), fC2(0.), fSm(0.), fCm(0.), fCdfi(0.)
1317 (rmax1*rmax1+rmax2*rmax2+rmax1*rmax2-
1318 rmin1*rmin1-rmin2*rmin2-rmin1*rmin2);
1349 if (ddp<0) ddp+= 360;
1350 if (ddp<=dp)
xmax = rmax;
1352 if (ddp<0) ddp+= 360;
1353 if (ddp<=dp)
ymax = rmax;
1355 if (ddp<0) ddp+= 360;
1356 if (ddp<=dp)
xmin = -rmax;
1358 if (ddp<0) ddp+= 360;
1359 if (ddp<=dp)
ymin = -rmax;
1393 norm[0] = norm[1] = 0.;
1412 if (norm[0]*dir[0]+norm[1]*dir[1]+norm[2]*dir[2]<0) {
1428 Double_t tg1 = 0.5*(rmin2-rmin1)/dz;
1431 Double_t tg2 = 0.5*(rmax2-rmax1)/dz;
1459 if (norm[0]*dir[0]+norm[1]*dir[1]+norm[2]*dir[2]<0) {
1473 if (dphi >= 360.)
return kTRUE;
1475 if (phi < 0 ) phi+=360.;
1477 if (ddp < 0) ddp+=360.;
1479 if (ddp > dphi)
return kFALSE;
1498 if (dphi >= 360.) hasphi=
kFALSE;
1499 if (dphi < 0) dphi+=360.;
1504 Double_t r0sq = point[0]*point[0] + point[1]*point[1];
1505 Double_t rc = ro0 + fz*(point[2]-0.5*(z1+z2));
1507 Double_t a = dir[0]*dir[0] + dir[1]*dir[1] - fz*fz*dir[2]*dir[2];
1508 Double_t b = point[0]*dir[0] + point[1]*dir[1] - fz*rc*dir[2];
1524 ptnew[2] = point[2] + snxt*dir[2];
1525 if (((ptnew[2]-z1)*(ptnew[2]-z2)) < 0) {
1527 if (!hasphi)
return snxt;
1528 ptnew[0] = point[0] + snxt*dir[0];
1529 ptnew[1] = point[1] + snxt*dir[1];
1531 if (phi < 0 ) phi+=360.;
1533 if (ddp < 0) ddp+=360.;
1535 if (ddp<=dphi)
return snxt;
1541 ptnew[2] = point[2] + snxt*dir[2];
1542 if (((ptnew[2]-z1)*(ptnew[2]-z2)) < 0) {
1544 if (!hasphi)
return snxt;
1545 ptnew[0] = point[0] + snxt*dir[0];
1546 ptnew[1] = point[1] + snxt*dir[1];
1548 if (phi < 0 ) phi+=360.;
1550 if (ddp < 0) ddp+=360.;
1552 if (ddp<=dphi)
return snxt;
1568 if (scone<=0)
return 0.0;
1570 Double_t rsq = point[0]*point[0]+point[1]*point[1];
1572 Double_t cpsi=point[0]*cm+point[1]*sm;
1581 ddotn =
s1*dir[0]-
c1*dir[1];
1582 if (ddotn>=0)
return 0.0;
1583 ddotn = -s2*dir[0]+
c2*dir[1];
1584 if (ddotn<=0)
return scone;
1585 sfmin = s2*point[0]-
c2*point[1];
1586 if (sfmin<=0)
return scone;
1588 if (sfmin >= scone)
return scone;
1589 xi = point[0]+sfmin*dir[0];
1590 yi = point[1]+sfmin*dir[1];
1591 if (yi*cm-xi*sm<0)
return scone;
1594 ddotn = -s2*dir[0]+
c2*dir[1];
1595 if (ddotn>=0)
return 0.0;
1596 ddotn =
s1*dir[0]-
c1*dir[1];
1597 if (ddotn<=0)
return scone;
1598 sfmin = -
s1*point[0]+
c1*point[1];
1599 if (sfmin<=0)
return scone;
1601 if (sfmin >= scone)
return scone;
1602 xi = point[0]+sfmin*dir[0];
1603 yi = point[1]+sfmin*dir[1];
1604 if (yi*cm-xi*sm>0)
return scone;
1613 if (iact<3 && safe) {
1621 return TGeoConeSeg::DistFromInsideS(point,dir,
fDz,
fRmin1,
fRmax1,
fRmin2,
fRmax2,
fC1,
fS1,
fC2,
fS2,
fCm,
fSm,
fCdfi);
1645 xi = point[0]+s*dir[0];
1646 yi = point[1]+s*dir[1];
1655 if ((rin*rin<=r2) && (r2<=rout*rout)) {
1661 Double_t rsq = point[0]*point[0]+point[1]*point[1];
1669 tg1=0.5*(rmin2-rmin1)*zinv;
1670 rin = ro1+tg1*point[2];
1676 Double_t tg2=0.5*(rmax2-rmax1)*zinv;
1677 rout = ro2+tg2*point[2];
1681 cpsi=point[0]*cm+point[1]*sm;
1683 in = inz & inrmin & inrmax & inphi;
1690 if (zi<safrmax && zi<safrmin && zi<safphi) {
1691 if (point[2]*dir[2]<0)
return 0.0;
1695 if (safrmax<safrmin && safrmax<safphi) {
1696 Double_t ddotn = point[0]*dir[0]+point[1]*dir[1]-tg2*dir[2]*
r;
1697 if (ddotn<=0)
return 0.0;
1701 if (safphi<safrmin) {
1705 if (point[0]*
c1 + point[1]*
s1 > point[0]*
c2 + point[1]*s2) {
1706 un = dir[0]*
s1-dir[1]*
c1;
1707 if (un < 0)
return 0.0;
1709 un = -dir[0]*s2+dir[1]*
c2;
1711 s = -point[0]*s2+point[1]*
c2;
1714 zi = point[2]+s*dir[2];
1716 xi = point[0]+s*dir[0];
1717 yi = point[1]+s*dir[1];
1718 if ((yi*cm-xi*sm)>0) {
1722 if ((rin*rin<=r2) && (rout*rout>=r2))
return s;
1728 un = -dir[0]*s2+dir[1]*
c2;
1729 if (un < 0)
return 0.0;
1731 un = dir[0]*
s1-dir[1]*
c1;
1733 s = point[0]*
s1-point[1]*
c1;
1736 zi = point[2]+s*dir[2];
1738 xi = point[0]+s*dir[0];
1739 yi = point[1]+s*dir[1];
1740 if ((yi*cm-xi*sm)<0) {
1744 if ((rin*rin<=r2) && (rout*rout>=r2))
return s;
1751 Double_t ddotn = point[0]*dir[0]+point[1]*dir[1]-tg1*dir[2]*
r;
1759 zi = point[2]+snxt*dir[2];
1761 xi = point[0]+snxt*dir[0];
1762 yi = point[1]+snxt*dir[1];
1769 Double_t ddotn = point[0]*dir[0]+point[1]*dir[1]-tg1*dir[2]*
r;
1770 if (ddotn>=0)
return 0.0;
1772 if (delta<0)
return 0.0;
1776 zi = point[2]+snxt*dir[2];
1779 xi = point[0]+snxt*dir[0];
1780 yi = point[1]+snxt*dir[1];
1788 s=point[0]*
s1-point[1]*
c1;
1791 zi=point[2]+s*dir[2];
1793 xi=point[0]+s*dir[0];
1794 yi=point[1]+s*dir[1];
1795 if ((yi*cm-xi*sm)<=0) {
1799 if ((rin*rin<=r2) && (rout*rout>=r2))
return s;
1804 un=dir[0]*s2-dir[1]*
c2;
1806 s=(point[1]*
c2-point[0]*s2)/un;
1808 zi=point[2]+s*dir[2];
1810 xi=point[0]+s*dir[0];
1811 yi=point[1]+s*dir[1];
1812 if ((yi*cm-xi*sm)>=0) {
1816 if ((rin*rin<=r2) && (rout*rout>=r2))
return s;
1832 zi=point[2]+s*dir[2];
1834 xi=point[0]+s*dir[0];
1835 yi=point[1]+s*dir[1];
1843 zi=point[2]+s*dir[2];
1845 xi=point[0]+s*dir[0];
1846 yi=point[1]+s*dir[1];
1860 zi=point[2]+s*dir[2];
1862 xi=point[0]+s*dir[0];
1863 yi=point[1]+s*dir[1];
1872 zi=point[2]+s*dir[2];
1874 xi=point[0]+s*dir[0];
1875 yi=point[1]+s*dir[1];
1886 if (s>snxt)
return snxt;
1887 zi=point[2]+s*dir[2];
1889 xi=point[0]+s*dir[0];
1890 yi=point[1]+s*dir[1];
1893 if (r2>rout*rout)
return snxt;
1895 if (r2>=rin*rin)
return s;
1905 if (iact<3 && safe) {
1914 return TGeoConeSeg::DistFromOutsideS(point,dir,
fDz,
fRmin1,
fRmax1,
fRmin2,
fRmax2,
fC1,
fS1,
fC2,
fS2,
fCm,
fSm,
fCdfi);
1923 const Int_t numPoints = 4*
n;
1948 Error(
"Divide",
"division of a cone segment on R not implemented");
1952 if (dphi<0) dphi+=360.;
1961 for (
id=0;
id<ndiv;
id++) {
1971 for (
id=0;
id<ndiv;
id++) {
1987 Error(
"Divide",
"Wrong axis type for division");
2022 param[0] *= param[0];
2024 param[1] *= param[1];
2027 while (param[3]<param[2]) param[3]+=360.;
2038 Error(
"GetMakeRuntimeShape",
"invalid mother");
2041 Double_t rmin1, rmax1, rmin2, rmax2, dz;
2049 rmin1 = ((
TGeoCone*)mother)->GetRmin1();
2051 rmax1 = ((
TGeoCone*)mother)->GetRmax1();
2053 rmin2 = ((
TGeoCone*)mother)->GetRmin2();
2055 rmax2 = ((
TGeoCone*)mother)->GetRmax2();
2065 printf(
"*** Shape %s: TGeoConeSeg ***\n",
GetName());
2066 printf(
" dz = %11.5f\n",
fDz);
2067 printf(
" Rmin1 = %11.5f\n",
fRmin1);
2068 printf(
" Rmax1 = %11.5f\n",
fRmax1);
2069 printf(
" Rmin2 = %11.5f\n",
fRmin2);
2070 printf(
" Rmax2 = %11.5f\n",
fRmax2);
2071 printf(
" phi1 = %11.5f\n",
fPhi1);
2072 printf(
" phi2 = %11.5f\n",
fPhi2);
2073 printf(
" Bounding box:\n");
2085 Int_t nbSegs = 2*nbPnts;
2086 Int_t nbPols = nbPnts-2;
2111 for (i = 0; i < 4; i++) {
2112 for (j = 1; j <
n; j++) {
2113 buffer.
fSegs[(i*
n+j-1)*3 ] =
c;
2114 buffer.
fSegs[(i*
n+j-1)*3+1] = i*
n+j-1;
2115 buffer.
fSegs[(i*
n+j-1)*3+2] = i*
n+j;
2118 for (i = 4; i < 6; i++) {
2119 for (j = 0; j <
n; j++) {
2120 buffer.
fSegs[(i*
n+j)*3 ] =
c+1;
2121 buffer.
fSegs[(i*
n+j)*3+1] = (i-4)*
n+j;
2122 buffer.
fSegs[(i*
n+j)*3+2] = (i-2)*
n+j;
2125 for (i = 6; i < 8; i++) {
2126 for (j = 0; j <
n; j++) {
2128 buffer.
fSegs[(i*
n+j)*3+1] = 2*(i-6)*
n+j;
2129 buffer.
fSegs[(i*
n+j)*3+2] = (2*(i-6)+1)*
n+j;
2136 for (j = 0; j <
n-1; j++) {
2137 buffer.
fPols[indx++] =
c;
2138 buffer.
fPols[indx++] = 4;
2139 buffer.
fPols[indx++] = (4+i)*
n+j+1;
2140 buffer.
fPols[indx++] = (2+i)*
n+j;
2141 buffer.
fPols[indx++] = (4+i)*
n+j;
2142 buffer.
fPols[indx++] = i*
n+j;
2145 for (j = 0; j <
n-1; j++) {
2146 buffer.
fPols[indx++] =
c;
2147 buffer.
fPols[indx++] = 4;
2148 buffer.
fPols[indx++] = i*
n+j;
2149 buffer.
fPols[indx++] = (4+i)*
n+j;
2150 buffer.
fPols[indx++] = (2+i)*
n+j;
2151 buffer.
fPols[indx++] = (4+i)*
n+j+1;
2154 for (j = 0; j <
n-1; j++) {
2155 buffer.
fPols[indx++] =
c+i;
2156 buffer.
fPols[indx++] = 4;
2157 buffer.
fPols[indx++] = (i-2)*2*
n+j;
2158 buffer.
fPols[indx++] = (4+i)*
n+j;
2159 buffer.
fPols[indx++] = ((i-2)*2+1)*
n+j;
2160 buffer.
fPols[indx++] = (4+i)*
n+j+1;
2163 for (j = 0; j <
n-1; j++) {
2164 buffer.
fPols[indx++] =
c+i;
2165 buffer.
fPols[indx++] = 4;
2166 buffer.
fPols[indx++] = (4+i)*
n+j+1;
2167 buffer.
fPols[indx++] = ((i-2)*2+1)*
n+j;
2168 buffer.
fPols[indx++] = (4+i)*
n+j;
2169 buffer.
fPols[indx++] = (i-2)*2*
n+j;
2171 buffer.
fPols[indx++] =
c+2;
2172 buffer.
fPols[indx++] = 4;
2173 buffer.
fPols[indx++] = 6*
n;
2174 buffer.
fPols[indx++] = 4*
n;
2175 buffer.
fPols[indx++] = 7*
n;
2176 buffer.
fPols[indx++] = 5*
n;
2177 buffer.
fPols[indx++] =
c+2;
2178 buffer.
fPols[indx++] = 4;
2179 buffer.
fPols[indx++] = 6*
n-1;
2180 buffer.
fPols[indx++] = 8*
n-1;
2181 buffer.
fPols[indx++] = 5*
n-1;
2182 buffer.
fPols[indx++] = 7*
n-1;
2195 if (safe>1.E10)
return safphi;
2206 if ((phi2-phi1)>=360.)
return safe;
2209 if (safe>1.E10)
return safphi;
2219 out <<
" // Shape: " <<
GetName() <<
" type: " <<
ClassName() << std::endl;
2220 out <<
" dz = " <<
fDz <<
";" << std::endl;
2221 out <<
" rmin1 = " <<
fRmin1 <<
";" << std::endl;
2222 out <<
" rmax1 = " <<
fRmax1 <<
";" << std::endl;
2223 out <<
" rmin2 = " <<
fRmin2 <<
";" << std::endl;
2224 out <<
" rmax2 = " <<
fRmax2 <<
";" << std::endl;
2225 out <<
" phi1 = " <<
fPhi1 <<
";" << std::endl;
2226 out <<
" phi2 = " <<
fPhi2 <<
";" << std::endl;
2227 out <<
" TGeoShape *" <<
GetPointerName() <<
" = new TGeoConeSeg(\"" <<
GetName() <<
"\", dz,rmin1,rmax1,rmin2,rmax2,phi1,phi2);" << std::endl;
2271 Float_t dphi,phi,phi1, phi2,dz;
2278 dphi = (phi2-phi1)/(
n-1);
2283 for (j = 0; j <
n; j++) {
2289 for (j = 0; j <
n; j++) {
2295 for (j = 0; j <
n; j++) {
2301 for (j = 0; j <
n; j++) {
2316 Float_t dphi,phi,phi1, phi2,dz;
2323 dphi = (phi2-phi1)/(
n-1);
2328 for (j = 0; j <
n; j++) {
2334 for (j = 0; j <
n; j++) {
2340 for (j = 0; j <
n; j++) {
2346 for (j = 0; j <
n; j++) {
2395 Int_t nbSegs = 2*nbPnts;
2396 Int_t nbPols = nbPnts-2;
2397 if (buffer.
SetRawSizes(nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, nbPols, 6*nbPols)) {
2421 if (npoints > (npoints/2)*2) {
2422 Error(
"GetPointsOnSegments",
"Npoints must be even number");
2429 Int_t ntop = npoints/2 - nc*(nc-1);
2437 for (
Int_t i=0; i<nc; i++) {
2446 for (
Int_t j=0; j<nphi; j++) {
2447 phi = phi1 + j*dphi;
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...
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()