154 Double_t r1min, r1max, r2min, r2max, rmin, rmax;
184 if (ddp<0) ddp+= 360;
185 if (ddp>360) ddp-=360;
186 if (ddp<=dp) xmax = rmax;
188 if (ddp<0) ddp+= 360;
189 if (ddp>360) ddp-=360;
190 if (ddp<=dp) ymax = rmax;
192 if (ddp<0) ddp+= 360;
193 if (ddp>360) ddp-=360;
194 if (ddp<=dp) xmin = -rmax;
196 if (ddp<0) ddp+= 360;
197 if (ddp>360) ddp-=360;
198 if (ddp<=dp) ymin = -rmax;
220 Double_t rxy2 = point[0]*point[0]+point[1]*point[1];
224 if (r<=1
E-20) rzero=
kTRUE;
265 if (norm[0]*dir[0]+norm[1]*dir[1]+norm[2]*dir[2]<0) {
285 Double_t r2 = point[0]*point[0]+point[1]*point[1]+point[2]*point[2];
288 if (
TMath::Abs(drsqout)<2.*fRmax*tol)
return 2;
293 if (
TMath::Abs(drsqin)<2.*fRmin*tol)
return 1;
301 if (r2*ddp*ddp < tol*tol)
return 3;
303 if (r2*ddp*ddp < tol*tol)
return 4;
313 if (r*ddt < tol)
return 5;
317 if (r*ddt < tol)
return 6;
328 Double_t r2 = point[0]*point[0]+point[1]*point[1]+point[2]*point[2];
333 if (r2<1
E-20)
return kTRUE;
336 while (phi <
fPhi1) phi+=360.;
339 if (ddp > dphi)
return kFALSE;
356 Double_t r2=point[0]*point[0]+point[1]*point[1]+point[2]*point[2];
359 if (r2<1
E-20)
return kTRUE;
363 if (phi < 0 ) phi+=360.;
365 if (dphi < 0) dphi+=360.;
367 if (ddp < 0) ddp += 360.;
368 if (ddp > dphi)
return kFALSE;
386 const Int_t numPoints = 2*n*nz;
400 Double_t rxy2 = point[0]*point[0]+point[1]*point[1];
402 r2 = rxy2+point[2]*point[2];
415 if (phi<0) phi+=360.;
417 if (iact<3 && safe) {
431 if (dph1<0) dph1+=360.;
434 if (dph2<0) dph2+=360.;
444 Double_t rdotn = point[0]*dir[0]+point[1]*dir[1]+point[2]*dir[2];
457 if (inrmax && inrmin) {
474 if (snxt<1E20)
return snxt;
479 if (snxt<1E20)
return snxt;
489 Double_t b,delta,xnew,ynew,znew, phi0, ddp;
497 if (point[2]*dir[2]<0) {
498 snxt = -point[2]/dir[2];
499 ptnew[0] = point[0]+snxt*dir[0];
500 ptnew[1] = point[1]+snxt*dir[1];
522 ptnew[2] = point[2]-0.5*(z1+z2);
524 Double_t rin = 0.5*(r1+r2+(r2-
r1)*ptnew[2]*zinv);
529 if (delta<0) skip =
kTRUE;
534 if (sigz*ddotn>=0 || -b+delta<1.
E-9) skip =
kTRUE;
538 znew = ptnew[2]+snxt*dir[2];
542 xnew = ptnew[0]+snxt*dir[0];
543 ynew = ptnew[1]+snxt*dir[1];
546 while (ddp<0) ddp+=360.;
547 if (ddp<=
fPhi2-fPhi1) st1 = snxt;
551 if (!skip && st1>1E10) {
553 znew = ptnew[2]+snxt*dir[2];
557 xnew = ptnew[0]+snxt*dir[0];
558 ynew = ptnew[1]+snxt*dir[1];
561 while (ddp<0) ddp+=360.;
562 if (ddp<=
fPhi2-fPhi1) st1 = snxt;
573 if (point[2]*dir[2]<0) {
574 snxt = -point[2]/dir[2];
575 ptnew[0] = point[0]+snxt*dir[0];
576 ptnew[1] = point[1]+snxt*dir[1];
598 ptnew[2] = point[2]-0.5*(z1+z2);
600 Double_t rin = 0.5*(r1+r2+(r2-
r1)*ptnew[2]*zinv);
605 if (delta<0) skip =
kTRUE;
610 if (sigz*ddotn<=0 || -b+delta<1.
E-9) skip =
kTRUE;
614 znew = ptnew[2]+snxt*dir[2];
618 xnew = ptnew[0]+snxt*dir[0];
619 ynew = ptnew[1]+snxt*dir[1];
622 while (ddp<0) ddp+=360.;
623 if (ddp<=
fPhi2-fPhi1) st2 = snxt;
627 if (!skip && st2>1E10) {
629 znew = ptnew[2]+snxt*dir[2];
633 xnew = ptnew[0]+snxt*dir[0];
634 ynew = ptnew[1]+snxt*dir[1];
637 while (ddp<0) ddp+=360.;
638 if (ddp<=
fPhi2-fPhi1) st2 = snxt;
661 safety = point[0]*s1-point[1]*
c1;
663 un = dir[0]*s1-dir[1]*
c1;
666 ptnew[0] = point[0]+s*dir[0];
667 ptnew[1] = point[1]+s*dir[1];
668 ptnew[2] = point[2]+s*dir[2];
669 if ((ptnew[1]*cm-ptnew[0]*sm)<=0) {
675 safety = -point[0]*s2+point[1]*
c2;
677 un = -dir[0]*s2+dir[1]*
c2;
680 ptnew[0] = point[0]+s*dir[0];
681 ptnew[1] = point[1]+s*dir[1];
682 ptnew[2] = point[2]+s*dir[2];
683 if ((ptnew[1]*cm-ptnew[0]*sm)>=0) {
699 Double_t rxy2 = point[0]*point[0]+point[1]*point[1];
701 Double_t rad2 = rxy2+point[2]*point[2];
704 if (r<=1
E-20) rzero=
kTRUE;
714 if (phi<0) phi+=360.;
716 if (iact<3 && safe) {
730 if (dph1<0) dph1+=360.;
733 if (dph2<0) dph2+=360.;
747 Double_t b,delta, xnew,ynew,znew, phi0, ddp;
748 Double_t rdotn = point[0]*dir[0]+point[1]*dir[1]+point[2]*dir[2];
754 if (rdotn<0)
return 0.0;
762 if (rdotn>=0)
return 0.0;
772 if (point[2]*dir[2]<0) sn1 = -point[2]/dir[2];
792 ptnew[2] = point[2]-0.5*(z1+z2);
794 Double_t rin = 0.5*(r1+r2+(r2-
r1)*ptnew[2]*zinv);
799 if (sigz*ddotn<=0)
return 0.0;
804 znew = ptnew[2]+snxt*dir[2];
808 xnew = ptnew[0]+snxt*dir[0];
809 ynew = ptnew[1]+snxt*dir[1];
812 while (ddp<0) ddp+=360.;
813 if (ddp<=
fPhi2-fPhi1) sn1 = snxt;
818 znew = ptnew[2]+snxt*dir[2];
822 xnew = ptnew[0]+snxt*dir[0];
823 ynew = ptnew[1]+snxt*dir[1];
826 while (ddp<0) ddp+=360.;
827 if (ddp<=
fPhi2-fPhi1) sn1 = snxt;
837 if (point[2]*dir[2]<0) sn1 = -point[2]/dir[2];
857 ptnew[2] = point[2]-0.5*(z1+z2);
859 Double_t rin = 0.5*(r1+r2+(r2-
r1)*ptnew[2]*zinv);
864 if (sigz*ddotn>=0)
return 0.0;
869 znew = ptnew[2]+snxt*dir[2];
873 xnew = ptnew[0]+snxt*dir[0];
874 ynew = ptnew[1]+snxt*dir[1];
877 while (ddp<0) ddp+=360.;
878 if (ddp<=
fPhi2-fPhi1) sn2 = snxt;
883 znew = ptnew[2]+snxt*dir[2];
887 xnew = ptnew[0]+snxt*dir[0];
888 ynew = ptnew[1]+snxt*dir[1];
891 while (ddp<0) ddp+=360.;
892 if (ddp<=
fPhi2-fPhi1) sn2 = snxt;
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];
939 s = (firstcross)?(-b-d):(-b+d);
942 if (!check)
return s;
943 for (i=0; i<3; i++) pt[i]=point[i]+s*dir[i];
967 for (
id=0;
id<ndiv;
id++) {
983 vmulti->AddVolume(vol);
985 for (
id=0;
id<ndiv;
id++) {
995 for (
id=0;
id<ndiv;
id++) {
998 vmulti->AddVolume(vol);
1005 Error(
"Divide",
"In shape %s wrong axis type for division",
GetName());
1068 param[0] =
fRmin*smin;
1069 param[0] *= param[0];
1071 param[1] =
fRmax*smax;
1072 param[1] *= param[1];
1079 while (param[3]<param[2]) param[3]+=360.;
1087 printf(
"*** Shape %s: TGeoSphere ***\n",
GetName());
1088 printf(
" Rmin = %11.5f\n",
fRmin);
1089 printf(
" Rmax = %11.5f\n",
fRmax);
1090 printf(
" Th1 = %11.5f\n",
fTheta1);
1091 printf(
" Th2 = %11.5f\n",
fTheta2);
1092 printf(
" Ph1 = %11.5f\n",
fPhi1);
1093 printf(
" Ph2 = %11.5f\n",
fPhi2);
1094 printf(
" Bounding box:\n");
1116 Int_t nbPnts = nlat*nlong+nup+ndown+ncenter;
1119 Int_t nbSegs = nlat*
fNseg + (nlat-1+nup+ndown)*nlong;
1122 nbSegs += nlong * (2-nup - ndown);
1127 nbPols += (2-nup-ndown)*fNseg;
1130 nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, nbPols, 6*nbPols);
1158 Int_t nbPnts = nlat*nlong+nup+ndown+ncenter;
1161 Int_t nbSegs = nlat*
fNseg + (nlat-1+nup+ndown)*nlong;
1164 nbSegs += nlong * (2-nup - ndown);
1169 nbPols += (2-nup-ndown)*fNseg;
1179 for (i=0; i<nlat; i++) {
1180 for (j=0; j<
fNseg; j++) {
1182 buff.
fSegs[indx++] = i*nlong+j;
1183 buff.
fSegs[indx++] = i*nlong+(j+1)%nlong;
1189 for (i=0; i<nlat-1; i++) {
1190 for (j=0; j<nlong; j++) {
1192 buff.
fSegs[indx++] = i*nlong+j;
1193 buff.
fSegs[indx++] = (i+1)*nlong+j;
1196 Int_t indup = indlong + (nlat-1)*nlong;
1200 Int_t indpup = nlat*nlong;
1201 for (j=0; j<nlong; j++) {
1203 buff.
fSegs[indx++] = j;
1204 buff.
fSegs[indx++] = indpup;
1207 Int_t inddown = indup + nup*nlong;
1211 Int_t indpdown = nlat*nlong+nup;
1212 for (j=0; j<nlong; j++) {
1214 buff.
fSegs[indx++] = (nlat-1)*nlong+j;
1215 buff.
fSegs[indx++] = indpdown;
1218 Int_t indparin = inddown + ndown*nlong;
1219 Int_t indlongin = indparin;
1220 Int_t indupin = indparin;
1221 Int_t inddownin = indparin;
1222 Int_t indphi = indparin;
1224 Int_t indptin = nlat*nlong + nup + ndown;
1225 Int_t iptcenter = indptin;
1228 indlongin = indparin + nlat*
fNseg;
1229 indupin = indlongin + (nlat-1)*nlong;
1230 inddownin = indupin + nup*nlong;
1233 for (i=0; i<nlat; i++) {
1234 for (j=0; j<
fNseg; j++) {
1235 buff.
fSegs[indx++] = c+1;
1236 buff.
fSegs[indx++] = indptin + i*nlong+j;
1237 buff.
fSegs[indx++] = indptin + i*nlong+(j+1)%nlong;
1242 for (i=0; i<nlat-1; i++) {
1243 for (j=0; j<nlong; j++) {
1244 buff.
fSegs[indx++] = c+1;
1245 buff.
fSegs[indx++] = indptin + i*nlong+j;
1246 buff.
fSegs[indx++] = indptin + (i+1)*nlong+j;
1252 Int_t indupltop = indptin + nlat*nlong;
1253 for (j=0; j<nlong; j++) {
1254 buff.
fSegs[indx++] = c+1;
1255 buff.
fSegs[indx++] = indptin + j;
1256 buff.
fSegs[indx++] = indupltop;
1262 Int_t indpdown = indptin + nlat*nlong+nup;
1263 for (j=0; j<nlong; j++) {
1264 buff.
fSegs[indx++] = c+1;
1265 buff.
fSegs[indx++] = indptin + (nlat-1)*nlong+j;
1266 buff.
fSegs[indx++] = indpdown;
1269 indphi = inddownin + ndown*nlong;
1271 Int_t indtheta = indphi;
1274 indtheta += 2*nlat + nup + ndown;
1275 for (j=0; j<nlat; j++) {
1276 buff.
fSegs[indx++] = c+2;
1277 buff.
fSegs[indx++] = j*nlong;
1279 else buff.
fSegs[indx++] = iptcenter;
1281 for (j=0; j<nlat; j++) {
1282 buff.
fSegs[indx++] = c+2;
1283 buff.
fSegs[indx++] = (j+1)*nlong-1;
1285 else buff.
fSegs[indx++] = iptcenter;
1288 buff.
fSegs[indx++] = c+2;
1289 buff.
fSegs[indx++] = nlat*nlong;
1291 else buff.
fSegs[indx++] = iptcenter;
1294 buff.
fSegs[indx++] = c+2;
1295 buff.
fSegs[indx++] = nlat*nlong+nup;
1297 else buff.
fSegs[indx++] = iptcenter;
1302 for (j=0; j<nlong; j++) {
1303 buff.
fSegs[indx++] = c+2;
1304 buff.
fSegs[indx++] = j;
1306 else buff.
fSegs[indx++] = iptcenter;
1310 for (j=0; j<nlong; j++) {
1311 buff.
fSegs[indx++] = c+2;
1312 buff.
fSegs[indx++] = (nlat-1)*nlong + j;
1314 else buff.
fSegs[indx++] = iptcenter;
1320 for (i=0; i<nlat-1; i++) {
1321 for (j=0; j<
fNseg; j++) {
1323 buff.
fPols[indx++] = 4;
1324 buff.
fPols[indx++] = indpar+i*fNseg+j;
1325 buff.
fPols[indx++] = indlong+i*nlong+(j+1)%nlong;
1326 buff.
fPols[indx++] = indpar+(i+1)*fNseg+j;
1327 buff.
fPols[indx++] = indlong+i*nlong+j;
1332 for (j=0; j<
fNseg; j++) {
1334 buff.
fPols[indx++] = 3;
1335 buff.
fPols[indx++] = indup + j;
1336 buff.
fPols[indx++] = indup + (j+1)%nlong;
1337 buff.
fPols[indx++] = indpar + j;
1342 for (j=0; j<
fNseg; j++) {
1344 buff.
fPols[indx++] = 3;
1345 buff.
fPols[indx++] = inddown + j;
1346 buff.
fPols[indx++] = indpar + (nlat-1)*fNseg + j;
1347 buff.
fPols[indx++] = inddown + (j+1)%nlong;
1353 for (i=0; i<nlat-1; i++) {
1354 for (j=0; j<
fNseg; j++) {
1355 buff.
fPols[indx++] = c+1;
1356 buff.
fPols[indx++] = 4;
1357 buff.
fPols[indx++] = indparin+i*fNseg+j;
1358 buff.
fPols[indx++] = indlongin+i*nlong+j;
1359 buff.
fPols[indx++] = indparin+(i+1)*fNseg+j;
1360 buff.
fPols[indx++] = indlongin+i*nlong+(j+1)%nlong;
1365 for (j=0; j<
fNseg; j++) {
1366 buff.
fPols[indx++] = c+1;
1367 buff.
fPols[indx++] = 3;
1368 buff.
fPols[indx++] = indupin + j;
1369 buff.
fPols[indx++] = indparin + j;
1370 buff.
fPols[indx++] = indupin + (j+1)%nlong;
1375 for (j=0; j<
fNseg; j++) {
1376 buff.
fPols[indx++] = c+1;
1377 buff.
fPols[indx++] = 3;
1378 buff.
fPols[indx++] = inddownin + j;
1379 buff.
fPols[indx++] = inddownin + (j+1)%nlong;
1380 buff.
fPols[indx++] = indparin + (nlat-1)*fNseg + j;
1386 for (i=0; i<nlat-1; i++) {
1387 buff.
fPols[indx++] = c+2;
1389 buff.
fPols[indx++] = 4;
1390 buff.
fPols[indx++] = indlong + i*nlong;
1391 buff.
fPols[indx++] = indphi + i + 1;
1392 buff.
fPols[indx++] = indlongin + i*nlong;
1393 buff.
fPols[indx++] = indphi + i;
1395 buff.
fPols[indx++] = 3;
1396 buff.
fPols[indx++] = indlong + i*nlong;
1397 buff.
fPols[indx++] = indphi + i + 1;
1398 buff.
fPols[indx++] = indphi + i;
1401 for (i=0; i<nlat-1; i++) {
1402 buff.
fPols[indx++] = c+2;
1404 buff.
fPols[indx++] = 4;
1405 buff.
fPols[indx++] = indlong + (i+1)*nlong-1;
1406 buff.
fPols[indx++] = indphi + nlat + i;
1407 buff.
fPols[indx++] = indlongin + (i+1)*nlong-1;
1408 buff.
fPols[indx++] = indphi + nlat + i + 1;
1410 buff.
fPols[indx++] = 3;
1411 buff.
fPols[indx++] = indlong + (i+1)*nlong-1;
1412 buff.
fPols[indx++] = indphi + nlat + i;
1413 buff.
fPols[indx++] = indphi + nlat + i + 1;
1417 buff.
fPols[indx++] = c+2;
1419 buff.
fPols[indx++] = 4;
1420 buff.
fPols[indx++] = indup;
1421 buff.
fPols[indx++] = indphi;
1422 buff.
fPols[indx++] = indupin;
1423 buff.
fPols[indx++] = indphi + 2*nlat;
1425 buff.
fPols[indx++] = 3;
1426 buff.
fPols[indx++] = indup;
1427 buff.
fPols[indx++] = indphi;
1428 buff.
fPols[indx++] = indphi + 2*nlat;
1430 buff.
fPols[indx++] = c+2;
1432 buff.
fPols[indx++] = 4;
1433 buff.
fPols[indx++] = indup+nlong-1;
1434 buff.
fPols[indx++] = indphi + 2*nlat;
1435 buff.
fPols[indx++] = indupin+nlong-1;
1436 buff.
fPols[indx++] = indphi + nlat;
1438 buff.
fPols[indx++] = 3;
1439 buff.
fPols[indx++] = indup+nlong-1;
1440 buff.
fPols[indx++] = indphi + 2*nlat;
1441 buff.
fPols[indx++] = indphi + nlat;
1445 buff.
fPols[indx++] = c+2;
1447 buff.
fPols[indx++] = 4;
1448 buff.
fPols[indx++] = inddown;
1449 buff.
fPols[indx++] = indphi + 2*nlat + nup;
1450 buff.
fPols[indx++] = inddownin;
1451 buff.
fPols[indx++] = indphi + nlat-1;
1453 buff.
fPols[indx++] = 3;
1454 buff.
fPols[indx++] = inddown;
1455 buff.
fPols[indx++] = indphi + 2*nlat + nup;
1456 buff.
fPols[indx++] = indphi + nlat-1;
1458 buff.
fPols[indx++] = c+2;
1460 buff.
fPols[indx++] = 4;
1461 buff.
fPols[indx++] = inddown+nlong-1;
1462 buff.
fPols[indx++] = indphi + 2*nlat-1;
1463 buff.
fPols[indx++] = inddownin+nlong-1;
1464 buff.
fPols[indx++] = indphi + 2*nlat+nup;
1466 buff.
fPols[indx++] = 3;
1467 buff.
fPols[indx++] = inddown+nlong-1;
1468 buff.
fPols[indx++] = indphi + 2*nlat-1;
1469 buff.
fPols[indx++] = indphi + 2*nlat+nup;
1475 for (j=0; j<
fNseg; j++) {
1476 buff.
fPols[indx++] = c+2;
1478 buff.
fPols[indx++] = 4;
1479 buff.
fPols[indx++] = indpar+j;
1480 buff.
fPols[indx++] = indtheta + j;
1481 buff.
fPols[indx++] = indparin + j;
1482 buff.
fPols[indx++] = indtheta + (j+1)%nlong;
1484 buff.
fPols[indx++] = 3;
1485 buff.
fPols[indx++] = indpar+j;
1486 buff.
fPols[indx++] = indtheta + j;
1487 buff.
fPols[indx++] = indtheta + (j+1)%nlong;
1492 for (j=0; j<
fNseg; j++) {
1493 buff.
fPols[indx++] = c+2;
1495 buff.
fPols[indx++] = 4;
1496 buff.
fPols[indx++] = indpar+(nlat-1)*fNseg+j;
1497 buff.
fPols[indx++] = indtheta + (1-nup)*nlong +(j+1)%nlong;
1498 buff.
fPols[indx++] = indparin + (nlat-1)*fNseg + j;
1499 buff.
fPols[indx++] = indtheta + (1-nup)*nlong + j;
1501 buff.
fPols[indx++] = 3;
1502 buff.
fPols[indx++] = indpar+(nlat-1)*fNseg+j;
1503 buff.
fPols[indx++] = indtheta + (1-nup)*nlong +(j+1)%nlong;
1504 buff.
fPols[indx++] = indtheta + (1-nup)*nlong + j;
1516 Double_t r2 = point[0]*point[0]+point[1]*point[1]+point[2]*point[2];
1519 if (r<=1
E-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;
1684 points[indx++] = 0.;
1685 points[indx++] = 0.;
1686 points[indx++] =
fRmax;
1690 points[indx++] = 0.;
1691 points[indx++] = 0.;
1692 points[indx++] = -
fRmax;
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;
1715 points[indx++] = 0.;
1716 points[indx++] = 0.;
1717 points[indx++] =
fRmin;
1721 points[indx++] = 0.;
1722 points[indx++] = 0.;
1723 points[indx++] = -
fRmin;
1729 points[indx++] = 0.;
1730 points[indx++] = 0.;
1731 points[indx++] = 0.;
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;
1789 points[indx++] = 0.;
1790 points[indx++] = 0.;
1791 points[indx++] =
fRmax;
1795 points[indx++] = 0.;
1796 points[indx++] = 0.;
1797 points[indx++] = -
fRmax;
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;
1820 points[indx++] = 0.;
1821 points[indx++] = 0.;
1822 points[indx++] =
fRmin;
1826 points[indx++] = 0.;
1827 points[indx++] = 0.;
1828 points[indx++] = -
fRmin;
1834 points[indx++] = 0.;
1835 points[indx++] = 0.;
1836 points[indx++] = 0.;
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)) {
1976 for (
Int_t i=0; i<vecsize; i++) inside[i] =
Contains(&points[3*i]);
1986 for (
Int_t i=0; i<vecsize; i++)
ComputeNormal(&points[3*i], &dirs[3*i], &norms[3*i]);
1994 for (
Int_t i=0; i<vecsize; i++) dists[i] =
DistFromInside(&points[3*i], &dirs[3*i], 3, step[i]);
2002 for (
Int_t i=0; i<vecsize; i++) dists[i] =
DistFromOutside(&points[3*i], &dirs[3*i], 3, step[i]);
2012 for (
Int_t i=0; i<vecsize; i++) safe[i] =
Safety(&points[3*i], inside[i]);
virtual void InspectShape() const
print shape parameters
TGeoVolumeMulti * MakeVolumeMulti(const char *name, TGeoMedium *medium)
Make a TGeoVolumeMulti handling a list of volumes.
Int_t IsOnBoundary(const Double_t *point) const
Check if a point in local sphere coordinates is close to a boundary within shape tolerance.
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 Int_t GetNmeshVertices() const
Return number of vertices of the mesh representation.
#define snext(osub1, osub2)
Long64_t LocMax(Long64_t n, const T *a)
void SetFinder(TGeoPatternFinder *finder)
virtual const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
Fills a static 3D buffer and returns a reference.
void AddNodeOffset(TGeoVolume *vol, Int_t copy_no, Double_t offset=0, Option_t *option="")
Add a division node to the list of nodes.
Bool_t TestBit(UInt_t f) const
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
virtual void SetPoints(Double_t *points) const
create sphere mesh points
Short_t Min(Short_t a, Short_t b)
virtual Double_t Capacity() const
Computes capacity of the shape in [length^3].
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 InspectShape() const
Prints shape parameters.
TObject * At(Int_t idx) const
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.
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...
static Double_t Tolerance()
Int_t GetNdaughters() const
virtual const char * ClassName() const
Returns name of class to which the object belongs.
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.
void AddVolume(TGeoVolume *vol)
Add a volume with valid shape to the list of volumes.
TGeoMedium * GetMedium() const
void SetSphDimensions(Double_t rmin, Double_t rmax, Double_t theta1, Double_t theta2, Double_t phi1, Double_t phi2)
Set spherical segment dimensions.
Sphere description class - see TBuffer3DTypes for producer classes Supports hollow and cut spheres...
Double_t ATan2(Double_t, Double_t)
void SetSectionsValid(UInt_t mask)
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...
const char * GetPointerName() const
Provide a pointer name containing uid.
Base finder class for patterns.
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
virtual void Sizeof3D() const
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...
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
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.
Base abstract class for all shapes.
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.
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.
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 TBuffer3D * MakeBuffer3D() const
Creates a TBuffer3D describing this shape.
Generic 3D primitive description class.
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)
Compute normal to closest surface from POINT.
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.
virtual const char * GetAxisName(Int_t iaxis) const
Returns name of axis IAXIS.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
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 ComputeBBox()
compute bounding box of the sphere
Node containing an offset.
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.
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 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 Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const
Get range of shape for a given axis.
virtual void SetDimensions(Double_t *param)
Set dimensions of the spherical segment starting from a list of parameters.
Short_t Max(Short_t a, Short_t b)
TGeoSphere()
Default constructor.
virtual void GetBoundingCylinder(Double_t *param) const
Fill vector param[4] with the bounding cylinder parameters.
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
virtual Bool_t Contains(const Double_t *point) const
test if point is inside this sphere check Rmin<=R<=Rmax
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 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 SetNumberOfDivisions(Int_t p)
Set the number of divisions of mesh circles keeping aspect ratio.
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 ~TGeoSphere()
destructor
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...
Double_t Sqrt(Double_t x)
Long64_t LocMin(Long64_t n, const T *a)
double norm(double *x, double *p)
Int_t GetBasicColor() const
Get the basic color (0-7).
static char * skip(char **buf, const char *delimiters)
virtual void SetSegsAndPols(TBuffer3D &buff) const
Fill TBuffer3D structure for segments and polygons.
unsigned int r2[N_CITIES]
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
const char * Data() const