CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/DetectorDescription/Core/src/Tubs.cc

Go to the documentation of this file.
00001 #include "DetectorDescription/Core/src/Tubs.h"
00002 
00003 #include "CLHEP/Units/GlobalSystemOfUnits.h"
00004 #include "CLHEP/Units/GlobalPhysicalConstants.h"
00005 
00006 #include <cmath>
00007 
00008 using std::fabs;
00009 
00010 
00011 DDI::Tubs::Tubs(double zhalf,
00012                 double rIn, double rOut,                      
00013                 double startPhi, 
00014                 double deltaPhi)
00015  : Solid(ddtubs)
00016 {
00017   p_.push_back(zhalf);
00018   p_.push_back(rIn);
00019   p_.push_back(rOut);
00020   p_.push_back(startPhi);
00021   p_.push_back(deltaPhi);
00022 }
00023 
00024 
00025 void DDI::Tubs::stream(std::ostream & os) const
00026 {
00027   os << " zhalf=" << p_[0]/cm
00028      << " rIn=" << p_[1]/cm
00029      << " rOut=" << p_[2]/cm
00030      << " startPhi=" << p_[3]/deg
00031      << " deltaPhi=" << p_[4]/deg;              
00032 }
00033 
00034                                         
00035 double DDI::Tubs::volume() const
00036 {
00037    double volume=0;
00038    double z=2.*p_[0];
00039    double rIn=p_[1];
00040    double rOut=p_[2];
00041    double phi=p_[4]/rad;
00042 
00043    double volume1=pi*rIn*rIn*z;
00044    double volume2=pi*rOut*rOut*z;
00045 
00046    double slice=fabs(phi/(2*pi));
00047 
00048    volume=slice*(volume2-volume1);
00049   
00050    return volume;                                                                                                                                               
00051 }                                                                                                                                               
00052