35 #if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
45 using namespace CLHEP;
53 : G4USolid(pName, new UOrb(pName, pRmax))
62 G4UOrb::G4UOrb( __void__&
a )
79 G4UOrb::G4UOrb(
const G4UOrb& rhs)
88 G4UOrb& G4UOrb::operator = (
const G4UOrb& rhs)
92 if (
this == &rhs) {
return *
this; }
96 G4USolid::operator=(rhs);
107 return GetShape()->GetRadius();
110 void G4UOrb::SetRadius(
G4double newRmax)
112 GetShape()->SetRadius(newRmax);
113 fRebuildPolyhedron =
true;
134 return new G4UOrb(*
this);
144 pMin.set(-radius,-radius,-radius);
145 pMax.set( radius, radius, radius);
149 if (pMin.x() >= pMax.x() || pMin.y() >= pMax.y() || pMin.z() >= pMax.z())
151 std::ostringstream message;
152 message <<
"Bad bounding box (min >= max) for solid: "
154 <<
"\npMin = " << pMin
155 <<
"\npMax = " << pMax;
166 G4UOrb::CalculateExtent(
const EAxis pAxis,
180 if (
true)
return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
182 if (bbox.BoundingBoxVsVoxelLimits(pAxis,pVoxelLimit,pTransform,pMin,pMax))
184 return exist = (pMin < pMax) ?
true :
false;
189 static const G4int NTHETA = 8;
190 static const G4int NPHI = 16;
193 static const G4double sinHalfPhi = std::sin(
pi/NPHI);
194 static const G4double cosHalfPhi = std::cos(
pi/NPHI);
195 static const G4double sinStepTheta = 2.*sinHalfTheta*cosHalfTheta;
196 static const G4double cosStepTheta = 1. - 2.*sinHalfTheta*sinHalfTheta;
197 static const G4double sinStepPhi = 2.*sinHalfPhi*cosHalfPhi;
198 static const G4double cosStepPhi = 1. - 2.*sinHalfPhi*sinHalfPhi;
201 G4double rtheta = radius/cosHalfTheta;
208 for (
G4int k=0; k<NPHI; ++k)
210 xy[k].set(cosCurPhi,sinCurPhi);
212 sinCurPhi = sinCurPhi*cosStepPhi + cosCurPhi*sinStepPhi;
213 cosCurPhi = cosCurPhi*cosStepPhi - sinTmpPhi*sinStepPhi;
218 for (
G4int i=0; i<NTHETA; ++i) circles[i].resize(NPHI);
220 G4double sinCurTheta = sinHalfTheta;
221 G4double cosCurTheta = cosHalfTheta;
222 for (
G4int i=0; i<NTHETA; ++i)
226 for (
G4int k=0; k<NPHI; ++k)
228 circles[i][k].set(rho*xy[k].x(),rho*xy[k].y(),z);
231 sinCurTheta = sinCurTheta*cosStepTheta + cosCurTheta*sinStepTheta;
232 cosCurTheta = cosCurTheta*cosStepTheta - sinTmpTheta*sinStepTheta;
236 std::vector<const G4ThreeVectorList *> polygons;
237 polygons.resize(NTHETA);
238 for (
G4int i=0; i<NTHETA; ++i) polygons[i] = &circles[i];
241 exist = benv.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
254 #endif // G4GEOM_USE_USOLIDS
CLHEP::Hep3Vector G4ThreeVector
std::vector< ExP01TrackerHit * > a
static constexpr double twopi
G4GLOB_DLL std::ostream G4cout
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
CLHEP::Hep2Vector G4TwoVector
static constexpr double pi
static constexpr double halfpi