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";
 
  139   : 
G4VSolid(a), innerRadius(0.), outerRadius(0.), halfLenZ(0.), innerStereo(0.),
 
  140     outerStereo(0.), tanInnerStereo(0.), tanOuterStereo(0.), tanInnerStereo2(0.),
 
  141     tanOuterStereo2(0.), innerRadius2(0.), outerRadius2(0.), endInnerRadius2(0.),
 
  142     endOuterRadius2(0.), endInnerRadius(0.), endOuterRadius(0.),
 
  143     fCubicVolume(0.), fSurfaceArea(0.), fHalfTol(0.),
 
  144     fRebuildPolyhedron(false), fpPolyhedron(0)
 
  162   : 
G4VSolid(rhs), innerRadius(rhs.innerRadius),
 
  163     outerRadius(rhs.outerRadius), halfLenZ(rhs.halfLenZ),
 
  164     innerStereo(rhs.innerStereo), outerStereo(rhs.outerStereo),
 
  165     tanInnerStereo(rhs.tanInnerStereo), tanOuterStereo(rhs.tanOuterStereo),
 
  166     tanInnerStereo2(rhs.tanInnerStereo2), tanOuterStereo2(rhs.tanOuterStereo2),
 
  167     innerRadius2(rhs.innerRadius2), outerRadius2(rhs.outerRadius2),
 
  168     endInnerRadius2(rhs.endInnerRadius2), endOuterRadius2(rhs.endOuterRadius2),
 
  169     endInnerRadius(rhs.endInnerRadius), endOuterRadius(rhs.endOuterRadius),
 
  170     fCubicVolume(rhs.fCubicVolume), fSurfaceArea(rhs.fSurfaceArea),
 
  171     fHalfTol(rhs.fHalfTol), fRebuildPolyhedron(false), fpPolyhedron(0)
 
  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() );
 
  518   const G4double absZ(std::fabs(p.z()));
 
  525   const G4double xR2( p.x()*p.x()+p.y()*p.y() );
 
  562   const G4double absZ(std::fabs(p.z()));
 
  566   const G4double xR2( p.x()*p.x()+p.y()*p.y() );
 
  575     if (dist2Inner < dist2Z && dist2Inner < dist2Outer)
 
  582   if (dist2Z < dist2Outer) 
 
  635   G4bool couldMissOuter(
true),
 
  636          couldMissInner(
true),
 
  637          cantMissInnerCylinder(
false);
 
  662       G4double pr2 = p.x()*p.x() + p.y()*p.y();
 
  687                yi = p.y() + q*v.y();
 
  714               && ((std::fabs(v.x()) > 
DBL_MIN) || (std::fabs(v.y()) > 
DBL_MIN)) )
 
  715               cantMissInnerCylinder = 
true;
 
  725         G4double dotR( xi*v.x() + yi*v.y() );
 
  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();
 
  905   G4double r2 = p.x()*p.x() + p.y()*p.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; }
 
 1027   G4double r2 = p.x()*p.x() + p.y()*p.y();
 
 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;
 
 1217   G4double tx = v.x(), ty = v.y(), tz = v.z();
 
 1219   G4double a = tx*tx + ty*ty - tz*tz*tan2Phi;
 
 1220   G4double b = 2*( x0*tx + y0*ty - 
z0*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;
 
 1341   if (tan2Phi < 
DBL_MIN) 
return r0 - pr;
 
 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()
 
ThreeVector shoot(const G4int Ap, const G4int Af)
 
G4Hype(const G4String &pName, G4double newInnerRadius, G4double newOuterRadius, G4double newInnerStereo, G4double newOuterStereo, G4double newHalfLenZ)
 
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const 
 
static const G4double kInfinity
 
CLHEP::Hep3Vector G4ThreeVector
 
G4double GetSurfaceArea()
 
G4GeometryType GetEntityType() const 
 
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
 
static G4double ApproxDistInside(G4double pr, G4double pz, G4double r0, G4double tan2Phi)
 
G4bool GetExtent(G4double &min, G4double &max) const 
 
virtual G4double GetCubicVolume()
 
void SetNormal(const G4ThreeVector &newNormal)
 
virtual G4bool PartialClip(const G4VoxelLimits &voxelLimit, const EAxis IgnoreMe)
 
G4Polyhedron * CreatePolyhedron() const 
 
virtual void AddVertexInOrder(const G4ThreeVector vertex)
 
void DescribeYourselfTo(G4VGraphicsScene &scene) const 
 
virtual void AddSolid(const G4Box &)=0
 
G4bool InnerSurfaceExists() const 
 
#define G4MUTEX_INITIALIZER
 
G4double HypeOuterRadius2(G4double zVal) const 
 
static double normal(HepRandomEngine *eptr)
 
static G4double ApproxDistOutside(G4double pr, G4double pz, G4double r0, G4double tanPhi)
 
G4double HypeInnerRadius2(G4double zVal) const 
 
static const double twopi
 
void AddSurface(const G4ClippablePolygon &surface)
 
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=G4bool(false), G4bool *validNorm=0, G4ThreeVector *n=0) const 
 
G4Hype & operator=(const G4Hype &rhs)
 
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
 
G4ThreeVector GetPointOnSurface() const 
 
virtual void ComputeDimensions(G4Box &, const G4int, const G4VPhysicalVolume *) const 
 
static void AddPolyToExtent(const G4ThreeVector &v0, const G4ThreeVector &v1, const G4ThreeVector &w1, const G4ThreeVector &w0, const G4VoxelLimits &voxelLimit, const EAxis axis, G4SolidExtentList &extentList)
 
G4VisExtent GetExtent() const 
 
static G4int IntersectHype(const G4ThreeVector &p, const G4ThreeVector &v, G4double r2, G4double tan2Phi, G4double s[2])
 
T max(const T t1, const T t2)
brief Return the largest of the two arguments 
 
EInside Inside(const G4ThreeVector &p) const 
 
T min(const T t1, const T t2)
brief Return the smallest of the two arguments 
 
static const double degree
 
G4Polyhedron * fpPolyhedron
 
G4double asinh(G4double arg)
 
G4VSolid & operator=(const G4VSolid &rhs)
 
G4int GetNumberOfRotationStepsAtTimeOfCreation() const 
 
void SetOuterStereo(G4double newOSte)
 
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const 
 
static const G4double alpha
 
virtual G4double GetSurfaceArea()
 
std::ostream & StreamInfo(std::ostream &os) const 
 
G4Polyhedron * GetPolyhedron() const 
 
void SetInnerStereo(G4double newISte)
 
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const 
 
const G4int kMaxMeshSections