36 #if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
42 using namespace CLHEP;
48 G4UTrap::G4UTrap(
const G4String& pName,
55 : G4USolid(pName, new UTrap(pName, pdz, pTheta, pPhi,
56 pdy1, pdx1, pdx2, pAlp1, pdy2, pdx3, pdx4, pAlp2))
60 G4UTrap::G4UTrap(
const G4String& pName,
62 : G4USolid(pName, new UTrap(pName))
67 G4UTrap::G4UTrap(
const G4String& pName,
71 : G4USolid(pName, new UTrap(pName, pZ, pY, pX, pLTX))
75 G4UTrap::G4UTrap(
const G4String& pName,
79 : G4USolid(pName, new UTrap(pName, pdx1, pdx2, pdy1, pdy2, pdz))
83 G4UTrap::G4UTrap(
const G4String& pName,
86 : G4USolid(pName, new UTrap(pName, pdx, pdy, pdz, pAlpha, pTheta, pPhi))
90 G4UTrap::G4UTrap(
const G4String& pName )
91 : G4USolid(pName, new UTrap(pName))
100 G4UTrap::G4UTrap( __void__&
a )
117 G4UTrap::G4UTrap(
const G4UTrap& rhs)
126 G4UTrap& G4UTrap::operator = (
const G4UTrap& rhs)
130 if (
this == &rhs) {
return *
this; }
134 G4USolid::operator=(rhs);
143 G4double G4UTrap::GetZHalfLength()
const
145 return GetShape()->GetZHalfLength();
147 G4double G4UTrap::GetYHalfLength1()
const
149 return GetShape()->GetYHalfLength1();
151 G4double G4UTrap::GetXHalfLength1()
const
153 return GetShape()->GetXHalfLength1();
155 G4double G4UTrap::GetXHalfLength2()
const
157 return GetShape()->GetXHalfLength2();
159 G4double G4UTrap::GetTanAlpha1()
const
161 return GetShape()->GetTanAlpha1();
163 G4double G4UTrap::GetYHalfLength2()
const
165 return GetShape()->GetYHalfLength2();
167 G4double G4UTrap::GetXHalfLength3()
const
169 return GetShape()->GetXHalfLength3();
171 G4double G4UTrap::GetXHalfLength4()
const
173 return GetShape()->GetXHalfLength4();
175 G4double G4UTrap::GetTanAlpha2()
const
177 return GetShape()->GetTanAlpha2();
181 UTrapSidePlane iplane = GetShape()->GetSidePlane(n);
187 UVector3 axis = GetShape()->GetSymAxis();
197 GetShape()->SetAllParameters(pDz, pTheta, pPhi,
198 pDy1, pDx1, pDx2, pAlp1,
199 pDy2, pDx3, pDx4, pAlp2);
200 fRebuildPolyhedron =
true;
206 for (
unsigned int i=0; i<8; ++i)
208 upt[i] = UVector3(pt[i].x(), pt[i].y(), pt[i].z());
210 GetShape()->SetPlanes(upt);
211 fRebuildPolyhedron =
true;
232 return new G4UTrap(*
this);
241 static G4bool checkBBox =
true;
250 G4double fTthetaSphi = GetShape()->GetThetaSphi();
251 G4double fTthetaCphi = GetShape()->GetThetaCphi();
259 std::min(-x0-x1-dx1,-x0+x1-dx2),x0-x2-dx3),x0+x2-dx4);
263 std::max(-x0-x1+dx1,-x0+x1+dx2),x0-x2+dx3),x0+x2+dx4);
269 pMin.set(xmin,ymin,-dz);
270 pMax.set(xmax,ymax, dz);
274 if (pMin.x() >= pMax.x() || pMin.y() >= pMax.y() || pMin.z() >= pMax.z())
276 std::ostringstream message;
277 message <<
"Bad bounding box (min >= max) for solid: "
279 <<
"\npMin = " << pMin
280 <<
"\npMax = " << pMax;
290 GetShape()->Extent(vmin,vmax);
298 std::ostringstream message;
299 message <<
"Inconsistency in bounding boxes for solid: "
301 <<
"\nBBox min: wrapper = " << pMin <<
" solid = " << vmin
302 <<
"\nBBox max: wrapper = " << pMax <<
" solid = " << vmax;
314 G4UTrap::CalculateExtent(
const EAxis pAxis,
327 if (
true)
return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
329 if (bbox.BoundingBoxVsVoxelLimits(pAxis,pVoxelLimit,pTransform,pMin,pMax))
331 return exist = (pMin < pMax) ?
true :
false;
343 G4double fTthetaSphi = GetShape()->GetThetaSphi();
344 G4double fTthetaCphi = GetShape()->GetThetaCphi();
352 baseA[0].set(-x0-x1-dx1,-y0-dy1,-dz);
353 baseA[1].set(-x0-x1+dx1,-y0-dy1,-dz);
354 baseA[2].set(-x0+x1+dx2,-y0+dy1,-dz);
355 baseA[3].set(-x0+x1-dx2,-y0+dy1,-dz);
357 baseB[0].set( x0-x2-dx3, y0-dy2, dz);
358 baseB[1].set( x0-x2+dx3, y0-dy2, dz);
359 baseB[2].set( x0+x2+dx4, y0+dy2, dz);
360 baseB[3].set( x0+x2-dx4, y0+dy2, dz);
362 std::vector<const G4ThreeVectorList *> polygons(2);
363 polygons[0] = &baseA;
364 polygons[1] = &baseB;
367 exist = benv.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
377 G4double fTthetaSphi = GetShape()->GetThetaSphi();
378 G4double fTthetaCphi = GetShape()->GetThetaCphi();
379 G4double phi = std::atan2(fTthetaSphi, fTthetaCphi);
380 G4double alpha1 = std::atan(GetTanAlpha1());
381 G4double alpha2 = std::atan(GetTanAlpha2());
382 G4double theta = std::atan(std::sqrt(fTthetaCphi*fTthetaCphi+fTthetaSphi*fTthetaSphi));
386 GetXHalfLength1(), GetXHalfLength2(), alpha1,
388 GetXHalfLength3(), GetXHalfLength4(), alpha2);
391 #endif // G4GEOM_USE_USOLIDS
CLHEP::Hep3Vector G4ThreeVector
std::vector< ExP01TrackerHit * > a
G4GLOB_DLL std::ostream G4cout
const G4double kCarTolerance
std::vector< G4ThreeVector > G4ThreeVectorList
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
virtual void ComputeDimensions(G4Box &, const G4int, const G4VPhysicalVolume *) const
T max(const T t1, const T t2)
brief Return the largest of the two arguments
T min(const T t1, const T t2)
brief Return the smallest of the two arguments