160 Double_t r1min, r1max, r2min, r2max, rmin, rmax;
190 if (ddp<0) ddp+= 360;
191 if (ddp>360) ddp-=360;
192 if (ddp<=dp)
xmax = rmax;
194 if (ddp<0) ddp+= 360;
195 if (ddp>360) ddp-=360;
196 if (ddp<=dp)
ymax = rmax;
198 if (ddp<0) ddp+= 360;
199 if (ddp>360) ddp-=360;
200 if (ddp<=dp)
xmin = -rmax;
202 if (ddp<0) ddp+= 360;
203 if (ddp>360) ddp-=360;
204 if (ddp<=dp)
ymin = -rmax;
226 Double_t rxy2 = point[0]*point[0]+point[1]*point[1];
227 Double_t r2 = rxy2+point[2]*point[2];
230 if (
r<=1E-20) rzero=
kTRUE;
271 if (norm[0]*dir[0]+norm[1]*dir[1]+norm[2]*dir[2]<0) {
291 Double_t r2 = point[0]*point[0]+point[1]*point[1]+point[2]*point[2];
307 if (r2*ddp*ddp < tol*tol)
return 3;
309 if (r2*ddp*ddp < tol*tol)
return 4;
319 if (
r*ddt < tol)
return 5;
323 if (
r*ddt < tol)
return 6;
334 Double_t r2 = point[0]*point[0]+point[1]*point[1]+point[2]*point[2];
339 if (r2<1E-20)
return kTRUE;
342 while (phi <
fPhi1) phi+=360.;
345 if (ddp > dphi)
return kFALSE;
362 Double_t r2=point[0]*point[0]+point[1]*point[1]+point[2]*point[2];
365 if (r2<1E-20)
return kTRUE;
369 if (phi < 0 ) phi+=360.;
371 if (dphi < 0) dphi+=360.;
373 if (ddp < 0) ddp += 360.;
374 if (ddp > dphi)
return kFALSE;
392 const Int_t numPoints = 2*
n*nz;
406 Double_t rxy2 = point[0]*point[0]+point[1]*point[1];
408 r2 = rxy2+point[2]*point[2];
421 if (phi<0) phi+=360.;
423 if (iact<3 && safe) {
437 if (dph1<0) dph1+=360.;
440 if (dph2<0) dph2+=360.;
450 Double_t rdotn = point[0]*dir[0]+point[1]*dir[1]+point[2]*dir[2];
463 if (inrmax && inrmin) {
480 if (snxt<1E20)
return snxt;
485 if (snxt<1E20)
return snxt;
495 Double_t b,delta,xnew,ynew,znew, phi0, ddp;
503 if (point[2]*dir[2]<0) {
504 snxt = -point[2]/dir[2];
505 ptnew[0] = point[0]+snxt*dir[0];
506 ptnew[1] = point[1]+snxt*dir[1];
528 ptnew[2] = point[2]-0.5*(z1+z2);
530 Double_t rin = 0.5*(r1+r2+(r2-r1)*ptnew[2]*zinv);
535 if (delta<0) skip =
kTRUE;
539 Double_t ddotn = ptnew[0]*dir[0]+ptnew[1]*dir[1]+0.5*(r1-r2)*dir[2]*zinv*
TMath::Sqrt(rxy2);
540 if (sigz*ddotn>=0 || -
b+delta<1.E-9) skip =
kTRUE;
544 znew = ptnew[2]+snxt*dir[2];
548 xnew = ptnew[0]+snxt*dir[0];
549 ynew = ptnew[1]+snxt*dir[1];
552 while (ddp<0) ddp+=360.;
557 if (!skip && st1>1E10) {
559 znew = ptnew[2]+snxt*dir[2];
563 xnew = ptnew[0]+snxt*dir[0];
564 ynew = ptnew[1]+snxt*dir[1];
567 while (ddp<0) ddp+=360.;
579 if (point[2]*dir[2]<0) {
580 snxt = -point[2]/dir[2];
581 ptnew[0] = point[0]+snxt*dir[0];
582 ptnew[1] = point[1]+snxt*dir[1];
604 ptnew[2] = point[2]-0.5*(z1+z2);
606 Double_t rin = 0.5*(r1+r2+(r2-r1)*ptnew[2]*zinv);
611 if (delta<0) skip =
kTRUE;
615 Double_t ddotn = ptnew[0]*dir[0]+ptnew[1]*dir[1]+0.5*(r1-r2)*dir[2]*zinv*
TMath::Sqrt(rxy2);
616 if (sigz*ddotn<=0 || -
b+delta<1.E-9) skip =
kTRUE;
620 znew = ptnew[2]+snxt*dir[2];
624 xnew = ptnew[0]+snxt*dir[0];
625 ynew = ptnew[1]+snxt*dir[1];
628 while (ddp<0) ddp+=360.;
633 if (!skip && st2>1E10) {
635 znew = ptnew[2]+snxt*dir[2];
639 xnew = ptnew[0]+snxt*dir[0];
640 ynew = ptnew[1]+snxt*dir[1];
643 while (ddp<0) ddp+=360.;
665 safety = point[0]*
s1-point[1]*
c1;
667 un = dir[0]*
s1-dir[1]*
c1;
670 ptnew[0] = point[0]+s*dir[0];
671 ptnew[1] = point[1]+s*dir[1];
672 ptnew[2] = point[2]+s*dir[2];
673 if ((ptnew[1]*cm-ptnew[0]*sm)<=0) {
679 safety = -point[0]*s2+point[1]*
c2;
681 un = -dir[0]*s2+dir[1]*
c2;
684 ptnew[0] = point[0]+s*dir[0];
685 ptnew[1] = point[1]+s*dir[1];
686 ptnew[2] = point[2]+s*dir[2];
687 if ((ptnew[1]*cm-ptnew[0]*sm)>=0) {
703 Double_t rxy2 = point[0]*point[0]+point[1]*point[1];
705 Double_t rad2 = rxy2+point[2]*point[2];
708 if (
r<=1E-20) rzero=
kTRUE;
718 if (phi<0) phi+=360.;
720 if (iact<3 && safe) {
734 if (dph1<0) dph1+=360.;
737 if (dph2<0) dph2+=360.;
750 Double_t b,delta, xnew,ynew,znew, phi0, ddp;
751 Double_t rdotn = point[0]*dir[0]+point[1]*dir[1]+point[2]*dir[2];
757 if (rdotn<0)
return 0.0;
764 if (rdotn>=0)
return 0.0;
773 if (point[2]*dir[2]<0) sn1 = -point[2]/dir[2];
793 ptnew[2] = point[2]-0.5*(z1+z2);
795 Double_t rin = 0.5*(r1+r2+(r2-r1)*ptnew[2]*zinv);
799 Double_t ddotn = ptnew[0]*dir[0]+ptnew[1]*dir[1]+0.5*(r1-r2)*dir[2]*zinv*
TMath::Sqrt(rxy2);
800 if (sigz*ddotn<=0)
return 0.0;
805 znew = ptnew[2]+snxt*dir[2];
809 xnew = ptnew[0]+snxt*dir[0];
810 ynew = ptnew[1]+snxt*dir[1];
813 while (ddp<0) ddp+=360.;
819 znew = ptnew[2]+snxt*dir[2];
823 xnew = ptnew[0]+snxt*dir[0];
824 ynew = ptnew[1]+snxt*dir[1];
827 while (ddp<0) ddp+=360.;
838 if (point[2]*dir[2]<0) sn1 = -point[2]/dir[2];
858 ptnew[2] = point[2]-0.5*(z1+z2);
860 Double_t rin = 0.5*(r1+r2+(r2-r1)*ptnew[2]*zinv);
864 Double_t ddotn = ptnew[0]*dir[0]+ptnew[1]*dir[1]+0.5*(r1-r2)*dir[2]*zinv*
TMath::Sqrt(rxy2);
865 if (sigz*ddotn>=0)
return 0.0;
870 znew = ptnew[2]+snxt*dir[2];
874 xnew = ptnew[0]+snxt*dir[0];
875 ynew = ptnew[1]+snxt*dir[1];
878 while (ddp<0) ddp+=360.;
884 znew = ptnew[2]+snxt*dir[2];
888 xnew = ptnew[0]+snxt*dir[0];
889 ynew = ptnew[1]+snxt*dir[1];
892 while (ddp<0) ddp+=360.;
925 Double_t r2 = point[0]*point[0]+point[1]*point[1]+point[2]*point[2];
926 Double_t b = point[0]*dir[0]+point[1]*dir[1]+point[2]*dir[2];
940 s = (firstcross)?(-
b-
d):(-
b+
d);
943 if (!check)
return s;
944 for (i=0; i<3; i++)
pt[i]=point[i]+s*dir[i];
968 for (
id=0;
id<ndiv;
id++) {
986 for (
id=0;
id<ndiv;
id++) {
996 for (
id=0;
id<ndiv;
id++) {
1006 Error(
"Divide",
"In shape %s wrong axis type for division",
GetName());
1069 param[0] =
fRmin*smin;
1070 param[0] *= param[0];
1072 param[1] =
fRmax*smax;
1073 param[1] *= param[1];
1080 while (param[3]<param[2]) param[3]+=360.;
1088 printf(
"*** Shape %s: TGeoSphere ***\n",
GetName());
1089 printf(
" Rmin = %11.5f\n",
fRmin);
1090 printf(
" Rmax = %11.5f\n",
fRmax);
1091 printf(
" Th1 = %11.5f\n",
fTheta1);
1092 printf(
" Th2 = %11.5f\n",
fTheta2);
1093 printf(
" Ph1 = %11.5f\n",
fPhi1);
1094 printf(
" Ph2 = %11.5f\n",
fPhi2);
1095 printf(
" Bounding box:\n");
1117 Int_t nbPnts = nlat*nlong+nup+ndown+ncenter;
1120 Int_t nbSegs = nlat*
fNseg + (nlat-1+nup+ndown)*nlong;
1123 nbSegs += nlong * (2-nup - ndown);
1128 nbPols += (2-nup-ndown)*
fNseg;
1131 nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, nbPols, 6*nbPols);
1180 for (i=0; i<nlat; i++) {
1181 for (j=0; j<
fNseg; j++) {
1183 buff.
fSegs[indx++] = i*nlong+j;
1184 buff.
fSegs[indx++] = i*nlong+(j+1)%nlong;
1190 for (i=0; i<nlat-1; i++) {
1191 for (j=0; j<nlong; j++) {
1193 buff.
fSegs[indx++] = i*nlong+j;
1194 buff.
fSegs[indx++] = (i+1)*nlong+j;
1197 Int_t indup = indlong + (nlat-1)*nlong;
1201 Int_t indpup = nlat*nlong;
1202 for (j=0; j<nlong; j++) {
1204 buff.
fSegs[indx++] = j;
1205 buff.
fSegs[indx++] = indpup;
1208 Int_t inddown = indup + nup*nlong;
1212 Int_t indpdown = nlat*nlong+nup;
1213 for (j=0; j<nlong; j++) {
1215 buff.
fSegs[indx++] = (nlat-1)*nlong+j;
1216 buff.
fSegs[indx++] = indpdown;
1219 Int_t indparin = inddown + ndown*nlong;
1220 Int_t indlongin = indparin;
1221 Int_t indupin = indparin;
1222 Int_t inddownin = indparin;
1223 Int_t indphi = indparin;
1225 Int_t indptin = nlat*nlong + nup + ndown;
1226 Int_t iptcenter = indptin;
1229 indlongin = indparin + nlat*
fNseg;
1230 indupin = indlongin + (nlat-1)*nlong;
1231 inddownin = indupin + nup*nlong;
1234 for (i=0; i<nlat; i++) {
1235 for (j=0; j<
fNseg; j++) {
1236 buff.
fSegs[indx++] =
c+1;
1237 buff.
fSegs[indx++] = indptin + i*nlong+j;
1238 buff.
fSegs[indx++] = indptin + i*nlong+(j+1)%nlong;
1243 for (i=0; i<nlat-1; i++) {
1244 for (j=0; j<nlong; j++) {
1245 buff.
fSegs[indx++] =
c+1;
1246 buff.
fSegs[indx++] = indptin + i*nlong+j;
1247 buff.
fSegs[indx++] = indptin + (i+1)*nlong+j;
1253 Int_t indupltop = indptin + nlat*nlong;
1254 for (j=0; j<nlong; j++) {
1255 buff.
fSegs[indx++] =
c+1;
1256 buff.
fSegs[indx++] = indptin + j;
1257 buff.
fSegs[indx++] = indupltop;
1263 Int_t indpdown = indptin + nlat*nlong+nup;
1264 for (j=0; j<nlong; j++) {
1265 buff.
fSegs[indx++] =
c+1;
1266 buff.
fSegs[indx++] = indptin + (nlat-1)*nlong+j;
1267 buff.
fSegs[indx++] = indpdown;
1270 indphi = inddownin + ndown*nlong;
1272 Int_t indtheta = indphi;
1275 indtheta += 2*nlat + nup + ndown;
1276 for (j=0; j<nlat; j++) {
1277 buff.
fSegs[indx++] =
c+2;
1278 buff.
fSegs[indx++] = j*nlong;
1280 else buff.
fSegs[indx++] = iptcenter;
1282 for (j=0; j<nlat; j++) {
1283 buff.
fSegs[indx++] =
c+2;
1284 buff.
fSegs[indx++] = (j+1)*nlong-1;
1286 else buff.
fSegs[indx++] = iptcenter;
1289 buff.
fSegs[indx++] =
c+2;
1290 buff.
fSegs[indx++] = nlat*nlong;
1292 else buff.
fSegs[indx++] = iptcenter;
1295 buff.
fSegs[indx++] =
c+2;
1296 buff.
fSegs[indx++] = nlat*nlong+nup;
1298 else buff.
fSegs[indx++] = iptcenter;
1303 for (j=0; j<nlong; j++) {
1304 buff.
fSegs[indx++] =
c+2;
1305 buff.
fSegs[indx++] = j;
1307 else buff.
fSegs[indx++] = iptcenter;
1311 for (j=0; j<nlong; j++) {
1312 buff.
fSegs[indx++] =
c+2;
1313 buff.
fSegs[indx++] = (nlat-1)*nlong + j;
1315 else buff.
fSegs[indx++] = iptcenter;
1321 for (i=0; i<nlat-1; i++) {
1322 for (j=0; j<
fNseg; j++) {
1324 buff.
fPols[indx++] = 4;
1326 buff.
fPols[indx++] = indlong+i*nlong+(j+1)%nlong;
1328 buff.
fPols[indx++] = indlong+i*nlong+j;
1333 for (j=0; j<
fNseg; j++) {
1335 buff.
fPols[indx++] = 3;
1336 buff.
fPols[indx++] = indup + j;
1337 buff.
fPols[indx++] = indup + (j+1)%nlong;
1338 buff.
fPols[indx++] = indpar + j;
1343 for (j=0; j<
fNseg; j++) {
1345 buff.
fPols[indx++] = 3;
1346 buff.
fPols[indx++] = inddown + j;
1347 buff.
fPols[indx++] = indpar + (nlat-1)*
fNseg + j;
1348 buff.
fPols[indx++] = inddown + (j+1)%nlong;
1354 for (i=0; i<nlat-1; i++) {
1355 for (j=0; j<
fNseg; j++) {
1356 buff.
fPols[indx++] =
c+1;
1357 buff.
fPols[indx++] = 4;
1359 buff.
fPols[indx++] = indlongin+i*nlong+j;
1361 buff.
fPols[indx++] = indlongin+i*nlong+(j+1)%nlong;
1366 for (j=0; j<
fNseg; j++) {
1367 buff.
fPols[indx++] =
c+1;
1368 buff.
fPols[indx++] = 3;
1369 buff.
fPols[indx++] = indupin + j;
1370 buff.
fPols[indx++] = indparin + j;
1371 buff.
fPols[indx++] = indupin + (j+1)%nlong;
1376 for (j=0; j<
fNseg; j++) {
1377 buff.
fPols[indx++] =
c+1;
1378 buff.
fPols[indx++] = 3;
1379 buff.
fPols[indx++] = inddownin + j;
1380 buff.
fPols[indx++] = inddownin + (j+1)%nlong;
1381 buff.
fPols[indx++] = indparin + (nlat-1)*
fNseg + j;
1387 for (i=0; i<nlat-1; i++) {
1388 buff.
fPols[indx++] =
c+2;
1390 buff.
fPols[indx++] = 4;
1391 buff.
fPols[indx++] = indlong + i*nlong;
1392 buff.
fPols[indx++] = indphi + i + 1;
1393 buff.
fPols[indx++] = indlongin + i*nlong;
1394 buff.
fPols[indx++] = indphi + i;
1396 buff.
fPols[indx++] = 3;
1397 buff.
fPols[indx++] = indlong + i*nlong;
1398 buff.
fPols[indx++] = indphi + i + 1;
1399 buff.
fPols[indx++] = indphi + i;
1402 for (i=0; i<nlat-1; i++) {
1403 buff.
fPols[indx++] =
c+2;
1405 buff.
fPols[indx++] = 4;
1406 buff.
fPols[indx++] = indlong + (i+1)*nlong-1;
1407 buff.
fPols[indx++] = indphi + nlat + i;
1408 buff.
fPols[indx++] = indlongin + (i+1)*nlong-1;
1409 buff.
fPols[indx++] = indphi + nlat + i + 1;
1411 buff.
fPols[indx++] = 3;
1412 buff.
fPols[indx++] = indlong + (i+1)*nlong-1;
1413 buff.
fPols[indx++] = indphi + nlat + i;
1414 buff.
fPols[indx++] = indphi + nlat + i + 1;
1418 buff.
fPols[indx++] =
c+2;
1420 buff.
fPols[indx++] = 4;
1421 buff.
fPols[indx++] = indup;
1422 buff.
fPols[indx++] = indphi;
1423 buff.
fPols[indx++] = indupin;
1424 buff.
fPols[indx++] = indphi + 2*nlat;
1426 buff.
fPols[indx++] = 3;
1427 buff.
fPols[indx++] = indup;
1428 buff.
fPols[indx++] = indphi;
1429 buff.
fPols[indx++] = indphi + 2*nlat;
1431 buff.
fPols[indx++] =
c+2;
1433 buff.
fPols[indx++] = 4;
1434 buff.
fPols[indx++] = indup+nlong-1;
1435 buff.
fPols[indx++] = indphi + 2*nlat;
1436 buff.
fPols[indx++] = indupin+nlong-1;
1437 buff.
fPols[indx++] = indphi + nlat;
1439 buff.
fPols[indx++] = 3;
1440 buff.
fPols[indx++] = indup+nlong-1;
1441 buff.
fPols[indx++] = indphi + 2*nlat;
1442 buff.
fPols[indx++] = indphi + nlat;
1446 buff.
fPols[indx++] =
c+2;
1448 buff.
fPols[indx++] = 4;
1449 buff.
fPols[indx++] = inddown;
1450 buff.
fPols[indx++] = indphi + 2*nlat + nup;
1451 buff.
fPols[indx++] = inddownin;
1452 buff.
fPols[indx++] = indphi + nlat-1;
1454 buff.
fPols[indx++] = 3;
1455 buff.
fPols[indx++] = inddown;
1456 buff.
fPols[indx++] = indphi + 2*nlat + nup;
1457 buff.
fPols[indx++] = indphi + nlat-1;
1459 buff.
fPols[indx++] =
c+2;
1461 buff.
fPols[indx++] = 4;
1462 buff.
fPols[indx++] = inddown+nlong-1;
1463 buff.
fPols[indx++] = indphi + 2*nlat-1;
1464 buff.
fPols[indx++] = inddownin+nlong-1;
1465 buff.
fPols[indx++] = indphi + 2*nlat+nup;
1467 buff.
fPols[indx++] = 3;
1468 buff.
fPols[indx++] = inddown+nlong-1;
1469 buff.
fPols[indx++] = indphi + 2*nlat-1;
1470 buff.
fPols[indx++] = indphi + 2*nlat+nup;
1476 for (j=0; j<
fNseg; j++) {
1477 buff.
fPols[indx++] =
c+2;
1479 buff.
fPols[indx++] = 4;
1480 buff.
fPols[indx++] = indpar+j;
1481 buff.
fPols[indx++] = indtheta + j;
1482 buff.
fPols[indx++] = indparin + j;
1483 buff.
fPols[indx++] = indtheta + (j+1)%nlong;
1485 buff.
fPols[indx++] = 3;
1486 buff.
fPols[indx++] = indpar+j;
1487 buff.
fPols[indx++] = indtheta + j;
1488 buff.
fPols[indx++] = indtheta + (j+1)%nlong;
1493 for (j=0; j<
fNseg; j++) {
1494 buff.
fPols[indx++] =
c+2;
1496 buff.
fPols[indx++] = 4;
1497 buff.
fPols[indx++] = indpar+(nlat-1)*
fNseg+j;
1498 buff.
fPols[indx++] = indtheta + (1-nup)*nlong +(j+1)%nlong;
1499 buff.
fPols[indx++] = indparin + (nlat-1)*
fNseg + j;
1500 buff.
fPols[indx++] = indtheta + (1-nup)*nlong + j;
1502 buff.
fPols[indx++] = 3;
1503 buff.
fPols[indx++] = indpar+(nlat-1)*
fNseg+j;
1504 buff.
fPols[indx++] = indtheta + (1-nup)*nlong +(j+1)%nlong;
1505 buff.
fPols[indx++] = indtheta + (1-nup)*nlong + j;
1517 Double_t r2 = point[0]*point[0]+point[1]*point[1]+point[2]*point[2];
1520 if (
r<=1E-20) rzero=
kTRUE;
1540 for (
Int_t i=0; i<4; i++) saf[i]=-saf[i];
1552 out <<
" // Shape: " <<
GetName() <<
" type: " <<
ClassName() << std::endl;
1553 out <<
" rmin = " <<
fRmin <<
";" << std::endl;
1554 out <<
" rmax = " <<
fRmax <<
";" << std::endl;
1555 out <<
" theta1 = " <<
fTheta1<<
";" << std::endl;
1556 out <<
" theta2 = " <<
fTheta2 <<
";" << std::endl;
1557 out <<
" phi1 = " <<
fPhi1 <<
";" << std::endl;
1558 out <<
" phi2 = " <<
fPhi2 <<
";" << std::endl;
1559 out <<
" TGeoShape *" <<
GetPointerName() <<
" = new TGeoSphere(\"" <<
GetName() <<
"\",rmin,rmax,theta1, theta2,phi1,phi2);" << std::endl;
1570 Error(
"SetDimensions",
"invalid parameters rmin/rmax");
1576 if (theta1 >= theta2 || theta1<0 || theta1>180 || theta2>180) {
1577 Error(
"SetDimensions",
"invalid parameters theta1/theta2");
1584 if (phi1<0)
fPhi1+=360.;
1601 if (nparam > 2) theta1 = param[2];
1602 if (nparam > 3) theta2 = param[3];
1603 if (nparam > 4) phi1 = param[4];
1604 if (nparam > 5) phi2 = param[5];
1624 if (dphi<0) dphi+=360;
1636 Error(
"SetPoints",
"Input array is NULL");
1667 for (i = 0; i < nlat; i++) {
1668 theta = theta1+(nup+i)*dtheta;
1672 for (j = 0; j < nlong; j++) {
1676 points[indx++] = zi * cphi;
1677 points[indx++] = zi * sphi;
1698 for (i = 0; i < nlat; i++) {
1699 theta = theta1+(nup+i)*dtheta;
1703 for (j = 0; j < nlong; j++) {
1707 points[indx++] = zi * cphi;
1708 points[indx++] = zi * sphi;
1741 Error(
"SetPoints",
"Input array is NULL");
1772 for (i = 0; i < nlat; i++) {
1773 theta = theta1+(nup+i)*dtheta;
1777 for (j = 0; j < nlong; j++) {
1781 points[indx++] = zi * cphi;
1782 points[indx++] = zi * sphi;
1803 for (i = 0; i < nlat; i++) {
1804 theta = theta1+(nup+i)*dtheta;
1808 for (j = 0; j < nlong; j++) {
1812 points[indx++] = zi * cphi;
1813 points[indx++] = zi * sphi;
1859 nvert = nlat*nlong+nup+ndown+ncenter;
1862 nsegs = nlat*
fNseg + (nlat-1+nup+ndown)*nlong;
1865 nsegs += nlong * (2-nup - ndown);
1870 npols += (2-nup-ndown)*
fNseg;
1892 Int_t numPoints = 0;
1894 else numPoints = nlat*nlong+nup+ndown+ncenter;
1940 Int_t nbPnts = nlat*nlong+nup+ndown+ncenter;
1943 Int_t nbSegs = nlat*
fNseg + (nlat-1+nup+ndown)*nlong;
1946 nbSegs += nlong * (2-nup - ndown);
1951 nbPols += (2-nup-ndown)*
fNseg;
1953 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
TGeoSphere are not just balls having internal and external radii, but sectors of a sphere having defi...
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)