98 if ((dz<0) || (rmin1<0) || (rmax1<0) || (rmin2<0) || (rmax2<0)) {
113 if ((dz<0) || (rmin1<0) || (rmax1<0) || (rmin2<0) || (rmax2<0)) {
151 rmin1*rmin1-rmin2*rmin2-rmin1*rmin2);
208 if (norm[0]*dir[0]+norm[1]*dir[1]+norm[2]*dir[2]<0) {
227 Double_t tg1 = 0.5*(rmin2-rmin1)/dz;
230 Double_t tg2 = 0.5*(rmax2-rmax1)/dz;
245 if (norm[0]*dir[0]+norm[1]*dir[1]+norm[2]*dir[2]<0) {
258 Double_t r2 = point[0]*point[0]+point[1]*point[1];
261 if ((r2<rl*rl) || (r2>rh*rh))
return kFALSE;
278 if (sz<=0)
return 0.0;
280 Double_t rsq=point[0]*point[0]+point[1]*point[1];
282 Double_t rin = 0.5*(rmin1+rmin2+(rmin2-rmin1)*point[2]*zinv);
289 Double_t ddotn = point[0]*dir[0]+point[1]*dir[1]+0.5*(rmin1-rmin2)*dir[2]*zinv*
TMath::Sqrt(rsq);
290 if (ddotn<=0)
return 0.0;
296 zi = point[2]+sr*dir[2];
301 zi = point[2]+sr*dir[2];
308 Double_t rout = 0.5*(rmax1+rmax2+(rmax2-rmax1)*point[2]*zinv);
310 Double_t ddotn = point[0]*dir[0]+point[1]*dir[1]+0.5*(rmax1-rmax2)*dir[2]*zinv*
TMath::Sqrt(rsq);
311 if (ddotn>=0)
return 0.0;
313 if (delta<0)
return 0.0;
317 zi = point[2]+sr*dir[2];
325 zi = point[2]+sr*dir[2];
330 zi = point[2]+sr*dir[2];
343 if (iact<3 && safe) {
367 snxt = (-dz-point[2])/dir[2];
368 xp = point[0]+snxt*dir[0];
369 yp = point[1]+snxt*dir[1];
371 if ((r2>=rmin1*rmin1) && (r2<=rmax1*rmax1))
return snxt;
376 snxt = (dz-point[2])/dir[2];
377 xp = point[0]+snxt*dir[0];
378 yp = point[1]+snxt*dir[1];
380 if ((r2>=rmin2*rmin2) && (r2<=rmax2*rmax2))
return snxt;
385 Double_t rsq = point[0]*point[0]+point[1]*point[1];
393 tg1=0.5*(rmin2-rmin1)*dzinv;
394 rin=ro1+tg1*point[2];
398 Double_t tg2=0.5*(rmax2-rmax1)*dzinv;
402 Bool_t in = inz & inrmin & inrmax;
410 if (safz<=safrmin && safz<=safrmax) {
412 if (point[2]*dir[2]<0)
return 0.0;
415 if (safrmax<safrmin) {
417 Double_t ddotn = point[0]*dir[0]+point[1]*dir[1]-tg2*dir[2]*
r;
418 if (ddotn<=0)
return 0.0;
422 Double_t ddotn = point[0]*dir[0]+point[1]*dir[1]-tg1*dir[2]*
r;
423 if (ddotn>=0)
return 0.0;
427 if (delta<0)
return 0.0;
431 zp = point[2]+snxt*dir[2];
432 if (TMath::Abs(zp)<=dz)
return snxt;
444 zp = point[2]+snxt*dir[2];
449 zp = point[2]+snxt*dir[2];
459 zp = point[2]+din*dir[2];
466 if (inrmax)
return snxt;
470 if (delta<0)
return snxt;
472 if (dout>0 && dout<snxt) {
473 zp = point[2]+dout*dir[2];
477 if (dout<=0 || dout>snxt)
return snxt;
478 zp = point[2]+dout*dir[2];
489 if (iact<3 && safe) {
513 Double_t rsq = point[0]*point[0] + point[1]*point[1];
516 Double_t a = dir[0]*dir[0] + dir[1]*dir[1] - tz*tz*dir[2]*dir[2];
517 b = point[0]*dir[0] + point[1]*dir[1] - tz*rc*dir[2];
543 const Int_t numPoints = 4*
n;
567 Error(
"Divide",
"division of a cone on R not implemented");
576 vmulti->AddVolume(vol);
578 for (
id=0;
id<ndiv;
id++) {
588 for (
id=0;
id<ndiv;
id++) {
595 shape =
new TGeoCone(0.5*step,rmin1n, rmax1n, rmin2n, rmax2n);
597 vmulti->AddVolume(vol);
604 Error(
"Divide",
"Wrong axis type for division");
655 param[0] *= param[0];
657 param[1] *= param[1];
670 Error(
"GetMakeRuntimeShape",
"invalid mother");
673 Double_t rmin1, rmax1, rmin2, rmax2, dz;
681 rmin1 = ((
TGeoCone*)mother)->GetRmin1();
683 rmax1 = ((
TGeoCone*)mother)->GetRmax1();
685 rmin2 = ((
TGeoCone*)mother)->GetRmin2();
687 rmax2 = ((
TGeoCone*)mother)->GetRmax2();
699 if (npoints > (npoints/2)*2) {
700 Error(
"GetPointsOnSegments",
"Npoints must be even number");
710 if (hasrmin) ntop = npoints/2 - nc*(nc-1);
711 else ntop = npoints - nc*(nc-1);
719 for (
Int_t i=0; i<nc; i++) {
720 if (i == (nc-1)) nphi = ntop;
725 for (
Int_t j=0; j<nphi; j++) {
752 printf(
" Bounding box:\n");
788 for (i = 0; i < 4; i++) {
789 for (j = 0; j <
n; j++) {
790 buffer.
fSegs[(i*n+j)*3 ] = c;
791 buffer.
fSegs[(i*n+j)*3+1] = i*n+j;
792 buffer.
fSegs[(i*n+j)*3+2] = i*n+j+1;
794 buffer.
fSegs[(i*n+j-1)*3+2] = i*n;
796 for (i = 4; i < 6; i++) {
797 for (j = 0; j <
n; j++) {
798 buffer.
fSegs[(i*n+j)*3 ] = c+1;
799 buffer.
fSegs[(i*n+j)*3+1] = (i-4)*n+j;
800 buffer.
fSegs[(i*n+j)*3+2] = (i-2)*n+j;
803 for (i = 6; i < 8; i++) {
804 for (j = 0; j <
n; j++) {
805 buffer.
fSegs[(i*n+j)*3 ] = c;
806 buffer.
fSegs[(i*n+j)*3+1] = 2*(i-6)*n+j;
807 buffer.
fSegs[(i*n+j)*3+2] = (2*(i-6)+1)*n+j;
813 for (j = 0; j <
n; j++) {
816 buffer.
fPols[indx+1] = 4;
817 buffer.
fPols[indx+5] = i*n+j;
818 buffer.
fPols[indx+4] = (4+i)*n+j;
819 buffer.
fPols[indx+3] = (2+i)*n+j;
820 buffer.
fPols[indx+2] = (4+i)*n+j+1;
822 buffer.
fPols[indx+2] = (4+i)*n;
824 for (j = 0; j <
n; j++) {
827 buffer.
fPols[indx+1] = 4;
828 buffer.
fPols[indx+2] = i*n+j;
829 buffer.
fPols[indx+3] = (4+i)*n+j;
830 buffer.
fPols[indx+4] = (2+i)*n+j;
831 buffer.
fPols[indx+5] = (4+i)*n+j+1;
833 buffer.
fPols[indx+5] = (4+i)*n;
835 for (j = 0; j <
n; j++) {
837 buffer.
fPols[indx ] = c+i;
838 buffer.
fPols[indx+1] = 4;
839 buffer.
fPols[indx+2] = (i-2)*2*n+j;
840 buffer.
fPols[indx+3] = (4+i)*n+j;
841 buffer.
fPols[indx+4] = ((i-2)*2+1)*n+j;
842 buffer.
fPols[indx+5] = (4+i)*n+j+1;
844 buffer.
fPols[indx+5] = (4+i)*n;
846 for (j = 0; j <
n; j++) {
848 buffer.
fPols[indx ] = c+i;
849 buffer.
fPols[indx+1] = 4;
850 buffer.
fPols[indx+5] = (i-2)*2*n+j;
851 buffer.
fPols[indx+4] = (4+i)*n+j;
852 buffer.
fPols[indx+3] = ((i-2)*2+1)*n+j;
853 buffer.
fPols[indx+2] = (4+i)*n+j+1;
855 buffer.
fPols[indx+2] = (4+i)*n;
901 if (rmin1>0 || rmin2>0)
916 out <<
" dz = " <<
fDz <<
";" << std::endl;
917 out <<
" rmin1 = " <<
fRmin1 <<
";" << std::endl;
918 out <<
" rmax1 = " <<
fRmax1 <<
";" << std::endl;
919 out <<
" rmin2 = " <<
fRmin2 <<
";" << std::endl;
920 out <<
" rmax2 = " <<
fRmax2 <<
";" << std::endl;
921 out <<
" TGeoShape *" <<
GetPointerName() <<
" = new TGeoCone(\"" <<
GetName() <<
"\", dz,rmin1,rmax1,rmin2,rmax2);" << std::endl;
940 Warning(
"SetConeDimensions",
"rmin1>rmax1 Switch rmin1<->rmax1");
962 Warning(
"SetConeDimensions",
"rmin2>rmax2 Switch rmin2<->rmax2");
1006 for (j = 0; j <
n; j++) {
1010 points[indx++] = -dz;
1013 for (j = 0; j <
n; j++) {
1017 points[indx++] = -dz;
1020 for (j = 0; j <
n; j++) {
1024 points[indx++] = dz;
1027 for (j = 0; j <
n; j++) {
1031 points[indx++] = dz;
1050 for (j = 0; j <
n; j++) {
1054 points[indx++] = -dz;
1057 for (j = 0; j <
n; j++) {
1061 points[indx++] = -dz;
1064 for (j = 0; j <
n; j++) {
1068 points[indx++] = dz;
1071 for (j = 0; j <
n; j++) {
1075 points[indx++] = dz;
1097 Int_t numPoints = n*4;
1129 if (buffer.
SetRawSizes(nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, nbPols, 6*nbPols)) {
1155 for (
Int_t i=0; i<vecsize; i++) inside[i] =
Contains(&points[3*i]);
1165 for (
Int_t i=0; i<vecsize; i++)
ComputeNormal(&points[3*i], &dirs[3*i], &norms[3*i]);
1173 for (
Int_t i=0; i<vecsize; i++) dists[i] =
DistFromInside(&points[3*i], &dirs[3*i], 3, step[i]);
1181 for (
Int_t i=0; i<vecsize; i++) dists[i] =
DistFromOutside(&points[3*i], &dirs[3*i], 3, step[i]);
1191 for (
Int_t i=0; i<vecsize; i++) safe[i] =
Safety(&points[3*i], inside[i]);
1201 fPhi1(0.), fPhi2(0.), fS1(0.), fC1(0.), fS2(0.), fC2(0.), fSm(0.), fCm(0.), fCdfi(0.)
1204 fPhi1 = fPhi2 = 0.0;
1211 :
TGeoCone(dz, rmin1, rmax1, rmin2, rmax2),
1212 fPhi1(0.), fPhi2(0.), fS1(0.), fC1(0.), fS2(0.), fC2(0.), fSm(0.), fCm(0.), fCdfi(0.)
1226 :
TGeoCone(name, dz, rmin1, rmax1, rmin2, rmax2),
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 (TMath::Abs(point[1]-s1*r) < TMath::Abs(point[1]-s2*r)) {
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];
1698 if (TMath::Abs(zi)<=dz) {
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];
1720 if (TMath::Abs(zi)<=dz) {
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];
1775 if (TMath::Abs(zi)<=dz) {
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];
1792 if (TMath::Abs(zi)<=dz) {
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];
1816 if (TMath::Abs(zi)<=dz) {
1817 xi=point[0]+s*dir[0];
1818 yi=point[1]+s*dir[1];
1826 zi=point[2]+s*dir[2];
1827 if (TMath::Abs(zi)<=dz) {
1828 xi=point[0]+s*dir[0];
1829 yi=point[1]+s*dir[1];
1843 zi=point[2]+s*dir[2];
1844 if (TMath::Abs(zi)<=dz) {
1845 xi=point[0]+s*dir[0];
1846 yi=point[1]+s*dir[1];
1855 zi=point[2]+s*dir[2];
1856 if (TMath::Abs(zi)<=dz) {
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];
1871 if (TMath::Abs(zi)>dz)
return snxt;
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.;
1942 vmulti->AddVolume(vol);
1944 for (
id=0;
id<ndiv;
id++) {
1954 for (
id=0;
id<ndiv;
id++) {
1961 shape =
new TGeoConeSeg(step/2, rmin1n, rmax1n, rmin2n, rmax2n, fPhi1,
fPhi2);
1963 vmulti->AddVolume(vol);
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();
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++) {
2110 buffer.
fSegs[(i*n+j)*3 ] = c;
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;
2261 dphi = (phi2-phi1)/(n-1);
2266 for (j = 0; j <
n; j++) {
2270 points[indx++] = -dz;
2272 for (j = 0; j <
n; j++) {
2276 points[indx++] = -dz;
2278 for (j = 0; j <
n; j++) {
2282 points[indx++] = dz;
2284 for (j = 0; j <
n; j++) {
2288 points[indx++] = dz;
2306 dphi = (phi2-phi1)/(n-1);
2311 for (j = 0; j <
n; j++) {
2315 points[indx++] = -dz;
2317 for (j = 0; j <
n; j++) {
2321 points[indx++] = -dz;
2323 for (j = 0; j <
n; j++) {
2327 points[indx++] = dz;
2329 for (j = 0; j <
n; j++) {
2333 points[indx++] = dz;
2355 Int_t numPoints = n*4;
2387 Int_t nbSegs = 2*nbPnts;
2388 Int_t nbPols = nbPnts-2;
2389 if (buffer.
SetRawSizes(nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, nbPols, 6*nbPols)) {
2413 if (npoints > (npoints/2)*2) {
2414 Error(
"GetPointsOnSegments",
"Npoints must be even number");
2421 Int_t ntop = npoints/2 - nc*(nc-1);
2429 for (
Int_t i=0; i<nc; i++) {
2432 dphi = (
fPhi2-
fPhi1)*TMath::DegToRad()/(nphi-1);
2438 for (
Int_t j=0; j<nphi; j++) {
2439 phi = phi1 + j*dphi;
2458 for (
Int_t i=0; i<vecsize; i++) inside[i] =
Contains(&points[3*i]);
2468 for (
Int_t i=0; i<vecsize; i++)
ComputeNormal(&points[3*i], &dirs[3*i], &norms[3*i]);
2476 for (
Int_t i=0; i<vecsize; i++) dists[i] =
DistFromInside(&points[3*i], &dirs[3*i], 3, step[i]);
2484 for (
Int_t i=0; i<vecsize; i++) dists[i] =
DistFromOutside(&points[3*i], &dirs[3*i], 3, step[i]);
2494 for (
Int_t i=0; i<vecsize; i++) safe[i] =
Safety(&points[3*i], inside[i]);
TGeoVolumeMulti * MakeVolumeMulti(const char *name, TGeoMedium *medium)
Make a TGeoVolumeMulti handling a list of volumes.
virtual ~TGeoConeSeg()
destructor
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 Sizeof3D() const
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.
Int_t GetNsegments() const
Get number of segments approximating circles.
virtual const char * GetAxisName(Int_t iaxis) const
Returns name of axis IAXIS.
Long64_t LocMax(Long64_t n, const T *a)
void SetFinder(TGeoPatternFinder *finder)
virtual Bool_t Contains(const Double_t *point) const
test if point is inside this cone
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 TBuffer3D * MakeBuffer3D() const
Creates a TBuffer3D describing this shape.
virtual void SetPoints(Double_t *points) const
Create cone mesh points.
void AddNodeOffset(TGeoVolume *vol, Int_t copy_no, Double_t offset=0, Option_t *option="")
Add a division node to the list of nodes.
virtual void ComputeBBox()
compute bounding box of the tube segment
Int_t GetBasicColor() const
Get the basic color (0-7).
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 specisied by dirs. Store output in dist...
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...
virtual void ComputeBBox()
compute bounding box of the sphere
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 Safety(const Double_t *point, Bool_t in=kTRUE) const
computes the closest distance from given point to this shape, according to option.
Short_t Min(Short_t a, Short_t b)
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...
virtual void SetPoints(Double_t *points) const
Create cone segment mesh points.
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 InspectShape() const
print shape parameters
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
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.
Int_t GetNdaughters() const
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 Bool_t IsSameWithinTolerance(Double_t a, Double_t b)
Check if two numbers differ with less than a tolerance.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
static Double_t Tolerance()
virtual void SetDimensions(Double_t *param)
Set cone dimensions from an array.
void InitTrigonometry()
cos(0.5*(phi1-phi2))
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.
const char * Data() const
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
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...
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 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 specisied by dirs. Store output in dist...
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 compute safe radius
virtual void AfterStreamer()
Function called after streaming an object of this class.
Double_t ATan2(Double_t, Double_t)
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
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 SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
virtual TBuffer3D * MakeBuffer3D() const
Creates a TBuffer3D describing this shape.
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.
void SetSectionsValid(UInt_t mask)
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)
void TransformPoints(Double_t *points, UInt_t NbPoints) const
Tranform a set of points (LocalToMaster)
virtual void SetSegsAndPols(TBuffer3D &buffer) const
Fill TBuffer3D structure for segments and polygons.
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 GetBoundingCylinder(Double_t *param) const
— Fill vector param[4] with the bounding cylinder parameters.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
unsigned int r1[N_CITIES]
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 :
virtual Int_t GetNmeshVertices() const
Return number of vertices of the mesh representation.
virtual Double_t Capacity() const
Computes capacity of the shape in [length^3].
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 ...
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.
virtual void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const
Returns numbers of vertices, segments and polygons composing the shape mesh.
Bool_t TestBit(UInt_t f) const
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 void Sizeof3D() const
Generic 3D primitive description class.
virtual Double_t Capacity() const
Computes capacity of the shape in [length^3].
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 specisied by dirs. Store output in dist...
virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const
Get range of shape for a given axis.
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, from start position with the given step.
void SetDivIndex(Int_t index)
virtual const char * GetName() const
Get the shape name.
virtual const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
Fills a static 3D buffer and returns a reference.
void SetBoxDimensions(Double_t dx, Double_t dy, Double_t dz, Double_t *origin=0)
Set parameters of the box.
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 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.
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 :
ClassImp(TGeoCone) TGeoCone
Default constructor.
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)
Compute normal to closest surface from POINT.
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,s2.
virtual void InspectShape() const
Prints shape parameters.
R__EXTERN TGeoManager * gGeoManager
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...
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
compute closest distance from point px,py to each corner
Int_t ShapeDistancetoPrimitive(Int_t numpoints, Int_t px, Int_t py) const
Returns distance to shape primitive mesh.
virtual void GetBoundingCylinder(Double_t *param) const
— Fill vector param[4] with the bounding cylinder parameters.
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 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 ...
const char * GetPointerName() const
Provide a pointer name containing uid.
virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const
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, Double_t c1, Double_t s1, Double_t c2, Double_t s2)
Compute normal to closest surface from POINT.
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)
Compute normal to closest surface from POINT.
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...
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 ~TGeoCone()
destructor
void SetShapeBit(UInt_t f, Bool_t set)
Equivalent of TObject::SetBit.
void SetConeDimensions(Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2)
Set cone dimensions.
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 Bool_t Contains(const Double_t *point) const
test if point is inside this sphere
Bool_t TestShapeBit(UInt_t f) const
virtual void InspectShape() const
print shape parameters
TGeoMedium * GetMedium() const
Short_t Max(Short_t a, Short_t b)
virtual Int_t GetNmeshVertices() const
Return number of vertices of the mesh representation.
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.
Double_t fCdfi
cos(0.5*(phi1+phi2))
Double_t Sqrt(Double_t x)
virtual const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
Fills a static 3D buffer and returns a reference.
TObject * At(Int_t idx) const
Long64_t LocMin(Long64_t n, const T *a)
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 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
Double_t fCm
sin(0.5*(phi1+phi2))
double norm(double *x, double *p)
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 compute safe radius
unsigned int r2[N_CITIES]
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 specisied by dirs. Store output in dist...
Bool_t SectionsValid(UInt_t mask) const
virtual void SetSegsAndPols(TBuffer3D &buffer) const
Fill TBuffer3D structure for segments and polygons.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.