71 using namespace CLHEP;
80 :
G4VSolid(pName), fCubicVolume(0.), fSurfaceArea(0.),
81 fRebuildPolyhedron(false), fpPolyhedron(0)
89 std::ostringstream message;
91 <<
" Invalid Z half-length: " 92 << newHalfLenZ/
mm <<
" mm";
100 if (newInnerRadius<0 || newOuterRadius<0)
102 std::ostringstream message;
104 <<
" Invalid radii ! Inner radius: " 105 << newInnerRadius/
mm <<
" mm" <<
G4endl 107 << newOuterRadius/
mm <<
" mm";
111 if (newInnerRadius >= newOuterRadius)
113 std::ostringstream message;
115 <<
" Invalid radii ! Inner radius: " 116 << newInnerRadius/
mm <<
" mm" <<
G4endl 118 << newOuterRadius/
mm <<
" mm";
183 if (
this == &rhs) {
return *
this; }
236 G4double rFudge = 1.0/std::cos(0.5*sigPhi);
289 cosPhi = std::cos(phi),
290 sinPhi = std::sin(phi);
298 w0, w1, w2, w3, w4, w5, w6;
356 if (numPhi == 1) phi = 0;
357 cosPhi = std::cos(phi),
358 sinPhi = std::sin(phi);
449 if (splitOuter) v4 = w4;
451 }
while( --numPhi > 0 );
504 phiPoly.
SetNormal( (v1-v0).cross(w0-v0).unit() );
575 if (dist2Inner < dist2Z && dist2Inner < dist2Outer)
582 if (dist2Z < dist2Outer)
635 G4bool couldMissOuter(
true),
636 couldMissInner(
true),
637 cantMissInnerCylinder(
false);
687 yi = p.
y() + q*v.
y();
715 cantMissInnerCylinder =
true;
793 if (zi < -halfLenZ)
continue;
794 if (zi > +halfLenZ && couldMissOuter)
continue;
800 yi = p.
y() + q[i]*v.
y();
818 if (cantMissInnerCylinder)
return (sigz <
fHalfTol) ? 0 : -sigz/vz;
846 if (q[i] > best)
break;
856 if (zi < -halfLenZ)
continue;
857 if (zi > +halfLenZ && couldMissInner)
continue;
863 yi = p.
y() + q[i]*v.
y();
925 G4double answer = std::sqrt( dr*dr + sigz*sigz );
926 return answer <
fHalfTol ? 0 : answer;
946 G4double answer = std::sqrt( dr*dr + sigz*sigz );
947 return answer <
fHalfTol ? 0 : answer;
959 return answer <
fHalfTol ? 0 : answer;
967 return answer <
fHalfTol ? 0 : answer;
1014 if (calcNorm) { *norm = *nBest; *validNorm =
true; }
1046 if (normHere.dot(v) > 0)
1048 if (calcNorm) { *norm = normHere.
unit(); *validNorm =
false; }
1057 for( i=0; i<
n; i++ )
1059 if (q[i] > sBest)
break;
1068 if (norm1.
dot(v) > 0)
1094 if (normHere.dot(v) > 0)
1098 *norm = normHere.
unit();
1109 for( i=0; i<
n; i++ )
1111 if (q[i] > sBest)
break;
1116 if (norm2.
dot(v) > 0)
1135 if (nBest == &norm1 || nBest == &norm2)
1136 *norm = nBest->
unit();
1161 if (tryOuter < sBest)
1167 if (tryInner < sBest) sBest = tryInner;
1219 G4double a = tx*tx + ty*ty - tz*tz*tan2Phi;
1229 if (std::fabs(b) <
DBL_MIN)
return 0;
1238 if (radical < -
DBL_MIN)
return 0;
1249 radical = std::sqrt(radical);
1251 G4double q = -0.5*( b + (b < 0 ? -radical : +radical) );
1254 if (sa < sb) { ss[0] = sa; ss[1] = sb; }
else { ss[0] = sb; ss[1] = sa; }
1291 G4double r1 = std::sqrt( r0*r0 + z1*z1*tan2Phi );
1296 G4double z2 = (pr*tanPhi + pz)/(1 + tan2Phi);
1297 G4double r2 = std::sqrt( r0*r0 + z2*z2*tan2Phi );
1305 G4double len = std::sqrt(dr*dr + dz*dz);
1314 return std::sqrt( dr*dr + dz*dz );
1320 return std::fabs((pr-r1)*dz - (pz-z1)*dr)/len;
1346 G4double rh = std::sqrt( r0*r0 + pz*pz*tan2Phi );
1350 G4double len = std::sqrt(dr*dr + dz*dz);
1355 return std::fabs((pr-rh)*dr)/len;
1373 return new G4Hype(*
this);
1404 G4int oldprc = os.precision(16);
1405 os <<
"-----------------------------------------------------------\n" 1406 <<
" *** Dump for solid - " <<
GetName() <<
" ***\n" 1407 <<
" ===================================================\n" 1408 <<
" Solid type: G4Hype\n" 1409 <<
" Parameters: \n" 1410 <<
" half length Z: " <<
halfLenZ/
mm <<
" mm \n" 1415 <<
"-----------------------------------------------------------\n";
1416 os.precision(oldprc);
1428 G4double xRand, yRand, zRand, r2 , aOne, aTwo, aThree, chose, sinhu;
1429 G4double phi, cosphi, sinphi, rBar2Out, rBar2In,
alpha, t, rOut, rIn2, rOut2;
1438 t = std::log(t+std::sqrt(
sqr(t)+1));
1439 aOne = std::fabs(2.*alpha*(std::sinh(2.*t)/4.+t/2.));
1445 t = std::log(t+std::sqrt(
sqr(t)+1));
1446 aTwo = std::fabs(2.*alpha*(std::sinh(2.*t)/4.+t/2.));
1455 cosphi = std::cos(phi);
1456 sinphi = std::sin(phi);
1461 if(chose>=0. && chose < aOne)
1476 else if(chose>=aOne && chose<aOne+aTwo)
1493 else if(chose>=aOne+aTwo && chose<aOne+aTwo+aThree)
1497 rOut = std::sqrt(rOut2) ;
1503 r2 = xRand*xRand + yRand*yRand ;
1504 }
while ( ! ( r2 >= rIn2 && r2 <= rOut2 ) ) ;
1513 rOut = std::sqrt(rOut2) ;
1519 r2 = xRand*xRand + yRand*yRand ;
1520 }
while ( ! ( r2 >= rIn2 && r2 <= rOut2 ) ) ;
1585 return std::log(arg+std::sqrt(
sqr(arg)+1));
G4bool fRebuildPolyhedron
G4double GetCubicVolume()
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
ThreeVector shoot(const G4int Ap, const G4int Af)
G4Hype(const G4String &pName, G4double newInnerRadius, G4double newOuterRadius, G4double newInnerStereo, G4double newOuterStereo, G4double newHalfLenZ)
G4double HypeInnerRadius2(G4double zVal) const
static const G4double kInfinity
G4int GetNumberOfRotationStepsAtTimeOfCreation() const
CLHEP::Hep3Vector G4ThreeVector
G4double GetSurfaceArea()
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
static G4double ApproxDistInside(G4double pr, G4double pz, G4double r0, G4double tan2Phi)
virtual G4double GetCubicVolume()
void DescribeYourselfTo(G4VGraphicsScene &scene) const
void SetNormal(const G4ThreeVector &newNormal)
virtual G4bool PartialClip(const G4VoxelLimits &voxelLimit, const EAxis IgnoreMe)
G4VisExtent GetExtent() const
virtual void AddVertexInOrder(const G4ThreeVector vertex)
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
G4Polyhedron * GetPolyhedron() const
G4double HypeOuterRadius2(G4double zVal) const
virtual void AddSolid(const G4Box &)=0
EInside Inside(const G4ThreeVector &p) const
#define G4MUTEX_INITIALIZER
G4bool GetExtent(G4double &min, G4double &max) const
static double normal(HepRandomEngine *eptr)
static G4double ApproxDistOutside(G4double pr, G4double pz, G4double r0, G4double tanPhi)
G4ThreeVector GetPointOnSurface() const
static const double twopi
G4GeometryType GetEntityType() const
void AddSurface(const G4ClippablePolygon &surface)
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const
G4Hype & operator=(const G4Hype &rhs)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
static void AddPolyToExtent(const G4ThreeVector &v0, const G4ThreeVector &v1, const G4ThreeVector &w1, const G4ThreeVector &w0, const G4VoxelLimits &voxelLimit, const EAxis axis, G4SolidExtentList &extentList)
double dot(const Hep3Vector &) const
static G4int IntersectHype(const G4ThreeVector &p, const G4ThreeVector &v, G4double r2, G4double tan2Phi, G4double s[2])
static G4int GetNumberOfRotationSteps()
G4bool InnerSurfaceExists() const
static const double degree
G4Polyhedron * fpPolyhedron
G4double asinh(G4double arg)
G4VSolid & operator=(const G4VSolid &rhs)
void SetOuterStereo(G4double newOSte)
G4Polyhedron * CreatePolyhedron() const
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=G4bool(false), G4bool *validNorm=0, G4ThreeVector *n=0) const
static const G4double alpha
virtual G4double GetSurfaceArea()
void SetInnerStereo(G4double newISte)
std::ostream & StreamInfo(std::ostream &os) const
const G4int kMaxMeshSections
virtual void ComputeDimensions(G4Box &, const G4int, const G4VPhysicalVolume *) const