CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
 
double volume () const
 
- 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

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

Definition at line 8 of file Sphere.cc.

References DDI::Solid::p_.

14  : Solid(ddsphere)
15 {
16  p_.push_back(innerRadius);
17  p_.push_back(outerRadius);
18  p_.push_back(startPhi);
19  p_.push_back(deltaPhi);
20  p_.push_back(startTheta);
21  p_.push_back(deltaTheta);
22 }
Solid()
Definition: Solid.h:14
std::vector< double > p_
Definition: Solid.h:32

Member Function Documentation

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

Reimplemented from DDI::Solid.

Definition at line 25 of file Sphere.cc.

26 {
27  os << " innerRadius=" << p_[0]/cm
28  << " outerRadius=" << p_[1]/cm
29  << " startPhi=" << p_[2]/deg
30  << " deltaPhi=" << p_[3]/deg
31  << " startTheta=" << p_[4]/deg
32  << " deltaTheta=" << p_[5]/deg;
33 }
std::vector< double > p_
Definition: Solid.h:32
double DDI::Sphere::volume ( void  ) const
virtual

Reimplemented from DDI::Solid.

Definition at line 35 of file Sphere.cc.

References funct::cos(), and Geom::pi().

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