CMS 3D CMS Logo

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