test
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 <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::fabs;
13 
14 
15 DDI::Tubs::Tubs(double zhalf,
16  double rIn, double rOut,
17  double startPhi,
18  double deltaPhi)
19  : Solid(ddtubs)
20 {
21  p_.push_back(zhalf);
22  p_.push_back(rIn);
23  p_.push_back(rOut);
24  p_.push_back(startPhi);
25  p_.push_back(deltaPhi);
26 }
27 
28 
29 void DDI::Tubs::stream(std::ostream & os) const
30 {
31  os << " zhalf=" << p_[0]/cm
32  << " rIn=" << p_[1]/cm
33  << " rOut=" << p_[2]/cm
34  << " startPhi=" << p_[3]/deg
35  << " deltaPhi=" << p_[4]/deg;
36 }
37 
38 
39 double DDI::Tubs::volume() const
40 {
41  double volume=0;
42  double z=2.*p_[0];
43  double rIn=p_[1];
44  double rOut=p_[2];
45  double phi=p_[4]/rad;
46 
47  double volume1=pi*rIn*rIn*z;
48  double volume2=pi*rOut*rOut*z;
49 
50  double slice=fabs(phi/(2*pi));
51 
52  volume=slice*(volume2-volume1);
53 
54  return volume;
55 }
56 
void stream(std::ostream &) const
Definition: Tubs.cc:29
Tubs(double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
Definition: Tubs.cc:15
const Double_t pi
Geom::Phi< T > phi() const
double volume() const
Definition: Tubs.cc:39
std::vector< double > p_
Definition: Solid.h:32