CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Tubs.cc
Go to the documentation of this file.
2 
3 #include "CLHEP/Units/GlobalSystemOfUnits.h"
4 #include "CLHEP/Units/GlobalPhysicalConstants.h"
5 
6 #include <cmath>
7 
8 using std::fabs;
9 
10 
11 DDI::Tubs::Tubs(double zhalf,
12  double rIn, double rOut,
13  double startPhi,
14  double deltaPhi)
15  : Solid(ddtubs)
16 {
17  p_.push_back(zhalf);
18  p_.push_back(rIn);
19  p_.push_back(rOut);
20  p_.push_back(startPhi);
21  p_.push_back(deltaPhi);
22 }
23 
24 
25 void DDI::Tubs::stream(std::ostream & os) const
26 {
27  os << " zhalf=" << p_[0]/cm
28  << " rIn=" << p_[1]/cm
29  << " rOut=" << p_[2]/cm
30  << " startPhi=" << p_[3]/deg
31  << " deltaPhi=" << p_[4]/deg;
32 }
33 
34 
35 double DDI::Tubs::volume() const
36 {
37  double volume=0;
38  double z=2.*p_[0];
39  double rIn=p_[1];
40  double rOut=p_[2];
41  double phi=p_[4]/rad;
42 
43  double volume1=pi*rIn*rIn*z;
44  double volume2=pi*rOut*rOut*z;
45 
46  double slice=fabs(phi/(2*pi));
47 
48  volume=slice*(volume2-volume1);
49 
50  return volume;
51 }
52 
void stream(std::ostream &) const
Definition: Tubs.cc:25
Tubs(double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
Definition: Tubs.cc:11
double double double z
const Double_t pi
double volume() const
Definition: Tubs.cc:35
std::vector< double > p_
Definition: Solid.h:32
Definition: DDAxes.h:10