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 CONVERT_TO, and DDI::Solid::p_.

31 {
32  os << " rMin=" << CONVERT_TO( p_[0], cm )
33  << " rMax=" << CONVERT_TO( p_[1], deg )
34  << " rTor=" << CONVERT_TO( p_[2], deg )
35  << " sPhi=" << CONVERT_TO( p_[3], cm )
36  << " dPhi=" << CONVERT_TO( p_[4], cm );
37 }
#define CONVERT_TO(_x, _y)
Definition: DDUnits.h:6
std::vector< double > p_
Definition: Solid.h:32
double DDI::Torus::volume ( void  ) const
overridevirtual

Reimplemented from DDI::Solid.

Definition at line 39 of file Torus.cc.

References _pi(), and DDI::Solid::p_.

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]*_pi*p_[2]*(p_[1]*p_[1]-p_[0]*p_[0]);
48 
49  return volume;
50 }
double volume() const override
Definition: Torus.cc:39
std::vector< double > p_
Definition: Solid.h:32
constexpr long double _pi(M_PI)