CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Torus.cc
Go to the documentation of this file.
2 #include "CLHEP/Units/GlobalPhysicalConstants.h"
3 #include "CLHEP/Units/GlobalSystemOfUnits.h"
4 #include <cmath>
5 
6 using std::sqrt;
7 
8 
9 DDI::Torus::Torus( double pRMin,
10  double pRMax,
11  double pRTor,
12  double pSPhi,
13  double pDPhi
14  )
15  : Solid(ddtorus)
16 {
17  p_.push_back(pRMin); // ......... 0
18  p_.push_back(pRMax); // ......... 1
19  p_.push_back(pRTor); // ......... 2
20  p_.push_back(pSPhi); // ......... 3
21  p_.push_back(pDPhi); // ......... 4
22 }
23 
24 
25 void DDI::Torus::stream(std::ostream & os) const
26 {
27  os << " rMin=" << p_[0]/cm
28  << " rMax=" << p_[1]/deg
29  << " rTor=" << p_[2]/deg
30  << " sPhi=" << p_[3]/cm
31  << " dPhi=" << p_[4]/cm;
32 }
33 
34 double DDI::Torus::volume() const
35 {
36  double volume=0;
37 
38  /* use notation as described in documentation about geant 4 shapes */
39 
40  // From Geant4: { fCubicVolume = fDPhi*pi*fRtor*(fRmax*fRmax-fRmin*fRmin);
41 
42  volume = p_[4]*pi*p_[2]*(p_[1]*p_[1]-p_[0]*p_[0]);
43 
44  return volume;
45 }
double volume() const
Definition: Torus.cc:34
T sqrt(T t)
Definition: SSEVec.h:28
Torus(double pRMin, double pRMax, double pRTor, double pSPhi, double pDPhi)
Definition: Torus.cc:9
std::vector< double > p_
Definition: Solid.h:41
void stream(std::ostream &) const
Definition: Torus.cc:25
double pi