54 TGeoPgon::ThreadData_t::ThreadData_t() :
55 fIntBuffer(0), fDblBuffer(0)
81 std::vector<ThreadData_t*>::iterator i =
fThreadData.begin();
101 for (
Int_t tid=0; tid<nthreads; tid++) {
181 Double_t rmin1, rmax1, rmin2, rmax2, dphi, dz;
185 for (ipl=0; ipl<
fNz-1; ipl++) {
186 dz =
fZ[ipl+1]-
fZ[ipl];
190 rmin2 =
fRmin[ipl+1];
191 rmax2 =
fRmax[ipl+1];
192 capacity +=
fNedges*(tphi2/3.)*dz*(rmax1*rmax1+rmax1*rmax2+rmax2*rmax2 -
193 rmin1*rmin1-rmin1*rmin2-rmin2*rmin2);
204 for (
Int_t isec=0; isec<
fNz-1; isec++) {
205 if (
fZ[isec]>
fZ[isec+1]) {
207 Fatal(
"ComputeBBox",
"Wrong section order");
214 Fatal(
"ComputeBBox",
"Shape %s at index %d: Not allowed first two or last two sections at same Z",
246 if (ddp<0) ddp+= 360;
247 if (ddp<=fDphi) xmax = rmax;
249 if (ddp<0) ddp+= 360;
250 if (ddp<=fDphi) ymax = rmax;
252 if (ddp<0) ddp+= 360;
253 if (ddp<=fDphi) xmin = -rmax;
255 if (ddp<0) ddp+= 360;
256 if (ddp<=fDphi) ymin = -rmax;
262 fDZ = 0.5*(zmax-zmin);
277 if (phi1<0) phi1+=360;
292 if (ipl==(
fNz-1) || ipl<0) {
297 Int_t iplclose = ipl;
298 if ((
fZ[ipl+1]-point[2])<(point[2]-
fZ[ipl])) iplclose++;
303 while (phi<
fPhi1) phi+=360.;
311 if (iplclose==0 || iplclose==(
fNz-1)) {
330 dz =
fZ[ipl+1]-
fZ[ipl];
332 rmin2 =
fRmin[ipl+1];
336 ta = (rmin2-rmin1)/dz;
338 rpgon = rmin1 + (point[2]-fZ[ipl])*ta;
346 rpgon =
fRmax[ipl] + (point[2]-fZ[ipl])*ta;
352 if (norm[0]*dir[0]+norm[1]*dir[1]+norm[2]*dir[2]<0) {
370 while (phi <
fPhi1) phi += 360.0;
391 if (r<rmin)
return kFALSE;
392 if (r>rmax)
return kFALSE;
396 Double_t dzrat = (point[2]-fZ[iz])/dz;
399 if (r < rmin)
return kFALSE;
401 if (r > rmax)
return kFALSE;
412 if (iact<3 && safe) {
421 if (dir[2]>=0)
return 0.;
426 if (dir[2]<=0)
return 0.;
440 if ((point[0]*dir[1]-point[1]*dir[0])>0) {
478 Double_t rproj = point[0]*cphi+point[1]*sphi;
481 if (rproj>
fRmin[ipln] && rproj<
fRmin[ipln+1])
return 0.0;
482 if (rproj<
fRmax[ipln] && rproj>
fRmax[ipln+1])
return 0.0;
485 if (rproj<
fRmin[ipln] && rproj>
fRmin[ipln+1])
return 0.0;
486 if (rproj>
fRmax[ipln] && rproj<
fRmax[ipln+1])
return 0.0;
509 while (phi<
fPhi1) phi+=360.;
511 if (ipsec>
fNedges-1) ipsec = -1;
530 Double_t rdotn = point[0]*dir[0]+point[1]*dir[1];
532 sphi[icrossed] = stepmax;
533 iphi[icrossed++] = istart;
536 sphi[icrossed] =
TMath::Sqrt((point[0]*point[0]+point[1]*point[1])/(1.-dir[2]*dir[2]));
537 iphi[icrossed++] = istart;
538 if (sphi[icrossed-1]>stepmax) {
539 sphi[icrossed-1] = stepmax;
543 while (phi<
fPhi1) phi+=360.;
545 if (istart>
fNedges-1) istart=-1;
546 iphi[icrossed] = istart;
547 sphi[icrossed] = stepmax;
553 if (istart<0) ist=(incsec>0)?0:
fNedges;
554 else ist=(incsec>0)?(istart+1):istart;
560 if (istart<0) gapdone =
kTRUE;
561 phi = phi1+ist*divphi;
565 if (!crossing) sphi[icrossed] = stepmax;
566 iphi[icrossed++] = istart;
568 if (sphi[icrossed-1]>stepmax) {
569 sphi[icrossed-1] = stepmax;
573 istart = (incsec>0)?0:(
fNedges-1);
580 if (gapdone)
return icrossed;
583 ist=(incsec>0)?(istart+1):istart;
601 if (iphi[0]<0 && nphi==1)
return kFALSE;
617 rmin =
Rpg(point[2], ipl,
kTRUE, apg,bpg);
618 rmax =
Rpg(point[2], ipl,
kFALSE, apg,bpg);
628 memcpy(pt,point,3*
sizeof(
Double_t));
629 for (iphcrt=0; iphcrt<nphi; iphcrt++) {
634 if (iphi[iphcrt]<0) {
639 snextphi = stepphi[iphcrt];
640 phi = phi1+(iphi[iphcrt]+0.5)*divphi;
643 rproj = pt[0]*cosph+pt[1]*sinph;
645 ndot = dir[0]*cosph+dir[1]*sinph;
647 dist = (ndot>0)?((rmax-rproj)/ndot):((rmin-rproj)/ndot);
650 if (dist < (snextphi-step)) {
652 if (snext<stepmax)
return kTRUE;
656 for (i=0; i<3; i++) pt[i] = point[i]+step*dir[i];
672 if (iphi[0]<0 && nphi==1)
return kFALSE;
688 rmin =
Rpg(point[2], ipl,
kTRUE, apg,bpg);
689 rmax =
Rpg(point[2], ipl,
kFALSE, apg,bpg);
699 memcpy(pt,point,3*
sizeof(
Double_t));
700 for (iphcrt=0; iphcrt<nphi; iphcrt++) {
701 if (step>stepmax)
return kFALSE;
702 snextphi = stepphi[iphcrt];
703 if (iphi[iphcrt]<0) {
704 if (iphcrt==nphi-1)
return kFALSE;
705 if (snextphi>stepmax)
return kFALSE;
706 for (i=0; i<3; i++) pt[i] = point[i]+snextphi*dir[i];
707 phi = phi1+(iphi[iphcrt+1]+0.5)*divphi;
710 rproj = pt[0]*cosph+pt[1]*sinph;
711 if (rproj<rmin || rproj>rmax) {
719 phi = phi1+(iphi[iphcrt]+0.5)*divphi;
722 rproj = pt[0]*cosph+pt[1]*sinph;
724 ndot = dir[0]*cosph+dir[1]*sinph;
732 if (snext<stepmax)
return kTRUE;
735 for (i=0; i<3; i++) pt[i] = point[i]+step*dir[i];
763 Int_t incseg = (dir[2]>0)?1:-1;
765 Int_t iplstart = ipl;
769 Double_t rpgin=0,rpgout=0,apgin=0,apgout=0,bpgin=0,bpgout=0;
776 memcpy(pt,point,3*
sizeof(
Double_t));
777 for (iphcrt=iphstart; iphcrt<nphi; iphcrt++) {
783 if (iphi[iphcrt]<0) {
787 snextphi = stepphi[iphcrt];
788 phi = phi1+(iphi[iphcrt]+0.5)*divphi;
791 Double_t rproj =
Rproj(pt[2], pt, dir, cosph, sinph, apr, bpr);
793 while (ipl>=0 && ipl<
fNz-1) {
796 distz = (
fZ[ipl+((1+incseg)>>1)]-pt[2])*invdir;
798 dz =
fZ[ipl+1] -
fZ[ipl];
800 rnew = apr+bpr*fZ[ipl];
802 if (rpg<=0) din=distz;
804 if (rpg<=0) dout=distz;
807 rpgin =
Rpg(pt[2], ipl,
kTRUE, apgin, bpgin);
810 znew = (apr-apgin)/db;
811 din = (znew-pt[2])*invdir;
813 rpgout =
Rpg(pt[2], ipl,
kFALSE, apgout, bpgout);
816 znew = (apr-apgout)/db;
817 dout = (znew-pt[2])*invdir;
823 if (iphcrt==iphstart && ipl==iplstart) {
824 if (rproj<rpgin+1.
E-8) {
827 snext = (din<0)?step:(step+din);
835 }
else if (rproj>rpgout-1.
E-8) {
838 snext = (dout<0)?step:(step+dout);
851 for (i=0; i<3; i++) pt[i] = point[i] + snextphi*dir[i];
863 if ((ipl+incseg<0) || (ipl+incseg>
fNz-2)) {
885 if (iphi[0]<0 && nphi==1)
return kFALSE;
890 Int_t incseg = (dir[2]>0)?1:-1;
894 if (incseg<0)
return kFALSE;
898 if (incseg>0)
return kFALSE;
902 if ((ipl+incseg)<0 || (ipl+incseg)>
fNz-1)
return kFALSE;
921 memcpy(pt,point,3*
sizeof(
Double_t));
922 for (iphcrt=0; iphcrt<nphi; iphcrt++) {
924 if (step>stepmax)
return kFALSE;
926 snextphi = stepphi[iphcrt];
927 if (iphi[iphcrt]<0) {
928 if (iphcrt==nphi-1)
return kFALSE;
929 if (snextphi>stepmax)
return kFALSE;
930 for (i=0; i<3; i++) pt[i] = point[i]+snextphi*dir[i];
934 while (pt[2]>
fZ[ipl+1]) {
939 while (pt[2]<
fZ[ipl]) {
945 rpgin =
Rpg(pt[2],ipl,
kTRUE,apg,bpg);
947 phi = phi1+(iphi[iphcrt+1]+0.5)*divphi;
951 rproj = pt[0]*cosph+pt[1]*sinph;
952 if (rproj<rpgin || rproj>rpgout) {
971 if (sstart>stepmax)
return kFALSE;
973 memcpy(pt, point, 3*
sizeof(
Double_t));
974 if (sstart>0)
for (
Int_t i=0; i<3; i++) pt[i] += sstart*dir[i];
977 Int_t incseg = (dir[2]>0)?1:-1;
985 Rproj(pt[2], point, dir, cphi, sphi, apr, bpr);
989 Int_t isegstart = ipl;
990 Int_t iseglast = (incseg>0)?(
fNz-1):-1;
991 Double_t din,dout,rdot,rnew,rpg,apg,bpg,db,znew;
993 for (ipl=isegstart; ipl!=iseglast; ipl+=incseg) {
994 step = (
fZ[ipl+1-((1+incseg)>>1)]-pt[2])*invdir;
1003 dz =
fZ[ipl+1]-
fZ[ipl];
1007 else rdot = dir[0]*cphi+dir[1]*sphi+dir[2]*(
fRmin[ipl]-
fRmin[ipl+1])/dz;
1012 rnew = apr+bpr*fZ[ipl];
1014 if (rpg<=0) din=(fZ[ipl]-pt[2])*invdir;
1016 rpg =
Rpg(pt[2], ipl,
kTRUE, apg, bpg);
1019 znew = (apr-apg)/db;
1020 if (znew>fZ[ipl] && znew<fZ[ipl+1]) {
1021 din=(znew-pt[2])*invdir;
1030 else rdot = dir[0]*cphi+dir[1]*sphi+dir[2]*(
fRmax[ipl]-
fRmax[ipl+1])/dz;
1035 rnew = apr+bpr*fZ[ipl];
1037 if (rpg<=0) dout=(fZ[ipl]-pt[2])*invdir;
1039 rpg =
Rpg(pt[2], ipl,
kFALSE, apg, bpg);
1042 znew = (apr-apg)/db;
1043 if (znew>fZ[ipl] && znew<fZ[ipl+1]) dout=(znew-pt[2])*invdir;
1056 snext = sstart+step;
1069 if (iact<3 && safe) {
1082 memcpy(pt,point,3*
sizeof(
Double_t));
1097 if (r2>(radmax*radmax) || pt[2]<
fZ[0] || pt[2]>
fZ[
fNz-1]) {
1098 pt[2] -= 0.5*(
fZ[0]+
fZ[
fNz-1]);
1104 for (i=0; i<3; i++) pt[i] += snext*dir[i];
1117 while (phi <
fPhi1) phi += 360.0;
1120 ipsec =
Int_t(ddp/divphi);
1123 if (rpr>=rmin && rpr<=rmax)
return snext;
1137 if (
SliceCrossingZ(pt, dir, icrossed, iph, sph, snewcross, stepmax))
return (snext+snewcross);
1144 while (ph<
fPhi1) ph+=360.;
1146 if (ipsec>
fNedges-1) ipsec = -1;
1154 if (ipl==
fNz-1) ipl--;
1165 Double_t rproj = pt[0]*cphi+pt[1]*sphi;
1167 if (rproj<
fRmin[ipl] && rproj>
fRmin[ipl+1] && dir[2]>0)
return 0.0;
1168 if (rproj>
fRmin[ipl] && rproj<
fRmin[ipl+1] && dir[2]<0)
return 0.0;
1169 if (rproj>
fRmax[ipl] && rproj<
fRmax[ipl+1] && dir[2]>0)
return 0.0;
1170 if (rproj<
fRmax[ipl] && rproj>
fRmax[ipl+1] && dir[2]<0)
return 0.0;
1176 if (rproj<rpgout+1.
E-8) {
1179 if (rproj>rpgin-1.
E-8) {
1190 if (safrmin<safz && safrmin<safrmax && safrmin<safphi) {
1194 if (ndotd>0)
return snext;
1197 if (!done && safrmax<safz && safrmax<safphi) {
1200 if (ndotd<0)
return snext;
1203 if (!done && safz<safphi) {
1207 if (iplc==0 || iplc==
fNz-1) {
1208 if (pt[2]*dir[2]<0)
return snext;
1240 if (!icrossed)
return snext;
1242 if (iph[0]>=0 && sph[0]>1.
E-8)
return snext;
1245 if (
SliceCrossing(pt, dir, icrossed, iph, sph, snewcross, stepmax)) {
1287 Error(
"Divide",
"makes no sense dividing a pgon on radius");
1291 Error(
"Divide",
"ndiv should divide number of pgon edges");
1302 for (is=0; is<
fNz; is++)
1305 for (
id=0;
id<ndiv;
id++) {
1312 for (ipl=0; ipl<fNz-1; ipl++) {
1313 if (start<
fZ[ipl])
continue;
1315 if ((start+ndiv*step)>
fZ[ipl+1])
continue;
1323 Error(
"Divide",
"cannot divide pcon on Z if divided region is not between 2 consecutive planes");
1326 finder =
new TGeoPatternZ(voldiv, ndiv, start, start+ndiv*step);
1331 for (
id=0;
id<ndiv;
id++) {
1339 ((
TGeoPgon*)shape)->DefineSection(0, -step/2, rmin1, rmax1);
1340 ((
TGeoPgon*)shape)->DefineSection(1, step/2, rmin2, rmax2);
1348 Error(
"Divide",
"Wrong axis type for division");
1359 param[0] =
fRmin[0];
1360 param[1] =
fRmax[0];
1362 if (
fRmin[i] < param[0]) param[0] =
fRmin[i];
1363 if (
fRmax[i] > param[1]) param[1] =
fRmax[i];
1367 param[0] *= param[0];
1368 param[1] *= param[1];
1375 param[3] = param[2]+
fDphi;
1396 if (nz < 2)
return 0;
1398 if (nbPnts <= 0)
return 0;
1402 Int_t nbSegs = 4*(nz*n-1+(specialCase ==
kTRUE));
1403 Int_t nbPols = 2*(nz*n-1+(specialCase ==
kTRUE));
1406 nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, nbPols, 6*nbPols);
1426 if (nbPnts <= 0)
return;
1432 Int_t indx, indx2, k;
1437 for (i = 0; i < nz*2; i++) {
1439 for (j = 1; j <
n; j++) {
1441 buff.
fSegs[indx++] = indx2+j-1;
1442 buff.
fSegs[indx++] = indx2+j;
1446 buff.
fSegs[indx++] = indx2+j-1;
1447 buff.
fSegs[indx++] = indx2;
1452 for (i = 0; i < 2; i++) {
1453 indx2 = i*(nz-1)*2*n;
1454 for (j = 0; j <
n; j++) {
1456 buff.
fSegs[indx++] = indx2+j;
1457 buff.
fSegs[indx++] = indx2+n+j;
1462 for (i = 0; i < (nz-1); i++) {
1465 for (j = 0; j <
n; j++) {
1466 buff.
fSegs[indx++] = c+2;
1467 buff.
fSegs[indx++] = indx2+j;
1468 buff.
fSegs[indx++] = indx2+n*2+j;
1472 for (j = 0; j <
n; j++) {
1473 buff.
fSegs[indx++] = c+3;
1474 buff.
fSegs[indx++] = indx2+j;
1475 buff.
fSegs[indx++] = indx2+n*2+j;
1482 for (i = 1; i < (nz-1); i++) {
1483 for (j = 0; j < 2; j++) {
1485 buff.
fSegs[indx++] = 2*i * n + j*(n-1);
1486 buff.
fSegs[indx++] = (2*i+1) * n + j*(n-1);
1497 for (j = 0; j < n-1; j++) {
1498 buff.
fPols[indx++] = c+3;
1499 buff.
fPols[indx++] = 4;
1500 buff.
fPols[indx++] = 2*nz*m+i*n+j;
1501 buff.
fPols[indx++] = i*(nz*2-2)*m+m+j;
1502 buff.
fPols[indx++] = 2*nz*m+i*n+j+1;
1503 buff.
fPols[indx++] = i*(nz*2-2)*m+j;
1506 buff.
fPols[indx++] = c+3;
1507 buff.
fPols[indx++] = 4;
1508 buff.
fPols[indx++] = 2*nz*m+i*n+j;
1509 buff.
fPols[indx++] = i*(nz*2-2)*m+m+j;
1510 buff.
fPols[indx++] = 2*nz*m+i*
n;
1511 buff.
fPols[indx++] = i*(nz*2-2)*m+j;
1514 for (j = 0; j < n-1; j++) {
1515 buff.
fPols[indx++] = c+3;
1516 buff.
fPols[indx++] = 4;
1517 buff.
fPols[indx++] = i*(nz*2-2)*m+j;
1518 buff.
fPols[indx++] = 2*nz*m+i*n+j+1;
1519 buff.
fPols[indx++] = i*(nz*2-2)*m+m+j;
1520 buff.
fPols[indx++] = 2*nz*m+i*n+j;
1523 buff.
fPols[indx++] = c+3;
1524 buff.
fPols[indx++] = 4;
1525 buff.
fPols[indx++] = i*(nz*2-2)*m+j;
1526 buff.
fPols[indx++] = 2*nz*m+i*
n;
1527 buff.
fPols[indx++] = i*(nz*2-2)*m+m+j;
1528 buff.
fPols[indx++] = 2*nz*m+i*n+j;
1532 for (k = 0; k < (nz-1); k++) {
1534 for (j = 0; j < n-1; j++) {
1535 buff.
fPols[indx++] = c+i;
1536 buff.
fPols[indx++] = 4;
1537 buff.
fPols[indx++] = nz*2*m+(2*k+i*1+2)*n+j+1;
1538 buff.
fPols[indx++] = (2*k+i*1+2)*m+j;
1539 buff.
fPols[indx++] = nz*2*m+(2*k+i*1+2)*n+j;
1540 buff.
fPols[indx++] = (2*k+i*1)*m+j;
1543 buff.
fPols[indx++] = c+i;
1544 buff.
fPols[indx++] = 4;
1545 buff.
fPols[indx++] = nz*2*m+(2*k+i*1+2)*n;
1546 buff.
fPols[indx++] = (2*k+i*1+2)*m+j;
1547 buff.
fPols[indx++] = nz*2*m+(2*k+i*1+2)*n+j;
1548 buff.
fPols[indx++] = (2*k+i*1)*m+j;
1551 for (j = 0; j < n-1; j++) {
1552 buff.
fPols[indx++] = c+i;
1553 buff.
fPols[indx++] = 4;
1554 buff.
fPols[indx++] = (2*k+i*1)*m+j;
1555 buff.
fPols[indx++] = nz*2*m+(2*k+i*1+2)*n+j;
1556 buff.
fPols[indx++] = (2*k+i*1+2)*m+j;
1557 buff.
fPols[indx++] = nz*2*m+(2*k+i*1+2)*n+j+1;
1560 buff.
fPols[indx++] = c+i;
1561 buff.
fPols[indx++] = 4;
1562 buff.
fPols[indx++] = (2*k+i*1)*m+j;
1563 buff.
fPols[indx++] = nz*2*m+(2*k+i*1+2)*n+j;
1564 buff.
fPols[indx++] = (2*k+i*1+2)*m+j;
1565 buff.
fPols[indx++] = nz*2*m+(2*k+i*1+2)*n;
1573 for (k = 0; k < (nz-1); k++) {
1574 buff.
fPols[indx++] = c+2;
1575 buff.
fPols[indx++] = 4;
1576 buff.
fPols[indx++] = k==0 ? indx2 : indx2+2*nz*n+2*(k-1);
1577 buff.
fPols[indx++] = indx2+2*(k+1)*n;
1578 buff.
fPols[indx++] = indx2+2*nz*n+2*k;
1579 buff.
fPols[indx++] = indx2+(2*k+3)*n;
1581 buff.
fPols[indx++] = c+2;
1582 buff.
fPols[indx++] = 4;
1583 buff.
fPols[indx++] = k==0 ? indx2+n-1 : indx2+2*nz*n+2*(k-1)+1;
1584 buff.
fPols[indx++] = indx2+(2*k+3)*n+n-1;
1585 buff.
fPols[indx++] = indx2+2*nz*n+2*k+1;
1586 buff.
fPols[indx++] = indx2+2*(k+1)*n+n-1;
1588 buff.
fPols[indx-8] = indx2+
n;
1589 buff.
fPols[indx-2] = indx2+2*n-1;
1602 if (ipl<0 || ipl>
fNz-2) {
1603 Fatal(
"Rpg",
"Plane index parameter ipl=%i out of range\n", ipl);
1623 a = (r1*fZ[ipl+1]-
r2*fZ[ipl])*dzinv;
1640 a = ((point[0]*dir[2]-point[2]*dir[0])*cphi+(point[1]*dir[2]-point[2]*dir[1])*sphi)*invdirz;
1641 b = (dir[0]*cphi+dir[1]*sphi)*invdirz;
1654 if (ipl<0 || ipl>
fNz-2)
return (safmin+1.);
1657 if (dz<1
E-9)
return 1E9;
1658 Double_t znew = point[2] - 0.5*(fZ[ipl]+fZ[ipl+1]);
1670 r =
TMath::Sqrt(point[0]*point[0]+point[1]*point[1]);
1680 saf[2] = (rout-
r)*cr2;
1681 for (i=0; i<3; i++) saf[i]=-saf[i];
1684 if (safe<0) safe = 0;
1689 if (rmin1+rmin2>1
E-10) {
1690 ta = (rmin2-rmin1)/dz;
1692 rpgon = rmin1 + (point[2]-fZ[ipl])*ta;
1693 saf[1] = (r-rpgon)*calf;
1697 ta = (rmax2-rmax1)/dz;
1699 rpgon = rmax1 + (point[2]-fZ[ipl])*ta;
1700 saf[2] = (rpgon-
r)*calf;
1705 for (i=0; i<3; i++) saf[i]=-saf[i];
1721 Int_t ipl, iplane, iphi;
1727 if (ipl==(
fNz-1))
return 0;
1728 if (ipl<0)
return 0;
1729 dz = 0.5*(
fZ[ipl+1]-
fZ[ipl]);
1730 if (dz<1
E-8)
return 0;
1741 while ((iplane<
fNz-1) && saftmp<1E10) {
1743 if (saftmp<safmin) safmin=saftmp;
1749 while ((iplane>=0) && saftmp<1E10) {
1751 if (saftmp<safmin) safmin=saftmp;
1759 else if (ipl==
fNz-1) ipl=
fNz-2;
1760 dz = 0.5*(
fZ[ipl+1]-
fZ[ipl]);
1763 if (ipl>
fNz-2)
return 0.;
1764 dz = 0.5*(
fZ[ipl+1]-
fZ[ipl]);
1773 while ((iplane<
fNz-1) && saftmp<1E10) {
1775 if (saftmp<safmin) safmin=saftmp;
1781 while ((iplane>=0) && saftmp<1E10) {
1783 if (saftmp<safmin) safmin=saftmp;
1795 out <<
" // Shape: " <<
GetName() <<
" type: " <<
ClassName() << std::endl;
1796 out <<
" phi1 = " <<
fPhi1 <<
";" << std::endl;
1797 out <<
" dphi = " <<
fDphi <<
";" << std::endl;
1798 out <<
" nedges = " <<
fNedges <<
";" << std::endl;
1799 out <<
" nz = " <<
fNz <<
";" << std::endl;
1800 out <<
" TGeoPgon *pgon = new TGeoPgon(\"" <<
GetName() <<
"\",phi1,dphi,nedges,nz);" << std::endl;
1802 out <<
" z = " <<
fZ[i] <<
";" << std::endl;
1803 out <<
" rmin = " <<
fRmin[i] <<
";" << std::endl;
1804 out <<
" rmax = " <<
fRmax[i] <<
";" << std::endl;
1805 out <<
" pgon->DefineSection(" << i <<
", z,rmin,rmax);" << std::endl;
1807 out <<
" TGeoShape *" <<
GetPointerName() <<
" = pgon;" << std::endl;
1821 Error(
"SetDimensions",
"Pgon %s: Number of Z sections must be > 2",
GetName());
1826 if (
fZ)
delete []
fZ;
1850 for (i = 0; i <
fNz; i++) {
1851 for (j = 0; j <
n; j++) {
1855 points[indx++] =
fZ[i];
1857 for (j = 0; j <
n; j++) {
1861 points[indx++] =
fZ[i];
1880 for (i = 0; i <
fNz; i++) {
1881 for (j = 0; j <
n; j++) {
1885 points[indx++] =
fZ[i];
1887 for (j = 0; j <
n; j++) {
1891 points[indx++] =
fZ[i];
1906 nsegs = 4*(nz*n-1+(specialCase ==
kTRUE));
1907 npols = 2*(nz*n-1+(specialCase ==
kTRUE));
1950 if (nz >= 2 && nbPnts > 0) {
1952 Int_t nbSegs = 4*(nz*n-1+(specialCase ==
kTRUE));
1953 Int_t nbPols = 2*(nz*n-1+(specialCase ==
kTRUE));
1954 if (buffer.
SetRawSizes(nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, nbPols, 6*nbPols)) {
1981 for (
Int_t i=0; i<vecsize; i++) inside[i] =
Contains(&points[3*i]);
1991 for (
Int_t i=0; i<vecsize; i++)
ComputeNormal(&points[3*i], &dirs[3*i], &norms[3*i]);
1999 for (
Int_t i=0; i<vecsize; i++) dists[i] =
DistFromInside(&points[3*i], &dirs[3*i], 3, step[i]);
2007 for (
Int_t i=0; i<vecsize; i++) dists[i] =
DistFromOutside(&points[3*i], &dirs[3*i], 3, step[i]);
2017 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.
void ClearThreadData() const
Bool_t SliceCrossing(const Double_t *point, const Double_t *dir, Int_t nphi, Int_t *iphi, Double_t *sphi, Double_t &snext, Double_t stepmax) const
Check boundary crossing inside phi slices.
double dist(Rotation3D const &r1, Rotation3D const &r2)
#define snext(osub1, osub2)
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 polygone first find out in which Z section the p...
Long64_t LocMax(Long64_t n, const T *a)
void SetFinder(TGeoPatternFinder *finder)
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 void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
virtual Bool_t Contains(const Double_t *point) const
test if point is inside this shape check total z range
virtual Int_t GetNmeshVertices() const
Return number of vertices of the mesh representation.
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 ~TGeoPgon()
destructor
Double_t * fDblBuffer
[fNedges+4] temporary int buffer array
TObjArray * GetListOfShapes() const
Short_t Min(Short_t a, Short_t b)
static Double_t SafetyPhi(const Double_t *point, Bool_t in, Double_t phi1, Double_t phi2)
Static method to compute safety w.r.t a phi corner defined by cosines/sines of the angles phi1...
virtual 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 fThreadSize
Navigation data per thread.
~ThreadData_t()
Destructor.
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()
double distr(double *x, double *p)
Double_t SafetyToSegment(const Double_t *point, Int_t ipl, Int_t iphi, Bool_t in, Double_t safphi, Double_t safmin=TGeoShape::Big()) const
Compute safety from POINT to segment between planes ipl, ipl+1 within safmin.
const char * Data() const
std::vector< ThreadData_t * > fThreadData
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
Bool_t SliceCrossingInZ(const Double_t *point, const Double_t *dir, Int_t nphi, Int_t *iphi, Double_t *sphi, Double_t &snext, Double_t stepmax) const
Performs ray propagation between Z segments.
Bool_t IsCrossingSlice(const Double_t *point, const Double_t *dir, Int_t iphi, Double_t sstart, Int_t &ipl, Double_t &snext, Double_t stepmax) const
Check crossing of a given pgon slice, from a starting point inside the slice.
void AddVolume(TGeoVolume *vol)
Add a volume with valid shape to the list of volumes.
virtual TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step)
— Divide this polygone shape belonging to volume "voldiv" into ndiv volumes called divname...
static Bool_t IsCrossingSemiplane(const Double_t *point, const Double_t *dir, Double_t cphi, Double_t sphi, Double_t &snext, Double_t &rxy)
Compute distance from POINT to semiplane defined by PHI angle along DIR.
Bool_t SliceCrossingZ(const Double_t *point, const Double_t *dir, Int_t nphi, Int_t *iphi, Double_t *sphi, Double_t &snext, Double_t stepmax) const
Performs ray propagation between Z segments.
virtual void ComputeBBox()
compute bounding box for a polygone Check if the sections are in increasing Z order ...
virtual void InspectShape() const
print shape parameters
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...
Double_t ATan2(Double_t, Double_t)
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)
Compute normal to closest surface from POINT.
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 SetSectionsValid(UInt_t mask)
ThreadData_t & GetThreadData() const
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 TransformPoints(Double_t *points, UInt_t NbPoints) const
Tranform a set of points (LocalToMaster)
Int_t IndexOf(const TObject *obj) const
virtual void InspectShape() const
Inspect the PGON parameters.
virtual TBuffer3D * MakeBuffer3D() const
Creates a TBuffer3D describing this shape.
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 const char * ClassName() const
Returns name of class to which the object belongs.
unsigned int r1[N_CITIES]
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.
Int_t GetPhiCrossList(const Double_t *point, const Double_t *dir, Int_t istart, Double_t *sphi, Int_t *iphi, Double_t stepmax=TGeoShape::Big()) const
Size for the navigation data array.
Double_t Rpg(Double_t z, Int_t ipl, Bool_t inner, Double_t &a, Double_t &b) const
Computes projected pgon radius (inner or outer) corresponding to a given Z value. ...
ClassImp(TGeoPgon) TGeoPgon
Constructor.
static Int_t Lock()
Static method to lock the main thread mutex.
void CreateThreadData(Int_t nthreads)
Create thread data for n threads max.
void SetDivIndex(Int_t index)
virtual const char * GetName() const
Get the shape name.
Double_t Rproj(Double_t z, const Double_t *point, const Double_t *dir, Double_t cphi, Double_t sphi, Double_t &a, Double_t &b) const
Computes projected distance at a given Z for a given ray inside a given sector and fills coefficients...
virtual Double_t Capacity() const
Computes capacity of the shape in [length^3].
static Int_t UnLock()
Static method to unlock the main thread mutex.
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 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 SetPoints(Double_t *points) const
create polygone mesh points
Int_t ShapeDistancetoPrimitive(Int_t numpoints, Int_t px, Int_t py) const
Returns distance to shape primitive mesh.
virtual void SetSegsAndPols(TBuffer3D &buff) const
Fill TBuffer3D structure for segments and polygons.
const char * GetPointerName() const
Provide a pointer name containing uid.
virtual void GetBoundingCylinder(Double_t *param) const
— Fill vector param[4] with the bounding cylinder parameters.
void SetShapeBit(UInt_t f, Bool_t set)
Equivalent of TObject::SetBit.
virtual void SetDimensions(Double_t *param)
Set PGON dimensions starting from an array.
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
compute closest distance from point px,py to each corner
static Int_t ThreadId()
Translates the current thread id to an ordinal number.
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...
TGeoMedium * GetMedium() const
Short_t Max(Short_t a, Short_t b)
static Double_t DistFromOutsideS(const Double_t *point, const Double_t *dir, Double_t rmin, Double_t rmax, Double_t dz)
Static method to compute distance from outside point to a tube with given parameters Boundary safe al...
Bool_t SliceCrossingIn(const Double_t *point, const Double_t *dir, Int_t ipl, Int_t nphi, Int_t *iphi, Double_t *sphi, Double_t &snext, Double_t stepmax) const
Check boundary crossing inside phi slices.
virtual void DefineSection(Int_t snum, Double_t z, Double_t rmin, Double_t rmax)
Defines z position of a section plane, rmin and rmax at this z.
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 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.
Double_t Sqrt(Double_t x)
TObject * At(Int_t idx) const
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 polygone.
Long64_t LocMin(Long64_t n, const T *a)
virtual const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
Fills a static 3D buffer and returns a reference.
double norm(double *x, double *p)
virtual void Sizeof3D() const
void LocatePhi(const Double_t *point, Int_t &ipsec) const
Locates index IPSEC of the phi sector containing POINT.
Long64_t BinarySearch(Long64_t n, const T *array, T value)
unsigned int r2[N_CITIES]
virtual Int_t GetNsegments() const
Returns number of segments on each mesh circle segment.
Bool_t SectionsValid(UInt_t mask) const