36 #if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
43 using namespace CLHEP;
50 G4UTubs::G4UTubs(
const G4String& pName,
54 : Base_t(pName, pRMin, pRMax, pDz, pSPhi, pDPhi)
63 G4UTubs::G4UTubs( __void__&
a )
80 G4UTubs::G4UTubs(
const G4UTubs& rhs)
89 G4UTubs& G4UTubs::operator = (
const G4UTubs& rhs)
93 if (
this == &rhs) {
return *
this; }
97 Base_t::operator=(rhs);
106 G4double G4UTubs::GetInnerRadius()
const
110 G4double G4UTubs::GetOuterRadius()
const
114 G4double G4UTubs::GetZHalfLength()
const
118 G4double G4UTubs::GetStartPhiAngle()
const
122 G4double G4UTubs::GetDeltaPhiAngle()
const
126 G4double G4UTubs::GetSinStartPhi()
const
128 return std::sin(GetStartPhiAngle());
130 G4double G4UTubs::GetCosStartPhi()
const
132 return std::cos(GetStartPhiAngle());
134 G4double G4UTubs::GetSinEndPhi()
const
136 return std::sin(GetStartPhiAngle()+GetDeltaPhiAngle());
138 G4double G4UTubs::GetCosEndPhi()
const
140 return std::cos(GetStartPhiAngle()+GetDeltaPhiAngle());
143 void G4UTubs::SetInnerRadius(
G4double newRMin)
146 fRebuildPolyhedron =
true;
148 void G4UTubs::SetOuterRadius(
G4double newRMax)
151 fRebuildPolyhedron =
true;
153 void G4UTubs::SetZHalfLength(
G4double newDz)
156 fRebuildPolyhedron =
true;
161 fRebuildPolyhedron =
true;
163 void G4UTubs::SetDeltaPhiAngle(
G4double newDPhi)
166 fRebuildPolyhedron =
true;
187 return new G4UTubs(*
this);
196 static G4bool checkBBox =
true;
204 if (GetDeltaPhiAngle() <
twopi)
208 GetSinStartPhi(),GetCosStartPhi(),
209 GetSinEndPhi(),GetCosEndPhi(),
211 pMin.
set(vmin.
x(),vmin.
y(),-dz);
212 pMax.
set(vmax.
x(),vmax.
y(), dz);
216 pMin.
set(-rmax,-rmax,-dz);
217 pMax.
set( rmax, rmax, dz);
222 if (pMin.
x() >= pMax.
x() || pMin.
y() >= pMax.
y() || pMin.
z() >= pMax.
z())
225 message <<
"Bad bounding box (min >= max) for solid: "
227 <<
"\npMin = " << pMin
228 <<
"\npMax = " << pMax;
229 G4Exception(
"G4UTubs::BoundingLimits()",
"GeomMgt0001",
248 message <<
"Inconsistency in bounding boxes for solid: "
250 <<
"\nBBox min: wrapper = " << pMin <<
" solid = " << vmin
251 <<
"\nBBox max: wrapper = " << pMax <<
" solid = " << vmax;
252 G4Exception(
"G4UTubs::BoundingLimits()",
"GeomMgt0001",
264 G4UTubs::CalculateExtent(
const EAxis pAxis,
273 BoundingLimits(bmin,bmax);
278 if (
true)
return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
280 if (bbox.BoundingBoxVsVoxelLimits(pAxis,pVoxelLimit,pTransform,pMin,pMax))
282 return exist = (pMin < pMax) ?
true :
false;
293 const G4int NSTEPS = 24;
295 G4int ksteps = (dphi <= astep) ? 1 : (
G4int)((dphi-
deg)/astep) + 1;
298 G4double sinHalf = std::sin(0.5*ang);
299 G4double cosHalf = std::cos(0.5*ang);
300 G4double sinStep = 2.*sinHalf*cosHalf;
301 G4double cosStep = 1. - 2.*sinHalf*sinHalf;
306 if (rmin == 0 && dphi ==
twopi)
312 for (
G4int k=0; k<NSTEPS; ++k)
314 baseA[k].set(rext*cosCur,rext*sinCur,-dz);
315 baseB[k].set(rext*cosCur,rext*sinCur, dz);
318 sinCur = sinCur*cosStep + cosCur*sinStep;
319 cosCur = cosCur*cosStep - sinTmp*sinStep;
321 std::vector<const G4ThreeVectorList *> polygons(2);
322 polygons[0] = &baseA;
323 polygons[1] = &baseB;
325 exist = benv.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
329 G4double sinStart = GetSinStartPhi();
330 G4double cosStart = GetCosStartPhi();
333 G4double sinCur = sinStart*cosHalf + cosStart*sinHalf;
334 G4double cosCur = cosStart*cosHalf - sinStart*sinHalf;
338 for (
G4int k=0; k<ksteps+2; ++k) pols[k].resize(4);
339 pols[0][0].set(rmin*cosStart,rmin*sinStart, dz);
340 pols[0][1].set(rmin*cosStart,rmin*sinStart,-dz);
341 pols[0][2].set(rmax*cosStart,rmax*sinStart,-dz);
342 pols[0][3].set(rmax*cosStart,rmax*sinStart, dz);
343 for (
G4int k=1; k<ksteps+1; ++k)
345 pols[k][0].set(rmin*cosCur,rmin*sinCur, dz);
346 pols[k][1].set(rmin*cosCur,rmin*sinCur,-dz);
347 pols[k][2].set(rext*cosCur,rext*sinCur,-dz);
348 pols[k][3].set(rext*cosCur,rext*sinCur, dz);
351 sinCur = sinCur*cosStep + cosCur*sinStep;
352 cosCur = cosCur*cosStep - sinTmp*sinStep;
354 pols[ksteps+1][0].set(rmin*cosEnd,rmin*sinEnd, dz);
355 pols[ksteps+1][1].set(rmin*cosEnd,rmin*sinEnd,-dz);
356 pols[ksteps+1][2].set(rmax*cosEnd,rmax*sinEnd,-dz);
357 pols[ksteps+1][3].set(rmax*cosEnd,rmax*sinEnd, dz);
360 std::vector<const G4ThreeVectorList *> polygons;
361 polygons.resize(ksteps+2);
362 for (
G4int k=0; k<ksteps+2; ++k) polygons[k] = &pols[k];
364 exist = benv.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
382 #endif // G4GEOM_USE_USOLIDS
void set(double x, double y, double z)
std::vector< ExP01TrackerHit * > a
virtual void ComputeDimensions(G4Box &, const G4int, const G4VPhysicalVolume *) const
void message(RunManager *runmanager)
const G4double kCarTolerance
std::vector< G4ThreeVector > G4ThreeVectorList
static constexpr double deg
static constexpr double twopi
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4GLOB_DLL std::ostream G4cout