36 #if !(defined(G4GEOM_USE_UHYPE) && defined(G4GEOM_USE_SYS_USOLIDS))
61 using namespace CLHEP;
81 <<
" Invalid Z half-length: "
82 << newHalfLenZ/
mm <<
" mm";
90 if (newInnerRadius<0 || newOuterRadius<0)
94 <<
" Invalid radii ! Inner radius: "
95 << newInnerRadius/
mm <<
" mm" <<
G4endl
97 << newOuterRadius/
mm <<
" mm";
101 if (newInnerRadius >= newOuterRadius)
105 <<
" Invalid radii ! Inner radius: "
106 << newInnerRadius/
mm <<
" mm" <<
G4endl
108 << newOuterRadius/
mm <<
" mm";
127 :
G4VSolid(a), innerRadius(0.), outerRadius(0.), halfLenZ(0.), innerStereo(0.),
128 outerStereo(0.), tanInnerStereo(0.), tanOuterStereo(0.), tanInnerStereo2(0.),
129 tanOuterStereo2(0.), innerRadius2(0.), outerRadius2(0.), endInnerRadius2(0.),
130 endOuterRadius2(0.), endInnerRadius(0.), endOuterRadius(0.), fHalfTol(0.)
144 :
G4VSolid(rhs), innerRadius(rhs.innerRadius),
145 outerRadius(rhs.outerRadius), halfLenZ(rhs.halfLenZ),
146 innerStereo(rhs.innerStereo), outerStereo(rhs.outerStereo),
147 tanInnerStereo(rhs.tanInnerStereo), tanOuterStereo(rhs.tanOuterStereo),
148 tanInnerStereo2(rhs.tanInnerStereo2), tanOuterStereo2(rhs.tanOuterStereo2),
149 innerRadius2(rhs.innerRadius2), outerRadius2(rhs.outerRadius2),
150 endInnerRadius2(rhs.endInnerRadius2), endOuterRadius2(rhs.endOuterRadius2),
151 endInnerRadius(rhs.endInnerRadius), endOuterRadius(rhs.endOuterRadius),
152 fCubicVolume(rhs.fCubicVolume), fSurfaceArea(rhs.fSurfaceArea),
153 fHalfTol(rhs.fHalfTol)
163 if (
this == &rhs) {
return *
this; }
206 if (pMin.
x() >= pMax.
x() || pMin.
y() >= pMax.
y() || pMin.
z() >= pMax.
z())
209 message <<
"Bad bounding box (min >= max) for solid: "
211 <<
"\npMin = " << pMin
212 <<
"\npMax = " <<
pMax;
213 G4Exception(
"G4Hype::BoundingLimits()",
"GeomMgt0001",
297 if (dist2Inner < dist2Z && dist2Inner < dist2Outer)
304 if (dist2Z < dist2Outer)
355 G4bool couldMissOuter(
true),
356 couldMissInner(
true),
357 cantMissInnerCylinder(
false);
407 yi = p.
y() + q*v.
y();
435 cantMissInnerCylinder =
true;
501 for(
G4int i=0; i<
n; ++i )
512 if (zi < -halfLenZ)
continue;
513 if (zi > +halfLenZ && couldMissOuter)
continue;
519 yi = p.
y() + q[i]*v.
y();
537 if (cantMissInnerCylinder)
return (sigz <
fHalfTol) ? 0 : -sigz/vz;
562 for(
G4int i=0; i<
n; ++i )
564 if (q[i] > best)
break;
574 if (zi < -halfLenZ)
continue;
575 if (zi > +halfLenZ && couldMissInner)
continue;
581 yi = p.
y() + q[i]*v.
y();
641 G4double answer = std::sqrt( dr*dr + sigz*sigz );
642 return answer <
fHalfTol ? 0 : answer;
662 G4double answer = std::sqrt( dr*dr + sigz*sigz );
663 return answer <
fHalfTol ? 0 : answer;
675 return answer <
fHalfTol ? 0 : answer;
683 return answer <
fHalfTol ? 0 : answer;
728 if (calcNorm) { *norm = *nBest; *validNorm =
true; }
760 if (normHere.dot(v) > 0)
762 if (calcNorm) { *norm = normHere.
unit(); *validNorm =
false; }
770 for(
G4int i=0; i<
n; ++i )
772 if (q[i] > sBest)
break;
781 if (norm1.
dot(v) > 0)
807 if (normHere.dot(v) > 0)
811 *norm = normHere.
unit();
821 for(
G4int i=0; i<
n; ++i )
823 if (q[i] > sBest)
break;
828 if (norm2.
dot(v) > 0)
847 if (nBest == &norm1 || nBest == &norm2)
848 *norm = nBest->
unit();
871 if (tryOuter < sBest)
877 if (tryInner < sBest) sBest = tryInner;
927 G4double a = tx*tx + ty*ty - tz*tz*tan2Phi;
937 if (std::fabs(b) <
DBL_MIN)
return 0;
946 if (radical < -
DBL_MIN)
return 0;
957 radical = std::sqrt(radical);
959 G4double q = -0.5*( b + (b < 0 ? -radical : +radical) );
962 if (sa < sb) { ss[0] = sa; ss[1] = sb; }
else { ss[0] = sb; ss[1] = sa; }
989 if (tanPhi <
DBL_MIN)
return pr-r0;
997 G4double r1 = std::sqrt( r0*r0 + z1*z1*tan2Phi );
1002 G4double z2 = (pr*tanPhi + pz)/(1 + tan2Phi);
1003 G4double r2 = std::sqrt( r0*r0 + z2*z2*tan2Phi );
1020 return std::sqrt( dr*dr + dz*dz );
1026 return std::fabs((pr-r1)*dz - (pz-z1)*dr)/
len;
1051 G4double rh = std::sqrt( r0*r0 + pz*pz*tan2Phi );
1060 return std::fabs((pr-rh)*dr)/
len;
1074 return new G4Hype(*
this);
1101 G4int oldprc = os.precision(16);
1102 os <<
"-----------------------------------------------------------\n"
1103 <<
" *** Dump for solid - " <<
GetName() <<
" ***\n"
1104 <<
" ===================================================\n"
1105 <<
" Solid type: G4Hype\n"
1106 <<
" Parameters: \n"
1107 <<
" half length Z: " <<
halfLenZ/
mm <<
" mm \n"
1112 <<
"-----------------------------------------------------------\n";
1113 os.precision(oldprc);
1122 G4double xRand, yRand, zRand,
r2 , aOne, aTwo, aThree, chose, sinhu;
1132 t = std::log(t+std::sqrt(
sqr(t)+1));
1133 aOne = std::fabs(2.*alpha*(std::sinh(2.*t)/4.+t/2.));
1139 t = std::log(t+std::sqrt(
sqr(t)+1));
1140 aTwo = std::fabs(2.*alpha*(std::sinh(2.*t)/4.+t/2.));
1149 cosphi = std::cos(phi);
1150 sinphi = std::sin(phi);
1155 if(chose>=0. && chose < aOne)
1170 else if(chose>=aOne && chose<aOne+aTwo)
1187 else if(chose>=aOne+aTwo && chose<aOne+aTwo+aThree)
1191 rOut = std::sqrt(rOut2) ;
1197 r2 = xRand*xRand + yRand*yRand ;
1198 }
while ( ! ( r2 >= rIn2 && r2 <= rOut2 ) ) ;
1207 rOut = std::sqrt(rOut2) ;
1213 r2 = xRand*xRand + yRand*yRand ;
1214 }
while ( ! ( r2 >= rIn2 && r2 <= rOut2 ) ) ;
1269 return std::log(arg+std::sqrt(
sqr(arg)+1));
1272 #endif // !defined(G4GEOM_USE_UHYPE) || !defined(G4GEOM_USE_SYS_USOLIDS)