40 #if !(defined(G4GEOM_USE_UPARABOLOID) && defined(G4GEOM_USE_SYS_USOLIDS))
60 using namespace CLHEP;
70 :
G4VSolid(pName), fRebuildPolyhedron(false), fpPolyhedron(0),
71 fSurfaceArea(0.), fCubicVolume(0.)
74 if( (pDz <= 0.) || (pR2 <= pR1) || (pR1 < 0.) )
77 message <<
"Invalid dimensions. Negative Input Values or R1>=R2 - "
79 G4Exception(
"G4Paraboloid::G4Paraboloid()",
"GeomSolids0002",
81 "Z half-length must be larger than zero or R1>=R2.");
103 :
G4VSolid(a), fRebuildPolyhedron(false), fpPolyhedron(0),
104 fSurfaceArea(0.), fCubicVolume(0.),
105 dz(0.), r1(0.), r2(0.), k1(0.), k2(0.)
123 :
G4VSolid(rhs), fRebuildPolyhedron(false), fpPolyhedron(0),
124 fSurfaceArea(rhs.fSurfaceArea), fCubicVolume(rhs.fCubicVolume),
125 dz(rhs.dz), r1(rhs.r1), r2(rhs.r2), k1(rhs.k1), k2(rhs.k2)
138 if (
this == &rhs) {
return *
this; }
178 if (pMin.
x() >= pMax.
x() || pMin.
y() >= pMax.
y() || pMin.
z() >= pMax.
z())
181 message <<
"Bad bounding box (min >= max) for solid: "
183 <<
"\npMin = " << pMin
184 <<
"\npMax = " << pMax;
185 G4Exception(
"G4Paraboloid::BoundingLimits()",
"GeomMgt0001",
225 if(
A < 0 &&
sqr(
A) > rhoSurfTimesTol2)
230 if(std::fabs(p.
z()) >
dz - 0.5 * kCarTolerance)
242 else if(
A <= 0 ||
sqr(
A) < rhoSurfTimesTol2)
315 if(A < 0 &&
sqr(A) > rhoSurfTimesTol2)
322 else if(A <= 0 ||
sqr(A) < rhoSurfTimesTol2)
337 message <<
"No normal defined for this point p." <<
G4endl
338 <<
" p = " << 1 /
mm * p <<
" mm";
339 G4Exception(
"G4Paraboloid::SurfaceNormal(p)",
"GeomSolids1002",
358 if(
r2 && p.
z() > - tolh +
dz)
365 if(
sqr(p.
x() + v.
x()*intersection)
366 +
sqr(p.
y() + v.
y()*intersection) <
sqr(
r2 + 0.5 * kCarTolerance))
368 if(p.
z() < tolh +
dz)
371 {
return intersection; }
379 else if(
r1 && p.
z() < tolh -
dz)
386 if(
sqr(p.
x() + v.
x()*intersection)
387 +
sqr(p.
y() + v.
y()*intersection) <
sqr(
r1 + 0.5 * kCarTolerance))
389 if(p.
z() > -tolh -
dz)
406 vRho2 = v.
perp2(), intersection,
407 B = (
k1 * p.
z() +
k2 - rho2) * vRho2;
409 if ( ( (rho2 > paraRho2) && (
sqr(rho2-paraRho2-0.25*tol2) > tol2*paraRho2) )
417 intersection = ((rho2 -
k2)/
k1 - p.
z())/v.
z();
418 if(intersection < 0) {
return kInfinity; }
419 else if(std::fabs(p.
z() + v.
z() * intersection) <=
dz)
434 intersection = (A - std::sqrt(B +
sqr(A))) / vRho2;
439 else if(std::fabs(p.
z() + intersection * v.
z()) <
dz + tolh)
449 else if(
sqr(rho2 - paraRho2 - .25 * tol2) <= tol2 * paraRho2)
468 message <<
"Likely a problem in this function, for solid: " <<
GetName()
471 message <<
" p = " << p * (1/
mm) <<
" mm" <<
G4endl
472 <<
" v = " << v * (1/
mm) <<
" mm";
473 G4Exception(
"G4Paraboloid::DistanceToIn(p,v)",
"GeomSolids1002",
487 if(safz<0) { safz=0; }
497 if(safr>safz) { safz=safr; }
501 G4double sqprho = std::sqrt(paraRho);
503 if(dRho<0) {
return safz; }
507 if(tmp<0.) {
return safz; }
509 G4double salf = talf/std::sqrt(tmp);
510 safr = std::fabs(dRho*salf);
511 if(safr>safz) { safz=safr; }
531 if(calcNorm) { *validNorm =
false; }
547 if ( rho2 < paraRho2 &&
sqr(rho2 - paraRho2 - 0.25 * tol2) > tol2 * paraRho2
548 && std::fabs(p.
z()) <
dz - kCarTolerance)
559 intersection = (
dz - p.
z()) / v.
z();
584 intersection = (-
dz - p.
z()) / v.
z();
607 intersection = ((rho2 -
k2)/
k1 - p.
z())/v.
z();
618 else if( ((A <= 0) && (B >=
sqr(A) * (
sqr(vRho2) - 1))) || (A >= 0))
625 B = (
k1 * p.
z() +
k2 - rho2)/vRho2;
626 intersection = B/(-A + std::sqrt(B +
sqr(A)));
637 message <<
"There is no intersection between given line and solid!"
641 G4Exception(
"G4Paraboloid::DistanceToOut(p,v,...)",
"GeomSolids1002",
646 else if ( (rho2 < paraRho2 + kCarTolerance
647 ||
sqr(rho2 - paraRho2 - 0.25 * tol2) < tol2 * paraRho2 )
648 && std::fabs(p.
z()) <
dz + tolh)
654 if(std::fabs(p.
z()) >
dz - tolh)
658 if( ((v.
z() > 0) && (p.
z() > 0)) || ((v.
z() < 0) && (p.
z() < 0)) )
680 intersection = (-pDotV + std::sqrt(A +
sqr(pDotV))) / vRho2;
688 * intersection, -
k1/2).unit()).unit();
718 intersection = (
dz - p.
z()) / v.
z();
746 intersection = (-
dz - p.
z()) / v.
z();
773 if(std::fabs(vRho2) > tol2)
776 B = (
k1 * p.
z() +
k2 - rho2);
780 intersection = B/(-A + std::sqrt(B +
sqr(A)));
784 if(normal.
dot(v) >= 0)
798 intersection = ((rho2 -
k2) /
k1 - p.
z()) / v.
z();
805 + intersection * v.
y(), -
k1 / 2);
815 G4Exception(
"G4Paraboloid::DistanceToOut(p,v,...)",
"GeomSolids1002",
819 G4Exception(
"G4Paraboloid::DistanceToOut(p,v,...)",
"GeomSolids1002",
820 JustWarning,
"There's an error in this functions code.");
842 G4int oldprc = message.precision(16);
843 message <<
"Point p is outside !?" << G4endl
844 <<
"Position:" << G4endl
845 <<
" p.x() = " << p.
x()/
mm <<
" mm" << G4endl
846 <<
" p.y() = " << p.
y()/
mm <<
" mm" << G4endl
847 <<
" p.z() = " << p.
z()/
mm <<
" mm";
848 message.precision(oldprc) ;
849 G4Exception(
"G4Paraboloid::DistanceToOut(p)",
"GeomSolids1002",
855 safeZ =
dz - std::fabs(p.
z()) ;
857 tanRMax = (
r2 -
r1)*0.5/
dz ;
858 secRMax = std::sqrt(1.0 + tanRMax*tanRMax) ;
859 pRMax = tanRMax*p.
z() + (
r1+
r2)*0.5 ;
860 safeR = (pRMax - rho)/secRMax ;
862 if (safeZ < safeR) { safe = safeZ; }
863 else { safe = safeR; }
892 G4int oldprc = os.precision(16);
893 os <<
"-----------------------------------------------------------\n"
894 <<
" *** Dump for solid - " <<
GetName() <<
" ***\n"
895 <<
" ===================================================\n"
896 <<
" Solid type: G4Paraboloid\n"
898 <<
" z half-axis: " <<
dz/
mm <<
" mm \n"
899 <<
" radius at -dz: " <<
r1/
mm <<
" mm \n"
900 <<
" radius at dz: " <<
r2/
mm <<
" mm \n"
901 <<
"-----------------------------------------------------------\n";
902 os.precision(oldprc);
934 std::sqrt(z*
k1 +
k2)*std::sin(phi), z);
969 #endif // !defined(G4GEOM_USE_UPARABOLOID) || !defined(G4GEOM_USE_SYS_USOLIDS)
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimits, const G4Transform3D &pTransform3D, G4double &pMin, G4double &pMax) const
void set(double x, double y, double z)
CLHEP::Hep3Vector G4ThreeVector
G4Polyhedron * fpPolyhedron
std::vector< ExP01TrackerHit * > a
virtual void AddSolid(const G4Box &)=0
static const G4double kInfinity
static constexpr double mm
void message(RunManager *runmanager)
G4ThreeVector GetPointOnSurface() const
static double normal(HepRandomEngine *eptr)
double dot(const Hep3Vector &) const
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const
G4VSolid & operator=(const G4VSolid &rhs)
#define G4MUTEX_INITIALIZER
void DescribeYourselfTo(G4VGraphicsScene &scene) const
G4Polyhedron * GetPolyhedron() const
static constexpr double twopi
double A(double temperature)
EInside Inside(const G4ThreeVector &p) const
ThreeVector shoot(const G4int Ap, const G4int Af)
G4Paraboloid & operator=(const G4Paraboloid &rhs)
static G4int GetNumberOfRotationSteps()
std::ostream & StreamInfo(std::ostream &os) const
G4GeometryType GetEntityType() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4Polyhedron * CreatePolyhedron() const
G4int GetNumberOfRotationStepsAtTimeOfCreation() const
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=G4bool(false), G4bool *validNorm=0, G4ThreeVector *n=0) const
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
G4bool fRebuildPolyhedron
G4GLOB_DLL std::ostream G4cout
G4double CalculateSurfaceArea() const
static constexpr double pi
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
G4Paraboloid(const G4String &pName, G4double pDz, G4double pR1, G4double pR2)
double B(double temperature)