37 #if !(defined(G4GEOM_USE_UELLIPSOID) && defined(G4GEOM_USE_SYS_USOLIDS))
61 using namespace CLHEP;
73 :
G4VSolid(name), fDx(xSemiAxis), fDy(ySemiAxis), fDz(zSemiAxis),
74 fZBottomCut(zBottomCut), fZTopCut(zTopCut)
85 :
G4VSolid(a), fDx(0.), fDy(0.), fDz(0.), fZBottomCut(0.), fZTopCut(0.)
104 fDx(rhs.fDx), fDy(rhs.fDy), fDz(rhs.fDz),
105 fZBottomCut(rhs.fZBottomCut), fZTopCut(rhs.fZTopCut),
106 halfTolerance(rhs.halfTolerance),
107 fXmax(rhs.fXmax), fYmax(rhs.fYmax),
108 fRsph(rhs.fRsph), fR(rhs.fR),
109 fSx(rhs.fSx), fSy(rhs.fSy), fSz(rhs.fSz),
110 fZMidCut(rhs.fZMidCut), fZDimCut(rhs.fZDimCut),
111 fQ1(rhs.fQ1), fQ2(rhs.fQ2),
112 fCubicVolume(rhs.fCubicVolume),
113 fSurfaceArea(rhs.fSurfaceArea),
114 fLateralArea(rhs.fLateralArea)
126 if (
this == &rhs) {
return *
this; }
174 if (
fDx < dmin ||
fDy < dmin ||
fDz < dmin)
177 message <<
"Invalid (too small or negative) dimensions for Solid: "
179 <<
" semi-axis x: " <<
fDx <<
"\n"
180 <<
" semi-axis y: " <<
fDy <<
"\n"
181 <<
" semi-axis z: " <<
fDz;
182 G4Exception(
"G4Ellipsoid::CheckParameters()",
"GeomSolids0002",
199 message <<
"Invalid Z cuts for Solid: "
203 G4Exception(
"G4Ellipsoid::CheckParameters()",
"GeomSolids0002",
339 if (nsurf == 1)
return norm;
340 else if (nsurf > 1)
return norm.
unit();
345 G4int oldprc = message.precision(16);
346 message <<
"Point p is not on surface (!?) of solid: "
348 message <<
"Position:\n";
349 message <<
" p.x() = " << p.
x()/
mm <<
" mm\n";
350 message <<
" p.y() = " << p.
y()/
mm <<
" mm\n";
351 message <<
" p.z() = " << p.
z()/
mm <<
" mm";
353 G4Exception(
"G4Ellipsoid::SurfaceNormal(p)",
"GeomSolids1002",
374 if (distR > distZ && rr > 0.)
405 if (safe > 32. *
fRsph)
407 offset = (1. - 1.e-08) * safe - 2. *
fRsph;
429 G4double rr = px * px + py * py + pz * pz;
430 G4double pv = px * vx + py * vy + pz * vz;
434 G4double A = vx * vx + vy * vy + vz * vz;
451 G4double tmp = -B - std::copysign(std::sqrt(D), B);
486 G4double distR = std::sqrt(x*x + y*y + z*z) -
fR;
490 return (dist < 0.) ? 0. : dist;
515 n->
set(0., 0., std::copysign(1., pzcut));
526 G4double rr = px * px + py * py + pz * pz;
527 G4double pv = px * vx + py * vy + pz * vz;
545 G4int oldprc = message.precision(16);
546 message <<
"Point p is outside (!?) of solid: "
548 message <<
"Position: " << p <<
G4endl;;
549 message <<
"Direction: " <<
v;
551 G4Exception(
"G4Ellipsoid::DistanceToOut(p,v)",
"GeomSolids1002",
565 G4double A = vx * vx + vy * vy + vz * vz;
587 G4double tzmax = (vz == 0.) ?
DBL_MAX : (std::copysign(dzcut, vz) - pzcut) / vz;
591 G4double tmp = -B - std::copysign(std::sqrt(D), B);
592 G4double trmax = (tmp < 0.) ? C/tmp : tmp/
A;
605 n->
set(0., 0., (pznew > fZMidCut) ? 1. : -1.);
631 G4double distR =
fR - std::sqrt(x*x + y*y + z*z);
635 return (dist < 0.) ? 0. : dist;
662 G4int oldprc = os.precision(16);
663 os <<
"-----------------------------------------------------------\n"
664 <<
" *** Dump for solid - " <<
GetName() <<
" ***\n"
665 <<
" ===================================================\n"
668 <<
" semi-axis x: " <<
GetDx()/
mm <<
" mm \n"
669 <<
" semi-axis y: " <<
GetDy()/
mm <<
" mm \n"
670 <<
" semi-axis z: " <<
GetDz()/
mm <<
" mm \n"
673 <<
"-----------------------------------------------------------\n";
674 os.precision(oldprc);
708 const G4int Nphi = 100;
709 const G4int Nz = 200;
716 for (
G4int iz = 0; iz < Nz; ++iz)
719 rho[iz] = std::sqrt((1. + z) * (1. - z));
721 rho[Nz] = std::sqrt((1. + ztop) * (1. - ztop));
726 dz = (ztop - zbot) / Nz;
729 for (
G4int iphi = 0; iphi < Nphi; ++iphi)
737 for (
G4int iz = 0; iz < Nz; ++iz)
740 G4double z2 = (iz == Nz - 1) ? ztop : z1 + dz;
747 area += ((p4 - p1).
cross(p3 - p2)).mag();
793 G4double Sbot = piAB * Hbot * (2. - Hbot);
794 G4double Stop = piAB * Htop * (2. - Htop);
808 if (select > Sbot) k = 1;
809 if (select > Sbot + Slat) k = 2;
819 p.
set(rho.
x(), rho.
y(), Zbot);
826 for (
G4int i = 0; i < 1000; ++i)
830 G4double rho = std::sqrt((1. + z) * (1. - z));
832 x = rho * std::cos(phi);
833 y = rho * std::sin(phi);
838 G4double mu = std::sqrt(xbc * xbc + yac * yac + zab * zab);
841 p.
set(A * x, B * y, C * z);
848 p.
set(rho.
x(), rho.
y(), Ztop);
902 #endif // !defined(G4GEOM_USE_UELLIPSOID) || !defined(G4GEOM_USE_SYS_USOLIDS)