14 #ifndef DD4HEP_GEOMETRY_SOLIDS_H
15 #define DD4HEP_GEOMETRY_SOLIDS_H
26 #pragma GCC diagnostic push
27 #pragma GCC diagnostic ignored "-Wdeprecated" // Code that causes warning goes here
31 #include "TGeoParaboloid.h"
34 #include "TGeoSphere.h"
40 #include "TGeoTorus.h"
41 #include "TGeoHalfSpace.h"
42 #include "TGeoCompositeShape.h"
44 #pragma GCC diagnostic pop
56 std::string
toStringSolid(
const TGeoShape* shape,
int precision=2);
74 void _assign(
T* n,
const std::string& nam,
const std::string& tit,
bool cbbox);
92 const char*
name()
const;
94 const char*
type()
const;
123 void make(
double x_val,
double y_val,
double z_val);
135 Box(
double x_val,
double y_val,
double z_val) {
make(x_val, y_val, z_val); }
137 template <
typename X,
typename Y,
typename Z>
138 Box(
const X& x_val,
const Y& y_val,
const Z& z_val) {
166 void make(
const double*
const point,
const double*
const normal);
178 HalfSpace(
const double*
const point,
const double*
const normal) {
make(point,normal); }
212 Polycone(
double start,
double delta);
215 Polycone(
double start,
double delta,
const std::vector<double>& rmin,
const std::vector<double>& rmax,
216 const std::vector<double>& z);
221 void addZPlanes(
const std::vector<double>& rmin,
const std::vector<double>& rmax,
const std::vector<double>& z);
247 ConeSegment(
double dz,
double rmin1,
double rmax1,
double rmin2,
double rmax2,
double phi1 = 0.0,
double phi2 = 2.0 *
M_PI);
253 double rmin2,
double rmax2,
double phi1 = 0.0,
double phi2 = 2.0 *
M_PI);
280 void make(
const std::string& nam,
double rmin,
double rmax,
double z,
double startPhi,
double deltaPhi);
292 Tube(
double rmin,
double rmax,
double z)
293 {
make(
"", rmin, rmax, z, 0, 2*
M_PI); }
295 Tube(
double rmin,
double rmax,
double z,
double deltaPhi)
296 {
make(
"", rmin, rmax, z, 0, deltaPhi); }
298 Tube(
double rmin,
double rmax,
double z,
double startPhi,
double deltaPhi)
299 {
make(
"", rmin, rmax, z, startPhi, deltaPhi); }
301 Tube(
const std::string& nam,
double rmin,
double rmax,
double z)
302 {
make(nam, rmin, rmax, z, 0, 2*
M_PI); }
304 Tube(
const std::string& nam,
double rmin,
double rmax,
double z,
double deltaPhi)
305 {
make(nam, rmin, rmax, z, 0, deltaPhi); }
307 template <
typename RMIN,
typename RMAX,
typename Z,
typename DELTAPHI>
308 Tube(
const RMIN& rmin,
const RMAX& rmax,
const Z& z,
const DELTAPHI& deltaPhi)
313 Tube&
setDimensions(
double rmin,
double rmax,
double z,
double startPhi=0.0,
double deltaPhi=2*
M_PI);
331 void make(
double a,
double b,
double dz);
345 template <
typename A,
typename B,
typename DZ>
366 void make(
double z,
double rmin1,
double rmax1,
double rmin2,
double rmax2);
377 Cone(
double z,
double rmin1,
double rmax1,
double rmin2,
double rmax2)
378 {
make(z, rmin1, rmax1, rmin2, rmax2); }
379 template <
typename Z,
typename RMIN1,
typename RMAX1,
typename RMIN2,
typename RMAX2>
380 Cone(
const Z& z,
const RMIN1& rmin1,
const RMAX1& rmax1,
const RMIN2& rmin2,
const RMAX2& rmax2)
385 Cone&
setDimensions(
double z,
double rmin1,
double rmax1,
double rmin2,
double rmax2);
400 void make(
double pz,
double py,
double px,
double pLTX);
411 Trap(
double z,
double theta,
double phi,
412 double y1,
double x1,
double x2,
double alpha1,
413 double y2,
double x3,
double x4,
double alpha2);
415 Trap(
double pz,
double py,
double px,
double pLTX) {
make(pz,py,px,pLTX); }
417 template <
typename PZ,
typename PY,
typename PX,
typename PLTX>
Trap(PZ pz, PY py, PX px, PLTX pLTX)
423 double y1,
double x1,
double x2,
double alpha1,
424 double y2,
double x3,
double x4,
double alpha2);
440 void make(
double x1,
double x2,
double y1,
double y2,
double z);
452 Trapezoid(
double x1,
double x2,
double y1,
double y2,
double z);
454 template <
typename X1,
typename X2,
typename Y1,
typename Y2,
typename Z>
475 void make(
double r,
double rmin,
double rmax,
double phi,
double delta_phi);
486 template<
typename R,
typename RMIN,
typename RMAX,
typename PHI,
typename DELTA_PHI>
487 Torus(R r, RMIN rmin, RMAX rmax, PHI phi=
M_PI, DELTA_PHI delta_phi = 2.*
M_PI)
490 Torus(
double r,
double rmin,
double rmax,
double phi=
M_PI,
double delta_phi = 2.*
M_PI)
491 {
make(r,rmin,rmax,phi,delta_phi); }
495 Torus&
setDimensions(
double r,
double rmin,
double rmax,
double phi,
double delta_phi);
519 Sphere(
double rmin,
double rmax,
double theta = 0.,
double delta_theta =
M_PI,
double phi = 0.0,
double delta_phi = 2. *
M_PI);
523 Sphere&
setDimensions(
double rmin,
double rmax,
double theta,
double delta_theta,
double phi,
double delta_phi);
547 Paraboloid(
double r_low,
double r_high,
double delta_z);
575 Hyperboloid(
double rin,
double stin,
double rout,
double stout,
double dz);
594 void _create(
int nsides,
double rmin,
double rmax,
double zpos,
double zneg,
double start,
double delta);
609 PolyhedraRegular(
int nsides,
double phi_start,
double rmin,
double rmax,
double zlen);
626 void make(
double dz,
const double* vtx);
660 template <
typename Q>
Paraboloid & setDimensions(double r_low, double r_high, double delta_z)
Set the Paraboloid dimensions.
Trap(double pz, double py, double px, double pLTX)
Constructor to create a new anonymous object for right angular wedge from STEP (Se G4 manual for deta...
Class of the ROOT toolkit. See http://root.cern.ch/root/htmldoc/ClassIndex.html.
EllipticalTube(const Q *p)
Constructor to be used with an existing object.
Tube(const std::string &nam, double rmin, double rmax, double z)
Legacy: Constructor to create a new identifiable tube object with attribute initialization.
ConeSegment(const Handle< Q > &e)
Constructor to be used when reading the already parsed ConeSegment object.
double z() const
Access half "depth" of the box.
void make(double x_val, double y_val, double z_val)
Internal helper method to support object construction.
Sphere(const Q *p)
Constructor to be used with an existing object.
Polycone(const Handle< Q > &e)
Constructor to be used when reading the already parsed polycone object.
EightPointSolid & operator=(const EightPointSolid ©)=default
Assignment operator.
ConeSegment & setDimensions(double dz, double rmin1, double rmax1, double rmin2, double rmax2, double phi1=0.0, double phi2=2.0 *M_PI)
Set the cone segment dimensions.
IntersectionSolid(const Handle< Q > &e)
Constructor to be used when passing an already created object.
Torus(double r, double rmin, double rmax, double phi=M_PI, double delta_phi=2.*M_PI)
Constructor to create a new anonymous object with attribute initialization.
Torus(const Handle< Q > &e)
Constructor to be used when passing an already created object.
EllipticalTube(double a, double b, double dz)
Constructor to create a new anonymous tube object with attribute initialization.
Class describing a Torus shape.
Class describing a Hyperboloid shape.
void make(double z, double rmin1, double rmax1, double rmin2, double rmax2)
Internal helper method to support object construction.
Paraboloid()=default
Default constructor.
Hyperboloid & operator=(const Hyperboloid ©)=default
Assignment operator.
void make(double r, double rmin, double rmax, double phi, double delta_phi)
Internal helper method to support object construction.
ConeSegment & operator=(const ConeSegment ©)=default
Assignment operator.
Torus & setDimensions(double r, double rmin, double rmax, double phi, double delta_phi)
Set the Torus dimensions.
Solid_type(T *p)
Direct assignment using the implementation pointer.
IntersectionSolid & operator=(const IntersectionSolid ©)=default
Assignment operator.
Tube & setDimensions(double rmin, double rmax, double z, double startPhi=0.0, double deltaPhi=2 *M_PI)
Set the tube dimensions.
SubtractionSolid & operator=(const SubtractionSolid ©)=default
Assignment operator.
Box & operator=(const Box ©)=default
Assignment operator.
Box(const Handle< Q > &e)
Constructor to be used with an existing object.
Class describing a cone segment shape.
Class describing boolean subtraction solid.
EllipticalTube & operator=(const EllipticalTube ©)=default
Assignment operator.
Tube(double rmin, double rmax, double z, double startPhi, double deltaPhi)
Constructor to create a new anonymous tube object with attribute initialization.
Trapezoid(const Handle< Q > &e)
Constructor to be used when passing an already created object.
EllipticalTube(const A &a, const B &b, const DZ &dz)
Constructor to create a new anonymous tube object with attribute initialization.
Class describing a elliptical tube shape of a section of a tube.
void _setDimensions(double *param)
IntersectionSolid()=default
Default constructor.
Hyperboloid()=default
Default constructor.
void _assign(T *n, const std::string &nam, const std::string &tit, bool cbbox)
Assign pointrs and register solid to geometry.
HalfSpace()=default
Default constructor.
Trap(const Q *p)
Constructor to be used with an existing object.
Class describing half-space.
Trap(const Handle< Q > &e)
Constructor to be used when passing an already created object.
void make(double x1, double x2, double y1, double y2, double z)
Internal helper method to support object construction.
Torus()=default
Default constructor.
BooleanSolid & operator=(const BooleanSolid ©)=default
Assignment operator.
SubtractionSolid()=default
Default constructor.
EightPointSolid(const Handle< Q > &e)
Constructor to be used when passing an already created object.
Class describing a regular polyhedron shape.
void make(double a, double b, double dz)
Internal helper method to support object construction.
Class describing a box shape.
PolyhedraRegular(const Handle< Q > &e)
Constructor to be used when passing an already created object.
Trap & operator=(const Trap ©)=default
Assignment operator.
Class describing a trap shape.
Trapezoid & operator=(const Trapezoid ©)=default
Assignment operator.
EightPointSolid()=default
Default constructor.
BooleanSolid(const Handle< Q > &e)
Constructor to be used when passing an already created object.
UnionSolid()=default
Default constructor.
Polycone & operator=(const Polycone ©)=default
Assignment operator.
Cone(const Z &z, const RMIN1 &rmin1, const RMAX1 &rmax1, const RMIN2 &rmin2, const RMAX2 &rmax2)
Cone(double z, double rmin1, double rmax1, double rmin2, double rmax2)
Constructor to create a new anonymous object with attribute initialization.
Hyperboloid & setDimensions(double rin, double stin, double rout, double stout, double dz)
Set the Hyperboloid dimensions.
PolyhedraRegular(const Q *p)
Constructor to be used with an existing object.
Polycone(const Q *p)
Constructor to be used with an existing object.
void make(double pz, double py, double px, double pLTX)
Internal helper method to support object construction.
Cone & operator=(const Cone ©)=default
Assignment operator.
Class describing an arbitray solid defined by 8 vertices.
void make(const double *const point, const double *const normal)
Internal helper method to support object construction.
Trapezoid & setDimensions(double x1, double x2, double y1, double y2, double z)
Set the Trapezoid dimensions.
Box & setDimensions(double x_val, double y_val, double z_val)
Set the box dimensions.
void make(double dz, const double *vtx)
Internal helper method to support object construction.
std::string toString(int precision=2) const
Conversion to string for pretty print.
ROOT::Math::RotationZYX RotationZYX
Paraboloid(const Handle< Q > &e)
Constructor to be used when passing an already created object.
void _create(int nsides, double rmin, double rmax, double zpos, double zneg, double start, double delta)
Helper function to create the polyhedron.
Base class describing boolean (=union,intersection,subtraction) solids.
Trap & setDimensions(double z, double theta, double phi, double y1, double x1, double x2, double alpha1, double y2, double x3, double x4, double alpha2)
Set the trap dimensions.
Cone(const Handle< Q > &e)
Constructor to be used when passing an already created object.
Paraboloid & operator=(const Paraboloid ©)=default
Assignment operator.
HalfSpace(const double *const point, const double *const normal)
Constructor to create an new halfspace object from a point on a plane and the plane normal...
ROOT::Math::Rotation3D Rotation3D
Tube & operator=(const Tube ©)=default
Assignment operator.
Solid_type & operator=(const Solid_type ©)=default
Assignment operator.
Class describing a Paraboloid shape.
Box(const X &x_val, const Y &y_val, const Z &z_val)
Constructor to create an anonymous new box object (retrieves name from volume)
Trapezoid()=default
Default constructor.
HalfSpace & operator=(const HalfSpace ©)=default
Assignment operator.
Base class for Solid (shape) objects.
Tube()=default
Default constructor.
const char * name() const
Access to shape name.
void addZPlanes(const std::vector< double > &rmin, const std::vector< double > &rmax, const std::vector< double > &z)
Add Z-planes to the Polycone.
Cone & setDimensions(double z, double rmin1, double rmax1, double rmin2, double rmax2)
Set the box dimensions.
Tube(double rmin, double rmax, double z, double deltaPhi)
Constructor to create a new anonymous tube object with attribute initialization.
UnionSolid & operator=(const UnionSolid ©)=default
Assignment operator.
HalfSpace(const Q *p)
Constructor to be used with an existing object.
PolyhedraRegular & operator=(const PolyhedraRegular ©)=default
Assignment operator.
UnionSolid(const Handle< Q > &e)
Constructor to be used when passing an already created object.
Sphere & operator=(const Sphere ©)=default
Assignment operator.
ROOT::Math::XYZVector Position
Tube(const Q *p)
Constructor to be used with an existing object.
Solid_type< TGeoShape > Solid
Intermediate class to overcome drawing probles with the TGeoTubeSeg.
ConeSegment()=default
Default constructor.
Class describing boolean intersection solid.
void make(const std::string &nam, double rmin, double rmax, double z, double startPhi, double deltaPhi)
Internal helper method to support object construction.
Torus(const Q *p)
Constructor to be used with an existing object.
T * operator->() const
Overloaded operator -> to access underlying object.
EllipticalTube & setDimensions(double a, double b, double dz)
Set the tube dimensions.
EightPointSolid(double dz, const double *vertices)
Constructor to create a new anonymous object with attribute initialization.
Box(const Q *p)
Constructor to be used with an existing object.
Trapezoid(const Q *p)
Constructor to be used with an existing object.
double x() const
Access half "length" of the box.
Paraboloid(const Q *p)
Constructor to be used with an existing object.
Class describing boolean union solid.
ConeSegment(const Q *p)
Constructor to be used with an existing object.
Torus & operator=(const Torus ©)=default
Assignment operator.
Solid_type(const Handle< T > &e)
Constructor to be used when passing an already created object.
Torus(R r, RMIN rmin, RMAX rmax, PHI phi=M_PI, DELTA_PHI delta_phi=2.*M_PI)
Constructor to create a new anonymous object with attribute initialization.
Tube(double rmin, double rmax, double z)
Constructor to create a new anonymous tube object with attribute initialization.
Trap()=default
Default constructor.
Hyperboloid(const Handle< Q > &e)
Constructor to be used when passing an already created object.
double _toDouble(const std::string &value)
String conversions: string to double value.
BooleanSolid()=default
Default constructor.
Class describing a sphere shape.
Class describing a cone shape.
Handle: a templated class like a shared pointer, which allows specialized access to tgeometry objects...
Solid_type(const Handle< Q > &e)
Constructor to be used when passing an already created object: need to check pointers.
Box()=default
Default constructor.
Class describing a Polycone shape.
Polycone()=default
Default constructor.
std::string toStringSolid(const TGeoShape *shape, int precision=2)
Pretty print of solid attributes.
Trapezoid(X1 x1, X2 x2, Y1 y1, Y2 y2, Z z)
Constructor to create a new anonymous object with attribute initialization.
Tube(const RMIN &rmin, const RMAX &rmax, const Z &z, const DELTAPHI &deltaPhi)
Constructor to create a new anonymous tube object with attribute initialization.
HalfSpace(const Handle< Q > &e)
Constructor to be used with an existing object.
Sphere & setDimensions(double rmin, double rmax, double theta, double delta_theta, double phi, double delta_phi)
Set the Sphere dimensions.
EightPointSolid(const Q *p)
Constructor to be used with an existing object.
Box(double x_val, double y_val, double z_val)
Constructor to create an anonymous new box object (retrieves name from volume)
Tube(const Handle< Q > &e)
Constructor to assign an object.
T * m_element
Single and only data member: Reference to the actual element.
SubtractionSolid(const Handle< Q > &e)
Constructor to be used when passing an already created object.
double y() const
Access half "width" of the box.
Cone(const Q *p)
Constructor to be used with an existing object.
Cone()=default
Default constructor.
Sphere()=default
Default constructor.
ROOT::Math::Transform3D Transform3D
Trap(PZ pz, PY py, PX px, PLTX pLTX)
Constructor to create a new anonymous object with attribute initialization.
PolyhedraRegular()=default
Default constructor.
Class describing a Trapezoid shape.
Solid_type()=default
Default constructor for uninitialized object.
Hyperboloid(const Q *p)
Constructor to be used with an existing object.
Tube(const std::string &nam, double rmin, double rmax, double z, double deltaPhi)
Legacy: Constructor to create a new identifiable tube object with attribute initialization.
EllipticalTube()=default
Default constructor.
const char * type() const
Access to shape type (The TClass name of the ROOT implementation)
Sphere(const Handle< Q > &e)
Constructor to be used when passing an already created object.
Class describing a tube shape of a section of a tube.
EllipticalTube(const Handle< Q > &e)
Constructor to assign an object.