CMS 3D CMS Logo

Torus.cc
Go to the documentation of this file.
3 
4 #include <cmath>
5 #include <vector>
6 
9 
10 using std::sqrt;
11 using namespace dd;
12 using namespace dd::operators;
13 
14 DDI::Torus::Torus( double pRMin,
15  double pRMax,
16  double pRTor,
17  double pSPhi,
18  double pDPhi
19  )
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 }
28 
29 
30 void DDI::Torus::stream(std::ostream & os) const
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 }
38 
39 double DDI::Torus::volume() const
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 }
DDSolidShape
Definition: DDSolidShapes.h:4
#define CONVERT_TO(_x, _y)
Definition: DDUnits.h:6
double volume() const override
Definition: Torus.cc:39
void stream(std::ostream &) const override
Definition: Torus.cc:30
T sqrt(T t)
Definition: SSEVec.h:18
Torus(double pRMin, double pRMax, double pRTor, double pSPhi, double pDPhi)
Definition: Torus.cc:14
std::vector< double > p_
Definition: Solid.h:32
constexpr long double _pi(M_PI)
Definition: DDUnits.h:8