Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:05:26

0001 #include "DetectorDescription/Core/interface/Torus.h"
0002 #include "DataFormats/Math/interface/GeantUnits.h"
0003 
0004 #include <cmath>
0005 #include <vector>
0006 
0007 #include "DetectorDescription/Core/interface/DDSolidShapes.h"
0008 #include "DetectorDescription/Core/interface/Solid.h"
0009 
0010 using std::sqrt;
0011 using namespace geant_units;
0012 using namespace geant_units::operators;
0013 
0014 DDI::Torus::Torus(double pRMin, double pRMax, double pRTor, double pSPhi, double pDPhi) : Solid(DDSolidShape::ddtorus) {
0015   p_.emplace_back(pRMin);  // ......... 0
0016   p_.emplace_back(pRMax);  // ......... 1
0017   p_.emplace_back(pRTor);  // ......... 2
0018   p_.emplace_back(pSPhi);  // ......... 3
0019   p_.emplace_back(pDPhi);  // ......... 4
0020 }
0021 
0022 void DDI::Torus::stream(std::ostream& os) const {
0023   os << " rMin=" << convertMmToCm(p_[0]) << " rMax=" << convertRadToDeg(p_[1]) << " rTor=" << convertRadToDeg(p_[2])
0024      << " sPhi=" << convertMmToCm(p_[3]) << " dPhi=" << convertMmToCm(p_[4]);
0025 }
0026 
0027 double DDI::Torus::volume() const {
0028   double volume = 0;
0029 
0030   /* use notation as described in documentation about geant 4 shapes */
0031 
0032   // From Geant4: { fCubicVolume = fDPhi*pi*fRtor*(fRmax*fRmax-fRmin*fRmin);
0033 
0034   volume = p_[4] * piRadians * p_[2] * (p_[1] * p_[1] - p_[0] * p_[0]);
0035 
0036   return volume;
0037 }