153 Double_t r1min, r1max, r2min, r2max, rmin, rmax;
183 if (ddp<0) ddp+= 360;
184 if (ddp>360) ddp-=360;
185 if (ddp<=dp)
xmax = rmax;
187 if (ddp<0) ddp+= 360;
188 if (ddp>360) ddp-=360;
189 if (ddp<=dp)
ymax = rmax;
191 if (ddp<0) ddp+= 360;
192 if (ddp>360) ddp-=360;
193 if (ddp<=dp)
xmin = -rmax;
195 if (ddp<0) ddp+= 360;
196 if (ddp>360) ddp-=360;
197 if (ddp<=dp)
ymin = -rmax;
219 Double_t rxy2 = point[0]*point[0]+point[1]*point[1];
220 Double_t r2 = rxy2+point[2]*point[2];
223 if (
r<=1E-20) rzero=
kTRUE;
264 if (norm[0]*dir[0]+norm[1]*dir[1]+norm[2]*dir[2]<0) {
284 Double_t r2 = point[0]*point[0]+point[1]*point[1]+point[2]*point[2];
300 if (r2*ddp*ddp < tol*tol)
return 3;
302 if (r2*ddp*ddp < tol*tol)
return 4;
312 if (
r*ddt < tol)
return 5;
316 if (
r*ddt < tol)
return 6;
327 Double_t r2 = point[0]*point[0]+point[1]*point[1]+point[2]*point[2];
332 if (r2<1E-20)
return kTRUE;
335 while (phi <
fPhi1) phi+=360.;
338 if (ddp > dphi)
return kFALSE;
355 Double_t r2=point[0]*point[0]+point[1]*point[1]+point[2]*point[2];
358 if (r2<1E-20)
return kTRUE;
362 if (phi < 0 ) phi+=360.;
364 if (dphi < 0) dphi+=360.;
366 if (ddp < 0) ddp += 360.;
367 if (ddp > dphi)
return kFALSE;
385 const Int_t numPoints = 2*
n*nz;
399 Double_t rxy2 = point[0]*point[0]+point[1]*point[1];
401 r2 = rxy2+point[2]*point[2];
414 if (phi<0) phi+=360.;
416 if (iact<3 && safe) {
430 if (dph1<0) dph1+=360.;
433 if (dph2<0) dph2+=360.;
443 Double_t rdotn = point[0]*dir[0]+point[1]*dir[1]+point[2]*dir[2];
456 if (inrmax && inrmin) {
473 if (snxt<1E20)
return snxt;
478 if (snxt<1E20)
return snxt;
488 Double_t b,delta,xnew,ynew,znew, phi0, ddp;
496 if (point[2]*dir[2]<0) {
497 snxt = -point[2]/dir[2];
498 ptnew[0] = point[0]+snxt*dir[0];
499 ptnew[1] = point[1]+snxt*dir[1];
521 ptnew[2] = point[2]-0.5*(z1+z2);
523 Double_t rin = 0.5*(r1+r2+(r2-r1)*ptnew[2]*zinv);
528 if (delta<0) skip =
kTRUE;
532 Double_t ddotn = ptnew[0]*dir[0]+ptnew[1]*dir[1]+0.5*(r1-r2)*dir[2]*zinv*
TMath::Sqrt(rxy2);
533 if (sigz*ddotn>=0 || -
b+delta<1.E-9) skip =
kTRUE;
537 znew = ptnew[2]+snxt*dir[2];
541 xnew = ptnew[0]+snxt*dir[0];
542 ynew = ptnew[1]+snxt*dir[1];
545 while (ddp<0) ddp+=360.;
550 if (!skip && st1>1E10) {
552 znew = ptnew[2]+snxt*dir[2];
556 xnew = ptnew[0]+snxt*dir[0];
557 ynew = ptnew[1]+snxt*dir[1];
560 while (ddp<0) ddp+=360.;
572 if (point[2]*dir[2]<0) {
573 snxt = -point[2]/dir[2];
574 ptnew[0] = point[0]+snxt*dir[0];
575 ptnew[1] = point[1]+snxt*dir[1];
597 ptnew[2] = point[2]-0.5*(z1+z2);
599 Double_t rin = 0.5*(r1+r2+(r2-r1)*ptnew[2]*zinv);
604 if (delta<0) skip =
kTRUE;
608 Double_t ddotn = ptnew[0]*dir[0]+ptnew[1]*dir[1]+0.5*(r1-r2)*dir[2]*zinv*
TMath::Sqrt(rxy2);
609 if (sigz*ddotn<=0 || -
b+delta<1.E-9) skip =
kTRUE;
613 znew = ptnew[2]+snxt*dir[2];
617 xnew = ptnew[0]+snxt*dir[0];
618 ynew = ptnew[1]+snxt*dir[1];
621 while (ddp<0) ddp+=360.;
626 if (!skip && st2>1E10) {
628 znew = ptnew[2]+snxt*dir[2];
632 xnew = ptnew[0]+snxt*dir[0];
633 ynew = ptnew[1]+snxt*dir[1];
636 while (ddp<0) ddp+=360.;
660 safety = point[0]*
s1-point[1]*
c1;
662 un = dir[0]*
s1-dir[1]*
c1;
665 ptnew[0] = point[0]+s*dir[0];
666 ptnew[1] = point[1]+s*dir[1];
667 ptnew[2] = point[2]+s*dir[2];
668 if ((ptnew[1]*cm-ptnew[0]*sm)<=0) {
674 safety = -point[0]*s2+point[1]*
c2;
676 un = -dir[0]*s2+dir[1]*
c2;
679 ptnew[0] = point[0]+s*dir[0];
680 ptnew[1] = point[1]+s*dir[1];
681 ptnew[2] = point[2]+s*dir[2];
682 if ((ptnew[1]*cm-ptnew[0]*sm)>=0) {
698 Double_t rxy2 = point[0]*point[0]+point[1]*point[1];
700 Double_t rad2 = rxy2+point[2]*point[2];
703 if (
r<=1E-20) rzero=
kTRUE;
713 if (phi<0) phi+=360.;
715 if (iact<3 && safe) {
729 if (dph1<0) dph1+=360.;
732 if (dph2<0) dph2+=360.;
746 Double_t b,delta, xnew,ynew,znew, phi0, ddp;
747 Double_t rdotn = point[0]*dir[0]+point[1]*dir[1]+point[2]*dir[2];
753 if (rdotn<0)
return 0.0;
761 if (rdotn>=0)
return 0.0;
771 if (point[2]*dir[2]<0) sn1 = -point[2]/dir[2];
791 ptnew[2] = point[2]-0.5*(z1+z2);
793 Double_t rin = 0.5*(r1+r2+(r2-r1)*ptnew[2]*zinv);
797 Double_t ddotn = ptnew[0]*dir[0]+ptnew[1]*dir[1]+0.5*(r1-r2)*dir[2]*zinv*
TMath::Sqrt(rxy2);
798 if (sigz*ddotn<=0)
return 0.0;
803 znew = ptnew[2]+snxt*dir[2];
807 xnew = ptnew[0]+snxt*dir[0];
808 ynew = ptnew[1]+snxt*dir[1];
811 while (ddp<0) ddp+=360.;
817 znew = ptnew[2]+snxt*dir[2];
821 xnew = ptnew[0]+snxt*dir[0];
822 ynew = ptnew[1]+snxt*dir[1];
825 while (ddp<0) ddp+=360.;
836 if (point[2]*dir[2]<0) sn1 = -point[2]/dir[2];
856 ptnew[2] = point[2]-0.5*(z1+z2);
858 Double_t rin = 0.5*(r1+r2+(r2-r1)*ptnew[2]*zinv);
862 Double_t ddotn = ptnew[0]*dir[0]+ptnew[1]*dir[1]+0.5*(r1-r2)*dir[2]*zinv*
TMath::Sqrt(rxy2);
863 if (sigz*ddotn>=0)
return 0.0;
868 znew = ptnew[2]+snxt*dir[2];
872 xnew = ptnew[0]+snxt*dir[0];
873 ynew = ptnew[1]+snxt*dir[1];
876 while (ddp<0) ddp+=360.;
882 znew = ptnew[2]+snxt*dir[2];
886 xnew = ptnew[0]+snxt*dir[0];
887 ynew = ptnew[1]+snxt*dir[1];
890 while (ddp<0) ddp+=360.;
924 Double_t r2 = point[0]*point[0]+point[1]*point[1]+point[2]*point[2];
925 Double_t b = point[0]*dir[0]+point[1]*dir[1]+point[2]*dir[2];
938 s = (firstcross)?(-
b-
d):(-
b+
d);
941 if (!check)
return s;
942 for (i=0; i<3; i++)
pt[i]=point[i]+s*dir[i];
966 for (
id=0;
id<ndiv;
id++) {
984 for (
id=0;
id<ndiv;
id++) {
994 for (
id=0;
id<ndiv;
id++) {
1004 Error(
"Divide",
"In shape %s wrong axis type for division",
GetName());
1067 param[0] =
fRmin*smin;
1068 param[0] *= param[0];
1070 param[1] =
fRmax*smax;
1071 param[1] *= param[1];
1078 while (param[3]<param[2]) param[3]+=360.;
1086 printf(
"*** Shape %s: TGeoSphere ***\n",
GetName());
1087 printf(
" Rmin = %11.5f\n",
fRmin);
1088 printf(
" Rmax = %11.5f\n",
fRmax);
1089 printf(
" Th1 = %11.5f\n",
fTheta1);
1090 printf(
" Th2 = %11.5f\n",
fTheta2);
1091 printf(
" Ph1 = %11.5f\n",
fPhi1);
1092 printf(
" Ph2 = %11.5f\n",
fPhi2);
1093 printf(
" Bounding box:\n");
1115 Int_t nbPnts = nlat*nlong+nup+ndown+ncenter;
1118 Int_t nbSegs = nlat*
fNseg + (nlat-1+nup+ndown)*nlong;
1121 nbSegs += nlong * (2-nup - ndown);
1126 nbPols += (2-nup-ndown)*
fNseg;
1129 nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, nbPols, 6*nbPols);
1157 Int_t nbPnts = nlat*nlong+nup+ndown+ncenter;
1160 Int_t nbSegs = nlat*
fNseg + (nlat-1+nup+ndown)*nlong;
1163 nbSegs += nlong * (2-nup - ndown);
1168 nbPols += (2-nup-ndown)*
fNseg;
1178 for (i=0; i<nlat; i++) {
1179 for (j=0; j<
fNseg; j++) {
1181 buff.
fSegs[indx++] = i*nlong+j;
1182 buff.
fSegs[indx++] = i*nlong+(j+1)%nlong;
1188 for (i=0; i<nlat-1; i++) {
1189 for (j=0; j<nlong; j++) {
1191 buff.
fSegs[indx++] = i*nlong+j;
1192 buff.
fSegs[indx++] = (i+1)*nlong+j;
1195 Int_t indup = indlong + (nlat-1)*nlong;
1199 Int_t indpup = nlat*nlong;
1200 for (j=0; j<nlong; j++) {
1202 buff.
fSegs[indx++] = j;
1203 buff.
fSegs[indx++] = indpup;
1206 Int_t inddown = indup + nup*nlong;
1210 Int_t indpdown = nlat*nlong+nup;
1211 for (j=0; j<nlong; j++) {
1213 buff.
fSegs[indx++] = (nlat-1)*nlong+j;
1214 buff.
fSegs[indx++] = indpdown;
1217 Int_t indparin = inddown + ndown*nlong;
1218 Int_t indlongin = indparin;
1219 Int_t indupin = indparin;
1220 Int_t inddownin = indparin;
1221 Int_t indphi = indparin;
1223 Int_t indptin = nlat*nlong + nup + ndown;
1224 Int_t iptcenter = indptin;
1227 indlongin = indparin + nlat*
fNseg;
1228 indupin = indlongin + (nlat-1)*nlong;
1229 inddownin = indupin + nup*nlong;
1232 for (i=0; i<nlat; i++) {
1233 for (j=0; j<
fNseg; j++) {
1234 buff.
fSegs[indx++] =
c+1;
1235 buff.
fSegs[indx++] = indptin + i*nlong+j;
1236 buff.
fSegs[indx++] = indptin + i*nlong+(j+1)%nlong;
1241 for (i=0; i<nlat-1; i++) {
1242 for (j=0; j<nlong; j++) {
1243 buff.
fSegs[indx++] =
c+1;
1244 buff.
fSegs[indx++] = indptin + i*nlong+j;
1245 buff.
fSegs[indx++] = indptin + (i+1)*nlong+j;
1251 Int_t indupltop = indptin + nlat*nlong;
1252 for (j=0; j<nlong; j++) {
1253 buff.
fSegs[indx++] =
c+1;
1254 buff.
fSegs[indx++] = indptin + j;
1255 buff.
fSegs[indx++] = indupltop;
1261 Int_t indpdown = indptin + nlat*nlong+nup;
1262 for (j=0; j<nlong; j++) {
1263 buff.
fSegs[indx++] =
c+1;
1264 buff.
fSegs[indx++] = indptin + (nlat-1)*nlong+j;
1265 buff.
fSegs[indx++] = indpdown;
1268 indphi = inddownin + ndown*nlong;
1270 Int_t indtheta = indphi;
1273 indtheta += 2*nlat + nup + ndown;
1274 for (j=0; j<nlat; j++) {
1275 buff.
fSegs[indx++] =
c+2;
1276 buff.
fSegs[indx++] = j*nlong;
1278 else buff.
fSegs[indx++] = iptcenter;
1280 for (j=0; j<nlat; j++) {
1281 buff.
fSegs[indx++] =
c+2;
1282 buff.
fSegs[indx++] = (j+1)*nlong-1;
1284 else buff.
fSegs[indx++] = iptcenter;
1287 buff.
fSegs[indx++] =
c+2;
1288 buff.
fSegs[indx++] = nlat*nlong;
1290 else buff.
fSegs[indx++] = iptcenter;
1293 buff.
fSegs[indx++] =
c+2;
1294 buff.
fSegs[indx++] = nlat*nlong+nup;
1296 else buff.
fSegs[indx++] = iptcenter;
1301 for (j=0; j<nlong; j++) {
1302 buff.
fSegs[indx++] =
c+2;
1303 buff.
fSegs[indx++] = j;
1305 else buff.
fSegs[indx++] = iptcenter;
1309 for (j=0; j<nlong; j++) {
1310 buff.
fSegs[indx++] =
c+2;
1311 buff.
fSegs[indx++] = (nlat-1)*nlong + j;
1313 else buff.
fSegs[indx++] = iptcenter;
1319 for (i=0; i<nlat-1; i++) {
1320 for (j=0; j<
fNseg; j++) {
1322 buff.
fPols[indx++] = 4;
1324 buff.
fPols[indx++] = indlong+i*nlong+(j+1)%nlong;
1326 buff.
fPols[indx++] = indlong+i*nlong+j;
1331 for (j=0; j<
fNseg; j++) {
1333 buff.
fPols[indx++] = 3;
1334 buff.
fPols[indx++] = indup + j;
1335 buff.
fPols[indx++] = indup + (j+1)%nlong;
1336 buff.
fPols[indx++] = indpar + j;
1341 for (j=0; j<
fNseg; j++) {
1343 buff.
fPols[indx++] = 3;
1344 buff.
fPols[indx++] = inddown + j;
1345 buff.
fPols[indx++] = indpar + (nlat-1)*
fNseg + j;
1346 buff.
fPols[indx++] = inddown + (j+1)%nlong;
1352 for (i=0; i<nlat-1; i++) {
1353 for (j=0; j<
fNseg; j++) {
1354 buff.
fPols[indx++] =
c+1;
1355 buff.
fPols[indx++] = 4;
1357 buff.
fPols[indx++] = indlongin+i*nlong+j;
1359 buff.
fPols[indx++] = indlongin+i*nlong+(j+1)%nlong;
1364 for (j=0; j<
fNseg; j++) {
1365 buff.
fPols[indx++] =
c+1;
1366 buff.
fPols[indx++] = 3;
1367 buff.
fPols[indx++] = indupin + j;
1368 buff.
fPols[indx++] = indparin + j;
1369 buff.
fPols[indx++] = indupin + (j+1)%nlong;
1374 for (j=0; j<
fNseg; j++) {
1375 buff.
fPols[indx++] =
c+1;
1376 buff.
fPols[indx++] = 3;
1377 buff.
fPols[indx++] = inddownin + j;
1378 buff.
fPols[indx++] = inddownin + (j+1)%nlong;
1379 buff.
fPols[indx++] = indparin + (nlat-1)*
fNseg + j;
1385 for (i=0; i<nlat-1; i++) {
1386 buff.
fPols[indx++] =
c+2;
1388 buff.
fPols[indx++] = 4;
1389 buff.
fPols[indx++] = indlong + i*nlong;
1390 buff.
fPols[indx++] = indphi + i + 1;
1391 buff.
fPols[indx++] = indlongin + i*nlong;
1392 buff.
fPols[indx++] = indphi + i;
1394 buff.
fPols[indx++] = 3;
1395 buff.
fPols[indx++] = indlong + i*nlong;
1396 buff.
fPols[indx++] = indphi + i + 1;
1397 buff.
fPols[indx++] = indphi + i;
1400 for (i=0; i<nlat-1; i++) {
1401 buff.
fPols[indx++] =
c+2;
1403 buff.
fPols[indx++] = 4;
1404 buff.
fPols[indx++] = indlong + (i+1)*nlong-1;
1405 buff.
fPols[indx++] = indphi + nlat + i;
1406 buff.
fPols[indx++] = indlongin + (i+1)*nlong-1;
1407 buff.
fPols[indx++] = indphi + nlat + i + 1;
1409 buff.
fPols[indx++] = 3;
1410 buff.
fPols[indx++] = indlong + (i+1)*nlong-1;
1411 buff.
fPols[indx++] = indphi + nlat + i;
1412 buff.
fPols[indx++] = indphi + nlat + i + 1;
1416 buff.
fPols[indx++] =
c+2;
1418 buff.
fPols[indx++] = 4;
1419 buff.
fPols[indx++] = indup;
1420 buff.
fPols[indx++] = indphi;
1421 buff.
fPols[indx++] = indupin;
1422 buff.
fPols[indx++] = indphi + 2*nlat;
1424 buff.
fPols[indx++] = 3;
1425 buff.
fPols[indx++] = indup;
1426 buff.
fPols[indx++] = indphi;
1427 buff.
fPols[indx++] = indphi + 2*nlat;
1429 buff.
fPols[indx++] =
c+2;
1431 buff.
fPols[indx++] = 4;
1432 buff.
fPols[indx++] = indup+nlong-1;
1433 buff.
fPols[indx++] = indphi + 2*nlat;
1434 buff.
fPols[indx++] = indupin+nlong-1;
1435 buff.
fPols[indx++] = indphi + nlat;
1437 buff.
fPols[indx++] = 3;
1438 buff.
fPols[indx++] = indup+nlong-1;
1439 buff.
fPols[indx++] = indphi + 2*nlat;
1440 buff.
fPols[indx++] = indphi + nlat;
1444 buff.
fPols[indx++] =
c+2;
1446 buff.
fPols[indx++] = 4;
1447 buff.
fPols[indx++] = inddown;
1448 buff.
fPols[indx++] = indphi + 2*nlat + nup;
1449 buff.
fPols[indx++] = inddownin;
1450 buff.
fPols[indx++] = indphi + nlat-1;
1452 buff.
fPols[indx++] = 3;
1453 buff.
fPols[indx++] = inddown;
1454 buff.
fPols[indx++] = indphi + 2*nlat + nup;
1455 buff.
fPols[indx++] = indphi + nlat-1;
1457 buff.
fPols[indx++] =
c+2;
1459 buff.
fPols[indx++] = 4;
1460 buff.
fPols[indx++] = inddown+nlong-1;
1461 buff.
fPols[indx++] = indphi + 2*nlat-1;
1462 buff.
fPols[indx++] = inddownin+nlong-1;
1463 buff.
fPols[indx++] = indphi + 2*nlat+nup;
1465 buff.
fPols[indx++] = 3;
1466 buff.
fPols[indx++] = inddown+nlong-1;
1467 buff.
fPols[indx++] = indphi + 2*nlat-1;
1468 buff.
fPols[indx++] = indphi + 2*nlat+nup;
1474 for (j=0; j<
fNseg; j++) {
1475 buff.
fPols[indx++] =
c+2;
1477 buff.
fPols[indx++] = 4;
1478 buff.
fPols[indx++] = indpar+j;
1479 buff.
fPols[indx++] = indtheta + j;
1480 buff.
fPols[indx++] = indparin + j;
1481 buff.
fPols[indx++] = indtheta + (j+1)%nlong;
1483 buff.
fPols[indx++] = 3;
1484 buff.
fPols[indx++] = indpar+j;
1485 buff.
fPols[indx++] = indtheta + j;
1486 buff.
fPols[indx++] = indtheta + (j+1)%nlong;
1491 for (j=0; j<
fNseg; j++) {
1492 buff.
fPols[indx++] =
c+2;
1494 buff.
fPols[indx++] = 4;
1495 buff.
fPols[indx++] = indpar+(nlat-1)*
fNseg+j;
1496 buff.
fPols[indx++] = indtheta + (1-nup)*nlong +(j+1)%nlong;
1497 buff.
fPols[indx++] = indparin + (nlat-1)*
fNseg + j;
1498 buff.
fPols[indx++] = indtheta + (1-nup)*nlong + j;
1500 buff.
fPols[indx++] = 3;
1501 buff.
fPols[indx++] = indpar+(nlat-1)*
fNseg+j;
1502 buff.
fPols[indx++] = indtheta + (1-nup)*nlong +(j+1)%nlong;
1503 buff.
fPols[indx++] = indtheta + (1-nup)*nlong + j;
1515 Double_t r2 = point[0]*point[0]+point[1]*point[1]+point[2]*point[2];
1518 if (
r<=1E-20) rzero=
kTRUE;
1539 for (
Int_t i=0; i<4; i++) saf[i]=-saf[i];
1551 out <<
" // Shape: " <<
GetName() <<
" type: " <<
ClassName() << std::endl;
1552 out <<
" rmin = " <<
fRmin <<
";" << std::endl;
1553 out <<
" rmax = " <<
fRmax <<
";" << std::endl;
1554 out <<
" theta1 = " <<
fTheta1<<
";" << std::endl;
1555 out <<
" theta2 = " <<
fTheta2 <<
";" << std::endl;
1556 out <<
" phi1 = " <<
fPhi1 <<
";" << std::endl;
1557 out <<
" phi2 = " <<
fPhi2 <<
";" << std::endl;
1558 out <<
" TGeoShape *" <<
GetPointerName() <<
" = new TGeoSphere(\"" <<
GetName() <<
"\",rmin,rmax,theta1, theta2,phi1,phi2);" << std::endl;
1569 Error(
"SetDimensions",
"invalid parameters rmin/rmax");
1575 if (theta1 >= theta2 || theta1<0 || theta1>180 || theta2>180) {
1576 Error(
"SetDimensions",
"invalid parameters theta1/theta2");
1583 if (phi1<0)
fPhi1+=360.;
1600 if (nparam > 2) theta1 = param[2];
1601 if (nparam > 3) theta2 = param[3];
1602 if (nparam > 4) phi1 = param[4];
1603 if (nparam > 5) phi2 = param[5];
1623 if (dphi<0) dphi+=360;
1635 Error(
"SetPoints",
"Input array is NULL");
1666 for (i = 0; i < nlat; i++) {
1667 theta = theta1+(nup+i)*dtheta;
1671 for (j = 0; j < nlong; j++) {
1675 points[indx++] = zi * cphi;
1676 points[indx++] = zi * sphi;
1697 for (i = 0; i < nlat; i++) {
1698 theta = theta1+(nup+i)*dtheta;
1702 for (j = 0; j < nlong; j++) {
1706 points[indx++] = zi * cphi;
1707 points[indx++] = zi * sphi;
1740 Error(
"SetPoints",
"Input array is NULL");
1771 for (i = 0; i < nlat; i++) {
1772 theta = theta1+(nup+i)*dtheta;
1776 for (j = 0; j < nlong; j++) {
1780 points[indx++] = zi * cphi;
1781 points[indx++] = zi * sphi;
1802 for (i = 0; i < nlat; i++) {
1803 theta = theta1+(nup+i)*dtheta;
1807 for (j = 0; j < nlong; j++) {
1811 points[indx++] = zi * cphi;
1812 points[indx++] = zi * sphi;
1858 nvert = nlat*nlong+nup+ndown+ncenter;
1861 nsegs = nlat*
fNseg + (nlat-1+nup+ndown)*nlong;
1864 nsegs += nlong * (2-nup - ndown);
1869 npols += (2-nup-ndown)*
fNseg;
1891 Int_t numPoints = 0;
1893 else numPoints = nlat*nlong+nup+ndown+ncenter;
1939 Int_t nbPnts = nlat*nlong+nup+ndown+ncenter;
1942 Int_t nbSegs = nlat*
fNseg + (nlat-1+nup+ndown)*nlong;
1945 nbSegs += nlong * (2-nup - ndown);
1950 nbPols += (2-nup-ndown)*
fNseg;
1952 if (buffer.
SetRawSizes(nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, nbPols, 6*nbPols)) {
R__EXTERN TGeoManager * gGeoManager
Sphere description class - see TBuffer3DTypes for producer classes Supports hollow and cut spheres.
Generic 3D primitive description class.
Bool_t SectionsValid(UInt_t mask) const
void SetSectionsValid(UInt_t mask)
Bool_t SetRawSizes(UInt_t reqPnts, UInt_t reqPntsCapacity, UInt_t reqSegs, UInt_t reqSegsCapacity, UInt_t reqPols, UInt_t reqPolsCapacity)
Set kRaw tessellation section of buffer with supplied sizes.
virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=0) const
Compute distance from outside point to surface of the box.
virtual void InspectShape() const
Prints shape parameters.
virtual void FillBuffer3D(TBuffer3D &buffer, Int_t reqSections, Bool_t localFrame) const
Fills the supplied buffer, with sections in desired frame See TBuffer3D.h for explanation of sections...
void SetBoxDimensions(Double_t dx, Double_t dy, Double_t dz, Double_t *origin=0)
Set parameters of the box.
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 :
TGeoVolumeMulti * MakeVolumeMulti(const char *name, TGeoMedium *medium)
Make a TGeoVolumeMulti handling a list of volumes.
Int_t GetNsegments() const
Get number of segments approximating circles.
Node containing an offset.
Base finder class for patterns.
void SetDivIndex(Int_t index)
Base abstract class for all shapes.
Int_t GetBasicColor() const
Get the basic color (0-7).
void TransformPoints(Double_t *points, UInt_t NbPoints) const
Tranform a set of points (LocalToMaster)
void SetShapeBit(UInt_t f, Bool_t set)
Equivalent of TObject::SetBit.
static Double_t DistToPhiMin(const Double_t *point, const Double_t *dir, Double_t s1, Double_t c1, Double_t s2, Double_t c2, Double_t sm, Double_t cm, Bool_t in=kTRUE)
compute distance from point (inside phi) to both phi planes. Return minimum.
static Double_t SafetyPhi(const Double_t *point, Bool_t in, Double_t phi1, Double_t phi2)
Static method to compute safety w.r.t a phi corner defined by cosines/sines of the angles phi1,...
static Bool_t IsSameWithinTolerance(Double_t a, Double_t b)
Check if two numbers differ with less than a tolerance.
const char * GetPointerName() const
Provide a pointer name containing uid.
Int_t ShapeDistancetoPrimitive(Int_t numpoints, Int_t px, Int_t py) const
Returns distance to shape primitive mesh.
virtual const char * GetName() const
Get the shape name.
static void NormalPhi(const Double_t *point, const Double_t *dir, Double_t *norm, Double_t c1, Double_t s1, Double_t c2, Double_t s2)
Static method to compute normal to phi planes.
static Double_t Tolerance()
static Bool_t IsCloseToPhi(Double_t epsil, const Double_t *point, Double_t c1, Double_t s1, Double_t c2, Double_t s2)
True if point is closer than epsil to one of the phi planes defined by c1,s1 or c2,...
Bool_t TestShapeBit(UInt_t f) const
virtual ~TGeoSphere()
destructor
Double_t DistToSphere(const Double_t *point, const Double_t *dir, Double_t rsph, Bool_t check=kTRUE, Bool_t firstcross=kTRUE) const
compute distance to sphere of radius rsph. Direction has to be a unit vector
virtual TBuffer3D * MakeBuffer3D() const
Creates a TBuffer3D describing this shape.
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 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 sphere Check if the bounding box is crossed wit...
virtual void SetDimensions(Double_t *param)
Set dimensions of the spherical segment starting from a list of parameters.
virtual void InspectShape() const
print shape parameters
void SetSphDimensions(Double_t rmin, Double_t rmax, Double_t theta1, Double_t theta2, Double_t phi1, Double_t phi2)
Set spherical segment dimensions.
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 ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)
Compute normal to closest surface from POINT.
virtual void ComputeBBox()
compute bounding box of the sphere
TGeoSphere()
Default constructor.
virtual const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
Fills a static 3D buffer and returns a reference.
Bool_t IsPointInside(const Double_t *point, Bool_t checkR=kTRUE, Bool_t checkTh=kTRUE, Bool_t checkPh=kTRUE) const
Check if a point is inside radius/theta/phi ranges for the spherical sector.
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 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 void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
virtual void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const
Compute distance from array of input points having directions specified by dirs. Store output in dist...
virtual void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize)
Compute the normal for an array o points so that norm.dot.dir is positive Input: Arrays of point coor...
virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const
Get range of shape for a given axis.
virtual void SetNumberOfDivisions(Int_t p)
Set the number of divisions of mesh circles keeping aspect ratio.
virtual void Sizeof3D() const
virtual void SetSegsAndPols(TBuffer3D &buff) const
Fill TBuffer3D structure for segments and polygons.
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 sphere
virtual TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step)
Divide this box shape belonging to volume "voldiv" into ndiv equal volumes called divname,...
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 const char * GetAxisName(Int_t iaxis) const
Returns name of axis IAXIS.
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 Bool_t Contains(const Double_t *point) const
test if point is inside this sphere check Rmin<=R<=Rmax
virtual void SetPoints(Double_t *points) const
create sphere mesh points
Int_t IsOnBoundary(const Double_t *point) const
Check if a point in local sphere coordinates is close to a boundary within shape tolerance.
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
compute closest distance from point px,py to each corner
virtual void GetBoundingCylinder(Double_t *param) const
Fill vector param[4] with the bounding cylinder parameters.
void AddVolume(TGeoVolume *vol)
Add a volume with valid shape to the list of volumes.
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
void AddNodeOffset(TGeoVolume *vol, Int_t copy_no, Double_t offset=0, Option_t *option="")
Add a division node to the list of nodes.
TGeoMedium * GetMedium() const
void SetFinder(TGeoPatternFinder *finder)
Int_t GetNdaughters() const
TObject * At(Int_t idx) const
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual const char * ClassName() const
Returns name of class to which the object belongs.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
const char * Data() const
Long64_t LocMin(Long64_t n, const T *a)
Return index of array with the minimum element.
Short_t Max(Short_t a, Short_t b)
Double_t ATan2(Double_t y, Double_t x)
Long64_t LocMax(Long64_t n, const T *a)
Return index of array with the maximum element.
constexpr Double_t DegToRad()
Conversion from degree to radian:
Double_t Sqrt(Double_t x)
Short_t Min(Short_t a, Short_t b)
constexpr Double_t RadToDeg()
Conversion from radian to degree:
#define snext(osub1, osub2)