36 #if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
43 using namespace CLHEP;
50 G4USphere::G4USphere(
const G4String& pName,
54 : G4USolid(pName, new USphere(pName, pRmin, pRmax, pSPhi, pDPhi,
64 G4USphere::G4USphere( __void__&
a )
73 G4USphere::~G4USphere()
81 G4USphere::G4USphere(
const G4USphere& rhs)
90 G4USphere& G4USphere::operator = (
const G4USphere& rhs)
94 if (
this == &rhs) {
return *
this; }
98 G4USolid::operator=(rhs);
107 G4double G4USphere::GetInnerRadius()
const
109 return GetShape()->GetInnerRadius();
111 G4double G4USphere::GetOuterRadius()
const
113 return GetShape()->GetOuterRadius();
115 G4double G4USphere::GetStartPhiAngle()
const
117 return GetShape()->GetStartPhiAngle();
119 G4double G4USphere::GetDeltaPhiAngle()
const
121 return GetShape()->GetDeltaPhiAngle();
123 G4double G4USphere::GetStartThetaAngle()
const
125 return GetShape()->GetStartThetaAngle();
127 G4double G4USphere::GetDeltaThetaAngle()
const
129 return GetShape()->GetDeltaThetaAngle();
131 G4double G4USphere::GetSinStartPhi()
const
133 G4double phi = GetShape()->GetStartPhiAngle();
134 return std::sin(phi);
136 G4double G4USphere::GetCosStartPhi()
const
138 G4double phi = GetShape()->GetStartPhiAngle();
139 return std::cos(phi);
141 G4double G4USphere::GetSinEndPhi()
const
143 G4double phi = GetShape()->GetStartPhiAngle() +
144 GetShape()->GetDeltaPhiAngle();
145 return std::sin(phi);
147 G4double G4USphere::GetCosEndPhi()
const
149 G4double phi = GetShape()->GetStartPhiAngle() +
150 GetShape()->GetDeltaPhiAngle();
151 return std::cos(phi);
153 G4double G4USphere::GetSinStartTheta()
const
155 G4double theta = GetShape()->GetStartThetaAngle();
156 return std::sin(theta);
158 G4double G4USphere::GetCosStartTheta()
const
160 G4double theta = GetShape()->GetStartThetaAngle();
161 return std::cos(theta);
163 G4double G4USphere::GetSinEndTheta()
const
165 G4double theta = GetShape()->GetStartThetaAngle() +
166 GetShape()->GetDeltaThetaAngle();
167 return std::sin(theta);
169 G4double G4USphere::GetCosEndTheta()
const
171 G4double theta = GetShape()->GetStartThetaAngle() +
172 GetShape()->GetDeltaThetaAngle();
173 return std::cos(theta);
176 void G4USphere::SetInnerRadius(
G4double newRMin)
178 GetShape()->SetInnerRadius(newRMin);
179 fRebuildPolyhedron =
true;
181 void G4USphere::SetOuterRadius(
G4double newRmax)
183 GetShape()->SetOuterRadius(newRmax);
184 fRebuildPolyhedron =
true;
188 GetShape()->SetStartPhiAngle(newSphi, trig);
189 fRebuildPolyhedron =
true;
191 void G4USphere::SetDeltaPhiAngle(
G4double newDphi)
193 GetShape()->SetDeltaPhiAngle(newDphi);
194 fRebuildPolyhedron =
true;
196 void G4USphere::SetStartThetaAngle(
G4double newSTheta)
198 GetShape()->SetStartThetaAngle(newSTheta);
199 fRebuildPolyhedron =
true;
201 void G4USphere::SetDeltaThetaAngle(
G4double newDTheta)
203 GetShape()->SetDeltaThetaAngle(newDTheta);
204 fRebuildPolyhedron =
true;
225 return new G4USphere(*
this);
234 static G4bool checkBBox =
true;
241 if (GetDeltaThetaAngle() >=
pi && GetDeltaPhiAngle() >=
twopi)
243 pMin.set(-rmax,-rmax,-rmax);
244 pMax.set( rmax, rmax, rmax);
248 G4double sinStart = GetSinStartTheta();
249 G4double cosStart = GetCosStartTheta();
253 G4double stheta = GetStartThetaAngle();
254 G4double etheta = stheta + GetDeltaThetaAngle();
257 if (stheta >
halfpi) rhomax = rmax*sinStart;
258 if (etheta <
halfpi) rhomax = rmax*sinEnd;
262 GetSinStartPhi(),GetCosStartPhi(),
263 GetSinEndPhi(),GetCosEndPhi(),
268 pMin.set(xymin.x(),xymin.y(),zmin);
269 pMax.set(xymax.x(),xymax.y(),zmax);
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;
313 G4bool G4USphere::CalculateExtent(
const EAxis pAxis,
325 return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
338 GetStartThetaAngle(),
339 GetDeltaThetaAngle());
342 #endif // G4GEOM_USE_USOLIDS
CLHEP::Hep3Vector G4ThreeVector
std::vector< ExP01TrackerHit * > a
static constexpr double twopi
G4GLOB_DLL std::ostream G4cout
const G4double kCarTolerance
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
CLHEP::Hep2Vector G4TwoVector
static constexpr double pi
static constexpr double halfpi