Go to the documentation of this file.00001 #include "DetectorDescription/Core/src/Cons.h"
00002 #include "CLHEP/Units/GlobalSystemOfUnits.h"
00003 #include "CLHEP/Units/GlobalPhysicalConstants.h"
00004 #include <cmath>
00005 #include <ostream>
00006
00007 DDI::Cons::Cons(double zhalf,
00008 double rInMinusZ,
00009 double rOutMinusZ,
00010 double rInPlusZ,
00011 double rOutPlusZ,
00012 double startPhi,
00013 double deltaPhi)
00014 : Solid(ddcons)
00015 {
00016 p_.push_back(zhalf);
00017 p_.push_back(rInMinusZ);
00018 p_.push_back(rOutMinusZ);
00019 p_.push_back(rInPlusZ);
00020 p_.push_back(rOutPlusZ);
00021 p_.push_back(startPhi);
00022 p_.push_back(deltaPhi);
00023
00024 }
00025
00026
00027 void DDI::Cons::stream(std::ostream & os) const
00028 {
00029 os << " zhalf=" << p_[0]/cm
00030 << " rIn-Z=" << p_[1]/cm
00031 << " rOut-Z=" << p_[2]/cm
00032 << " rIn+Z=" << p_[3]/cm
00033 << " rOut+Z=" << p_[4]/cm
00034 << " startPhi=" << p_[5]/deg
00035 << " deltaPhi=" << p_[6]/deg;
00036 }
00037
00038 double DDI::Cons::volume() const
00039 {
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 double zhalf=p_[0];
00059 double rInMinusZ=p_[1];
00060 double rOutMinusZ=p_[2];
00061 double rInPlusZ=p_[3];
00062 double rOutPlusZ=p_[4];
00063
00064 double deltaPhi=fabs(p_[6]/rad);
00065 double z=2*zhalf;
00066
00067 double volume1=pi*(rInPlusZ*rInPlusZ+rInMinusZ*rInMinusZ+rInMinusZ*rInPlusZ)*z/3;
00068
00069 double volume2=pi*(rOutPlusZ*rOutPlusZ+rOutMinusZ*rOutMinusZ+rOutMinusZ*rOutPlusZ)*z/3;
00070
00071 double slice=deltaPhi/(2*pi);
00072 double volume=slice*(volume2-volume1);
00073
00074 return volume;
00075
00076 }
00077
00078