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 
)

Definition at line 14 of file Sphere.cc.

17  p_.emplace_back(innerRadius);
18  p_.emplace_back(outerRadius);
19  p_.emplace_back(startPhi);
20  p_.emplace_back(deltaPhi);
21  p_.emplace_back(startTheta);
22  p_.emplace_back(deltaTheta);
23 }

References ddsphere, SiPixelRawToDigiRegional_cfi::deltaPhi, interestingEgammaIsoDetIdsSequence_cff::innerRadius, interestingEgammaIsoDetIdsSequence_cff::outerRadius, and DDI::Solid::p_.

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.

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 }

References geant_units::operators::convertMmToCm(), and angle_units::operators::convertRadToDeg().

◆ volume()

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

Reimplemented from DDI::Solid.

Definition at line 31 of file Sphere.cc.

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 }

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

angle_units::operators::convertRadToDeg
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
interestingEgammaIsoDetIdsSequence_cff.outerRadius
outerRadius
Definition: interestingEgammaIsoDetIdsSequence_cff.py:14
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
SiPixelRawToDigiRegional_cfi.deltaPhi
deltaPhi
Definition: SiPixelRawToDigiRegional_cfi.py:9
DDI::Solid::Solid
Solid()
Definition: Solid.h:12
DDSolidShape::ddsphere
interestingEgammaIsoDetIdsSequence_cff.innerRadius
innerRadius
Definition: interestingEgammaIsoDetIdsSequence_cff.py:15
DDI::Sphere::volume
double volume() const override
Definition: Sphere.cc:31
angle_units::piRadians
constexpr double piRadians(M_PI)
geant_units::operators::convertMmToCm
constexpr NumType convertMmToCm(NumType millimeters)
Definition: GeantUnits.h:63
DDI::Solid::p_
std::vector< double > p_
Definition: Solid.h:30