CMS 3D CMS Logo

List of all members | Public Member Functions
DDI::Sphere Class Reference

#include <Sphere.h>

Inheritance diagram for DDI::Sphere:
DDI::Solid

Public Member Functions

 Sphere (double innerRadius, double outerRadius, double startPhi, double deltaPhi, double startZ, double deltaZ)
 
void stream (std::ostream &) const override
 
double volume () const override
 
- Public Member Functions inherited from DDI::Solid
const std::vector< double > & parameters () const
 
void setParameters (std::vector< double > const &p)
 
DDSolidShape shape () const
 
 Solid ()
 
 Solid (DDSolidShape shape)
 
virtual ~Solid ()
 

Additional Inherited Members

- Protected Attributes inherited from DDI::Solid
std::vector< double > p_
 
DDSolidShape shape_
 

Detailed Description

Definition at line 9 of file Sphere.h.

Constructor & Destructor Documentation

◆ Sphere()

DDI::Sphere::Sphere ( double  innerRadius,
double  outerRadius,
double  startPhi,
double  deltaPhi,
double  startZ,
double  deltaZ 
)

Member Function Documentation

◆ stream()

void DDI::Sphere::stream ( std::ostream &  os) const
overridevirtual

Reimplemented from DDI::Solid.

Definition at line 25 of file Sphere.cc.

References angle_units::operators::convertMmToCm(), angle_units::operators::convertRadToDeg(), and l1tGTMenu_BTagSeeds_cff::os.

25  {
26  os << " innerRadius=" << convertMmToCm(p_[0]) << " outerRadius=" << convertMmToCm(p_[1])
27  << " startPhi=" << convertRadToDeg(p_[2]) << " deltaPhi=" << convertRadToDeg(p_[3])
28  << " startTheta=" << convertRadToDeg(p_[4]) << " deltaTheta=" << convertRadToDeg(p_[5]);
29 }
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
constexpr NumType convertMmToCm(NumType millimeters)
Definition: angle_units.h:44
std::vector< double > p_
Definition: Solid.h:30

◆ volume()

double DDI::Sphere::volume ( void  ) const
overridevirtual

Reimplemented from DDI::Solid.

Definition at line 31 of file Sphere.cc.

References funct::cos(), and angle_units::piRadians().

31  {
32  double volume(0.);
33  if (std::fabs(p_[3]) <= 2._pi && std::fabs(p_[5]) <= piRadians) {
34  volume = std::fabs((p_[1] * p_[1] * p_[1] - p_[0] * p_[0] * p_[0]) / 3. *
35  (std::cos(p_[4] + p_[5]) - std::cos(p_[4])) * p_[3]);
36  } else if (std::fabs(p_[3]) <= 2._pi && std::fabs(p_[5]) > piRadians) {
37  volume = std::fabs((p_[1] * p_[1] * p_[1] - p_[0] * p_[0] * p_[0]) / 3. *
38  (std::cos(p_[4] + p_[5] - 180._deg) - std::cos(p_[4])) * p_[3]);
39  } else if (std::fabs(p_[3]) > 2._pi && std::fabs(p_[5]) <= piRadians) {
40  volume = std::fabs((p_[1] * p_[1] * p_[1] - p_[0] * p_[0] * p_[0]) / 3. *
41  (std::cos(p_[4] + p_[5]) - std::cos(p_[4])) * (p_[3] - p_[2]));
42  }
43  return volume;
44 }
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double volume() const override
Definition: Sphere.cc:31
constexpr double piRadians(M_PI)
std::vector< double > p_
Definition: Solid.h:30