78 :
G4VSolid(pName), fCubicVolume(0.), fSurfaceArea(0.), fpPolyhedron(0)
84 std::ostringstream message;
86 <<
" Invalid Z half-length: "
87 << newHalfLenZ/mm <<
" mm";
95 if (newInnerRadius<0 || newOuterRadius<0)
97 std::ostringstream message;
99 <<
" Invalid radii ! Inner radius: "
100 << newInnerRadius/mm <<
" mm" <<
G4endl
102 << newOuterRadius/mm <<
" mm";
106 if (newInnerRadius >= newOuterRadius)
108 std::ostringstream message;
110 <<
" Invalid radii ! Inner radius: "
111 << newInnerRadius/mm <<
" mm" <<
G4endl
113 << newOuterRadius/mm <<
" mm";
134 :
G4VSolid(a), innerRadius(0.), outerRadius(0.), halfLenZ(0.), innerStereo(0.),
135 outerStereo(0.), tanInnerStereo(0.), tanOuterStereo(0.), tanInnerStereo2(0.),
136 tanOuterStereo2(0.), innerRadius2(0.), outerRadius2(0.), endInnerRadius2(0.),
137 endOuterRadius2(0.), endInnerRadius(0.), endOuterRadius(0.),
138 fCubicVolume(0.), fSurfaceArea(0.), fpPolyhedron(0)
156 :
G4VSolid(rhs), innerRadius(rhs.innerRadius),
157 outerRadius(rhs.outerRadius), halfLenZ(rhs.halfLenZ),
158 innerStereo(rhs.innerStereo), outerStereo(rhs.outerStereo),
159 tanInnerStereo(rhs.tanInnerStereo), tanOuterStereo(rhs.tanOuterStereo),
160 tanInnerStereo2(rhs.tanInnerStereo2), tanOuterStereo2(rhs.tanOuterStereo2),
161 innerRadius2(rhs.innerRadius2), outerRadius2(rhs.outerRadius2),
162 endInnerRadius2(rhs.endInnerRadius2), endOuterRadius2(rhs.endOuterRadius2),
163 endInnerRadius(rhs.endInnerRadius), endOuterRadius(rhs.endOuterRadius),
164 fCubicVolume(rhs.fCubicVolume), fSurfaceArea(rhs.fSurfaceArea),
177 if (
this == &rhs) {
return *
this; }
193 fCubicVolume = rhs.fCubicVolume; fSurfaceArea = rhs.fSurfaceArea;
228 G4double rFudge = 1.0/std::cos(0.5*sigPhi);
281 cosPhi = std::cos(phi),
282 sinPhi = std::sin(phi);
290 w0, w1, w2, w3, w4, w5, w6;
348 if (numPhi == 1) phi = 0;
349 cosPhi = std::cos(phi),
350 sinPhi = std::sin(phi);
441 if (splitOuter) v4 = w4;
443 }
while( --numPhi > 0 );
496 phiPoly.
SetNormal( (v1-v0).cross(w0-v0).unit() );
569 if (dist2Inner < dist2Z && dist2Inner < dist2Outer)
576 if (dist2Z < dist2Outer)
631 G4bool couldMissOuter(
true),
632 couldMissInner(
true),
633 cantMissInnerCylinder(
false);
652 if (sigz > 0)
return kInfinity;
683 yi = p.
y() + q*v.
y();
711 cantMissInnerCylinder =
true;
716 return (sigz < halfTol) ? 0 : q;
790 if (zi > +
halfLenZ && couldMissOuter)
continue;
796 yi = p.
y() + q[i]*v.
y();
814 if (cantMissInnerCylinder)
return (sigz < halfTol) ? 0 : -sigz/vz;
842 if (q[i] > best)
break;
853 if (zi > +
halfLenZ && couldMissInner)
continue;
859 yi = p.
y() + q[i]*v.
y();
915 return sigz < halfTol ? 0 : sigz;
923 G4double answer = std::sqrt( dr*dr + sigz*sigz );
924 return answer < halfTol ? 0 : answer;
932 return sigz < halfTol ? 0 : sigz;
944 G4double answer = std::sqrt( dr*dr + sigz*sigz );
945 return answer < halfTol ? 0 : answer;
957 return answer < halfTol ? 0 : answer;
965 return answer < halfTol ? 0 : answer;
1015 if (calcNorm) { *norm = *nBest; *validNorm =
true; }
1047 if (normHere.
dot(v) > 0)
1049 if (calcNorm) { *norm = normHere.
unit(); *validNorm =
false; }
1058 for( i=0; i<n; i++ )
1060 if (q[i] > sBest)
break;
1069 if (norm1.
dot(v) > 0)
1095 if (normHere.
dot(v) > 0)
1099 *norm = normHere.
unit();
1110 for( i=0; i<n; i++ )
1112 if (q[i] > sBest)
break;
1117 if (norm2.
dot(v) > 0)
1136 if (nBest == &norm1 || nBest == &norm2)
1137 *norm = nBest->
unit();
1162 if (tryOuter < sBest)
1168 if (tryInner < sBest) sBest = tryInner;
1220 G4double a = tx*tx + ty*ty - tz*tz*tan2Phi;
1221 G4double b = 2*( x0*tx + y0*ty - z0*tz*tan2Phi );
1222 G4double c = x0*x0 + y0*y0 - r2 - z0*z0*tan2Phi;
1230 if (std::fabs(b) <
DBL_MIN)
return 0;
1239 if (radical < -
DBL_MIN)
return 0;
1250 radical = std::sqrt(radical);
1252 G4double q = -0.5*( b + (b < 0 ? -radical : +radical) );
1255 if (sa < sb) { ss[0] = sa; ss[1] = sb; }
else { ss[0] = sb; ss[1] = sa; }
1284 if (tanPhi <
DBL_MIN)
return pr-r0;
1292 G4double r1 = std::sqrt( r0*r0 + z1*z1*tan2Phi );
1297 G4double z2 = (pr*tanPhi + pz)/(1 + tan2Phi);
1298 G4double r2 = std::sqrt( r0*r0 + z2*z2*tan2Phi );
1306 G4double len = std::sqrt(dr*dr + dz*dz);
1315 return std::sqrt( dr*dr + dz*dz );
1321 return std::fabs((pr-r1)*dz - (pz-z1)*dr)/len;
1342 if (tan2Phi <
DBL_MIN)
return r0 - pr;
1347 G4double rh = std::sqrt( r0*r0 + pz*pz*tan2Phi );
1351 G4double len = std::sqrt(dr*dr + dz*dz);
1356 return std::fabs((pr-rh)*dr)/len;
1374 return new G4Hype(*
this);
1383 if(fCubicVolume != 0.) {;}
1385 return fCubicVolume;
1394 if(fSurfaceArea != 0.) {;}
1396 return fSurfaceArea;
1405 G4int oldprc = os.precision(16);
1406 os <<
"-----------------------------------------------------------\n"
1407 <<
" *** Dump for solid - " <<
GetName() <<
" ***\n"
1408 <<
" ===================================================\n"
1409 <<
" Solid type: G4Hype\n"
1410 <<
" Parameters: \n"
1411 <<
" half length Z: " <<
halfLenZ/mm <<
" mm \n"
1412 <<
" inner radius : " <<
innerRadius/mm <<
" mm \n"
1413 <<
" outer radius : " <<
outerRadius/mm <<
" mm \n"
1414 <<
" inner stereo angle : " <<
innerStereo/degree <<
" degrees \n"
1415 <<
" outer stereo angle : " <<
outerStereo/degree <<
" degrees \n"
1416 <<
"-----------------------------------------------------------\n";
1417 os.precision(oldprc);
1429 G4double xRand, yRand, zRand, r2 , aOne, aTwo, aThree, chose, sinhu;
1430 G4double phi, cosphi, sinphi, rBar2Out, rBar2In, alpha, t, rOut, rIn2, rOut2;
1439 t = std::log(t+std::sqrt(
sqr(t)+1));
1440 aOne = std::fabs(2.*alpha*(std::sinh(2.*t)/4.+t/2.));
1446 t = std::log(t+std::sqrt(
sqr(t)+1));
1447 aTwo = std::fabs(2.*alpha*(std::sinh(2.*t)/4.+t/2.));
1456 cosphi = std::cos(phi);
1457 sinphi = std::sin(phi);
1462 if(chose>=0. && chose < aOne)
1477 else if(chose>=aOne && chose<aOne+aTwo)
1494 else if(chose>=aOne+aTwo && chose<aOne+aTwo+aThree)
1498 rOut = std::sqrt(rOut2) ;
1503 r2 = xRand*xRand + yRand*yRand ;
1504 }
while ( ! ( r2 >= rIn2 && r2 <= rOut2 ) ) ;
1513 rOut = std::sqrt(rOut2) ;
1518 r2 = xRand*xRand + yRand*yRand ;
1519 }
while ( ! ( r2 >= rIn2 && r2 <= rOut2 ) ) ;
1564 if (!fpPolyhedron ||
1568 delete fpPolyhedron;
1571 return fpPolyhedron;
1591 return std::log(arg+std::sqrt(
sqr(arg)+1));
CLHEP::Hep3Vector G4ThreeVector
double dot(const Hep3Vector &) const
virtual G4bool PartialClip(const G4VoxelLimits &voxelLimit, const EAxis IgnoreMe)
virtual void AddVertexInOrder(const G4ThreeVector vertex)
void SetNormal(const G4ThreeVector &newNormal)
G4ThreeVector GetPointOnSurface() const
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=G4bool(false), G4bool *validNorm=0, G4ThreeVector *n=0) const
G4Hype(const G4String &pName, G4double newInnerRadius, G4double newOuterRadius, G4double newInnerStereo, G4double newOuterStereo, G4double newHalfLenZ)
G4Polyhedron * CreatePolyhedron() const
G4VisExtent GetExtent() const
static void AddPolyToExtent(const G4ThreeVector &v0, const G4ThreeVector &v1, const G4ThreeVector &w1, const G4ThreeVector &w0, const G4VoxelLimits &voxelLimit, const EAxis axis, G4SolidExtentList &extentList)
G4Polyhedron * GetPolyhedron() const
static G4int IntersectHype(const G4ThreeVector &p, const G4ThreeVector &v, G4double r2, G4double tan2Phi, G4double s[2])
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
G4NURBS * CreateNURBS() const
G4Hype & operator=(const G4Hype &rhs)
EInside Inside(const G4ThreeVector &p) const
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
static G4double ApproxDistOutside(G4double pr, G4double pz, G4double r0, G4double tanPhi)
void SetOuterStereo(G4double newOSte)
G4double GetCubicVolume()
G4bool InnerSurfaceExists() const
G4double HypeOuterRadius2(G4double zVal) const
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
std::ostream & StreamInfo(std::ostream &os) const
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const
static G4double ApproxDistInside(G4double pr, G4double pz, G4double r0, G4double tan2Phi)
G4GeometryType GetEntityType() const
G4double HypeInnerRadius2(G4double zVal) const
G4double GetSurfaceArea()
void SetInnerStereo(G4double newISte)
void DescribeYourselfTo(G4VGraphicsScene &scene) const
G4int GetNumberOfRotationStepsAtTimeOfCreation() const
void AddSurface(const G4ClippablePolygon &surface)
G4bool GetExtent(G4double &min, G4double &max) const
virtual void AddSolid(const G4Box &)=0
virtual void ComputeDimensions(G4Box &, const G4int, const G4VPhysicalVolume *) const
G4VSolid & operator=(const G4VSolid &rhs)
virtual G4double GetCubicVolume()
virtual G4double GetSurfaceArea()
static G4int GetNumberOfRotationSteps()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
const G4int kMaxMeshSections