CMS 3D CMS Logo

Public Member Functions

DDI::Sphere Class Reference

#include <Sphere.h>

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

List of all members.

Public Member Functions

 Sphere (double innerRadius, double outerRadius, double startPhi, double deltaPhi, double startZ, double deltaZ)
void stream (std::ostream &) const
double volume () const

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 10 of file Sphere.cc.

References DDI::Solid::p_.

 : Solid(ddsphere)        
{
  p_.push_back(innerRadius);
  p_.push_back(outerRadius);
  p_.push_back(startPhi);
  p_.push_back(deltaPhi);
  p_.push_back(startTheta);
  p_.push_back(deltaTheta);
}        

Member Function Documentation

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

Reimplemented from DDI::Solid.

Definition at line 27 of file Sphere.cc.

{
   os << " innerRadius=" << p_[0]/cm
      << " outerRadius=" << p_[1]/cm
      << " startPhi=" << p_[2]/deg
      << " deltaPhi=" << p_[3]/deg
      << " startTheta=" << p_[4]/deg
      << " deltaTheta=" << p_[5]/deg;
}
double DDI::Sphere::volume ( ) const [virtual]

Reimplemented from DDI::Solid.

Definition at line 37 of file Sphere.cc.

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

{
  double volume(0.);
  if ( std::fabs(p_[3]) <= 2.*Geom::pi() && std::fabs(p_[5]) <= Geom::pi() ) {
    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]);
  } else if (std::fabs(p_[3]) <= 2.*Geom::pi() && std::fabs(p_[5]) > Geom::pi() ) {
    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]);
  } else if (std::fabs(p_[3]) > 2.*Geom::pi() && std::fabs(p_[5]) <= Geom::pi() ) {
    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]));
  }
  return volume;
}