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 geant_units;
12 using namespace geant_units::operators;
13 
14 DDI::Torus::Torus(double pRMin, double pRMax, double pRTor, double pSPhi, double pDPhi) : Solid(DDSolidShape::ddtorus) {
15  p_.emplace_back(pRMin); // ......... 0
16  p_.emplace_back(pRMax); // ......... 1
17  p_.emplace_back(pRTor); // ......... 2
18  p_.emplace_back(pSPhi); // ......... 3
19  p_.emplace_back(pDPhi); // ......... 4
20 }
21 
22 void DDI::Torus::stream(std::ostream& os) const {
23  os << " rMin=" << convertMmToCm(p_[0]) << " rMax=" << convertRadToDeg(p_[1]) << " rTor=" << convertRadToDeg(p_[2])
24  << " sPhi=" << convertMmToCm(p_[3]) << " dPhi=" << convertMmToCm(p_[4]);
25 }
26 
27 double DDI::Torus::volume() const {
28  double volume = 0;
29 
30  /* use notation as described in documentation about geant 4 shapes */
31 
32  // From Geant4: { fCubicVolume = fDPhi*pi*fRtor*(fRmax*fRmax-fRmin*fRmin);
33 
34  volume = p_[4] * piRadians * p_[2] * (p_[1] * p_[1] - p_[0] * p_[0]);
35 
36  return volume;
37 }
DDSolidShapes.h
DDSolidShape
DDSolidShape
Definition: DDSolidShapes.h:6
DDSolidShape::ddtorus
Torus.h
angle_units::operators::convertRadToDeg
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
DDI::Torus::stream
void stream(std::ostream &) const override
Definition: Torus.cc:22
geant_units::operators
Definition: GeantUnits.h:18
Solid.h
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
GeantUnits.h
DDI::Solid
Definition: Solid.h:10
DDI::Torus::volume
double volume() const override
Definition: Torus.cc:27
angle_units::piRadians
constexpr double piRadians(M_PI)
geant_units::operators::convertMmToCm
constexpr NumType convertMmToCm(NumType millimeters)
Definition: GeantUnits.h:63
geant_units
Definition: GeantUnits.h:11
DDI::Torus::Torus
Torus(double pRMin, double pRMax, double pRTor, double pSPhi, double pDPhi)
Definition: Torus.cc:14
DDI::Solid::p_
std::vector< double > p_
Definition: Solid.h:30