104 if ((dz<0) || (rmin1<0) || (rmax1<0) || (rmin2<0) || (rmax2<0)) {
119 if ((dz<0) || (rmin1<0) || (rmax1<0) || (rmin2<0) || (rmax2<0)) {
157 rmin1*rmin1-rmin2*rmin2-rmin1*rmin2);
214 if (norm[0]*dir[0]+norm[1]*dir[1]+norm[2]*dir[2]<0) {
233 Double_t tg1 = 0.5*(rmin2-rmin1)/dz;
236 Double_t tg2 = 0.5*(rmax2-rmax1)/dz;
251 if (norm[0]*dir[0]+norm[1]*dir[1]+norm[2]*dir[2]<0) {
264 Double_t r2 = point[0]*point[0]+point[1]*point[1];
267 if ((r2<rl*rl) || (r2>rh*rh))
return kFALSE;
284 if (sz<=0)
return 0.0;
286 Double_t rsq=point[0]*point[0]+point[1]*point[1];
288 Double_t rin = 0.5*(rmin1+rmin2+(rmin2-rmin1)*point[2]*zinv);
295 Double_t ddotn = point[0]*dir[0]+point[1]*dir[1]+0.5*(rmin1-rmin2)*dir[2]*zinv*
TMath::Sqrt(rsq);
296 if (ddotn<=0)
return 0.0;
302 zi = point[2]+sr*dir[2];
307 zi = point[2]+sr*dir[2];
314 Double_t rout = 0.5*(rmax1+rmax2+(rmax2-rmax1)*point[2]*zinv);
316 Double_t ddotn = point[0]*dir[0]+point[1]*dir[1]+0.5*(rmax1-rmax2)*dir[2]*zinv*
TMath::Sqrt(rsq);
317 if (ddotn>=0)
return 0.0;
319 if (delta<0)
return 0.0;
323 zi = point[2]+sr*dir[2];
331 zi = point[2]+sr*dir[2];
336 zi = point[2]+sr*dir[2];
349 if (iact<3 && safe) {
373 snxt = (-dz-point[2])/dir[2];
374 xp = point[0]+snxt*dir[0];
375 yp = point[1]+snxt*dir[1];
377 if ((r2>=rmin1*rmin1) && (r2<=rmax1*rmax1))
return snxt;
382 snxt = (dz-point[2])/dir[2];
383 xp = point[0]+snxt*dir[0];
384 yp = point[1]+snxt*dir[1];
386 if ((r2>=rmin2*rmin2) && (r2<=rmax2*rmax2))
return snxt;
391 Double_t rsq = point[0]*point[0]+point[1]*point[1];
399 tg1=0.5*(rmin2-rmin1)*dzinv;
400 rin=ro1+tg1*point[2];
404 Double_t tg2=0.5*(rmax2-rmax1)*dzinv;
408 Bool_t in = inz & inrmin & inrmax;
416 if (safz<=safrmin && safz<=safrmax) {
418 if (point[2]*dir[2]<0)
return 0.0;
421 if (safrmax<safrmin) {
423 Double_t ddotn = point[0]*dir[0]+point[1]*dir[1]-tg2*dir[2]*
r;
424 if (ddotn<=0)
return 0.0;
428 Double_t ddotn = point[0]*dir[0]+point[1]*dir[1]-tg1*dir[2]*
r;
429 if (ddotn>=0)
return 0.0;
433 if (delta<0)
return 0.0;
437 zp = point[2]+snxt*dir[2];
438 if (TMath::Abs(zp)<=dz)
return snxt;
450 zp = point[2]+snxt*dir[2];
455 zp = point[2]+snxt*dir[2];
465 zp = point[2]+din*dir[2];
472 if (inrmax)
return snxt;
476 if (delta<0)
return snxt;
478 if (dout>0 && dout<snxt) {
479 zp = point[2]+dout*dir[2];
483 if (dout<=0 || dout>snxt)
return snxt;
484 zp = point[2]+dout*dir[2];
495 if (iact<3 && safe) {
519 Double_t rsq = point[0]*point[0] + point[1]*point[1];
522 Double_t a = dir[0]*dir[0] + dir[1]*dir[1] - tz*tz*dir[2]*dir[2];
523 b = point[0]*dir[0] + point[1]*dir[1] - tz*rc*dir[2];
549 const Int_t numPoints = 4*
n;
573 Error(
"Divide",
"division of a cone on R not implemented");
582 vmulti->AddVolume(vol);
584 for (
id=0;
id<ndiv;
id++) {
594 for (
id=0;
id<ndiv;
id++) {
601 shape =
new TGeoCone(0.5*step,rmin1n, rmax1n, rmin2n, rmax2n);
603 vmulti->AddVolume(vol);
610 Error(
"Divide",
"Wrong axis type for division");
661 param[0] *= param[0];
663 param[1] *= param[1];
676 Error(
"GetMakeRuntimeShape",
"invalid mother");
679 Double_t rmin1, rmax1, rmin2, rmax2, dz;
687 rmin1 = ((
TGeoCone*)mother)->GetRmin1();
689 rmax1 = ((
TGeoCone*)mother)->GetRmax1();
691 rmin2 = ((
TGeoCone*)mother)->GetRmin2();
693 rmax2 = ((
TGeoCone*)mother)->GetRmax2();
705 if (npoints > (npoints/2)*2) {
706 Error(
"GetPointsOnSegments",
"Npoints must be even number");
716 if (hasrmin) ntop = npoints/2 - nc*(nc-1);
717 else ntop = npoints - nc*(nc-1);
725 for (
Int_t i=0; i<nc; i++) {
726 if (i == (nc-1)) nphi = ntop;
731 for (
Int_t j=0; j<nphi; j++) {
752 printf(
"*** Shape %s TGeoCone ***\n",
GetName());
753 printf(
" dz =: %11.5f\n",
fDz);
754 printf(
" Rmin1 = %11.5f\n",
fRmin1);
755 printf(
" Rmax1 = %11.5f\n",
fRmax1);
756 printf(
" Rmin2 = %11.5f\n",
fRmin2);
757 printf(
" Rmax2 = %11.5f\n",
fRmax2);
758 printf(
" Bounding box:\n");
794 for (i = 0; i < 4; i++) {
795 for (j = 0; j <
n; j++) {
796 buffer.
fSegs[(i*n+j)*3 ] = c;
797 buffer.
fSegs[(i*n+j)*3+1] = i*n+j;
798 buffer.
fSegs[(i*n+j)*3+2] = i*n+j+1;
800 buffer.
fSegs[(i*n+j-1)*3+2] = i*n;
802 for (i = 4; i < 6; i++) {
803 for (j = 0; j <
n; j++) {
804 buffer.
fSegs[(i*n+j)*3 ] = c+1;
805 buffer.
fSegs[(i*n+j)*3+1] = (i-4)*n+j;
806 buffer.
fSegs[(i*n+j)*3+2] = (i-2)*n+j;
809 for (i = 6; i < 8; i++) {
810 for (j = 0; j <
n; j++) {
811 buffer.
fSegs[(i*n+j)*3 ] = c;
812 buffer.
fSegs[(i*n+j)*3+1] = 2*(i-6)*n+j;
813 buffer.
fSegs[(i*n+j)*3+2] = (2*(i-6)+1)*n+j;
819 for (j = 0; j <
n; j++) {
821 buffer.
fPols[indx ] = c;
822 buffer.
fPols[indx+1] = 4;
823 buffer.
fPols[indx+5] = i*n+j;
824 buffer.
fPols[indx+4] = (4+i)*n+j;
825 buffer.
fPols[indx+3] = (2+i)*n+j;
826 buffer.
fPols[indx+2] = (4+i)*n+j+1;
828 buffer.
fPols[indx+2] = (4+i)*n;
830 for (j = 0; j <
n; j++) {
832 buffer.
fPols[indx ] = c;
833 buffer.
fPols[indx+1] = 4;
834 buffer.
fPols[indx+2] = i*n+j;
835 buffer.
fPols[indx+3] = (4+i)*n+j;
836 buffer.
fPols[indx+4] = (2+i)*n+j;
837 buffer.
fPols[indx+5] = (4+i)*n+j+1;
839 buffer.
fPols[indx+5] = (4+i)*n;
841 for (j = 0; j <
n; j++) {
843 buffer.
fPols[indx ] = c+i;
844 buffer.
fPols[indx+1] = 4;
845 buffer.
fPols[indx+2] = (i-2)*2*n+j;
846 buffer.
fPols[indx+3] = (4+i)*n+j;
847 buffer.
fPols[indx+4] = ((i-2)*2+1)*n+j;
848 buffer.
fPols[indx+5] = (4+i)*n+j+1;
850 buffer.
fPols[indx+5] = (4+i)*n;
852 for (j = 0; j <
n; j++) {
854 buffer.
fPols[indx ] = c+i;
855 buffer.
fPols[indx+1] = 4;
856 buffer.
fPols[indx+5] = (i-2)*2*n+j;
857 buffer.
fPols[indx+4] = (4+i)*n+j;
858 buffer.
fPols[indx+3] = ((i-2)*2+1)*n+j;
859 buffer.
fPols[indx+2] = (4+i)*n+j+1;
861 buffer.
fPols[indx+2] = (4+i)*n;
877 if (safety>1.E20) safety = 0.;
909 if (rmin1>0 || rmin2>0)
924 out <<
" dz = " <<
fDz <<
";" << std::endl;
925 out <<
" rmin1 = " <<
fRmin1 <<
";" << std::endl;
926 out <<
" rmax1 = " <<
fRmax1 <<
";" << std::endl;
927 out <<
" rmin2 = " <<
fRmin2 <<
";" << std::endl;
928 out <<
" rmax2 = " <<
fRmax2 <<
";" << std::endl;
929 out <<
" TGeoShape *" <<
GetPointerName() <<
" = new TGeoCone(\"" <<
GetName() <<
"\", dz,rmin1,rmax1,rmin2,rmax2);" << std::endl;
948 Warning(
"SetConeDimensions",
"rmin1>rmax1 Switch rmin1<->rmax1");
970 Warning(
"SetConeDimensions",
"rmin2>rmax2 Switch rmin2<->rmax2");
1014 for (j = 0; j <
n; j++) {
1018 points[indx++] = -dz;
1021 for (j = 0; j <
n; j++) {
1025 points[indx++] = -dz;
1028 for (j = 0; j <
n; j++) {
1032 points[indx++] = dz;
1035 for (j = 0; j <
n; j++) {
1039 points[indx++] = dz;
1058 for (j = 0; j <
n; j++) {
1062 points[indx++] = -dz;
1065 for (j = 0; j <
n; j++) {
1069 points[indx++] = -dz;
1072 for (j = 0; j <
n; j++) {
1076 points[indx++] = dz;
1079 for (j = 0; j <
n; j++) {
1083 points[indx++] = dz;
1105 Int_t numPoints = n*4;
1130 if (buffer.
SetRawSizes(nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, nbPols, 6*nbPols)) {
1156 for (
Int_t i=0; i<vecsize; i++) inside[i] =
Contains(&points[3*i]);
1166 for (
Int_t i=0; i<vecsize; i++)
ComputeNormal(&points[3*i], &dirs[3*i], &norms[3*i]);
1174 for (
Int_t i=0; i<vecsize; i++) dists[i] =
DistFromInside(&points[3*i], &dirs[3*i], 3, step[i]);
1182 for (
Int_t i=0; i<vecsize; i++) dists[i] =
DistFromOutside(&points[3*i], &dirs[3*i], 3, step[i]);
1192 for (
Int_t i=0; i<vecsize; i++) safe[i] =
Safety(&points[3*i], inside[i]);
1202 fPhi1(0.), fPhi2(0.), fS1(0.), fC1(0.), fS2(0.), fC2(0.), fSm(0.), fCm(0.), fCdfi(0.)
1205 fPhi1 = fPhi2 = 0.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 :
TGeoCone(name, dz, rmin1, rmax1, rmin2, rmax2),
1301 (rmax1*rmax1+rmax2*rmax2+rmax1*rmax2-
1302 rmin1*rmin1-rmin2*rmin2-rmin1*rmin2);
1333 if (ddp<0) ddp+= 360;
1334 if (ddp<=dp) xmax = rmax;
1336 if (ddp<0) ddp+= 360;
1337 if (ddp<=dp) ymax = rmax;
1339 if (ddp<0) ddp+= 360;
1340 if (ddp<=dp) xmin = -rmax;
1342 if (ddp<0) ddp+= 360;
1343 if (ddp<=dp) ymin = -rmax;
1377 norm[0] = norm[1] = 0.;
1396 if (norm[0]*dir[0]+norm[1]*dir[1]+norm[2]*dir[2]<0) {
1412 Double_t tg1 = 0.5*(rmin2-rmin1)/dz;
1415 Double_t tg2 = 0.5*(rmax2-rmax1)/dz;
1443 if (norm[0]*dir[0]+norm[1]*dir[1]+norm[2]*dir[2]<0) {
1457 if (dphi >= 360.)
return kTRUE;
1459 if (phi < 0 ) phi+=360.;
1461 if (ddp < 0) ddp+=360.;
1463 if (ddp > dphi)
return kFALSE;
1482 if (dphi >= 360.) hasphi=
kFALSE;
1483 if (dphi < 0) dphi+=360.;
1488 Double_t r0sq = point[0]*point[0] + point[1]*point[1];
1489 Double_t rc = ro0 + fz*(point[2]-0.5*(z1+z2));
1491 Double_t a = dir[0]*dir[0] + dir[1]*dir[1] - fz*fz*dir[2]*dir[2];
1492 Double_t b = point[0]*dir[0] + point[1]*dir[1] - fz*rc*dir[2];
1508 ptnew[2] = point[2] + snxt*dir[2];
1509 if (((ptnew[2]-z1)*(ptnew[2]-z2)) < 0) {
1511 if (!hasphi)
return snxt;
1512 ptnew[0] = point[0] + snxt*dir[0];
1513 ptnew[1] = point[1] + snxt*dir[1];
1515 if (phi < 0 ) phi+=360.;
1517 if (ddp < 0) ddp+=360.;
1519 if (ddp<=dphi)
return snxt;
1525 ptnew[2] = point[2] + snxt*dir[2];
1526 if (((ptnew[2]-z1)*(ptnew[2]-z2)) < 0) {
1528 if (!hasphi)
return snxt;
1529 ptnew[0] = point[0] + snxt*dir[0];
1530 ptnew[1] = point[1] + snxt*dir[1];
1532 if (phi < 0 ) phi+=360.;
1534 if (ddp < 0) ddp+=360.;
1536 if (ddp<=dphi)
return snxt;
1552 if (scone<=0)
return 0.0;
1554 Double_t rsq = point[0]*point[0]+point[1]*point[1];
1556 Double_t cpsi=point[0]*cm+point[1]*sm;
1565 ddotn = s1*dir[0]-c1*dir[1];
1566 if (ddotn>=0)
return 0.0;
1567 ddotn = -s2*dir[0]+c2*dir[1];
1568 if (ddotn<=0)
return scone;
1569 sfmin = s2*point[0]-c2*point[1];
1570 if (sfmin<=0)
return scone;
1572 if (sfmin >= scone)
return scone;
1573 xi = point[0]+sfmin*dir[0];
1574 yi = point[1]+sfmin*dir[1];
1575 if (yi*cm-xi*sm<0)
return scone;
1578 ddotn = -s2*dir[0]+c2*dir[1];
1579 if (ddotn>=0)
return 0.0;
1580 ddotn = s1*dir[0]-c1*dir[1];
1581 if (ddotn<=0)
return scone;
1582 sfmin = -s1*point[0]+c1*point[1];
1583 if (sfmin<=0)
return scone;
1585 if (sfmin >= scone)
return scone;
1586 xi = point[0]+sfmin*dir[0];
1587 yi = point[1]+sfmin*dir[1];
1588 if (yi*cm-xi*sm>0)
return scone;
1597 if (iact<3 && safe) {
1605 return TGeoConeSeg::DistFromInsideS(point,dir,
fDz,
fRmin1,
fRmax1,
fRmin2,
fRmax2,
fC1,
fS1,
fC2,
fS2,
fCm,
fSm,
fCdfi);
1629 xi = point[0]+s*dir[0];
1630 yi = point[1]+s*dir[1];
1639 if ((rin*rin<=r2) && (r2<=rout*rout)) {
1645 Double_t rsq = point[0]*point[0]+point[1]*point[1];
1653 tg1=0.5*(rmin2-rmin1)*zinv;
1654 rin = ro1+tg1*point[2];
1660 Double_t tg2=0.5*(rmax2-rmax1)*zinv;
1661 rout = ro2+tg2*point[2];
1665 cpsi=point[0]*cm+point[1]*sm;
1667 in = inz & inrmin & inrmax & inphi;
1674 if (zi<safrmax && zi<safrmin && zi<safphi) {
1675 if (point[2]*dir[2]<0)
return 0.0;
1679 if (safrmax<safrmin && safrmax<safphi) {
1680 Double_t ddotn = point[0]*dir[0]+point[1]*dir[1]-tg2*dir[2]*
r;
1681 if (ddotn<=0)
return 0.0;
1685 if (safphi<safrmin) {
1689 if (TMath::Abs(point[1]-s1*r) < TMath::Abs(point[1]-s2*r)) {
1690 un = dir[0]*s1-dir[1]*
c1;
1691 if (un < 0)
return 0.0;
1693 un = -dir[0]*s2+dir[1]*
c2;
1695 s = -point[0]*s2+point[1]*
c2;
1698 zi = point[2]+s*dir[2];
1699 if (TMath::Abs(zi)<=dz) {
1700 xi = point[0]+s*dir[0];
1701 yi = point[1]+s*dir[1];
1702 if ((yi*cm-xi*sm)>0) {
1706 if ((rin*rin<=r2) && (rout*rout>=
r2))
return s;
1712 un = -dir[0]*s2+dir[1]*
c2;
1713 if (un < 0)
return 0.0;
1715 un = dir[0]*s1-dir[1]*
c1;
1717 s = point[0]*s1-point[1]*
c1;
1720 zi = point[2]+s*dir[2];
1721 if (TMath::Abs(zi)<=dz) {
1722 xi = point[0]+s*dir[0];
1723 yi = point[1]+s*dir[1];
1724 if ((yi*cm-xi*sm)<0) {
1728 if ((rin*rin<=r2) && (rout*rout>=
r2))
return s;
1735 Double_t ddotn = point[0]*dir[0]+point[1]*dir[1]-tg1*dir[2]*
r;
1743 zi = point[2]+snxt*dir[2];
1745 xi = point[0]+snxt*dir[0];
1746 yi = point[1]+snxt*dir[1];
1753 Double_t ddotn = point[0]*dir[0]+point[1]*dir[1]-tg1*dir[2]*
r;
1754 if (ddotn>=0)
return 0.0;
1756 if (delta<0)
return 0.0;
1760 zi = point[2]+snxt*dir[2];
1763 xi = point[0]+snxt*dir[0];
1764 yi = point[1]+snxt*dir[1];
1772 s=point[0]*s1-point[1]*
c1;
1775 zi=point[2]+s*dir[2];
1776 if (TMath::Abs(zi)<=dz) {
1777 xi=point[0]+s*dir[0];
1778 yi=point[1]+s*dir[1];
1779 if ((yi*cm-xi*sm)<=0) {
1783 if ((rin*rin<=r2) && (rout*rout>=r2))
return s;
1788 un=dir[0]*s2-dir[1]*
c2;
1790 s=(point[1]*c2-point[0]*s2)/un;
1792 zi=point[2]+s*dir[2];
1793 if (TMath::Abs(zi)<=dz) {
1794 xi=point[0]+s*dir[0];
1795 yi=point[1]+s*dir[1];
1796 if ((yi*cm-xi*sm)>=0) {
1800 if ((rin*rin<=r2) && (rout*rout>=
r2))
return s;
1816 zi=point[2]+s*dir[2];
1817 if (TMath::Abs(zi)<=dz) {
1818 xi=point[0]+s*dir[0];
1819 yi=point[1]+s*dir[1];
1827 zi=point[2]+s*dir[2];
1828 if (TMath::Abs(zi)<=dz) {
1829 xi=point[0]+s*dir[0];
1830 yi=point[1]+s*dir[1];
1844 zi=point[2]+s*dir[2];
1845 if (TMath::Abs(zi)<=dz) {
1846 xi=point[0]+s*dir[0];
1847 yi=point[1]+s*dir[1];
1856 zi=point[2]+s*dir[2];
1857 if (TMath::Abs(zi)<=dz) {
1858 xi=point[0]+s*dir[0];
1859 yi=point[1]+s*dir[1];
1870 if (s>snxt)
return snxt;
1871 zi=point[2]+s*dir[2];
1872 if (TMath::Abs(zi)>dz)
return snxt;
1873 xi=point[0]+s*dir[0];
1874 yi=point[1]+s*dir[1];
1877 if (r2>rout*rout)
return snxt;
1879 if (r2>=rin*rin)
return s;
1889 if (iact<3 && safe) {
1898 return TGeoConeSeg::DistFromOutsideS(point,dir,
fDz,
fRmin1,
fRmax1,
fRmin2,
fRmax2,
fC1,
fS1,
fC2,
fS2,
fCm,
fSm,
fCdfi);
1907 const Int_t numPoints = 4*
n;
1932 Error(
"Divide",
"division of a cone segment on R not implemented");
1936 if (dphi<0) dphi+=360.;
1943 vmulti->AddVolume(vol);
1945 for (
id=0;
id<ndiv;
id++) {
1955 for (
id=0;
id<ndiv;
id++) {
1962 shape =
new TGeoConeSeg(step/2, rmin1n, rmax1n, rmin2n, rmax2n, fPhi1,
fPhi2);
1964 vmulti->AddVolume(vol);
1971 Error(
"Divide",
"Wrong axis type for division");
2006 param[0] *= param[0];
2008 param[1] *= param[1];
2011 while (param[3]<param[2]) param[3]+=360.;
2022 Error(
"GetMakeRuntimeShape",
"invalid mother");
2025 Double_t rmin1, rmax1, rmin2, rmax2, dz;
2033 rmin1 = ((
TGeoCone*)mother)->GetRmin1();
2035 rmax1 = ((
TGeoCone*)mother)->GetRmax1();
2037 rmin2 = ((
TGeoCone*)mother)->GetRmin2();
2039 rmax2 = ((
TGeoCone*)mother)->GetRmax2();
2049 printf(
"*** Shape %s: TGeoConeSeg ***\n",
GetName());
2050 printf(
" dz = %11.5f\n",
fDz);
2051 printf(
" Rmin1 = %11.5f\n",
fRmin1);
2052 printf(
" Rmax1 = %11.5f\n",
fRmax1);
2053 printf(
" Rmin2 = %11.5f\n",
fRmin2);
2054 printf(
" Rmax2 = %11.5f\n",
fRmax2);
2055 printf(
" phi1 = %11.5f\n",
fPhi1);
2056 printf(
" phi2 = %11.5f\n",
fPhi2);
2057 printf(
" Bounding box:\n");
2069 Int_t nbSegs = 2*nbPnts;
2070 Int_t nbPols = nbPnts-2;
2095 for (i = 0; i < 4; i++) {
2096 for (j = 1; j <
n; j++) {
2097 buffer.
fSegs[(i*n+j-1)*3 ] = c;
2098 buffer.
fSegs[(i*n+j-1)*3+1] = i*n+j-1;
2099 buffer.
fSegs[(i*n+j-1)*3+2] = i*n+j;
2102 for (i = 4; i < 6; i++) {
2103 for (j = 0; j <
n; j++) {
2104 buffer.
fSegs[(i*n+j)*3 ] = c+1;
2105 buffer.
fSegs[(i*n+j)*3+1] = (i-4)*n+j;
2106 buffer.
fSegs[(i*n+j)*3+2] = (i-2)*n+j;
2109 for (i = 6; i < 8; i++) {
2110 for (j = 0; j <
n; j++) {
2111 buffer.
fSegs[(i*n+j)*3 ] = c;
2112 buffer.
fSegs[(i*n+j)*3+1] = 2*(i-6)*n+j;
2113 buffer.
fSegs[(i*n+j)*3+2] = (2*(i-6)+1)*n+j;
2120 for (j = 0; j < n-1; j++) {
2121 buffer.
fPols[indx++] = c;
2122 buffer.
fPols[indx++] = 4;
2123 buffer.
fPols[indx++] = (4+i)*n+j+1;
2124 buffer.
fPols[indx++] = (2+i)*n+j;
2125 buffer.
fPols[indx++] = (4+i)*n+j;
2126 buffer.
fPols[indx++] = i*n+j;
2129 for (j = 0; j < n-1; j++) {
2130 buffer.
fPols[indx++] = c;
2131 buffer.
fPols[indx++] = 4;
2132 buffer.
fPols[indx++] = i*n+j;
2133 buffer.
fPols[indx++] = (4+i)*n+j;
2134 buffer.
fPols[indx++] = (2+i)*n+j;
2135 buffer.
fPols[indx++] = (4+i)*n+j+1;
2138 for (j = 0; j < n-1; j++) {
2139 buffer.
fPols[indx++] = c+i;
2140 buffer.
fPols[indx++] = 4;
2141 buffer.
fPols[indx++] = (i-2)*2*n+j;
2142 buffer.
fPols[indx++] = (4+i)*n+j;
2143 buffer.
fPols[indx++] = ((i-2)*2+1)*n+j;
2144 buffer.
fPols[indx++] = (4+i)*n+j+1;
2147 for (j = 0; j < n-1; j++) {
2148 buffer.
fPols[indx++] = c+i;
2149 buffer.
fPols[indx++] = 4;
2150 buffer.
fPols[indx++] = (4+i)*n+j+1;
2151 buffer.
fPols[indx++] = ((i-2)*2+1)*n+j;
2152 buffer.
fPols[indx++] = (4+i)*n+j;
2153 buffer.
fPols[indx++] = (i-2)*2*n+j;
2155 buffer.
fPols[indx++] = c+2;
2156 buffer.
fPols[indx++] = 4;
2157 buffer.
fPols[indx++] = 6*
n;
2158 buffer.
fPols[indx++] = 4*
n;
2159 buffer.
fPols[indx++] = 7*
n;
2160 buffer.
fPols[indx++] = 5*
n;
2161 buffer.
fPols[indx++] = c+2;
2162 buffer.
fPols[indx++] = 4;
2163 buffer.
fPols[indx++] = 6*n-1;
2164 buffer.
fPols[indx++] = 8*n-1;
2165 buffer.
fPols[indx++] = 5*n-1;
2166 buffer.
fPols[indx++] = 7*n-1;
2179 if (safe>1.E10)
return safphi;
2190 if ((phi2-phi1)>=360.)
return safe;
2193 if (safe>1.E10)
return safphi;
2203 out <<
" // Shape: " <<
GetName() <<
" type: " <<
ClassName() << std::endl;
2204 out <<
" dz = " <<
fDz <<
";" << std::endl;
2205 out <<
" rmin1 = " <<
fRmin1 <<
";" << std::endl;
2206 out <<
" rmax1 = " <<
fRmax1 <<
";" << std::endl;
2207 out <<
" rmin2 = " <<
fRmin2 <<
";" << std::endl;
2208 out <<
" rmax2 = " <<
fRmax2 <<
";" << std::endl;
2209 out <<
" phi1 = " <<
fPhi1 <<
";" << std::endl;
2210 out <<
" phi2 = " <<
fPhi2 <<
";" << std::endl;
2211 out <<
" TGeoShape *" <<
GetPointerName() <<
" = new TGeoConeSeg(\"" <<
GetName() <<
"\", dz,rmin1,rmax1,rmin2,rmax2,phi1,phi2);" << std::endl;
2255 Float_t dphi,phi,phi1, phi2,dz;
2262 dphi = (phi2-phi1)/(n-1);
2267 for (j = 0; j <
n; j++) {
2271 points[indx++] = -dz;
2273 for (j = 0; j <
n; j++) {
2277 points[indx++] = -dz;
2279 for (j = 0; j <
n; j++) {
2283 points[indx++] = dz;
2285 for (j = 0; j <
n; j++) {
2289 points[indx++] = dz;
2300 Float_t dphi,phi,phi1, phi2,dz;
2307 dphi = (phi2-phi1)/(n-1);
2312 for (j = 0; j <
n; j++) {
2316 points[indx++] = -dz;
2318 for (j = 0; j <
n; j++) {
2322 points[indx++] = -dz;
2324 for (j = 0; j <
n; j++) {
2328 points[indx++] = dz;
2330 for (j = 0; j <
n; j++) {
2334 points[indx++] = dz;
2356 Int_t numPoints = n*4;
2379 Int_t nbSegs = 2*nbPnts;
2380 Int_t nbPols = nbPnts-2;
2381 if (buffer.
SetRawSizes(nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, nbPols, 6*nbPols)) {
2405 if (npoints > (npoints/2)*2) {
2406 Error(
"GetPointsOnSegments",
"Npoints must be even number");
2413 Int_t ntop = npoints/2 - nc*(nc-1);
2421 for (
Int_t i=0; i<nc; i++) {
2424 dphi = (
fPhi2-
fPhi1)*TMath::DegToRad()/(nphi-1);
2430 for (
Int_t j=0; j<nphi; j++) {
2431 phi = phi1 + j*dphi;
2450 for (
Int_t i=0; i<vecsize; i++) inside[i] =
Contains(&points[3*i]);
2460 for (
Int_t i=0; i<vecsize; i++)
ComputeNormal(&points[3*i], &dirs[3*i], &norms[3*i]);
2468 for (
Int_t i=0; i<vecsize; i++) dists[i] =
DistFromInside(&points[3*i], &dirs[3*i], 3, step[i]);
2476 for (
Int_t i=0; i<vecsize; i++) dists[i] =
DistFromOutside(&points[3*i], &dirs[3*i], 3, step[i]);
2486 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 void GetBoundingCylinder(Double_t *param) const
— Fill vector param[4] with the bounding cylinder parameters.
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 Double_t Capacity() const
Computes capacity of the shape in [length^3].
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 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.
Long64_t LocMax(Long64_t n, const T *a)
void SetFinder(TGeoPatternFinder *finder)
static Double_t DistFromOutsideS(const Double_t *point, const Double_t *dir, Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2, Double_t c1, Double_t s1, Double_t c2, Double_t s2, Double_t cm, Double_t sm, Double_t cdfi)
compute distance from outside point to surface of arbitrary tube
void AddNodeOffset(TGeoVolume *vol, Int_t copy_no, Double_t offset=0, Option_t *option="")
Add a division node to the list of nodes.
Geometrical transformation package.
constexpr Double_t TwoPi()
virtual void ComputeBBox()
compute bounding box of the tube segment
Bool_t TestBit(UInt_t f) const
virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const
Get range of shape for a given axis.
virtual Int_t GetNmeshVertices() const
Return number of vertices of the mesh representation.
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
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 Sizeof3D() const
Fill size of this 3-D object.
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 Int_t GetNmeshVertices() const
Return number of vertices of the mesh representation.
virtual void InspectShape() const
print shape parameters
virtual void SetPoints(Double_t *points) const
Create cone mesh points.
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...
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 SetSegsAndPols(TBuffer3D &buffer) const
Fill TBuffer3D structure for segments and polygons.
virtual void InspectShape() const
Prints shape parameters.
TObject * At(Int_t idx) const
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 Double_t Capacity() const
Computes capacity of the shape in [length^3].
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
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))
Int_t GetNdaughters() const
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.
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 Bool_t Contains(const Double_t *point) const
test if point is inside this 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, Double_t phi1, Double_t phi2, Int_t skipz=0)
Static method to compute the closest distance from given point to this shape.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
A phi segment of a conical tube.
virtual void InspectShape() const
print shape parameters
TGeoConeSeg()
Default constructor.
constexpr Double_t DegToRad()
TGeoMedium * GetMedium() 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.
virtual void AfterStreamer()
Function called after streaming an object of this class.
TGeoCone()
Default constructor.
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.
Double_t ATan2(Double_t, Double_t)
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 Bool_t Contains(const Double_t *point) const
test if point is inside this cone
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 ...
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
void SetSectionsValid(UInt_t mask)
const char * GetPointerName() const
Provide a pointer name containing uid.
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)
Base finder class for patterns.
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 const char * GetName() const
Get the shape name.
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
compute closest distance from point px,py to each corner
Int_t GetNsegments() const
Get number of segments approximating circles.
Int_t ShapeDistancetoPrimitive(Int_t numpoints, Int_t px, Int_t py) const
Returns distance to shape primitive mesh.
Bool_t SectionsValid(UInt_t mask) const
Base abstract class for all shapes.
virtual void SetDimensions(Double_t *param)
Set dimensions of the cone segment from an array.
virtual TBuffer3D * MakeBuffer3D() const
Creates a TBuffer3D describing this shape.
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 :
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.
void TransformPoints(Double_t *points, UInt_t NbPoints) const
Tranform a set of points (LocalToMaster)
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
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 GetBoundingCylinder(Double_t *param) const
— Fill vector param[4] with the bounding cylinder parameters.
Generic 3D primitive description class.
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...
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.
virtual void SetSegsAndPols(TBuffer3D &buffer) const
Fill TBuffer3D structure for segments and polygons.
void SetDivIndex(Int_t index)
void SetBoxDimensions(Double_t dx, Double_t dy, Double_t dz, Double_t *origin=0)
Set parameters of the box.
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 void SetPoints(Double_t *points) const
Create cone segment mesh points.
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)
Compute normal to closest surface from POINT.
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
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.
R__EXTERN TGeoManager * gGeoManager
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.
Bool_t TestShapeBit(UInt_t f) const
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
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 Int_t DistancetoPrimitive(Int_t px, Int_t py)
compute closest distance from point px,py to each corner
virtual TBuffer3D * MakeBuffer3D() const
Creates a TBuffer3D describing this shape.
Node containing an offset.
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 const char * GetAxisName(Int_t iaxis) const
Returns name of axis IAXIS.
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.
you should not use this method at all Int_t Int_t z
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 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 SetConeDimensions(Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2)
Set cone dimensions.
constexpr Double_t RadToDeg()
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 GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const
Get range of shape for a given axis.
Short_t Max(Short_t a, Short_t b)
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
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.
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
Double_t fCdfi
cos(0.5*(phi1+phi2))
virtual const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
Fills a static 3D buffer and returns a reference.
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 Sqrt(Double_t x)
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
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...
Long64_t LocMin(Long64_t n, const T *a)
Double_t fCm
sin(0.5*(phi1+phi2))
double norm(double *x, double *p)
Int_t GetBasicColor() const
Get the basic color (0-7).
unsigned int r2[N_CITIES]
virtual void Sizeof3D() const
Fill size of this 3-D object.
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 Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
Fills a static 3D buffer and returns a reference.
const char * Data() const