138 Double_t r1min, r1max, r2min, r2max, rmin, rmax;
168 if (ddp<0) ddp+= 360;
169 if (ddp>360) ddp-=360;
170 if (ddp<=dp) xmax = rmax;
172 if (ddp<0) ddp+= 360;
173 if (ddp>360) ddp-=360;
174 if (ddp<=dp) ymax = rmax;
176 if (ddp<0) ddp+= 360;
177 if (ddp>360) ddp-=360;
178 if (ddp<=dp) xmin = -rmax;
180 if (ddp<0) ddp+= 360;
181 if (ddp>360) ddp-=360;
182 if (ddp<=dp) ymin = -rmax;
204 Double_t rxy2 = point[0]*point[0]+point[1]*point[1];
208 if (r<=1
E-20) rzero=
kTRUE;
249 if (norm[0]*dir[0]+norm[1]*dir[1]+norm[2]*dir[2]<0) {
269 Double_t r2 = point[0]*point[0]+point[1]*point[1]+point[2]*point[2];
272 if (
TMath::Abs(drsqout)<2.*fRmax*tol)
return 2;
277 if (
TMath::Abs(drsqin)<2.*fRmin*tol)
return 1;
285 if (r2*ddp*ddp < tol*tol)
return 3;
287 if (r2*ddp*ddp < tol*tol)
return 4;
297 if (r*ddt < tol)
return 5;
301 if (r*ddt < tol)
return 6;
312 Double_t r2 = point[0]*point[0]+point[1]*point[1]+point[2]*point[2];
317 if (r2<1
E-20)
return kTRUE;
320 while (phi <
fPhi1) phi+=360.;
323 if (ddp > dphi)
return kFALSE;
340 Double_t r2=point[0]*point[0]+point[1]*point[1]+point[2]*point[2];
343 if (r2<1
E-20)
return kTRUE;
347 if (phi < 0 ) phi+=360.;
349 if (dphi < 0) dphi+=360.;
351 if (ddp < 0) ddp += 360.;
352 if (ddp > dphi)
return kFALSE;
370 const Int_t numPoints = 2*n*nz;
384 Double_t rxy2 = point[0]*point[0]+point[1]*point[1];
386 r2 = rxy2+point[2]*point[2];
399 if (phi<0) phi+=360.;
401 if (iact<3 && safe) {
415 if (dph1<0) dph1+=360.;
418 if (dph2<0) dph2+=360.;
428 Double_t rdotn = point[0]*dir[0]+point[1]*dir[1]+point[2]*dir[2];
441 if (inrmax && inrmin) {
458 if (snxt<1E20)
return snxt;
463 if (snxt<1E20)
return snxt;
473 Double_t b,delta,xnew,ynew,znew, phi0, ddp;
481 if (point[2]*dir[2]<0) {
482 snxt = -point[2]/dir[2];
483 ptnew[0] = point[0]+snxt*dir[0];
484 ptnew[1] = point[1]+snxt*dir[1];
506 ptnew[2] = point[2]-0.5*(z1+z2);
508 Double_t rin = 0.5*(r1+r2+(r2-
r1)*ptnew[2]*zinv);
513 if (delta<0) skip =
kTRUE;
518 if (sigz*ddotn>=0 || -b+delta<1.
E-9) skip =
kTRUE;
522 znew = ptnew[2]+snxt*dir[2];
526 xnew = ptnew[0]+snxt*dir[0];
527 ynew = ptnew[1]+snxt*dir[1];
530 while (ddp<0) ddp+=360.;
531 if (ddp<=
fPhi2-fPhi1) st1 = snxt;
535 if (!skip && st1>1E10) {
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.;
546 if (ddp<=
fPhi2-fPhi1) st1 = snxt;
557 if (point[2]*dir[2]<0) {
558 snxt = -point[2]/dir[2];
559 ptnew[0] = point[0]+snxt*dir[0];
560 ptnew[1] = point[1]+snxt*dir[1];
582 ptnew[2] = point[2]-0.5*(z1+z2);
584 Double_t rin = 0.5*(r1+r2+(r2-
r1)*ptnew[2]*zinv);
589 if (delta<0) skip =
kTRUE;
594 if (sigz*ddotn<=0 || -b+delta<1.
E-9) skip =
kTRUE;
598 znew = ptnew[2]+snxt*dir[2];
602 xnew = ptnew[0]+snxt*dir[0];
603 ynew = ptnew[1]+snxt*dir[1];
606 while (ddp<0) ddp+=360.;
607 if (ddp<=
fPhi2-fPhi1) st2 = snxt;
611 if (!skip && st2>1E10) {
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.;
622 if (ddp<=
fPhi2-fPhi1) st2 = snxt;
645 safety = point[0]*s1-point[1]*
c1;
647 un = dir[0]*s1-dir[1]*
c1;
650 ptnew[0] = point[0]+s*dir[0];
651 ptnew[1] = point[1]+s*dir[1];
652 ptnew[2] = point[2]+s*dir[2];
653 if ((ptnew[1]*cm-ptnew[0]*sm)<=0) {
659 safety = -point[0]*s2+point[1]*
c2;
661 un = -dir[0]*s2+dir[1]*
c2;
664 ptnew[0] = point[0]+s*dir[0];
665 ptnew[1] = point[1]+s*dir[1];
666 ptnew[2] = point[2]+s*dir[2];
667 if ((ptnew[1]*cm-ptnew[0]*sm)>=0) {
683 Double_t rxy2 = point[0]*point[0]+point[1]*point[1];
685 Double_t rad2 = rxy2+point[2]*point[2];
688 if (r<=1
E-20) rzero=
kTRUE;
698 if (phi<0) phi+=360.;
700 if (iact<3 && safe) {
714 if (dph1<0) dph1+=360.;
717 if (dph2<0) dph2+=360.;
731 Double_t b,delta, xnew,ynew,znew, phi0, ddp;
732 Double_t rdotn = point[0]*dir[0]+point[1]*dir[1]+point[2]*dir[2];
738 if (rdotn<0)
return 0.0;
746 if (rdotn>=0)
return 0.0;
756 if (point[2]*dir[2]<0) sn1 = -point[2]/dir[2];
776 ptnew[2] = point[2]-0.5*(z1+z2);
778 Double_t rin = 0.5*(r1+r2+(r2-
r1)*ptnew[2]*zinv);
783 if (sigz*ddotn<=0)
return 0.0;
788 znew = ptnew[2]+snxt*dir[2];
792 xnew = ptnew[0]+snxt*dir[0];
793 ynew = ptnew[1]+snxt*dir[1];
796 while (ddp<0) ddp+=360.;
797 if (ddp<=
fPhi2-fPhi1) sn1 = snxt;
802 znew = ptnew[2]+snxt*dir[2];
806 xnew = ptnew[0]+snxt*dir[0];
807 ynew = ptnew[1]+snxt*dir[1];
810 while (ddp<0) ddp+=360.;
811 if (ddp<=
fPhi2-fPhi1) sn1 = snxt;
821 if (point[2]*dir[2]<0) sn1 = -point[2]/dir[2];
841 ptnew[2] = point[2]-0.5*(z1+z2);
843 Double_t rin = 0.5*(r1+r2+(r2-
r1)*ptnew[2]*zinv);
848 if (sigz*ddotn>=0)
return 0.0;
853 znew = ptnew[2]+snxt*dir[2];
857 xnew = ptnew[0]+snxt*dir[0];
858 ynew = ptnew[1]+snxt*dir[1];
861 while (ddp<0) ddp+=360.;
862 if (ddp<=
fPhi2-fPhi1) sn2 = snxt;
867 znew = ptnew[2]+snxt*dir[2];
871 xnew = ptnew[0]+snxt*dir[0];
872 ynew = ptnew[1]+snxt*dir[1];
875 while (ddp<0) ddp+=360.;
876 if (ddp<=
fPhi2-fPhi1) sn2 = snxt;
909 Double_t r2 = point[0]*point[0]+point[1]*point[1]+point[2]*point[2];
910 Double_t b = point[0]*dir[0]+point[1]*dir[1]+point[2]*dir[2];
923 s = (firstcross)?(-b-d):(-b+
d);
926 if (!check)
return s;
927 for (i=0; i<3; i++) pt[i]=point[i]+s*dir[i];
951 for (
id=0;
id<ndiv;
id++) {
967 vmulti->AddVolume(vol);
969 for (
id=0;
id<ndiv;
id++) {
979 for (
id=0;
id<ndiv;
id++) {
982 vmulti->AddVolume(vol);
989 Error(
"Divide",
"In shape %s wrong axis type for division",
GetName());
1052 param[0] =
fRmin*smin;
1053 param[0] *= param[0];
1055 param[1] =
fRmax*smax;
1056 param[1] *= param[1];
1063 while (param[3]<param[2]) param[3]+=360.;
1078 printf(
" Bounding box:\n");
1100 Int_t nbPnts = nlat*nlong+nup+ndown+ncenter;
1103 Int_t nbSegs = nlat*
fNseg + (nlat-1+nup+ndown)*nlong;
1106 nbSegs += nlong * (2-nup - ndown);
1111 nbPols += (2-nup-ndown)*fNseg;
1114 nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, nbPols, 6*nbPols);
1142 Int_t nbPnts = nlat*nlong+nup+ndown+ncenter;
1145 Int_t nbSegs = nlat*
fNseg + (nlat-1+nup+ndown)*nlong;
1148 nbSegs += nlong * (2-nup - ndown);
1153 nbPols += (2-nup-ndown)*fNseg;
1163 for (i=0; i<nlat; i++) {
1164 for (j=0; j<
fNseg; j++) {
1166 buff.
fSegs[indx++] = i*nlong+j;
1167 buff.
fSegs[indx++] = i*nlong+(j+1)%nlong;
1173 for (i=0; i<nlat-1; i++) {
1174 for (j=0; j<nlong; j++) {
1176 buff.
fSegs[indx++] = i*nlong+j;
1177 buff.
fSegs[indx++] = (i+1)*nlong+j;
1180 Int_t indup = indlong + (nlat-1)*nlong;
1184 Int_t indpup = nlat*nlong;
1185 for (j=0; j<nlong; j++) {
1187 buff.
fSegs[indx++] = j;
1188 buff.
fSegs[indx++] = indpup;
1191 Int_t inddown = indup + nup*nlong;
1195 Int_t indpdown = nlat*nlong+nup;
1196 for (j=0; j<nlong; j++) {
1198 buff.
fSegs[indx++] = (nlat-1)*nlong+j;
1199 buff.
fSegs[indx++] = indpdown;
1202 Int_t indparin = inddown + ndown*nlong;
1203 Int_t indlongin = indparin;
1204 Int_t indupin = indparin;
1205 Int_t inddownin = indparin;
1206 Int_t indphi = indparin;
1208 Int_t indptin = nlat*nlong + nup + ndown;
1209 Int_t iptcenter = indptin;
1212 indlongin = indparin + nlat*
fNseg;
1213 indupin = indlongin + (nlat-1)*nlong;
1214 inddownin = indupin + nup*nlong;
1217 for (i=0; i<nlat; i++) {
1218 for (j=0; j<
fNseg; j++) {
1219 buff.
fSegs[indx++] = c+1;
1220 buff.
fSegs[indx++] = indptin + i*nlong+j;
1221 buff.
fSegs[indx++] = indptin + i*nlong+(j+1)%nlong;
1226 for (i=0; i<nlat-1; i++) {
1227 for (j=0; j<nlong; j++) {
1228 buff.
fSegs[indx++] = c+1;
1229 buff.
fSegs[indx++] = indptin + i*nlong+j;
1230 buff.
fSegs[indx++] = indptin + (i+1)*nlong+j;
1236 Int_t indupltop = indptin + nlat*nlong;
1237 for (j=0; j<nlong; j++) {
1238 buff.
fSegs[indx++] = c+1;
1239 buff.
fSegs[indx++] = indptin + j;
1240 buff.
fSegs[indx++] = indupltop;
1246 Int_t indpdown = indptin + nlat*nlong+nup;
1247 for (j=0; j<nlong; j++) {
1248 buff.
fSegs[indx++] = c+1;
1249 buff.
fSegs[indx++] = indptin + (nlat-1)*nlong+j;
1250 buff.
fSegs[indx++] = indpdown;
1253 indphi = inddownin + ndown*nlong;
1255 Int_t indtheta = indphi;
1258 indtheta += 2*nlat + nup + ndown;
1259 for (j=0; j<nlat; j++) {
1260 buff.
fSegs[indx++] = c+2;
1261 buff.
fSegs[indx++] = j*nlong;
1263 else buff.
fSegs[indx++] = iptcenter;
1265 for (j=0; j<nlat; j++) {
1266 buff.
fSegs[indx++] = c+2;
1267 buff.
fSegs[indx++] = (j+1)*nlong-1;
1269 else buff.
fSegs[indx++] = iptcenter;
1272 buff.
fSegs[indx++] = c+2;
1273 buff.
fSegs[indx++] = nlat*nlong;
1275 else buff.
fSegs[indx++] = iptcenter;
1278 buff.
fSegs[indx++] = c+2;
1279 buff.
fSegs[indx++] = nlat*nlong+nup;
1281 else buff.
fSegs[indx++] = iptcenter;
1286 for (j=0; j<nlong; j++) {
1287 buff.
fSegs[indx++] = c+2;
1288 buff.
fSegs[indx++] = j;
1290 else buff.
fSegs[indx++] = iptcenter;
1294 for (j=0; j<nlong; j++) {
1295 buff.
fSegs[indx++] = c+2;
1296 buff.
fSegs[indx++] = (nlat-1)*nlong + j;
1298 else buff.
fSegs[indx++] = iptcenter;
1304 for (i=0; i<nlat-1; i++) {
1305 for (j=0; j<
fNseg; j++) {
1307 buff.
fPols[indx++] = 4;
1308 buff.
fPols[indx++] = indpar+i*fNseg+j;
1309 buff.
fPols[indx++] = indlong+i*nlong+(j+1)%nlong;
1310 buff.
fPols[indx++] = indpar+(i+1)*fNseg+j;
1311 buff.
fPols[indx++] = indlong+i*nlong+j;
1316 for (j=0; j<
fNseg; j++) {
1318 buff.
fPols[indx++] = 3;
1319 buff.
fPols[indx++] = indup + j;
1320 buff.
fPols[indx++] = indup + (j+1)%nlong;
1321 buff.
fPols[indx++] = indpar + j;
1326 for (j=0; j<
fNseg; j++) {
1328 buff.
fPols[indx++] = 3;
1329 buff.
fPols[indx++] = inddown + j;
1330 buff.
fPols[indx++] = indpar + (nlat-1)*fNseg + j;
1331 buff.
fPols[indx++] = inddown + (j+1)%nlong;
1337 for (i=0; i<nlat-1; i++) {
1338 for (j=0; j<
fNseg; j++) {
1339 buff.
fPols[indx++] = c+1;
1340 buff.
fPols[indx++] = 4;
1341 buff.
fPols[indx++] = indparin+i*fNseg+j;
1342 buff.
fPols[indx++] = indlongin+i*nlong+j;
1343 buff.
fPols[indx++] = indparin+(i+1)*fNseg+j;
1344 buff.
fPols[indx++] = indlongin+i*nlong+(j+1)%nlong;
1349 for (j=0; j<
fNseg; j++) {
1350 buff.
fPols[indx++] = c+1;
1351 buff.
fPols[indx++] = 3;
1352 buff.
fPols[indx++] = indupin + j;
1353 buff.
fPols[indx++] = indparin + j;
1354 buff.
fPols[indx++] = indupin + (j+1)%nlong;
1359 for (j=0; j<
fNseg; j++) {
1360 buff.
fPols[indx++] = c+1;
1361 buff.
fPols[indx++] = 3;
1362 buff.
fPols[indx++] = inddownin + j;
1363 buff.
fPols[indx++] = inddownin + (j+1)%nlong;
1364 buff.
fPols[indx++] = indparin + (nlat-1)*fNseg + j;
1370 for (i=0; i<nlat-1; i++) {
1371 buff.
fPols[indx++] = c+2;
1373 buff.
fPols[indx++] = 4;
1374 buff.
fPols[indx++] = indlong + i*nlong;
1375 buff.
fPols[indx++] = indphi + i + 1;
1376 buff.
fPols[indx++] = indlongin + i*nlong;
1377 buff.
fPols[indx++] = indphi + i;
1379 buff.
fPols[indx++] = 3;
1380 buff.
fPols[indx++] = indlong + i*nlong;
1381 buff.
fPols[indx++] = indphi + i + 1;
1382 buff.
fPols[indx++] = indphi + i;
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+1)*nlong-1;
1390 buff.
fPols[indx++] = indphi + nlat + i;
1391 buff.
fPols[indx++] = indlongin + (i+1)*nlong-1;
1392 buff.
fPols[indx++] = indphi + nlat + i + 1;
1394 buff.
fPols[indx++] = 3;
1395 buff.
fPols[indx++] = indlong + (i+1)*nlong-1;
1396 buff.
fPols[indx++] = indphi + nlat + i;
1397 buff.
fPols[indx++] = indphi + nlat + i + 1;
1401 buff.
fPols[indx++] = c+2;
1403 buff.
fPols[indx++] = 4;
1404 buff.
fPols[indx++] = indup;
1405 buff.
fPols[indx++] = indphi;
1406 buff.
fPols[indx++] = indupin;
1407 buff.
fPols[indx++] = indphi + 2*nlat;
1409 buff.
fPols[indx++] = 3;
1410 buff.
fPols[indx++] = indup;
1411 buff.
fPols[indx++] = indphi;
1412 buff.
fPols[indx++] = indphi + 2*nlat;
1414 buff.
fPols[indx++] = c+2;
1416 buff.
fPols[indx++] = 4;
1417 buff.
fPols[indx++] = indup+nlong-1;
1418 buff.
fPols[indx++] = indphi + 2*nlat;
1419 buff.
fPols[indx++] = indupin+nlong-1;
1420 buff.
fPols[indx++] = indphi + nlat;
1422 buff.
fPols[indx++] = 3;
1423 buff.
fPols[indx++] = indup+nlong-1;
1424 buff.
fPols[indx++] = indphi + 2*nlat;
1425 buff.
fPols[indx++] = indphi + nlat;
1429 buff.
fPols[indx++] = c+2;
1431 buff.
fPols[indx++] = 4;
1432 buff.
fPols[indx++] = inddown;
1433 buff.
fPols[indx++] = indphi + 2*nlat + nup;
1434 buff.
fPols[indx++] = inddownin;
1435 buff.
fPols[indx++] = indphi + nlat-1;
1437 buff.
fPols[indx++] = 3;
1438 buff.
fPols[indx++] = inddown;
1439 buff.
fPols[indx++] = indphi + 2*nlat + nup;
1440 buff.
fPols[indx++] = indphi + nlat-1;
1442 buff.
fPols[indx++] = c+2;
1444 buff.
fPols[indx++] = 4;
1445 buff.
fPols[indx++] = inddown+nlong-1;
1446 buff.
fPols[indx++] = indphi + 2*nlat-1;
1447 buff.
fPols[indx++] = inddownin+nlong-1;
1448 buff.
fPols[indx++] = indphi + 2*nlat+nup;
1450 buff.
fPols[indx++] = 3;
1451 buff.
fPols[indx++] = inddown+nlong-1;
1452 buff.
fPols[indx++] = indphi + 2*nlat-1;
1453 buff.
fPols[indx++] = indphi + 2*nlat+nup;
1459 for (j=0; j<
fNseg; j++) {
1460 buff.
fPols[indx++] = c+2;
1462 buff.
fPols[indx++] = 4;
1463 buff.
fPols[indx++] = indpar+j;
1464 buff.
fPols[indx++] = indtheta + j;
1465 buff.
fPols[indx++] = indparin + j;
1466 buff.
fPols[indx++] = indtheta + (j+1)%nlong;
1468 buff.
fPols[indx++] = 3;
1469 buff.
fPols[indx++] = indpar+j;
1470 buff.
fPols[indx++] = indtheta + j;
1471 buff.
fPols[indx++] = indtheta + (j+1)%nlong;
1476 for (j=0; j<
fNseg; j++) {
1477 buff.
fPols[indx++] = c+2;
1479 buff.
fPols[indx++] = 4;
1480 buff.
fPols[indx++] = indpar+(nlat-1)*fNseg+j;
1481 buff.
fPols[indx++] = indtheta + (1-nup)*nlong +(j+1)%nlong;
1482 buff.
fPols[indx++] = indparin + (nlat-1)*fNseg + j;
1483 buff.
fPols[indx++] = indtheta + (1-nup)*nlong + j;
1485 buff.
fPols[indx++] = 3;
1486 buff.
fPols[indx++] = indpar+(nlat-1)*fNseg+j;
1487 buff.
fPols[indx++] = indtheta + (1-nup)*nlong +(j+1)%nlong;
1488 buff.
fPols[indx++] = indtheta + (1-nup)*nlong + j;
1500 Double_t r2 = point[0]*point[0]+point[1]*point[1]+point[2]*point[2];
1503 if (r<=1
E-20) rzero=
kTRUE;
1524 for (
Int_t i=0; i<4; i++) saf[i]=-saf[i];
1536 out <<
" // Shape: " <<
GetName() <<
" type: " <<
ClassName() << std::endl;
1537 out <<
" rmin = " <<
fRmin <<
";" << std::endl;
1538 out <<
" rmax = " <<
fRmax <<
";" << std::endl;
1539 out <<
" theta1 = " <<
fTheta1<<
";" << std::endl;
1540 out <<
" theta2 = " <<
fTheta2 <<
";" << std::endl;
1541 out <<
" phi1 = " <<
fPhi1 <<
";" << std::endl;
1542 out <<
" phi2 = " <<
fPhi2 <<
";" << std::endl;
1543 out <<
" TGeoShape *" <<
GetPointerName() <<
" = new TGeoSphere(\"" <<
GetName() <<
"\",rmin,rmax,theta1, theta2,phi1,phi2);" << std::endl;
1554 Error(
"SetDimensions",
"invalid parameters rmin/rmax");
1560 if (theta1 >= theta2 || theta1<0 || theta1>180 || theta2>180) {
1561 Error(
"SetDimensions",
"invalid parameters theta1/theta2");
1568 if (phi1<0)
fPhi1+=360.;
1585 if (nparam > 2) theta1 = param[2];
1586 if (nparam > 3) theta2 = param[3];
1587 if (nparam > 4) phi1 = param[4];
1588 if (nparam > 5) phi2 = param[5];
1608 if (dphi<0) dphi+=360;
1620 Error(
"SetPoints",
"Input array is NULL");
1651 for (i = 0; i < nlat; i++) {
1652 theta = theta1+(nup+i)*dtheta;
1656 for (j = 0; j < nlong; j++) {
1660 points[indx++] = zi * cphi;
1661 points[indx++] = zi * sphi;
1668 points[indx++] = 0.;
1669 points[indx++] = 0.;
1670 points[indx++] =
fRmax;
1674 points[indx++] = 0.;
1675 points[indx++] = 0.;
1676 points[indx++] = -
fRmax;
1682 for (i = 0; i < nlat; i++) {
1683 theta = theta1+(nup+i)*dtheta;
1687 for (j = 0; j < nlong; j++) {
1691 points[indx++] = zi * cphi;
1692 points[indx++] = zi * sphi;
1699 points[indx++] = 0.;
1700 points[indx++] = 0.;
1701 points[indx++] =
fRmin;
1705 points[indx++] = 0.;
1706 points[indx++] = 0.;
1707 points[indx++] = -
fRmin;
1713 points[indx++] = 0.;
1714 points[indx++] = 0.;
1715 points[indx++] = 0.;
1725 Error(
"SetPoints",
"Input array is NULL");
1756 for (i = 0; i < nlat; i++) {
1757 theta = theta1+(nup+i)*dtheta;
1761 for (j = 0; j < nlong; j++) {
1765 points[indx++] = zi * cphi;
1766 points[indx++] = zi * sphi;
1773 points[indx++] = 0.;
1774 points[indx++] = 0.;
1775 points[indx++] =
fRmax;
1779 points[indx++] = 0.;
1780 points[indx++] = 0.;
1781 points[indx++] = -
fRmax;
1787 for (i = 0; i < nlat; i++) {
1788 theta = theta1+(nup+i)*dtheta;
1792 for (j = 0; j < nlong; j++) {
1796 points[indx++] = zi * cphi;
1797 points[indx++] = zi * sphi;
1804 points[indx++] = 0.;
1805 points[indx++] = 0.;
1806 points[indx++] =
fRmin;
1810 points[indx++] = 0.;
1811 points[indx++] = 0.;
1812 points[indx++] = -
fRmin;
1818 points[indx++] = 0.;
1819 points[indx++] = 0.;
1820 points[indx++] = 0.;
1843 nvert = nlat*nlong+nup+ndown+ncenter;
1846 nsegs = nlat*
fNseg + (nlat-1+nup+ndown)*nlong;
1849 nsegs += nlong * (2-nup - ndown);
1854 npols += (2-nup-ndown)*fNseg;
1876 Int_t numPoints = 0;
1878 else numPoints = nlat*nlong+nup+ndown+ncenter;
1924 Int_t nbPnts = nlat*nlong+nup+ndown+ncenter;
1927 Int_t nbSegs = nlat*
fNseg + (nlat-1+nup+ndown)*nlong;
1930 nbSegs += nlong * (2-nup - ndown);
1935 nbPols += (2-nup-ndown)*fNseg;
1937 if (buffer.
SetRawSizes(nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, nbPols, 6*nbPols)) {
1960 for (
Int_t i=0; i<vecsize; i++) inside[i] =
Contains(&points[3*i]);
1970 for (
Int_t i=0; i<vecsize; i++)
ComputeNormal(&points[3*i], &dirs[3*i], &norms[3*i]);
1978 for (
Int_t i=0; i<vecsize; i++) dists[i] =
DistFromInside(&points[3*i], &dirs[3*i], 3, step[i]);
1986 for (
Int_t i=0; i<vecsize; i++) dists[i] =
DistFromOutside(&points[3*i], &dirs[3*i], 3, step[i]);
1996 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 const char * GetAxisName(Int_t iaxis) const
Returns name of axis IAXIS.
virtual TBuffer3D * MakeBuffer3D() const
Creates a TBuffer3D describing this shape.
virtual void GetBoundingCylinder(Double_t *param) const
— Fill vector param[4] with the bounding cylinder parameters.
#define snext(osub1, osub2)
Int_t GetNsegments() const
Get number of segments approximating circles.
Long64_t LocMax(Long64_t n, const T *a)
void SetFinder(TGeoPatternFinder *finder)
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 void SetSegsAndPols(TBuffer3D &buff) const
Fill TBuffer3D structure for segments and polygons.
void AddNodeOffset(TGeoVolume *vol, Int_t copy_no, Double_t offset=0, Option_t *option="")
Add a division node to the list of nodes.
Int_t GetBasicColor() const
Get the basic color (0-7).
virtual void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const
Returns numbers of vertices, segments and polygons composing the shape mesh.
ClassImp(TGeoSphere) TGeoSphere
Default constructor.
Short_t Min(Short_t a, Short_t b)
virtual void InspectShape() const
print shape parameters
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 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 DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=0) const
Compute distance from outside point to surface of the box.
Int_t GetNdaughters() const
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()
const char * Data() const
void AddVolume(TGeoVolume *vol)
Add a volume with valid shape to the list of volumes.
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 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...
virtual Int_t GetNmeshVertices() const
Return number of vertices of the mesh representation.
Double_t ATan2(Double_t, Double_t)
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const
Compute distance from array of input points having directions specisied by dirs. Store output in dist...
virtual 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
void SetSectionsValid(UInt_t mask)
void TransformPoints(Double_t *points, UInt_t NbPoints) const
Tranform a set of points (LocalToMaster)
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
compute closest distance from point px,py to each corner
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...
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 Double_t Capacity() const
Computes capacity of the shape in [length^3].
virtual const char * ClassName() const
Returns name of class to which the object belongs.
unsigned int r1[N_CITIES]
static void DistToCone(const Double_t *point, const Double_t *dir, Double_t dz, Double_t r1, Double_t r2, Double_t &b, Double_t &delta)
Static method to compute distance to a conical surface with :
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.
Bool_t TestBit(UInt_t f) const
Bool_t SetRawSizes(UInt_t reqPnts, UInt_t reqPntsCapacity, UInt_t reqSegs, UInt_t reqSegsCapacity, UInt_t reqPols, UInt_t reqPolsCapacity)
Set kRaw tessellation section of buffer with supplied sizes.
Generic 3D primitive description class.
virtual const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
Fills a static 3D buffer and returns a reference.
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)
virtual const char * GetName() const
Get the shape name.
void SetBoxDimensions(Double_t dx, Double_t dy, Double_t dz, Double_t *origin=0)
Set parameters of the box.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
virtual void SetPoints(Double_t *points) const
create sphere mesh points
virtual void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const
Compute safe distance from each of the points in the input array.
Int_t IsOnBoundary(const Double_t *point) const
Check if a point in local sphere coordinates is close to a boundary within shape 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,s2.
virtual void InspectShape() const
Prints shape parameters.
R__EXTERN TGeoManager * gGeoManager
virtual void FillBuffer3D(TBuffer3D &buffer, Int_t reqSections, Bool_t localFrame) const
Fills the supplied buffer, with sections in desired frame See TBuffer3D.h for explanation of sections...
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
virtual void ComputeBBox()
compute bounding box of the sphere Double_t xmin, xmax, ymin, ymax, zmin, zmax;
Int_t ShapeDistancetoPrimitive(Int_t numpoints, Int_t px, Int_t py) const
Returns distance to shape primitive mesh.
const char * GetPointerName() const
Provide a pointer name containing uid.
void SetShapeBit(UInt_t f, Bool_t set)
Equivalent of TObject::SetBit.
virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const
Get range of shape for a given axis.
Bool_t TestShapeBit(UInt_t f) const
virtual void SetDimensions(Double_t *param)
Set dimensions of the spherical segment starting from a list of parameters.
TGeoMedium * GetMedium() const
Short_t Max(Short_t a, Short_t b)
virtual Bool_t Contains(const Double_t *point) const
test if point is inside this sphere check Rmin<=R<=Rmax
virtual void Sizeof3D() const
ClassImp(TSlaveInfo) Int_t TSlaveInfo const TSlaveInfo * si
Used to sort slaveinfos by ordinal.
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 SetNumberOfDivisions(Int_t p)
Set the number of divisions of mesh circles keeping aspect ratio.
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)
TObject * At(Int_t idx) const
Long64_t LocMin(Long64_t n, const T *a)
double norm(double *x, double *p)
static char * skip(char **buf, const char *delimiters)
unsigned int r2[N_CITIES]
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...
Bool_t SectionsValid(UInt_t mask) const
virtual void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const
Compute distance from array of input points having directions specisied by dirs. Store output in dist...