46 #if !defined(G4GEOM_USE_UBOX)
75 message <<
"Dimensions too small for Solid: " <<
GetName() <<
"!" <<
G4endl
76 <<
" hX, hY, hZ = " << pX <<
", " << pY <<
", " << pZ;
87 :
G4CSGSolid(a), fDx(0.), fDy(0.), fDz(0.), delta(0.)
104 :
G4CSGSolid(rhs), fDx(rhs.fDx), fDy(rhs.fDy), fDz(rhs.fDz), delta(rhs.delta)
116 if (
this == &rhs) {
return *
this; }
145 message <<
"Dimension X too small for solid: " <<
GetName() <<
"!"
148 G4Exception(
"G4Box::SetXHalfLength()",
"GeomSolids0002",
169 message <<
"Dimension Y too small for solid: " <<
GetName() <<
"!\n"
171 G4Exception(
"G4Box::SetYHalfLength()",
"GeomSolids0002",
192 message <<
"Dimension Z too small for solid: " <<
GetName() <<
"!\n"
194 G4Exception(
"G4Box::SetZHalfLength()",
"GeomSolids0002",
225 if (pMin.
x() >= pMax.
x() || pMin.
y() >= pMax.
y() || pMin.
z() >= pMax.
z())
228 message <<
"Bad bounding box (min >= max) for solid: "
230 <<
"\npMin = " << pMin
231 <<
"\npMax = " << pMax;
264 std::abs(p.
y())-
fDy),
265 std::abs(p.
z())-
fDz);
278 if (std::abs(std::abs(px) -
fDx) <=
delta) norm.
setX(px < 0 ? -1. : 1.);
280 if (std::abs(std::abs(py) -
fDy) <=
delta) norm.
setY(py < 0 ? -1. : 1.);
282 if (std::abs(std::abs(pz) -
fDz) <=
delta) norm.
setZ(pz < 0 ? -1. : 1.);
295 G4int oldprc = message.precision(16);
296 message <<
"Point p is not on surface (!?) of solid: "
298 message <<
"Position:\n";
299 message <<
" p.x() = " << p.
x()/
mm <<
" mm\n";
300 message <<
" p.y() = " << p.
y()/
mm <<
" mm\n";
301 message <<
" p.z() = " << p.
z()/
mm <<
" mm";
303 G4Exception(
"G4Box::SurfaceNormal(p)",
"GeomSolids1002",
322 if (distx >= disty && distx >= distz)
324 if (disty >= distx && disty >= distz)
363 return (tmin <
delta) ? 0. : tmin;
377 std::abs(p.
y())-
fDy),
378 std::abs(p.
z())-
fDz);
379 return (dist > 0) ? dist : 0.;
395 if ((std::abs(p.
x()) -
fDx) >= -
delta && p.
x()*v.
x() > 0)
400 n->
set((p.
x() < 0) ? -1. : 1., 0., 0.);
404 if ((std::abs(p.
y()) -
fDy) >= -
delta && p.
y()*v.
y() > 0)
409 n->
set(0., (p.
y() < 0) ? -1. : 1., 0.);
413 if ((std::abs(p.
z()) -
fDz) >= -
delta && p.
z()*v.
z() > 0)
418 n->
set(0., 0., (p.
z() < 0) ? -1. : 1.);
429 G4double ty = (vy == 0) ? tx : (std::copysign(
fDy,vy) - p.
y())/vy;
433 G4double tz = (vz == 0) ? txy : (std::copysign(
fDz,vz) - p.
z())/vz;
441 if (tmax == tx) n->
set((v.
x() < 0) ? -1. : 1., 0., 0.);
442 else if (tmax == ty) n->
set(0., (v.
y() < 0) ? -1. : 1., 0.);
443 else n->
set(0., 0., (v.
z() < 0) ? -1. : 1.);
459 G4int oldprc = message.precision(16);
460 message <<
"Point p is outside (!?) of solid: " <<
GetName() <<
G4endl;
461 message <<
"Position:\n";
462 message <<
" p.x() = " << p.
x()/
mm <<
" mm\n";
463 message <<
" p.y() = " << p.
y()/
mm <<
" mm\n";
464 message <<
" p.z() = " << p.
z()/
mm <<
" mm";
466 G4Exception(
"G4Box::DistanceToOut(p)",
"GeomSolids1002",
473 fDy-std::abs(p.
y())),
474 fDz-std::abs(p.
z()));
475 return (dist > 0) ? dist : 0.;
493 G4int oldprc = os.precision(16);
494 os <<
"-----------------------------------------------------------\n"
495 <<
" *** Dump for solid - " <<
GetName() <<
" ***\n"
496 <<
" ===================================================\n"
497 <<
"Solid type: G4Box\n"
499 <<
" half length X: " <<
fDx/
mm <<
" mm \n"
500 <<
" half length Y: " <<
fDy/
mm <<
" mm \n"
501 <<
" half length Z: " <<
fDz/
mm <<
" mm \n"
502 <<
"-----------------------------------------------------------\n";
503 os.precision(oldprc);
522 (select < 0.5*sxy) ? -fDz : fDz);
524 if (select < sxy + sxz)
526 (select < sxy + 0.5*sxz) ? -fDy : fDy,
540 return new G4Box(*
this);
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimits, const G4Transform3D &pTransform3D, G4double &pMin, G4double &pMax) const
void SetXHalfLength(G4double dx)
void set(double x, double y, double z)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
EInside Inside(const G4ThreeVector &p) const
G4Polyhedron * CreatePolyhedron() const
CLHEP::Hep3Vector G4ThreeVector
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
std::vector< ExP01TrackerHit * > a
G4Box(const G4String &pName, G4double pX, G4double pY, G4double pZ)
virtual void AddSolid(const G4Box &)=0
static const G4double kInfinity
static constexpr double mm
G4CSGSolid & operator=(const G4CSGSolid &rhs)
virtual void ComputeDimensions(G4Box &, const G4int, const G4VPhysicalVolume *) const
std::ostream & StreamInfo(std::ostream &os) const
void SetZHalfLength(G4double dz)
void message(RunManager *runmanager)
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=0, G4ThreeVector *n=0) const
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
G4Box & operator=(const G4Box &rhs)
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const
G4VisExtent GetExtent() const
G4ThreeVector ApproxSurfaceNormal(const G4ThreeVector &p) const
void DescribeYourselfTo(G4VGraphicsScene &scene) const
G4GeometryType GetEntityType() const
void SetYHalfLength(G4double dy)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const
G4GLOB_DLL std::ostream G4cout
G4ThreeVector GetPointOnSurface() const
G4bool fRebuildPolyhedron
T min(const T t1, const T t2)
brief Return the smallest of the two arguments