103 if ((dz<0) || (rmin1<0) || (rmax1<0) || (rmin2<0) || (rmax2<0)) {
118 if ((dz<0) || (rmin1<0) || (rmax1<0) || (rmin2<0) || (rmax2<0)) {
156 rmin1*rmin1-rmin2*rmin2-rmin1*rmin2);
213 if (norm[0]*dir[0]+norm[1]*dir[1]+norm[2]*dir[2]<0) {
232 Double_t tg1 = 0.5*(rmin2-rmin1)/dz;
235 Double_t tg2 = 0.5*(rmax2-rmax1)/dz;
250 if (norm[0]*dir[0]+norm[1]*dir[1]+norm[2]*dir[2]<0) {
263 Double_t r2 = point[0]*point[0]+point[1]*point[1];
266 if ((r2<rl*rl) || (r2>rh*rh))
return kFALSE;
283 if (sz<=0)
return 0.0;
285 Double_t rsq=point[0]*point[0]+point[1]*point[1];
287 Double_t rin = 0.5*(rmin1+rmin2+(rmin2-rmin1)*point[2]*zinv);
294 Double_t ddotn = point[0]*dir[0]+point[1]*dir[1]+0.5*(rmin1-rmin2)*dir[2]*zinv*
TMath::Sqrt(rsq);
295 if (ddotn<=0)
return 0.0;
301 zi = point[2]+sr*dir[2];
306 zi = point[2]+sr*dir[2];
313 Double_t rout = 0.5*(rmax1+rmax2+(rmax2-rmax1)*point[2]*zinv);
315 Double_t ddotn = point[0]*dir[0]+point[1]*dir[1]+0.5*(rmax1-rmax2)*dir[2]*zinv*
TMath::Sqrt(rsq);
316 if (ddotn>=0)
return 0.0;
318 if (delta<0)
return 0.0;
322 zi = point[2]+sr*dir[2];
330 zi = point[2]+sr*dir[2];
335 zi = point[2]+sr*dir[2];
348 if (iact<3 && safe) {
372 snxt = (-dz-point[2])/dir[2];
373 xp = point[0]+snxt*dir[0];
374 yp = point[1]+snxt*dir[1];
376 if ((r2>=rmin1*rmin1) && (r2<=rmax1*rmax1))
return snxt;
381 snxt = (dz-point[2])/dir[2];
382 xp = point[0]+snxt*dir[0];
383 yp = point[1]+snxt*dir[1];
385 if ((r2>=rmin2*rmin2) && (r2<=rmax2*rmax2))
return snxt;
390 Double_t rsq = point[0]*point[0]+point[1]*point[1];
398 tg1=0.5*(rmin2-rmin1)*dzinv;
399 rin=ro1+tg1*point[2];
403 Double_t tg2=0.5*(rmax2-rmax1)*dzinv;
407 Bool_t in = inz & inrmin & inrmax;
415 if (safz<=safrmin && safz<=safrmax) {
417 if (point[2]*dir[2]<0)
return 0.0;
420 if (safrmax<safrmin) {
422 Double_t ddotn = point[0]*dir[0]+point[1]*dir[1]-tg2*dir[2]*
r;
423 if (ddotn<=0)
return 0.0;
427 Double_t ddotn = point[0]*dir[0]+point[1]*dir[1]-tg1*dir[2]*
r;
428 if (ddotn>=0)
return 0.0;
432 if (delta<0)
return 0.0;
436 zp = point[2]+snxt*dir[2];
449 zp = point[2]+snxt*dir[2];
454 zp = point[2]+snxt*dir[2];
464 zp = point[2]+din*dir[2];
471 if (inrmax)
return snxt;
475 if (delta<0)
return snxt;
477 if (dout>0 && dout<snxt) {
478 zp = point[2]+dout*dir[2];
482 if (dout<=0 || dout>snxt)
return snxt;
483 zp = point[2]+dout*dir[2];
494 if (iact<3 && safe) {
518 Double_t rsq = point[0]*point[0] + point[1]*point[1];
521 Double_t a = dir[0]*dir[0] + dir[1]*dir[1] - tz*tz*dir[2]*dir[2];
522 b = point[0]*dir[0] + point[1]*dir[1] - tz*rc*dir[2];
548 const Int_t numPoints = 4*
n;
572 Error(
"Divide",
"division of a cone on R not implemented");
583 for (
id=0;
id<ndiv;
id++) {
593 for (
id=0;
id<ndiv;
id++) {
600 shape =
new TGeoCone(0.5*step,rmin1n, rmax1n, rmin2n, rmax2n);
609 Error(
"Divide",
"Wrong axis type for division");
660 param[0] *= param[0];
662 param[1] *= param[1];
675 Error(
"GetMakeRuntimeShape",
"invalid mother");
678 Double_t rmin1, rmax1, rmin2, rmax2, dz;
686 rmin1 = ((
TGeoCone*)mother)->GetRmin1();
688 rmax1 = ((
TGeoCone*)mother)->GetRmax1();
690 rmin2 = ((
TGeoCone*)mother)->GetRmin2();
692 rmax2 = ((
TGeoCone*)mother)->GetRmax2();
704 if (npoints > (npoints/2)*2) {
705 Error(
"GetPointsOnSegments",
"Npoints must be even number");
715 if (hasrmin) ntop = npoints/2 - nc*(nc-1);
716 else ntop = npoints - nc*(nc-1);
724 for (
Int_t i=0; i<nc; i++) {
725 if (i == (nc-1)) nphi = ntop;
730 for (
Int_t j=0; j<nphi; j++) {
751 printf(
"*** Shape %s TGeoCone ***\n",
GetName());
752 printf(
" dz =: %11.5f\n",
fDz);
753 printf(
" Rmin1 = %11.5f\n",
fRmin1);
754 printf(
" Rmax1 = %11.5f\n",
fRmax1);
755 printf(
" Rmin2 = %11.5f\n",
fRmin2);
756 printf(
" Rmax2 = %11.5f\n",
fRmax2);
757 printf(
" Bounding box:\n");
793 for (i = 0; i < 4; i++) {
794 for (j = 0; j <
n; j++) {
796 buffer.
fSegs[(i*
n+j)*3+1] = i*
n+j;
797 buffer.
fSegs[(i*
n+j)*3+2] = i*
n+j+1;
799 buffer.
fSegs[(i*
n+j-1)*3+2] = i*
n;
801 for (i = 4; i < 6; i++) {
802 for (j = 0; j <
n; j++) {
803 buffer.
fSegs[(i*
n+j)*3 ] =
c+1;
804 buffer.
fSegs[(i*
n+j)*3+1] = (i-4)*
n+j;
805 buffer.
fSegs[(i*
n+j)*3+2] = (i-2)*
n+j;
808 for (i = 6; i < 8; i++) {
809 for (j = 0; j <
n; j++) {
811 buffer.
fSegs[(i*
n+j)*3+1] = 2*(i-6)*
n+j;
812 buffer.
fSegs[(i*
n+j)*3+2] = (2*(i-6)+1)*
n+j;
818 for (j = 0; j <
n; j++) {
821 buffer.
fPols[indx+1] = 4;
822 buffer.
fPols[indx+5] = i*
n+j;
823 buffer.
fPols[indx+4] = (4+i)*
n+j;
824 buffer.
fPols[indx+3] = (2+i)*
n+j;
825 buffer.
fPols[indx+2] = (4+i)*
n+j+1;
827 buffer.
fPols[indx+2] = (4+i)*
n;
829 for (j = 0; j <
n; j++) {
832 buffer.
fPols[indx+1] = 4;
833 buffer.
fPols[indx+2] = i*
n+j;
834 buffer.
fPols[indx+3] = (4+i)*
n+j;
835 buffer.
fPols[indx+4] = (2+i)*
n+j;
836 buffer.
fPols[indx+5] = (4+i)*
n+j+1;
838 buffer.
fPols[indx+5] = (4+i)*
n;
840 for (j = 0; j <
n; j++) {
842 buffer.
fPols[indx ] =
c+i;
843 buffer.
fPols[indx+1] = 4;
844 buffer.
fPols[indx+2] = (i-2)*2*
n+j;
845 buffer.
fPols[indx+3] = (4+i)*
n+j;
846 buffer.
fPols[indx+4] = ((i-2)*2+1)*
n+j;
847 buffer.
fPols[indx+5] = (4+i)*
n+j+1;
849 buffer.
fPols[indx+5] = (4+i)*
n;
851 for (j = 0; j <
n; j++) {
853 buffer.
fPols[indx ] =
c+i;
854 buffer.
fPols[indx+1] = 4;
855 buffer.
fPols[indx+5] = (i-2)*2*
n+j;
856 buffer.
fPols[indx+4] = (4+i)*
n+j;
857 buffer.
fPols[indx+3] = ((i-2)*2+1)*
n+j;
858 buffer.
fPols[indx+2] = (4+i)*
n+j+1;
860 buffer.
fPols[indx+2] = (4+i)*
n;
876 if (safety>1.E20) safety = 0.;
908 if (rmin1>0 || rmin2>0)
923 out <<
" dz = " <<
fDz <<
";" << std::endl;
924 out <<
" rmin1 = " <<
fRmin1 <<
";" << std::endl;
925 out <<
" rmax1 = " <<
fRmax1 <<
";" << std::endl;
926 out <<
" rmin2 = " <<
fRmin2 <<
";" << std::endl;
927 out <<
" rmax2 = " <<
fRmax2 <<
";" << std::endl;
928 out <<
" TGeoShape *" <<
GetPointerName() <<
" = new TGeoCone(\"" <<
GetName() <<
"\", dz,rmin1,rmax1,rmin2,rmax2);" << std::endl;
947 Warning(
"SetConeDimensions",
"rmin1>rmax1 Switch rmin1<->rmax1");
969 Warning(
"SetConeDimensions",
"rmin2>rmax2 Switch rmin2<->rmax2");
1013 for (j = 0; j <
n; j++) {
1020 for (j = 0; j <
n; j++) {
1027 for (j = 0; j <
n; j++) {
1034 for (j = 0; j <
n; j++) {
1057 for (j = 0; j <
n; j++) {
1064 for (j = 0; j <
n; j++) {
1071 for (j = 0; j <
n; j++) {
1078 for (j = 0; j <
n; j++) {
1129 if (buffer.
SetRawSizes(nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, nbPols, 6*nbPols)) {
1201 fPhi1(0.), fPhi2(0.), fS1(0.), fC1(0.), fS2(0.), fC2(0.), fSm(0.), fCm(0.), fCdfi(0.)
1212 :
TGeoCone(dz, rmin1, rmax1, rmin2, rmax2),
1213 fPhi1(0.), fPhi2(0.), fS1(0.), fC1(0.), fS2(0.), fC2(0.), fSm(0.), fCm(0.), fCdfi(0.)
1227 fPhi1(0.), fPhi2(0.), fS1(0.), fC1(0.), fS2(0.), fC2(0.), fSm(0.), fCm(0.), fCdfi(0.)
1246 fPhi1(0.), fPhi2(0.), fS1(0.), fC1(0.), fS2(0.), fC2(0.), fSm(0.), fCm(0.), fCdfi(0.)
1300 (rmax1*rmax1+rmax2*rmax2+rmax1*rmax2-
1301 rmin1*rmin1-rmin2*rmin2-rmin1*rmin2);
1332 if (ddp<0) ddp+= 360;
1333 if (ddp<=dp)
xmax = rmax;
1335 if (ddp<0) ddp+= 360;
1336 if (ddp<=dp)
ymax = rmax;
1338 if (ddp<0) ddp+= 360;
1339 if (ddp<=dp)
xmin = -rmax;
1341 if (ddp<0) ddp+= 360;
1342 if (ddp<=dp)
ymin = -rmax;
1376 norm[0] = norm[1] = 0.;
1395 if (norm[0]*dir[0]+norm[1]*dir[1]+norm[2]*dir[2]<0) {
1411 Double_t tg1 = 0.5*(rmin2-rmin1)/dz;
1414 Double_t tg2 = 0.5*(rmax2-rmax1)/dz;
1442 if (norm[0]*dir[0]+norm[1]*dir[1]+norm[2]*dir[2]<0) {
1456 if (dphi >= 360.)
return kTRUE;
1458 if (phi < 0 ) phi+=360.;
1460 if (ddp < 0) ddp+=360.;
1462 if (ddp > dphi)
return kFALSE;
1481 if (dphi >= 360.) hasphi=
kFALSE;
1482 if (dphi < 0) dphi+=360.;
1487 Double_t r0sq = point[0]*point[0] + point[1]*point[1];
1488 Double_t rc = ro0 + fz*(point[2]-0.5*(z1+z2));
1490 Double_t a = dir[0]*dir[0] + dir[1]*dir[1] - fz*fz*dir[2]*dir[2];
1491 Double_t b = point[0]*dir[0] + point[1]*dir[1] - fz*rc*dir[2];
1507 ptnew[2] = point[2] + snxt*dir[2];
1508 if (((ptnew[2]-z1)*(ptnew[2]-z2)) < 0) {
1510 if (!hasphi)
return snxt;
1511 ptnew[0] = point[0] + snxt*dir[0];
1512 ptnew[1] = point[1] + snxt*dir[1];
1514 if (phi < 0 ) phi+=360.;
1516 if (ddp < 0) ddp+=360.;
1518 if (ddp<=dphi)
return snxt;
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;
1551 if (scone<=0)
return 0.0;
1553 Double_t rsq = point[0]*point[0]+point[1]*point[1];
1555 Double_t cpsi=point[0]*cm+point[1]*sm;
1564 ddotn =
s1*dir[0]-
c1*dir[1];
1565 if (ddotn>=0)
return 0.0;
1566 ddotn = -s2*dir[0]+
c2*dir[1];
1567 if (ddotn<=0)
return scone;
1568 sfmin = s2*point[0]-
c2*point[1];
1569 if (sfmin<=0)
return scone;
1571 if (sfmin >= scone)
return scone;
1572 xi = point[0]+sfmin*dir[0];
1573 yi = point[1]+sfmin*dir[1];
1574 if (yi*cm-xi*sm<0)
return scone;
1577 ddotn = -s2*dir[0]+
c2*dir[1];
1578 if (ddotn>=0)
return 0.0;
1579 ddotn =
s1*dir[0]-
c1*dir[1];
1580 if (ddotn<=0)
return scone;
1581 sfmin = -
s1*point[0]+
c1*point[1];
1582 if (sfmin<=0)
return scone;
1584 if (sfmin >= scone)
return scone;
1585 xi = point[0]+sfmin*dir[0];
1586 yi = point[1]+sfmin*dir[1];
1587 if (yi*cm-xi*sm>0)
return scone;
1596 if (iact<3 && safe) {
1604 return TGeoConeSeg::DistFromInsideS(point,dir,
fDz,
fRmin1,
fRmax1,
fRmin2,
fRmax2,
fC1,
fS1,
fC2,
fS2,
fCm,
fSm,
fCdfi);
1628 xi = point[0]+s*dir[0];
1629 yi = point[1]+s*dir[1];
1638 if ((rin*rin<=r2) && (r2<=rout*rout)) {
1644 Double_t rsq = point[0]*point[0]+point[1]*point[1];
1652 tg1=0.5*(rmin2-rmin1)*zinv;
1653 rin = ro1+tg1*point[2];
1659 Double_t tg2=0.5*(rmax2-rmax1)*zinv;
1660 rout = ro2+tg2*point[2];
1664 cpsi=point[0]*cm+point[1]*sm;
1666 in = inz & inrmin & inrmax & inphi;
1673 if (zi<safrmax && zi<safrmin && zi<safphi) {
1674 if (point[2]*dir[2]<0)
return 0.0;
1678 if (safrmax<safrmin && safrmax<safphi) {
1679 Double_t ddotn = point[0]*dir[0]+point[1]*dir[1]-tg2*dir[2]*
r;
1680 if (ddotn<=0)
return 0.0;
1684 if (safphi<safrmin) {
1688 if (point[0]*
c1 + point[1]*
s1 > point[0]*
c2 + point[1]*s2) {
1689 un = dir[0]*
s1-dir[1]*
c1;
1690 if (un < 0)
return 0.0;
1692 un = -dir[0]*s2+dir[1]*
c2;
1694 s = -point[0]*s2+point[1]*
c2;
1697 zi = point[2]+s*dir[2];
1699 xi = point[0]+s*dir[0];
1700 yi = point[1]+s*dir[1];
1701 if ((yi*cm-xi*sm)>0) {
1705 if ((rin*rin<=r2) && (rout*rout>=r2))
return s;
1711 un = -dir[0]*s2+dir[1]*
c2;
1712 if (un < 0)
return 0.0;
1714 un = dir[0]*
s1-dir[1]*
c1;
1716 s = point[0]*
s1-point[1]*
c1;
1719 zi = point[2]+s*dir[2];
1721 xi = point[0]+s*dir[0];
1722 yi = point[1]+s*dir[1];
1723 if ((yi*cm-xi*sm)<0) {
1727 if ((rin*rin<=r2) && (rout*rout>=r2))
return s;
1734 Double_t ddotn = point[0]*dir[0]+point[1]*dir[1]-tg1*dir[2]*
r;
1742 zi = point[2]+snxt*dir[2];
1744 xi = point[0]+snxt*dir[0];
1745 yi = point[1]+snxt*dir[1];
1752 Double_t ddotn = point[0]*dir[0]+point[1]*dir[1]-tg1*dir[2]*
r;
1753 if (ddotn>=0)
return 0.0;
1755 if (delta<0)
return 0.0;
1759 zi = point[2]+snxt*dir[2];
1762 xi = point[0]+snxt*dir[0];
1763 yi = point[1]+snxt*dir[1];
1771 s=point[0]*
s1-point[1]*
c1;
1774 zi=point[2]+s*dir[2];
1776 xi=point[0]+s*dir[0];
1777 yi=point[1]+s*dir[1];
1778 if ((yi*cm-xi*sm)<=0) {
1782 if ((rin*rin<=r2) && (rout*rout>=r2))
return s;
1787 un=dir[0]*s2-dir[1]*
c2;
1789 s=(point[1]*
c2-point[0]*s2)/un;
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;
1815 zi=point[2]+s*dir[2];
1817 xi=point[0]+s*dir[0];
1818 yi=point[1]+s*dir[1];
1826 zi=point[2]+s*dir[2];
1828 xi=point[0]+s*dir[0];
1829 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];
1855 zi=point[2]+s*dir[2];
1857 xi=point[0]+s*dir[0];
1858 yi=point[1]+s*dir[1];
1869 if (s>snxt)
return snxt;
1870 zi=point[2]+s*dir[2];
1872 xi=point[0]+s*dir[0];
1873 yi=point[1]+s*dir[1];
1876 if (r2>rout*rout)
return snxt;
1878 if (r2>=rin*rin)
return s;
1888 if (iact<3 && safe) {
1897 return TGeoConeSeg::DistFromOutsideS(point,dir,
fDz,
fRmin1,
fRmax1,
fRmin2,
fRmax2,
fC1,
fS1,
fC2,
fS2,
fCm,
fSm,
fCdfi);
1906 const Int_t numPoints = 4*
n;
1931 Error(
"Divide",
"division of a cone segment on R not implemented");
1935 if (dphi<0) dphi+=360.;
1944 for (
id=0;
id<ndiv;
id++) {
1954 for (
id=0;
id<ndiv;
id++) {
1970 Error(
"Divide",
"Wrong axis type for division");
2005 param[0] *= param[0];
2007 param[1] *= param[1];
2010 while (param[3]<param[2]) param[3]+=360.;
2021 Error(
"GetMakeRuntimeShape",
"invalid mother");
2024 Double_t rmin1, rmax1, rmin2, rmax2, dz;
2032 rmin1 = ((
TGeoCone*)mother)->GetRmin1();
2034 rmax1 = ((
TGeoCone*)mother)->GetRmax1();
2036 rmin2 = ((
TGeoCone*)mother)->GetRmin2();
2038 rmax2 = ((
TGeoCone*)mother)->GetRmax2();
2048 printf(
"*** Shape %s: TGeoConeSeg ***\n",
GetName());
2049 printf(
" dz = %11.5f\n",
fDz);
2050 printf(
" Rmin1 = %11.5f\n",
fRmin1);
2051 printf(
" Rmax1 = %11.5f\n",
fRmax1);
2052 printf(
" Rmin2 = %11.5f\n",
fRmin2);
2053 printf(
" Rmax2 = %11.5f\n",
fRmax2);
2054 printf(
" phi1 = %11.5f\n",
fPhi1);
2055 printf(
" phi2 = %11.5f\n",
fPhi2);
2056 printf(
" Bounding box:\n");
2068 Int_t nbSegs = 2*nbPnts;
2069 Int_t nbPols = nbPnts-2;
2094 for (i = 0; i < 4; i++) {
2095 for (j = 1; j <
n; j++) {
2096 buffer.
fSegs[(i*
n+j-1)*3 ] =
c;
2097 buffer.
fSegs[(i*
n+j-1)*3+1] = i*
n+j-1;
2098 buffer.
fSegs[(i*
n+j-1)*3+2] = i*
n+j;
2101 for (i = 4; i < 6; i++) {
2102 for (j = 0; j <
n; j++) {
2103 buffer.
fSegs[(i*
n+j)*3 ] =
c+1;
2104 buffer.
fSegs[(i*
n+j)*3+1] = (i-4)*
n+j;
2105 buffer.
fSegs[(i*
n+j)*3+2] = (i-2)*
n+j;
2108 for (i = 6; i < 8; i++) {
2109 for (j = 0; j <
n; j++) {
2111 buffer.
fSegs[(i*
n+j)*3+1] = 2*(i-6)*
n+j;
2112 buffer.
fSegs[(i*
n+j)*3+2] = (2*(i-6)+1)*
n+j;
2119 for (j = 0; j <
n-1; j++) {
2120 buffer.
fPols[indx++] =
c;
2121 buffer.
fPols[indx++] = 4;
2122 buffer.
fPols[indx++] = (4+i)*
n+j+1;
2123 buffer.
fPols[indx++] = (2+i)*
n+j;
2124 buffer.
fPols[indx++] = (4+i)*
n+j;
2125 buffer.
fPols[indx++] = i*
n+j;
2128 for (j = 0; j <
n-1; j++) {
2129 buffer.
fPols[indx++] =
c;
2130 buffer.
fPols[indx++] = 4;
2131 buffer.
fPols[indx++] = i*
n+j;
2132 buffer.
fPols[indx++] = (4+i)*
n+j;
2133 buffer.
fPols[indx++] = (2+i)*
n+j;
2134 buffer.
fPols[indx++] = (4+i)*
n+j+1;
2137 for (j = 0; j <
n-1; j++) {
2138 buffer.
fPols[indx++] =
c+i;
2139 buffer.
fPols[indx++] = 4;
2140 buffer.
fPols[indx++] = (i-2)*2*
n+j;
2141 buffer.
fPols[indx++] = (4+i)*
n+j;
2142 buffer.
fPols[indx++] = ((i-2)*2+1)*
n+j;
2143 buffer.
fPols[indx++] = (4+i)*
n+j+1;
2146 for (j = 0; j <
n-1; j++) {
2147 buffer.
fPols[indx++] =
c+i;
2148 buffer.
fPols[indx++] = 4;
2149 buffer.
fPols[indx++] = (4+i)*
n+j+1;
2150 buffer.
fPols[indx++] = ((i-2)*2+1)*
n+j;
2151 buffer.
fPols[indx++] = (4+i)*
n+j;
2152 buffer.
fPols[indx++] = (i-2)*2*
n+j;
2154 buffer.
fPols[indx++] =
c+2;
2155 buffer.
fPols[indx++] = 4;
2156 buffer.
fPols[indx++] = 6*
n;
2157 buffer.
fPols[indx++] = 4*
n;
2158 buffer.
fPols[indx++] = 7*
n;
2159 buffer.
fPols[indx++] = 5*
n;
2160 buffer.
fPols[indx++] =
c+2;
2161 buffer.
fPols[indx++] = 4;
2162 buffer.
fPols[indx++] = 6*
n-1;
2163 buffer.
fPols[indx++] = 8*
n-1;
2164 buffer.
fPols[indx++] = 5*
n-1;
2165 buffer.
fPols[indx++] = 7*
n-1;
2178 if (safe>1.E10)
return safphi;
2189 if ((phi2-phi1)>=360.)
return safe;
2192 if (safe>1.E10)
return safphi;
2202 out <<
" // Shape: " <<
GetName() <<
" type: " <<
ClassName() << std::endl;
2203 out <<
" dz = " <<
fDz <<
";" << std::endl;
2204 out <<
" rmin1 = " <<
fRmin1 <<
";" << std::endl;
2205 out <<
" rmax1 = " <<
fRmax1 <<
";" << std::endl;
2206 out <<
" rmin2 = " <<
fRmin2 <<
";" << std::endl;
2207 out <<
" rmax2 = " <<
fRmax2 <<
";" << std::endl;
2208 out <<
" phi1 = " <<
fPhi1 <<
";" << std::endl;
2209 out <<
" phi2 = " <<
fPhi2 <<
";" << std::endl;
2210 out <<
" TGeoShape *" <<
GetPointerName() <<
" = new TGeoConeSeg(\"" <<
GetName() <<
"\", dz,rmin1,rmax1,rmin2,rmax2,phi1,phi2);" << std::endl;
2254 Float_t dphi,phi,phi1, phi2,dz;
2261 dphi = (phi2-phi1)/(
n-1);
2266 for (j = 0; j <
n; j++) {
2272 for (j = 0; j <
n; j++) {
2278 for (j = 0; j <
n; j++) {
2284 for (j = 0; j <
n; j++) {
2299 Float_t dphi,phi,phi1, phi2,dz;
2306 dphi = (phi2-phi1)/(
n-1);
2311 for (j = 0; j <
n; j++) {
2317 for (j = 0; j <
n; j++) {
2323 for (j = 0; j <
n; j++) {
2329 for (j = 0; j <
n; j++) {
2378 Int_t nbSegs = 2*nbPnts;
2379 Int_t nbPols = nbPnts-2;
2380 if (buffer.
SetRawSizes(nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, nbPols, 6*nbPols)) {
2404 if (npoints > (npoints/2)*2) {
2405 Error(
"GetPointsOnSegments",
"Npoints must be even number");
2412 Int_t ntop = npoints/2 - nc*(nc-1);
2420 for (
Int_t i=0; i<nc; i++) {
2429 for (
Int_t j=0; j<nphi; j++) {
2430 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.
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.
virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=0) const
Compute distance from outside point to surface of the box.
virtual void InspectShape() const
Prints shape parameters.
virtual void FillBuffer3D(TBuffer3D &buffer, Int_t reqSections, Bool_t localFrame) const
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=0)
Set parameters of the box.
A phi segment of a conical tube.
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.
virtual Bool_t Contains(const Double_t *point) const
test if point is inside this sphere
virtual TBuffer3D * MakeBuffer3D() const
Creates a TBuffer3D describing this shape.
virtual ~TGeoConeSeg()
destructor
virtual void GetBoundingCylinder(Double_t *param) const
Fill vector param[4] with the bounding cylinder parameters.
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
virtual Double_t Capacity() const
Computes capacity of the shape in [length^3].
virtual Int_t GetNmeshVertices() const
Return number of vertices of the mesh representation.
TGeoConeSeg()
Default constructor.
virtual Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const
Fills array with n random points located on the line segments of the shape mesh.
virtual Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=0) const
compute distance from inside point to surface of the tube segment
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)
Compute normal to closest surface from POINT.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
virtual void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize)
Compute the normal for an array o points so that norm.dot.dir is positive Input: Arrays of point coor...
virtual void Sizeof3D() const
Fill size of this 3-D object.
virtual void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const
Compute distance from array of input points having directions specified by dirs. Store output in dist...
void InitTrigonometry()
Init frequently used trigonometric values.
virtual void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const
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.
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
compute closest distance from point px,py to each corner
virtual void SetDimensions(Double_t *param)
Set dimensions of the cone segment from an array.
virtual void InspectShape() const
print shape parameters
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.
virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=0) const
compute distance from outside point to surface of the tube
virtual void AfterStreamer()
Function called after streaming an object of this class.
virtual void SetPoints(Double_t *points) const
Create cone segment mesh points.
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
virtual TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step)
Divide this cone segment shape belonging to volume "voldiv" into ndiv volumes called divname,...
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 :
virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const
Get range of shape for a given axis.
virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const
computes the closest distance from given point to this shape, according to option.
virtual void ComputeBBox()
compute bounding box of the tube segment
virtual void SetSegsAndPols(TBuffer3D &buffer) const
Fill TBuffer3D structure for segments and polygons.
virtual void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const
Compute safe distance from each of the points in the input array.
virtual void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const
Compute distance from array of input points having directions specified by dirs. Store output in dist...
virtual void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const
Check the inside status for each of the points in the array.
virtual const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
Fills a static 3D buffer and returns a reference.
virtual TGeoShape * GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const
in case shape has some negative parameters, these has to be computed in order to fit the mother
virtual void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const
Returns numbers of vertices, segments and polygons composing the shape mesh.
virtual const char * GetAxisName(Int_t iaxis) const
Returns name of axis IAXIS.
virtual void Sizeof3D() const
Fill size of this 3-D object.
virtual void SetDimensions(Double_t *param)
Set cone dimensions from an array.
virtual void GetBoundingCylinder(Double_t *param) const
Fill vector param[4] with the bounding cylinder parameters.
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 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.
virtual ~TGeoCone()
destructor
virtual void ComputeBBox()
compute bounding box of the sphere
virtual Double_t Capacity() const
Computes capacity of the shape in [length^3].
virtual void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const
Compute safe distance from each of the points in the input array.
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
compute closest distance from point px,py to each corner
virtual void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const
Compute distance from array of input points having directions specified by dirs. Store output in dist...
virtual Bool_t Contains(const Double_t *point) const
test if point is inside this cone
virtual void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize)
Compute the normal for an array o points so that norm.dot.dir is positive Input: Arrays of point coor...
virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const
Get range of shape for a given axis.
virtual const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
Fills a static 3D buffer and returns a reference.
virtual Int_t GetNmeshVertices() const
Return number of vertices of the mesh representation.
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)
Compute normal to closest surface from POINT.
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.
virtual void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const
Compute distance from array of input points having directions specified by dirs. Store output in dist...
TGeoCone()
Default constructor.
virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const
computes the closest distance from given point to this shape, according to option.
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.
virtual Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=0) const
Compute distance from inside point to surface of the cone Boundary safe algorithm.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
virtual TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step)
Divide this cone shape belonging to volume "voldiv" into ndiv volumes called divname,...
virtual TBuffer3D * MakeBuffer3D() const
Creates a TBuffer3D describing this shape.
virtual Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const
Fills array with n random points located on the line segments of the shape mesh.
virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=0) const
compute distance from outside point to surface of the tube
virtual void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const
Check the inside status for each of the points in the array.
virtual void SetSegsAndPols(TBuffer3D &buffer) const
Fill TBuffer3D structure for segments and polygons.
virtual void SetPoints(Double_t *points) const
Create cone mesh points.
virtual TGeoShape * GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const
in case shape has some negative parameters, these has to be computed in order to fit the mother
virtual void InspectShape() const
print shape parameters
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.
virtual const char * GetName() const
Get the shape name.
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)
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
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)
Return index of array with the minimum element.
Short_t Max(Short_t a, Short_t b)
Double_t ATan2(Double_t y, Double_t x)
Long64_t LocMax(Long64_t n, const T *a)
Return index of array with the maximum element.
constexpr Double_t DegToRad()
Conversion from degree to radian:
Double_t Sqrt(Double_t x)
Short_t Min(Short_t a, Short_t b)
constexpr Double_t RadToDeg()
Conversion from radian to degree:
constexpr Double_t TwoPi()