Go to the documentation of this file.00001 #include "DetectorDescription/Core/src/Sphere.h"
00002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00003 #include <DataFormats/GeometryVector/interface/Pi.h>
00004 #include "CLHEP/Units/GlobalSystemOfUnits.h"
00005 #include "CLHEP/Units/GlobalPhysicalConstants.h"
00006
00007 #include <cmath>
00008 #include <ostream>
00009
00010 DDI::Sphere::Sphere(double innerRadius,
00011 double outerRadius,
00012 double startPhi,
00013 double deltaPhi,
00014 double startTheta,
00015 double deltaTheta)
00016 : Solid(ddsphere)
00017 {
00018 p_.push_back(innerRadius);
00019 p_.push_back(outerRadius);
00020 p_.push_back(startPhi);
00021 p_.push_back(deltaPhi);
00022 p_.push_back(startTheta);
00023 p_.push_back(deltaTheta);
00024 }
00025
00026
00027 void DDI::Sphere::stream(std::ostream & os) const
00028 {
00029 os << " innerRadius=" << p_[0]/cm
00030 << " outerRadius=" << p_[1]/cm
00031 << " startPhi=" << p_[2]/deg
00032 << " deltaPhi=" << p_[3]/deg
00033 << " startTheta=" << p_[4]/deg
00034 << " deltaTheta=" << p_[5]/deg;
00035 }
00036
00037 double DDI::Sphere::volume() const
00038 {
00039 double volume(0.);
00040 if ( std::fabs(p_[3]) <= 2.*Geom::pi() && std::fabs(p_[5]) <= Geom::pi() ) {
00041 volume = std::fabs((p_[1]*p_[1]*p_[1] - p_[0]*p_[0]*p_[0])/3. * (std::cos(p_[4]+p_[5]) - std::cos(p_[4]))*p_[3]);
00042 } else if (std::fabs(p_[3]) <= 2.*Geom::pi() && std::fabs(p_[5]) > Geom::pi() ) {
00043 volume = std::fabs((p_[1]*p_[1]*p_[1] - p_[0]*p_[0]*p_[0])/3. * (std::cos(p_[4]+p_[5]-180.*deg) - std::cos(p_[4]))*p_[3]);
00044 } else if (std::fabs(p_[3]) > 2.*Geom::pi() && std::fabs(p_[5]) <= Geom::pi() ) {
00045 volume = std::fabs((p_[1]*p_[1]*p_[1] - p_[0]*p_[0]*p_[0])/3. * (std::cos(p_[4]+p_[5]) - std::cos(p_[4]))*(p_[3]-p_[2]));
00046 }
00047 return volume;
00048 }
00049
00050