CMS 3D CMS Logo

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

#include <Torus.h>

Inheritance diagram for DDI::Torus:
DDI::Solid

Public Member Functions

void stream (std::ostream &) const override
 
 Torus (double pRMin, double pRMax, double pRTor, double pSPhi, double pDPhi)
 
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 Torus.h.

Constructor & Destructor Documentation

DDI::Torus::Torus ( double  pRMin,
double  pRMax,
double  pRTor,
double  pSPhi,
double  pDPhi 
)

Definition at line 14 of file Torus.cc.

References ddtorus, and DDI::Solid::p_.

21 {
22  p_.emplace_back(pRMin); // ......... 0
23  p_.emplace_back(pRMax); // ......... 1
24  p_.emplace_back(pRTor); // ......... 2
25  p_.emplace_back(pSPhi); // ......... 3
26  p_.emplace_back(pDPhi); // ......... 4
27 }
Solid()
Definition: Solid.h:14
std::vector< double > p_
Definition: Solid.h:32

Member Function Documentation

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

Reimplemented from DDI::Solid.

Definition at line 30 of file Torus.cc.

References geant_units::operators::convertMmToCm(), geant_units::operators::convertRadToDeg(), and DDI::Solid::p_.

31 {
32  os << " rMin=" << convertMmToCm( p_[0] )
33  << " rMax=" << convertRadToDeg( p_[1] )
34  << " rTor=" << convertRadToDeg( p_[2] )
35  << " sPhi=" << convertMmToCm( p_[3] )
36  << " dPhi=" << convertMmToCm( p_[4] );
37 }
constexpr NumType convertRadToDeg(NumType radians)
Definition: GeantUnits.h:98
std::vector< double > p_
Definition: Solid.h:32
constexpr NumType convertMmToCm(NumType millimeters)
Definition: GeantUnits.h:110
double DDI::Torus::volume ( void  ) const
overridevirtual

Reimplemented from DDI::Solid.

Definition at line 39 of file Torus.cc.

References DDI::Solid::p_, and geant_units::piRadians().

40 {
41  double volume=0;
42 
43  /* use notation as described in documentation about geant 4 shapes */
44 
45  // From Geant4: { fCubicVolume = fDPhi*pi*fRtor*(fRmax*fRmax-fRmin*fRmin);
46 
47  volume = p_[4] * piRadians * p_[2] * (p_[1] * p_[1] - p_[0] * p_[0]);
48 
49  return volume;
50 }
double volume() const override
Definition: Torus.cc:39
constexpr long double piRadians(M_PI)
std::vector< double > p_
Definition: Solid.h:32