CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/DetectorDescription/Core/src/Torus.cc

Go to the documentation of this file.
00001 #include "DetectorDescription/Core/src/Torus.h"
00002 #include "CLHEP/Units/GlobalPhysicalConstants.h"
00003 #include "CLHEP/Units/GlobalSystemOfUnits.h"
00004 #include <cmath>
00005 
00006 using std::sqrt;
00007 
00008 
00009 DDI::Torus::Torus( double pRMin,
00010                    double pRMax,
00011                    double pRTor,
00012                    double pSPhi,
00013                    double pDPhi
00014                    )
00015  : Solid(ddtorus) 
00016 {                
00017   p_.push_back(pRMin); // ......... 0
00018   p_.push_back(pRMax); // ......... 1
00019   p_.push_back(pRTor); // ......... 2
00020   p_.push_back(pSPhi); // ......... 3
00021   p_.push_back(pDPhi); // ......... 4
00022 }
00023 
00024 
00025 void DDI::Torus::stream(std::ostream & os) const
00026 {
00027   os << " rMin=" << p_[0]/cm
00028      << " rMax=" << p_[1]/deg
00029      << " rTor=" << p_[2]/deg
00030      << " sPhi=" << p_[3]/cm
00031      << " dPhi=" << p_[4]/cm;
00032 }
00033 
00034 double DDI::Torus::volume() const
00035 {
00036   double volume=0;
00037   
00038   /* use notation as described in documentation about geant 4 shapes */
00039   
00040   // From Geant4: { fCubicVolume = fDPhi*pi*fRtor*(fRmax*fRmax-fRmin*fRmin);
00041   
00042   volume = p_[4]*pi*p_[2]*(p_[1]*p_[1]-p_[0]*p_[0]);
00043   
00044   return volume;
00045 }