111 for (
Int_t i=0; i<8; i++) {
115 SetShapeBit(kGeoArb8);
129 for (
Int_t i=0; i<8; i++) {
130 fXY[i][0] = vertices[2*i];
131 fXY[i][1] = vertices[2*i+1];
136 for (
Int_t i=0; i<8; i++) {
154 for (
Int_t i=0; i<8; i++) {
155 fXY[i][0] = vertices[2*i];
156 fXY[i][1] = vertices[2*i+1];
161 for (
Int_t i=0; i<8; i++) {
176 for(
Int_t i=0; i<8; i++) {
191 for(
Int_t i=0; i<8; i++) {
214 for (i=0; i<4; i++) {
216 capacity += 0.25*
fDz*((
fXY[i][0]+
fXY[i+4][0])*(
fXY[j][1]+
fXY[j+4][1]) -
218 (1./3)*((
fXY[i+4][0]-
fXY[i][0])*(
fXY[j+4][1]-
fXY[j][1]) -
230 xmin = xmax =
fXY[0][0];
231 ymin = ymax =
fXY[0][1];
233 for (
Int_t i=1; i<8; i++) {
234 if (xmin>
fXY[i][0]) xmin=
fXY[i][0];
235 if (xmax<
fXY[i][0]) xmax=
fXY[i][0];
236 if (ymin>
fXY[i][1]) ymin=
fXY[i][1];
237 if (ymax<
fXY[i][1]) ymax=
fXY[i][1];
261 for (i=0; i<4; i++) {
262 dx1 =
fXY[(i+1)%4][0]-
fXY[i][0];
263 dy1 =
fXY[(i+1)%4][1]-
fXY[i][1];
269 dx2 =
fXY[4+(i+1)%4][0]-
fXY[4+i][0];
270 dy2 =
fXY[4+(i+1)%4][1]-
fXY[4+i][1];
276 twist[i] = dy1*dx2 - dx1*dy2;
290 for (i=0; i<4; i++) {
291 fXY[i][0] += 1.E-8*
fXY[i+4][0];
292 fXY[i][1] += 1.E-8*
fXY[i+4][1];
296 for (i=0; i<4; i++) {
297 fXY[i+4][0] += 1.E-8*
fXY[i][0];
298 fXY[i+4][1] += 1.E-8*
fXY[i][1];
304 for (i=0; i<4; i++) {
307 sum2 += fXY[i+4][0]*fXY[j+4][1]-fXY[j+4][0]*fXY[i+4][1];
310 Fatal(
"ComputeTwist",
"Shape %s type Arb8: Lower/upper faces defined with opposite clockwise",
GetName());
314 Error(
"ComputeTwist",
"Shape %s type Arb8: Vertices must be defined clockwise in XY planes. Re-ordering...",
GetName());
337 Error(
"ComputeTwist",
"Shape %s type Arb8: Malformed polygon with crossing opposite segments",
GetName());
348 if (iseg<0 || iseg>3)
return 0.;
363 Double_t lsq, ssq, dx, dy, dpx, dpy, u;
366 for (i1=0; i1<4; i1++) {
373 p1[1] = vert[2*i1+1];
375 p2[1] = vert[2*i2+1];
378 dpx = point[0] - p1[0];
379 dpy = point[1] - p1[1];
383 ssq = dpx*dpx + dpy*dpy;
392 u = (dpx*dx + dpy*dy)/lsq;
396 dpx = point[0]-p2[0];
397 dpy = point[1]-p2[1];
409 ssq = dpx*dpx + dpy*dpy;
433 norm[2] = (dir[2]>0)?1:(-1);
441 if (frac<0) frac = 0.;
442 Int_t jseg = (iseg+1)%4;
454 x1 += frac*(
fXY[jseg+4][0]-
x1);
455 y1 += frac*(
fXY[jseg+4][1]-y1);
464 norm[0] = ay*bz-az*by;
465 norm[1] = az*bx-ax*bz;
466 norm[2] = ax*by-ay*bx;
467 fn =
TMath::Sqrt(norm[0]*norm[0]+norm[1]*norm[1]+norm[2]*norm[2]);
479 if (dir[0]>-2. && dir[0]*norm[0]+dir[1]*norm[1]+dir[2]*norm[2] < 0) {
499 for (i=0; i<4; i++) {
500 poly[2*i] =
fXY[i+4][0]+cf*(
fXY[i][0]-
fXY[i+4][0]);
501 poly[2*i+1] =
fXY[i+4][1]+cf*(
fXY[i][1]-
fXY[i+4][1]);
544 Double_t a=(dtx*dir[1]-dty*dir[0]+(tx1*ty2-tx2*ty1)*dir[2])*dir[2];
546 Double_t b=dxs*dir[1]-dys*dir[0]+(dtx*point[1]-dty*point[0]+ty2*xs1-ty1*xs2
547 +tx1*ys2-tx2*ys1)*dir[2];
548 Double_t c=dxs*point[1]-dys*point[0]+xs1*ys2-xs2*ys1;
556 memcpy(dirp,dir,3*
sizeof(
Double_t));
559 ((
TGeoArb8*)
this)->ComputeNormal(point,dirp,norm);
560 ndotd = dir[0]*norm[0]+dir[1]*norm[1]+dir[2]*norm[2];
564 zi = (point[0]-
xs1)*(point[0]-xs2)+(point[1]-ys1)*(point[1]-ys2);
577 memcpy(dirp,dir,3*
sizeof(
Double_t));
580 ((
TGeoArb8*)
this)->ComputeNormal(point,dirp,norm);
581 ndotd = dir[0]*norm[0]+dir[1]*norm[1]+dir[2]*norm[2];
588 zi=point[2]+s*dir[2];
592 xp=point[0]+s*dir[0];
595 yp=point[1]+s*dir[1];
596 zi = (xp-
x1)*(xp-x2)+(yp-y1)*(yp-y2);
603 memcpy(dirp,dir,3*
sizeof(
Double_t));
606 ((
TGeoArb8*)
this)->ComputeNormal(point,dirp,norm);
607 ndotd = dir[0]*norm[0]+dir[1]*norm[1]+dir[2]*norm[2];
616 zi=point[2]+s*dir[2];
620 xp=point[0]+s*dir[0];
623 yp=point[1]+s*dir[1];
624 zi = (xp-
x1)*(xp-x2)+(yp-y1)*(yp-y2);
642 if (point[2]*dir[2]<0) {
644 snext =
TMath::Max((pt[2]-point[2])/dir[2],0.);
645 for (
Int_t j=0; j<2; j++) pt[j]=point[j]+snext*dir[j];
652 for (
Int_t i=0; i<4; i++) {
654 if (dist<snext) snext =
dist;
670 distz=(-
fDz-point[2])/dir[2];
673 if (dir[2]>0) distz=(
fDz-point[2])/dir[2];
676 for (i=0; i<4; i++) {
678 if (dist<distl) distl =
dist;
681 pt[0] = point[0]+distz*dir[0];
682 pt[1] = point[1]+distz*dir[1];
686 if (dist<0 || dist>1.E10)
return 0.;
698 distmin=(-
fDz-point[2])/dir[2];
700 if (dir[2]>0) distmin =(
fDz-point[2])/dir[2];
707 for (
Int_t ipl=0;ipl<4;ipl++) {
731 Double_t a=(dtx*dir[1]-dty*dir[0]+(tx1*ty2-tx2*ty1)*dir[2])*dir[2];
732 Double_t b=dxs*dir[1]-dys*dir[0]+(dtx*point[1]-dty*point[0]+ty2*xs1-ty1*xs2
733 +tx1*ys2-tx2*ys1)*dir[2];
734 Double_t c=dxs*point[1]-dys*point[0]+xs1*ys2-xs2*ys1;
739 if (s>eps && s < distmin) {
752 lateral_cross =
kTRUE;
757 if (s>eps && s < distmin) {
759 lateral_cross =
kTRUE;
765 if (!lateral_cross) {
769 pt[0] = point[0]+distmin*dir[0];
770 pt[1] = point[1]+distmin*dir[1];
775 for (
Int_t j=0; j<4; j++) {
776 poly[2*j] =
fXY[j+i][0];
777 poly[2*j+1] =
fXY[j+i][1];
791 Error(
"Divide",
"Division of an arbitrary trapezoid not implemented");
822 for (i=0; i<8; i++) {
839 Error(
"GetFittingBox",
"cannot handle parametrized rotated volumes");
846 Error(
"GetFittingBox",
"wrong matrix - parametrized box is outside this");
851 dd[0] = parambox->
GetDX();
852 dd[1] = parambox->
GetDY();
853 dd[2] = parambox->
GetDZ();
858 Error(
"GetFittingBox",
"wrong matrix");
862 if (dd[0]>=0 && dd[1]>=0) {
874 for (
Int_t iaxis=0; iaxis<2; iaxis++) {
875 if (dd[iaxis]>=0)
continue;
877 for (
Int_t ivert=0; ivert<4; ivert++) {
897 for (i=0; i<3; i++) {
898 v1[i] = p2[i] - p1[i];
899 v2[i] = p3[i] - p1[i];
901 norm[0] = v1[1]*v2[2]-v1[2]*v2[1];
902 cross += norm[0]*norm[0];
903 norm[1] = v1[2]*v2[0]-v1[0]*v2[2];
904 cross += norm[1]*norm[1];
905 norm[2] = v1[0]*v2[1]-v1[1]*v2[0];
906 cross += norm[2]*norm[2];
909 for (i=0; i<3; i++) norm[i] *= cross;
981 for (i=0; i<4; i++) {
987 cross = (x-
x1)*(y2-y1)-(y-y1)*(x2-x1);
988 if (cross<0)
return kFALSE;
1000 for (
Int_t ip=0; ip<8; ip++) {
1001 printf(
" point #%i : x=%11.5f y=%11.5f z=%11.5f\n",
1002 ip,
fXY[ip][0],
fXY[ip][1],
fDz*((ip<4)?-1:1));
1004 printf(
" Bounding box:\n");
1014 if (!in) safz = -safz;
1017 Double_t lsq, ssq, dx, dy, dpx, dpy, u;
1029 for (iseg=0; iseg<4; iseg++) {
1032 p2 = &vert[2*((iseg+1)%4)];
1035 dpx = point[0] - p1[0];
1036 dpy = point[1] - p1[1];
1038 lsq = dx*dx + dy*dy;
1039 u = (dpx*dx + dpy*dy)/lsq;
1041 dpx = point[0]-p2[0];
1042 dpy = point[1]-p2[1];
1049 ssq = dpx*dpx + dpy*dpy;
1056 if (umin<0) umin = 0.;
1058 isegmin = (isegmin+1)%4;
1062 Int_t i2 = (isegmin+1)%4;
1064 Double_t dx2 = fXY[i2+4][0]-fXY[i1+4][0];
1065 Double_t dy1 = fXY[i2][1]-fXY[i1][1];
1066 Double_t dy2 = fXY[i2+4][1]-fXY[i1+4][1];
1067 dx = dx1 + umin*(dx2-dx1);
1068 dy = dy1 + umin*(dy2-dy1);
1078 for (iseg=0; iseg<4; iseg++) saf[iseg+1] =
SafetyToFace(point,iseg,in);
1081 if (safe<0)
return 0.;
1092 Int_t ipln = (iseg+1)%4;
1094 vertices[0] =
fXY[iseg][0];
1095 vertices[1] =
fXY[iseg][1];
1098 vertices[3] =
fXY[ipln][0];
1099 vertices[4] =
fXY[ipln][1];
1102 vertices[6] =
fXY[ipln+4][0];
1103 vertices[7] =
fXY[ipln+4][1];
1106 vertices[9] =
fXY[iseg+4][0];
1107 vertices[10] =
fXY[iseg+4][1];
1120 safe = (point[0]-p1[0])*norm[0]+(point[1]-p1[1])*norm[1]+(point[2]-p1[2])*norm[2];
1121 if (in)
return (-safe);
1131 out <<
" // Shape: " <<
GetName() <<
" type: " <<
ClassName() << std::endl;
1132 out <<
" dz = " <<
fDz <<
";" << std::endl;
1133 out <<
" vert[0] = " <<
fXY[0][0] <<
";" << std::endl;
1134 out <<
" vert[1] = " <<
fXY[0][1] <<
";" << std::endl;
1135 out <<
" vert[2] = " <<
fXY[1][0] <<
";" << std::endl;
1136 out <<
" vert[3] = " <<
fXY[1][1] <<
";" << std::endl;
1137 out <<
" vert[4] = " <<
fXY[2][0] <<
";" << std::endl;
1138 out <<
" vert[5] = " <<
fXY[2][1] <<
";" << std::endl;
1139 out <<
" vert[6] = " <<
fXY[3][0] <<
";" << std::endl;
1140 out <<
" vert[7] = " <<
fXY[3][1] <<
";" << std::endl;
1141 out <<
" vert[8] = " <<
fXY[4][0] <<
";" << std::endl;
1142 out <<
" vert[9] = " <<
fXY[4][1] <<
";" << std::endl;
1143 out <<
" vert[10] = " <<
fXY[5][0] <<
";" << std::endl;
1144 out <<
" vert[11] = " <<
fXY[5][1] <<
";" << std::endl;
1145 out <<
" vert[12] = " <<
fXY[6][0] <<
";" << std::endl;
1146 out <<
" vert[13] = " <<
fXY[6][1] <<
";" << std::endl;
1147 out <<
" vert[14] = " <<
fXY[7][0] <<
";" << std::endl;
1148 out <<
" vert[15] = " <<
fXY[7][1] <<
";" << std::endl;
1149 out <<
" TGeoShape *" <<
GetPointerName() <<
" = new TGeoArb8(\"" <<
GetName() <<
"\", dz,vert);" << std::endl;
1159 for (
Int_t i=0; i<4; i++) {
1160 vertices[2*i] =
fXY[i+4][0]+cf*(
fXY[i][0]-
fXY[i+4][0]);
1161 vertices[2*i+1] =
fXY[i+4][1]+cf*(
fXY[i][1]-
fXY[i+4][1]);
1175 for (
Int_t i=0; i<8; i++) {
1176 fXY[i][0] = param[2*i+1];
1177 fXY[i][1] = param[2*i+2];
1188 for (
Int_t i=0; i<8; i++) {
1189 points[3*i] =
fXY[i][0];
1190 points[3*i+1] =
fXY[i][1];
1191 points[3*i+2] = (i<4)?-
fDz:
fDz;
1200 for (
Int_t i=0; i<8; i++) {
1201 points[3*i] =
fXY[i][0];
1202 points[3*i+1] =
fXY[i][1];
1203 points[3*i+2] = (i<4)?-
fDz:
fDz;
1212 if (vnum<0 || vnum >7) {
1213 Error(
"SetVertex",
"Invalid vertex number");
1235 void TGeoArb8::Streamer(
TBuffer &R__b)
1252 for (
Int_t i=0; i<vecsize; i++) inside[i] =
Contains(&points[3*i]);
1262 for (
Int_t i=0; i<vecsize; i++)
ComputeNormal(&points[3*i], &dirs[3*i], &norms[3*i]);
1270 for (
Int_t i=0; i<vecsize; i++) dists[i] =
DistFromInside(&points[3*i], &dirs[3*i], 3, step[i]);
1278 for (
Int_t i=0; i<vecsize; i++) dists[i] =
DistFromOutside(&points[3*i], &dirs[3*i], 3, step[i]);
1288 for (
Int_t i=0; i<vecsize; i++) safe[i] =
Safety(&points[3*i], inside[i]);
1301 fH1 = fH2 = fBl1 = fBl2 = fTl1 = fTl2 = fAlpha1 = fAlpha2 = 0;
1339 fXY[0][0] = -dz*tx-h1*ta1-bl1;
fXY[0][1] = -dz*ty-
h1;
1340 fXY[1][0] = -dz*tx+h1*ta1-tl1;
fXY[1][1] = -dz*ty+
h1;
1341 fXY[2][0] = -dz*tx+h1*ta1+tl1;
fXY[2][1] = -dz*ty+
h1;
1342 fXY[3][0] = -dz*tx-h1*ta1+bl1;
fXY[3][1] = -dz*ty-
h1;
1343 fXY[4][0] = dz*tx-h2*ta2-bl2;
fXY[4][1] = dz*ty-
h2;
1344 fXY[5][0] = dz*tx+h2*ta2-tl2;
fXY[5][1] = dz*ty+
h2;
1345 fXY[6][0] = dz*tx+h2*ta2+tl2;
fXY[6][1] = dz*ty+
h2;
1346 fXY[7][0] = dz*tx-h2*ta2+bl2;
fXY[7][1] = dz*ty-
h2;
1348 if ((dz<0) || (h1<0) || (bl1<0) || (tl1<0) ||
1349 (h2<0) || (bl2<0) || (tl2<0)) {
1375 for (
Int_t i=0; i<8; i++) {
1383 fXY[0][0] = -dz*tx-h1*ta1-bl1;
fXY[0][1] = -dz*ty-
h1;
1384 fXY[1][0] = -dz*tx+h1*ta1-tl1;
fXY[1][1] = -dz*ty+
h1;
1385 fXY[2][0] = -dz*tx+h1*ta1+tl1;
fXY[2][1] = -dz*ty+
h1;
1386 fXY[3][0] = -dz*tx-h1*ta1+bl1;
fXY[3][1] = -dz*ty-
h1;
1387 fXY[4][0] = dz*tx-h2*ta2-bl2;
fXY[4][1] = dz*ty-
h2;
1388 fXY[5][0] = dz*tx+h2*ta2-tl2;
fXY[5][1] = dz*ty+
h2;
1389 fXY[6][0] = dz*tx+h2*ta2+tl2;
fXY[6][1] = dz*ty+
h2;
1390 fXY[7][0] = dz*tx-h2*ta2+bl2;
fXY[7][1] = dz*ty-
h2;
1392 if ((dz<0) || (h1<0) || (bl1<0) || (tl1<0) ||
1393 (h2<0) || (bl2<0) || (tl2<0)) {
1411 if (iact<3 && safe) {
1427 distmin=(-
fDz-point[2])/dir[2];
1429 if (dir[2]>0) distmin =(
fDz-point[2])/dir[2];
1434 for (
Int_t ipl=0;ipl<4;ipl++) {
1435 Int_t j = (ipl+1)%4;
1449 Double_t ddotn = -dir[0]*az*by + dir[1]*az*bx+dir[2]*(ax*by-ay*bx);
1450 if (ddotn<=0)
continue;
1451 Double_t saf = -(point[0]-xa)*az*by + (point[1]-ya)*az*bx + (point[2]+
fDz)*(ax*by-ay*bx);
1452 if (saf>=0.0)
return 0.0;
1454 if (s<distmin) distmin=s;
1464 if (iact<3 && safe) {
1482 snxt = -(
fDz+point[2])/dir[2];
1483 xnew = point[0] + snxt*dir[0];
1484 ynew = point[1] + snxt*dir[1];
1488 pts[j+1] =
fXY[i][1];
1494 snxt = (
fDz-point[2])/dir[2];
1495 xnew = point[0] + snxt*dir[0];
1496 ynew = point[1] + snxt*dir[1];
1499 pts[j] =
fXY[i+4][0];
1500 pts[j+1] =
fXY[i+4][1];
1516 for (i=0; i<4; i++) {
1531 ddotn = -dir[0]*az*by + dir[1]*az*bx+dir[2]*(ax*by-ay*bx);
1532 saf = (point[0]-xa)*az*by - (point[1]-ya)*az*bx - (point[2]+
fDz)*(ax*by-ay*bx);
1539 znew = point[2]+snxt*dir[2];
1541 xnew = point[0]+snxt*dir[0];
1542 ynew = point[1]+snxt*dir[1];
1553 if ((xnew-xs1)*(xs2-xnew)>=0)
return snxt;
1555 if ((ynew-ys1)*(ys2-ynew)>=0)
return snxt;
1561 if (ddotn>=0) exiting =
kTRUE;
1568 if (saf>0 && saf<safmin) exiting = (point[2]*dir[2] > 0)?
kTRUE:
kFALSE;
1590 Error(
"Divide",
"cannot divide trapezoids on other axis than Z");
1604 for (
Int_t idiv=0; idiv<ndiv; idiv++) {
1605 zmin = start+idiv*step;
1606 zmax = start+(idiv+1)*step;
1607 oz = start+idiv*step+step/2;
1613 for (
Int_t vert1=0; vert1<4; vert1++)
1614 ((
TGeoArb8*)shape)->SetVertex(vert1, points_lo[2*vert1]-ox, points_lo[2*vert1+1]-oy);
1615 for (
Int_t vert2=0; vert2<4; vert2++)
1616 ((
TGeoArb8*)shape)->SetVertex(vert2+4, points_hi[2*vert2]-ox, points_hi[2*vert2+1]-oy);
1633 Error(
"GetMakeRuntimeShape",
"invalid mother");
1658 return (
new TGeoTrap(dz,
fTheta,
fPhi, h1, bl1, tl1,
fAlpha1, h2, bl2, tl2,
fAlpha2));
1674 for (i=0; i<4; i++) {
1698 norm[2] = ax*by-ay*bx;
1699 fn =
TMath::Sqrt(norm[0]*norm[0]+norm[1]*norm[1]+norm[2]*norm[2]);
1700 if (fn<1
E-10)
continue;
1701 saf[i] = (x0-point[0])*norm[0]+(y0-point[1])*norm[1]+(-
fDz-point[2])*norm[2];
1705 saf[i] = -saf[i]/fn;
1711 for (j=1;j<5;j++)
if (saf[j] <safe) safe = saf[j];
1715 for (j=1;j<5;j++) if (saf[j] >safe) safe = saf[j];
1726 out <<
" // Shape: " <<
GetName() <<
" type: " <<
ClassName() << std::endl;
1727 out <<
" dz = " <<
fDz <<
";" << std::endl;
1728 out <<
" theta = " <<
fTheta <<
";" << std::endl;
1729 out <<
" phi = " <<
fPhi <<
";" << std::endl;
1730 out <<
" h1 = " <<
fH1<<
";" << std::endl;
1731 out <<
" bl1 = " <<
fBl1<<
";" << std::endl;
1732 out <<
" tl1 = " <<
fTl1<<
";" << std::endl;
1733 out <<
" alpha1 = " <<
fAlpha1 <<
";" << std::endl;
1734 out <<
" h2 = " <<
fH2 <<
";" << std::endl;
1735 out <<
" bl2 = " <<
fBl2<<
";" << std::endl;
1736 out <<
" tl2 = " <<
fTl2<<
";" << std::endl;
1737 out <<
" alpha2 = " <<
fAlpha2 <<
";" << std::endl;
1738 out <<
" TGeoShape *" <<
GetPointerName() <<
" = new TGeoTrap(\"" <<
GetName() <<
"\", dz,theta,phi,h1,bl1,tl1,alpha1,h2,bl2,tl2,alpha2);" << std::endl;
1782 if ((
fDz<0) || (fH1<0) || (fBl1<0) || (fTl1<0) ||
1783 (fH2<0) || (fBl2<0) || (fTl2<0)) {
1794 for (
Int_t i=0; i<vecsize; i++) dists[i] =
DistFromInside(&points[3*i], &dirs[3*i], 3, step[i]);
1802 for (
Int_t i=0; i<vecsize; i++) dists[i] =
DistFromOutside(&points[3*i], &dirs[3*i], 3, step[i]);
1812 for (
Int_t i=0; i<vecsize; i++) safe[i] =
Safety(&points[3*i], inside[i]);
1832 :
TGeoTrap(dz, theta, phi, h1, bl1, tl1, alpha1, h2, bl2, tl2, alpha2)
1844 for (i=0; i<4; i++) {
1853 for (i=4; i<8; i++) {
1860 if ((dz<0) || (h1<0) || (bl1<0) || (tl1<0) ||
1871 :
TGeoTrap(name, dz, theta, phi, h1, bl1, tl1, alpha1, h2, bl2, tl2, alpha2)
1883 for (i=0; i<4; i++) {
1892 for (i=4; i<8; i++) {
1899 if ((dz<0) || (h1<0) || (bl1<0) || (tl1<0) ||
1916 if (iact<3 && safe) {
1931 if (iact<3 && safe) {
1949 Error(
"GetMakeRuntimeShape",
"invalid mother");
1964 bl1 = ((
TGeoTrap*)mother)->GetBl1();
1968 bl2 = ((
TGeoTrap*)mother)->GetBl2();
1972 tl1 = ((
TGeoTrap*)mother)->GetTl1();
1976 tl2 = ((
TGeoTrap*)mother)->GetTl2();
1979 return (
new TGeoGtra(dz,
fTheta,
fPhi,
fTwistAngle ,h1, bl1, tl1,
fAlpha1, h2, bl2, tl2,
fAlpha2));
1996 out <<
" // Shape: " <<
GetName() <<
" type: " <<
ClassName() << std::endl;
1997 out <<
" dz = " <<
fDz <<
";" << std::endl;
1998 out <<
" theta = " <<
fTheta <<
";" << std::endl;
1999 out <<
" phi = " <<
fPhi <<
";" << std::endl;
2000 out <<
" twist = " <<
fTwistAngle <<
";" << std::endl;
2001 out <<
" h1 = " <<
fH1<<
";" << std::endl;
2002 out <<
" bl1 = " <<
fBl1<<
";" << std::endl;
2003 out <<
" tl1 = " <<
fTl1<<
";" << std::endl;
2004 out <<
" alpha1 = " <<
fAlpha1 <<
";" << std::endl;
2005 out <<
" h2 = " <<
fH2 <<
";" << std::endl;
2006 out <<
" bl2 = " <<
fBl2<<
";" << std::endl;
2007 out <<
" tl2 = " <<
fTl2<<
";" << std::endl;
2008 out <<
" alpha2 = " <<
fAlpha2 <<
";" << std::endl;
2009 out <<
" TGeoShape *" <<
GetPointerName() <<
" = new TGeoGtra(\"" <<
GetName() <<
"\", dz,theta,phi,twist,h1,bl1,tl1,alpha1,h2,bl2,tl2,alpha2);" << std::endl;
2042 for (i=0; i<4; i++) {
2051 for (i=4; i<8; i++) {
2068 for (
Int_t i=0; i<vecsize; i++) dists[i] =
DistFromInside(&points[3*i], &dirs[3*i], 3, step[i]);
2076 for (
Int_t i=0; i<vecsize; i++) dists[i] =
DistFromOutside(&points[3*i], &dirs[3*i], 3, step[i]);
2086 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 void SetPoints(Double_t *points) const
Creates arb8 mesh points.
Double_t SafetyToFace(const Double_t *point, Int_t iseg, Bool_t in) const
Estimate safety to lateral plane defined by segment iseg in range [0,3] Might be negative: plane seen...
Bool_t IsRunTimeShape() const
double dist(Rotation3D const &r1, Rotation3D const &r2)
void SetPlaneVertices(Double_t zpl, Double_t *vertices) const
Computes intersection points between plane at zpl and non-horizontal edges.
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
#define snext(osub1, osub2)
Long64_t LocMax(Long64_t n, const T *a)
static double p3(double t, double a, double b, double c, double d)
virtual ~TGeoGtra()
Destructor.
void SetFinder(TGeoPatternFinder *finder)
virtual TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step)
Divide this shape along one axis.
TVector3 cross(const TVector3 &v1, const TVector3 &v2)
void AddNodeOffset(TGeoVolume *vol, Int_t copy_no, Double_t offset=0, Option_t *option="")
Add a division node to the list of nodes.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
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 Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const
Computes the closest distance from given point to this shape.
virtual void SetName(const char *name)
Change (i.e.
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.
Buffer base class used for serializing objects.
Short_t Min(Short_t a, Short_t b)
virtual Double_t GetDY() const
virtual Bool_t GetPointsOnFacet(Int_t, Int_t, Double_t *) const
Fills array with n random points located on the surface of indexed facet.
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 IsRotation() const
virtual Double_t GetDZ() const
Int_t GetNdaughters() const
Double_t GetTwist(Int_t iseg) const
Get twist for segment I in range [0,3].
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 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 trapezoid.
static Double_t Tolerance()
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
const char * Data() const
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
static const double x2[5]
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.
Double_t DistToPlane(const Double_t *point, const Double_t *dir, Int_t ipl, Bool_t in) const
Computes distance to plane ipl : ipl=0 : points 0,4,1,5 ipl=1 : points 1,5,2,6 ipl=2 : points 2...
void AddVolume(TGeoVolume *vol)
Add a volume with valid shape to the list of volumes.
static double p2(double t, double a, double b, double c)
Double_t fXY[8][2]
[4] tangents of twist angles
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...
virtual void SetVertex(Int_t vnum, Double_t x, Double_t y)
Set values for a given vertex.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void ComputeBBox()
Computes bounding box for an Arb8 shape.
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 inside point to surface of the shape.
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 Int_t GetFittingBox(const TGeoBBox *parambox, TGeoMatrix *mat, Double_t &dx, Double_t &dy, Double_t &dz) const
Fills real parameters of a positioned box inside this arb8. Returns 0 if successfull.
virtual const Double_t * GetOrigin() const
virtual TGeoShape * GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const
In case shape has some negative parameters, these have to be computed in order to fit the mother...
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)
Compute normal to closest surface from POINT.
static Bool_t IsSegCrossing(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Double_t x3, Double_t y3, Double_t x4, Double_t y4)
Check if segments (A,B) and (C,D) are crossing, where: A(x1,y1), B(x2,y2), C(x3,y3), D(x4,y4)
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 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 trapezoid.
virtual Double_t GetDX() const
virtual void InspectShape() const
Prints shape parameters.
TNamed & operator=(const TNamed &rhs)
TNamed assignment operator.
virtual ~TGeoTrap()
destructor
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 shape.
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...
static Bool_t InsidePolygon(Double_t x, Double_t y, Double_t *pts)
Finds if a point in XY plane is inside the polygon defines by PTS.
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 shape.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const
Computes the closest distance from given point to this shape.
virtual void LocalToMaster(const Double_t *local, Double_t *master) const
convert a point by multiplying its column vector (x, y, z, 1) to matrix inverse
void ComputeTwist()
Computes tangents of twist angles (angles between projections on XY plane of corresponding -dz +dz ed...
Bool_t TestBit(UInt_t f) const
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 specisied by dirs. Store output in dist...
static Bool_t IsSamePoint(const Double_t *p1, const Double_t *p2)
static double p1(double t, double a, double b)
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
Computes distance from outside point to surface of the shape.
virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const
Computes the closest distance from given point to this shape.
void SetDivIndex(Int_t index)
ClassImp(TGeoArb8) TGeoArb8
Default ctor.
virtual const char * GetName() const
Get the shape name.
virtual Bool_t Contains(const Double_t *point) const
Test if point is inside this shape.
Double_t GetClosestEdge(const Double_t *point, Double_t *vert, Int_t &isegment) const
Get index of the edge of the quadrilater represented by vert closest to point.
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
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 void Sizeof3D() const
Fill size of this 3-D object.
virtual void InspectShape() const
Prints shape parameters.
static const double x1[5]
R__EXTERN TGeoManager * gGeoManager
virtual Double_t Capacity() const
Computes capacity of the shape in [length^3].
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
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...
const char * GetPointerName() const
Provide a pointer name containing uid.
static void GetPlaneNormal(Double_t *p1, Double_t *p2, Double_t *p3, Double_t *norm)
Computes normal to plane defined by P1, P2 and P3.
virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const
Computes the closest distance from given point to this shape.
void SetShapeBit(UInt_t f, Bool_t set)
Equivalent of TObject::SetBit.
virtual ~TGeoArb8()
Destructor.
Bool_t TestShapeBit(UInt_t f) const
TGeoMedium * GetMedium() const
Short_t Max(Short_t a, Short_t b)
virtual void GetBoundingCylinder(Double_t *param) const
— Fill vector param[4] with the bounding cylinder parameters.
TGeoArb8 & operator=(const TGeoArb8 &)
assignment operator
Double_t Sqrt(Double_t x)
TObject * At(Int_t idx) const
virtual void SetDimensions(Double_t *param)
Set all arb8 params in one step.
virtual void SetDimensions(Double_t *param)
Set all arb8 params in one step.
virtual void Sizeof3D() const
virtual TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step)
— Divide this trapezoid shape belonging to volume "voldiv" into ndiv volumes called divname...
Long64_t LocMin(Long64_t n, const T *a)
double norm(double *x, double *p)
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...
virtual Bool_t Contains(const Double_t *point) const
Test if point is inside this shape.
virtual void SetDimensions(Double_t *param)
Set all arb8 params in one step.
virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const
Get shape range on a given axis.
virtual TGeoShape * GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const
In case shape has some negative parameters, these has to be computed in order to fit the mother...