42 #if !defined(G4GEOM_USE_UORB)
58 using namespace CLHEP;
77 sqrRmaxPlusTol(0.), sqrRmaxMinusTol(0.)
94 :
G4CSGSolid(rhs), fRmax(rhs.fRmax), halfRmaxTol(rhs.halfRmaxTol),
95 sqrRmaxPlusTol(rhs.sqrRmaxPlusTol), sqrRmaxMinusTol(rhs.sqrRmaxMinusTol)
107 if (
this == &rhs) {
return *
this; }
136 "Invalid radius < 10*kCarTolerance.");
164 pMin.
set(-radius,-radius,-radius);
165 pMax.
set( radius, radius, radius);
169 if (pMin.
x() >= pMax.
x() || pMin.
y() >= pMax.
y() || pMin.
z() >= pMax.
z())
172 message <<
"Bad bounding box (min >= max) for solid: "
174 <<
"\npMin = " << pMin
175 <<
"\npMax = " << pMax;
176 G4Exception(
"G4Orb::BoundingLimits()",
"GeomMgt0001",
200 if (
true)
return bbox.
CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
204 return exist = (pMin < pMax) ?
true :
false;
209 static const G4int NTHETA = 8;
210 static const G4int NPHI = 16;
213 static const G4double sinHalfPhi = std::sin(
pi/NPHI);
214 static const G4double cosHalfPhi = std::cos(
pi/NPHI);
215 static const G4double sinStepTheta = 2.*sinHalfTheta*cosHalfTheta;
216 static const G4double cosStepTheta = 1. - 2.*sinHalfTheta*sinHalfTheta;
217 static const G4double sinStepPhi = 2.*sinHalfPhi*cosHalfPhi;
218 static const G4double cosStepPhi = 1. - 2.*sinHalfPhi*sinHalfPhi;
221 G4double rtheta = radius/cosHalfTheta;
228 for (
G4int k=0; k<NPHI; ++k)
230 xy[k].
set(cosCurPhi,sinCurPhi);
232 sinCurPhi = sinCurPhi*cosStepPhi + cosCurPhi*sinStepPhi;
233 cosCurPhi = cosCurPhi*cosStepPhi - sinTmpPhi*sinStepPhi;
238 for (
G4int i=0; i<NTHETA; ++i) circles[i].resize(NPHI);
240 G4double sinCurTheta = sinHalfTheta;
241 G4double cosCurTheta = cosHalfTheta;
242 for (
G4int i=0; i<NTHETA; ++i)
246 for (
G4int k=0; k<NPHI; ++k)
248 circles[i][k].set(rho*xy[k].
x(),rho*xy[k].
y(),z);
251 sinCurTheta = sinCurTheta*cosStepTheta + cosCurTheta*sinStepTheta;
252 cosCurTheta = cosCurTheta*cosStepTheta - sinTmpTheta*sinStepTheta;
256 std::vector<const G4ThreeVectorList *> polygons;
257 polygons.resize(NTHETA);
258 for (
G4int i=0; i<NTHETA; ++i) polygons[i] = &circles[i];
282 return (1/p.
mag())*p;
337 return (dist > 0) ? dist : 0.;
361 *n = p*(1./std::sqrt(rr));
375 G4double tmax = (D <= 0) ? 0. : std::sqrt(D) - pv;
381 *n = ptmax*(1./ptmax.
mag());
396 G4int oldprc = message.precision(16);
397 message <<
"Point p is outside (!?) of solid: " <<
GetName() <<
"\n";
398 message <<
"Position:\n";
399 message <<
" p.x() = " << p.
x()/
mm <<
" mm\n";
400 message <<
" p.y() = " << p.
y()/
mm <<
" mm\n";
401 message <<
" p.z() = " << p.
z()/
mm <<
" mm";
403 G4Exception(
"G4Trap::DistanceToOut(p)",
"GeomSolids1002",
409 return (dist > 0) ? dist : 0.;
427 return new G4Orb(*
this);
436 G4int oldprc = os.precision(16);
437 os <<
"-----------------------------------------------------------\n"
438 <<
" *** Dump for solid - " <<
GetName() <<
" ***\n"
439 <<
" ===================================================\n"
440 <<
" Solid type: G4Orb\n"
442 <<
" outer radius: " <<
fRmax/
mm <<
" mm \n"
443 <<
"-----------------------------------------------------------\n";
444 os.precision(oldprc);
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimits, const G4Transform3D &pTransform3D, G4double &pMin, G4double &pMax) const
void set(double x, double y, double z)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
std::vector< ExP01TrackerHit * > a
virtual void AddSolid(const G4Box &)=0
static const G4double kInfinity
G4double GetRadius() const
EInside Inside(const G4ThreeVector &p) const
std::ostream & StreamInfo(std::ostream &os) const
static constexpr double mm
G4CSGSolid & operator=(const G4CSGSolid &rhs)
virtual void ComputeDimensions(G4Box &, const G4int, const G4VPhysicalVolume *) const
void message(RunManager *runmanager)
G4ThreeVector GetPointOnSurface() const
G4Polyhedron * CreatePolyhedron() const
double dot(const Hep3Vector &) const
G4ThreeVector G4RandomDirection()
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=G4bool(false), G4bool *validNorm=0, G4ThreeVector *n=0) const
G4GeometryType GetEntityType() const
G4bool BoundingBoxVsVoxelLimits(const EAxis pAxis, const G4VoxelLimits &pVoxelLimits, const G4Transform3D &pTransform3D, G4double &pMin, G4double &pMax) const
std::vector< G4ThreeVector > G4ThreeVectorList
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
static constexpr double halfpi
G4Orb & operator=(const G4Orb &rhs)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
void set(double x, double y)
G4GLOB_DLL std::ostream G4cout
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const
static constexpr double pi
G4VisExtent GetExtent() const
G4Orb(const G4String &pName, G4double pRmax)
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
void DescribeYourselfTo(G4VGraphicsScene &scene) const