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;
913 out <<
" dz = " <<
fDz <<
";" << std::endl;
914 out <<
" rmin1 = " <<
fRmin1 <<
";" << std::endl;
915 out <<
" rmax1 = " <<
fRmax1 <<
";" << std::endl;
916 out <<
" rmin2 = " <<
fRmin2 <<
";" << std::endl;
917 out <<
" rmax2 = " <<
fRmax2 <<
";" << std::endl;
918 out <<
" TGeoShape *" <<
GetPointerName() <<
" = new TGeoCone(\"" <<
GetName() <<
"\", dz,rmin1,rmax1,rmin2,rmax2);" << std::endl;
937 Warning(
"SetConeDimensions",
"rmin1>rmax1 Switch rmin1<->rmax1");
959 Warning(
"SetConeDimensions",
"rmin2>rmax2 Switch rmin2<->rmax2");
1003 for (j = 0; j <
n; j++) {
1007 points[indx++] = -dz;
1010 for (j = 0; j <
n; j++) {
1014 points[indx++] = -dz;
1017 for (j = 0; j <
n; j++) {
1021 points[indx++] = dz;
1024 for (j = 0; j <
n; j++) {
1028 points[indx++] = dz;
1047 for (j = 0; j <
n; j++) {
1051 points[indx++] = -dz;
1054 for (j = 0; j <
n; j++) {
1058 points[indx++] = -dz;
1061 for (j = 0; j <
n; j++) {
1065 points[indx++] = dz;
1068 for (j = 0; j <
n; j++) {
1072 points[indx++] = dz;
1094 Int_t numPoints = n*4;
1126 if (buffer.
SetRawSizes(nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, nbPols, 6*nbPols)) {
1152 for (
Int_t i=0; i<vecsize; i++) inside[i] =
Contains(&points[3*i]);
1162 for (
Int_t i=0; i<vecsize; i++)
ComputeNormal(&points[3*i], &dirs[3*i], &norms[3*i]);
1170 for (
Int_t i=0; i<vecsize; i++) dists[i] =
DistFromInside(&points[3*i], &dirs[3*i], 3, step[i]);
1178 for (
Int_t i=0; i<vecsize; i++) dists[i] =
DistFromOutside(&points[3*i], &dirs[3*i], 3, step[i]);
1188 for (
Int_t i=0; i<vecsize; i++) safe[i] =
Safety(&points[3*i], inside[i]);
1198 fPhi1(0.), fPhi2(0.), fS1(0.), fC1(0.), fS2(0.), fC2(0.), fSm(0.), fCm(0.), fCdfi(0.)
1201 fPhi1 = fPhi2 = 0.0;
1208 :
TGeoCone(dz, rmin1, rmax1, rmin2, rmax2),
1209 fPhi1(0.), fPhi2(0.), fS1(0.), fC1(0.), fS2(0.), fC2(0.), fSm(0.), fCm(0.), fCdfi(0.)
1223 :
TGeoCone(name, dz, rmin1, rmax1, rmin2, rmax2),
1224 fPhi1(0.), fPhi2(0.), fS1(0.), fC1(0.), fS2(0.), fC2(0.), fSm(0.), fCm(0.), fCdfi(0.)
1243 fPhi1(0.), fPhi2(0.), fS1(0.), fC1(0.), fS2(0.), fC2(0.), fSm(0.), fCm(0.), fCdfi(0.)
1297 (rmax1*rmax1+rmax2*rmax2+rmax1*rmax2-
1298 rmin1*rmin1-rmin2*rmin2-rmin1*rmin2);
1329 if (ddp<0) ddp+= 360;
1330 if (ddp<=dp) xmax = rmax;
1332 if (ddp<0) ddp+= 360;
1333 if (ddp<=dp) ymax = rmax;
1335 if (ddp<0) ddp+= 360;
1336 if (ddp<=dp) xmin = -rmax;
1338 if (ddp<0) ddp+= 360;
1339 if (ddp<=dp) ymin = -rmax;
1373 norm[0] = norm[1] = 0.;
1392 if (norm[0]*dir[0]+norm[1]*dir[1]+norm[2]*dir[2]<0) {
1408 Double_t tg1 = 0.5*(rmin2-rmin1)/dz;
1411 Double_t tg2 = 0.5*(rmax2-rmax1)/dz;
1439 if (norm[0]*dir[0]+norm[1]*dir[1]+norm[2]*dir[2]<0) {
1453 if (dphi >= 360.)
return kTRUE;
1455 if (phi < 0 ) phi+=360.;
1457 if (ddp < 0) ddp+=360.;
1459 if (ddp > dphi)
return kFALSE;
1478 if (dphi >= 360.) hasphi=
kFALSE;
1479 if (dphi < 0) dphi+=360.;
1484 Double_t r0sq = point[0]*point[0] + point[1]*point[1];
1485 Double_t rc = ro0 + fz*(point[2]-0.5*(z1+z2));
1487 Double_t a = dir[0]*dir[0] + dir[1]*dir[1] - fz*fz*dir[2]*dir[2];
1488 Double_t b = point[0]*dir[0] + point[1]*dir[1] - fz*rc*dir[2];
1504 ptnew[2] = point[2] + snxt*dir[2];
1505 if (((ptnew[2]-z1)*(ptnew[2]-z2)) < 0) {
1507 if (!hasphi)
return snxt;
1508 ptnew[0] = point[0] + snxt*dir[0];
1509 ptnew[1] = point[1] + snxt*dir[1];
1511 if (phi < 0 ) phi+=360.;
1513 if (ddp < 0) ddp+=360.;
1515 if (ddp<=dphi)
return snxt;
1521 ptnew[2] = point[2] + snxt*dir[2];
1522 if (((ptnew[2]-z1)*(ptnew[2]-z2)) < 0) {
1524 if (!hasphi)
return snxt;
1525 ptnew[0] = point[0] + snxt*dir[0];
1526 ptnew[1] = point[1] + snxt*dir[1];
1528 if (phi < 0 ) phi+=360.;
1530 if (ddp < 0) ddp+=360.;
1532 if (ddp<=dphi)
return snxt;
1548 if (scone<=0)
return 0.0;
1550 Double_t rsq = point[0]*point[0]+point[1]*point[1];
1552 Double_t cpsi=point[0]*cm+point[1]*sm;
1561 ddotn = s1*dir[0]-c1*dir[1];
1562 if (ddotn>=0)
return 0.0;
1563 ddotn = -s2*dir[0]+c2*dir[1];
1564 if (ddotn<=0)
return scone;
1565 sfmin = s2*point[0]-c2*point[1];
1566 if (sfmin<=0)
return scone;
1568 if (sfmin >= scone)
return scone;
1569 xi = point[0]+sfmin*dir[0];
1570 yi = point[1]+sfmin*dir[1];
1571 if (yi*cm-xi*sm<0)
return scone;
1574 ddotn = -s2*dir[0]+c2*dir[1];
1575 if (ddotn>=0)
return 0.0;
1576 ddotn = s1*dir[0]-c1*dir[1];
1577 if (ddotn<=0)
return scone;
1578 sfmin = -s1*point[0]+c1*point[1];
1579 if (sfmin<=0)
return scone;
1581 if (sfmin >= scone)
return scone;
1582 xi = point[0]+sfmin*dir[0];
1583 yi = point[1]+sfmin*dir[1];
1584 if (yi*cm-xi*sm>0)
return scone;
1593 if (iact<3 && safe) {
1601 return TGeoConeSeg::DistFromInsideS(point,dir,
fDz,
fRmin1,
fRmax1,
fRmin2,
fRmax2,
fC1,
fS1,
fC2,
fS2,
fCm,
fSm,
fCdfi);
1625 xi = point[0]+s*dir[0];
1626 yi = point[1]+s*dir[1];
1635 if ((rin*rin<=r2) && (r2<=rout*rout)) {
1641 Double_t rsq = point[0]*point[0]+point[1]*point[1];
1649 tg1=0.5*(rmin2-rmin1)*zinv;
1650 rin = ro1+tg1*point[2];
1656 Double_t tg2=0.5*(rmax2-rmax1)*zinv;
1657 rout = ro2+tg2*point[2];
1661 cpsi=point[0]*cm+point[1]*sm;
1663 in = inz & inrmin & inrmax & inphi;
1670 if (zi<safrmax && zi<safrmin && zi<safphi) {
1671 if (point[2]*dir[2]<0)
return 0.0;
1675 if (safrmax<safrmin && safrmax<safphi) {
1676 Double_t ddotn = point[0]*dir[0]+point[1]*dir[1]-tg2*dir[2]*
r;
1677 if (ddotn<=0)
return 0.0;
1681 if (safphi<safrmin) {
1685 if (TMath::Abs(point[1]-s1*r) < TMath::Abs(point[1]-s2*r)) {
1686 un = dir[0]*s1-dir[1]*
c1;
1687 if (un < 0)
return 0.0;
1689 un = -dir[0]*s2+dir[1]*
c2;
1691 s = -point[0]*s2+point[1]*
c2;
1694 zi = point[2]+s*dir[2];
1695 if (TMath::Abs(zi)<=dz) {
1696 xi = point[0]+s*dir[0];
1697 yi = point[1]+s*dir[1];
1698 if ((yi*cm-xi*sm)>0) {
1702 if ((rin*rin<=r2) && (rout*rout>=
r2))
return s;
1708 un = -dir[0]*s2+dir[1]*
c2;
1709 if (un < 0)
return 0.0;
1711 un = dir[0]*s1-dir[1]*
c1;
1713 s = point[0]*s1-point[1]*
c1;
1716 zi = point[2]+s*dir[2];
1717 if (TMath::Abs(zi)<=dz) {
1718 xi = point[0]+s*dir[0];
1719 yi = point[1]+s*dir[1];
1720 if ((yi*cm-xi*sm)<0) {
1724 if ((rin*rin<=r2) && (rout*rout>=
r2))
return s;
1731 Double_t ddotn = point[0]*dir[0]+point[1]*dir[1]-tg1*dir[2]*
r;
1739 zi = point[2]+snxt*dir[2];
1741 xi = point[0]+snxt*dir[0];
1742 yi = point[1]+snxt*dir[1];
1749 Double_t ddotn = point[0]*dir[0]+point[1]*dir[1]-tg1*dir[2]*
r;
1750 if (ddotn>=0)
return 0.0;
1752 if (delta<0)
return 0.0;
1756 zi = point[2]+snxt*dir[2];
1759 xi = point[0]+snxt*dir[0];
1760 yi = point[1]+snxt*dir[1];
1768 s=point[0]*s1-point[1]*
c1;
1771 zi=point[2]+s*dir[2];
1772 if (TMath::Abs(zi)<=dz) {
1773 xi=point[0]+s*dir[0];
1774 yi=point[1]+s*dir[1];
1775 if ((yi*cm-xi*sm)<=0) {
1779 if ((rin*rin<=r2) && (rout*rout>=r2))
return s;
1784 un=dir[0]*s2-dir[1]*
c2;
1786 s=(point[1]*c2-point[0]*s2)/un;
1788 zi=point[2]+s*dir[2];
1789 if (TMath::Abs(zi)<=dz) {
1790 xi=point[0]+s*dir[0];
1791 yi=point[1]+s*dir[1];
1792 if ((yi*cm-xi*sm)>=0) {
1796 if ((rin*rin<=r2) && (rout*rout>=
r2))
return s;
1812 zi=point[2]+s*dir[2];
1813 if (TMath::Abs(zi)<=dz) {
1814 xi=point[0]+s*dir[0];
1815 yi=point[1]+s*dir[1];
1823 zi=point[2]+s*dir[2];
1824 if (TMath::Abs(zi)<=dz) {
1825 xi=point[0]+s*dir[0];
1826 yi=point[1]+s*dir[1];
1840 zi=point[2]+s*dir[2];
1841 if (TMath::Abs(zi)<=dz) {
1842 xi=point[0]+s*dir[0];
1843 yi=point[1]+s*dir[1];
1852 zi=point[2]+s*dir[2];
1853 if (TMath::Abs(zi)<=dz) {
1854 xi=point[0]+s*dir[0];
1855 yi=point[1]+s*dir[1];
1866 if (s>snxt)
return snxt;
1867 zi=point[2]+s*dir[2];
1868 if (TMath::Abs(zi)>dz)
return snxt;
1869 xi=point[0]+s*dir[0];
1870 yi=point[1]+s*dir[1];
1873 if (r2>rout*rout)
return snxt;
1875 if (r2>=rin*rin)
return s;
1885 if (iact<3 && safe) {
1894 return TGeoConeSeg::DistFromOutsideS(point,dir,
fDz,
fRmin1,
fRmax1,
fRmin2,
fRmax2,
fC1,
fS1,
fC2,
fS2,
fCm,
fSm,
fCdfi);
1903 const Int_t numPoints = 4*
n;
1928 Error(
"Divide",
"division of a cone segment on R not implemented");
1932 if (dphi<0) dphi+=360.;
1939 vmulti->AddVolume(vol);
1941 for (
id=0;
id<ndiv;
id++) {
1951 for (
id=0;
id<ndiv;
id++) {
1958 shape =
new TGeoConeSeg(step/2, rmin1n, rmax1n, rmin2n, rmax2n, fPhi1,
fPhi2);
1960 vmulti->AddVolume(vol);
1967 Error(
"Divide",
"Wrong axis type for division");
2002 param[0] *= param[0];
2004 param[1] *= param[1];
2007 while (param[3]<param[2]) param[3]+=360.;
2018 Error(
"GetMakeRuntimeShape",
"invalid mother");
2021 Double_t rmin1, rmax1, rmin2, rmax2, dz;
2029 rmin1 = ((
TGeoCone*)mother)->GetRmin1();
2031 rmax1 = ((
TGeoCone*)mother)->GetRmax1();
2033 rmin2 = ((
TGeoCone*)mother)->GetRmin2();
2035 rmax2 = ((
TGeoCone*)mother)->GetRmax2();
2053 printf(
" Bounding box:\n");
2065 Int_t nbSegs = 2*nbPnts;
2066 Int_t nbPols = nbPnts-2;
2091 for (i = 0; i < 4; i++) {
2092 for (j = 1; j <
n; j++) {
2093 buffer.
fSegs[(i*n+j-1)*3 ] = c;
2094 buffer.
fSegs[(i*n+j-1)*3+1] = i*n+j-1;
2095 buffer.
fSegs[(i*n+j-1)*3+2] = i*n+j;
2098 for (i = 4; i < 6; i++) {
2099 for (j = 0; j <
n; j++) {
2100 buffer.
fSegs[(i*n+j)*3 ] = c+1;
2101 buffer.
fSegs[(i*n+j)*3+1] = (i-4)*n+j;
2102 buffer.
fSegs[(i*n+j)*3+2] = (i-2)*n+j;
2105 for (i = 6; i < 8; i++) {
2106 for (j = 0; j <
n; j++) {
2107 buffer.
fSegs[(i*n+j)*3 ] = c;
2108 buffer.
fSegs[(i*n+j)*3+1] = 2*(i-6)*n+j;
2109 buffer.
fSegs[(i*n+j)*3+2] = (2*(i-6)+1)*n+j;
2116 for (j = 0; j < n-1; j++) {
2117 buffer.
fPols[indx++] =
c;
2118 buffer.
fPols[indx++] = 4;
2119 buffer.
fPols[indx++] = (4+i)*n+j+1;
2120 buffer.
fPols[indx++] = (2+i)*n+j;
2121 buffer.
fPols[indx++] = (4+i)*n+j;
2122 buffer.
fPols[indx++] = i*n+j;
2125 for (j = 0; j < n-1; j++) {
2126 buffer.
fPols[indx++] =
c;
2127 buffer.
fPols[indx++] = 4;
2128 buffer.
fPols[indx++] = i*n+j;
2129 buffer.
fPols[indx++] = (4+i)*n+j;
2130 buffer.
fPols[indx++] = (2+i)*n+j;
2131 buffer.
fPols[indx++] = (4+i)*n+j+1;
2134 for (j = 0; j < n-1; j++) {
2135 buffer.
fPols[indx++] = c+i;
2136 buffer.
fPols[indx++] = 4;
2137 buffer.
fPols[indx++] = (i-2)*2*n+j;
2138 buffer.
fPols[indx++] = (4+i)*n+j;
2139 buffer.
fPols[indx++] = ((i-2)*2+1)*n+j;
2140 buffer.
fPols[indx++] = (4+i)*n+j+1;
2143 for (j = 0; j < n-1; j++) {
2144 buffer.
fPols[indx++] = c+i;
2145 buffer.
fPols[indx++] = 4;
2146 buffer.
fPols[indx++] = (4+i)*n+j+1;
2147 buffer.
fPols[indx++] = ((i-2)*2+1)*n+j;
2148 buffer.
fPols[indx++] = (4+i)*n+j;
2149 buffer.
fPols[indx++] = (i-2)*2*n+j;
2151 buffer.
fPols[indx++] = c+2;
2152 buffer.
fPols[indx++] = 4;
2153 buffer.
fPols[indx++] = 6*
n;
2154 buffer.
fPols[indx++] = 4*
n;
2155 buffer.
fPols[indx++] = 7*
n;
2156 buffer.
fPols[indx++] = 5*
n;
2157 buffer.
fPols[indx++] = c+2;
2158 buffer.
fPols[indx++] = 4;
2159 buffer.
fPols[indx++] = 6*n-1;
2160 buffer.
fPols[indx++] = 8*n-1;
2161 buffer.
fPols[indx++] = 5*n-1;
2162 buffer.
fPols[indx++] = 7*n-1;
2175 if (safe>1.E10)
return safphi;
2186 if ((phi2-phi1)>=360.)
return safe;
2189 if (safe>1.E10)
return safphi;
2199 out <<
" // Shape: " <<
GetName() <<
" type: " <<
ClassName() << std::endl;
2200 out <<
" dz = " <<
fDz <<
";" << std::endl;
2201 out <<
" rmin1 = " <<
fRmin1 <<
";" << std::endl;
2202 out <<
" rmax1 = " <<
fRmax1 <<
";" << std::endl;
2203 out <<
" rmin2 = " <<
fRmin2 <<
";" << std::endl;
2204 out <<
" rmax2 = " <<
fRmax2 <<
";" << std::endl;
2205 out <<
" phi1 = " <<
fPhi1 <<
";" << std::endl;
2206 out <<
" phi2 = " <<
fPhi2 <<
";" << std::endl;
2207 out <<
" TGeoShape *" <<
GetPointerName() <<
" = new TGeoConeSeg(\"" <<
GetName() <<
"\", dz,rmin1,rmax1,rmin2,rmax2,phi1,phi2);" << std::endl;
2251 Float_t dphi,phi,phi1, phi2,dz;
2258 dphi = (phi2-phi1)/(n-1);
2263 for (j = 0; j <
n; j++) {
2267 points[indx++] = -dz;
2269 for (j = 0; j <
n; j++) {
2273 points[indx++] = -dz;
2275 for (j = 0; j <
n; j++) {
2279 points[indx++] = dz;
2281 for (j = 0; j <
n; j++) {
2285 points[indx++] = dz;
2296 Float_t dphi,phi,phi1, phi2,dz;
2303 dphi = (phi2-phi1)/(n-1);
2308 for (j = 0; j <
n; j++) {
2312 points[indx++] = -dz;
2314 for (j = 0; j <
n; j++) {
2318 points[indx++] = -dz;
2320 for (j = 0; j <
n; j++) {
2324 points[indx++] = dz;
2326 for (j = 0; j <
n; j++) {
2330 points[indx++] = dz;
2352 Int_t numPoints = n*4;
2384 Int_t nbSegs = 2*nbPnts;
2385 Int_t nbPols = nbPnts-2;
2386 if (buffer.
SetRawSizes(nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, nbPols, 6*nbPols)) {
2410 if (npoints > (npoints/2)*2) {
2411 Error(
"GetPointsOnSegments",
"Npoints must be even number");
2418 Int_t ntop = npoints/2 - nc*(nc-1);
2426 for (
Int_t i=0; i<nc; i++) {
2429 dphi = (
fPhi2-
fPhi1)*TMath::DegToRad()/(nphi-1);
2435 for (
Int_t j=0; j<nphi; j++) {
2436 phi = phi1 + j*dphi;
2455 for (
Int_t i=0; i<vecsize; i++) inside[i] =
Contains(&points[3*i]);
2465 for (
Int_t i=0; i<vecsize; i++)
ComputeNormal(&points[3*i], &dirs[3*i], &norms[3*i]);
2473 for (
Int_t i=0; i<vecsize; i++) dists[i] =
DistFromInside(&points[3*i], &dirs[3*i], 3, step[i]);
2481 for (
Int_t i=0; i<vecsize; i++) dists[i] =
DistFromOutside(&points[3*i], &dirs[3*i], 3, step[i]);
2491 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.