3 #include "CLHEP/Units/GlobalSystemOfUnits.h"
12 Polyhedra::Polyhedra(
int sides,
double startPhi,
double deltaPhi,
13 const std::vector<double> &
z,
14 const std::vector<double> & rmin,
18 p_.push_back(startPhi);
19 p_.push_back(deltaPhi);
20 if((z.size()!=rmin.size()) || (z.size()!=rmax.size()) )
22 throw cms::Exception(
"DDException") <<
"Polyhedra(..): std::vectors z,rmin,rmax not of same length";
26 for(
unsigned int i=0;
i<z.size(); ++
i)
29 p_.push_back(rmin[i]);
30 p_.push_back(rmax[i]);
37 const std::vector<double> & z,
41 p_.push_back(startPhi);
42 p_.push_back(deltaPhi);
43 if(z.size()!=r.size())
45 throw cms::Exception(
"DDException") <<
"Polyhedra(..): std::vectors z,rmin,rmax not of same length";
49 for(
unsigned int i=0;
i<z.size(); ++
i)
67 int loop = (
p_.size()-3)/3 -1;
69 double a = 0.5*fabs(
p_[2]/rad /
p_[0]);
70 DCOUT(
'V',
"Polyhedra::volume(), loop=" << loop <<
" alph[deg]=" << a/deg);
72 for (
int j=3;
j<(loop+3); ++
j)
74 double dz= fabs(
p_[i]-
p_[i+3]);
75 DCOUT(
'v',
" dz[m] =" << dz/
m);
87 double H1=(
p_[i+2]-
p_[i+1])*
cos(a);
88 double Bl1=
p_[i+1]*
sin(a);
89 double Tl1=
p_[i+2]*
sin(a);
92 double Bl2=
p_[i+4]*
sin(a);
93 double Tl2=
p_[i+5]*
sin(a);
95 double s = (2*H1*Bl1+2*H1*Tl1)*z+(H1*Bl2-2*H1*Bl1+H1*Tl2-2*H1*Tl1+H2*Bl1+H2*Tl1+H2*Tl2-H2*Tl1)*z+(2/3)*(H2*Bl2-H2*Bl1-H1*Bl2+H1*Bl1-H1*Tl2+H1*Tl1)*z;
103 int sides=int(
p_[0]);
105 double phiDelta=
p_[2]/rad;
116 alpha=fabs(phiDelta);
117 beta=0.5*(alpha/sides);
119 while(i<(
p_.size()-2))
128 double volume1=(rEnd*rEnd+rBegin*rBegin+rBegin*rEnd)*z/3;
130 volume=volume+volume1;
144 double volume2=(rEnd*rEnd+rBegin*rBegin+rBegin*rEnd)*z/3;
146 volume=volume+volume2;
148 volume=fabs(sides*
cos(beta)*
sin(beta)*volume);
Sin< T >::type sin(const T &t)
Cos< T >::type cos(const T &t)
Polyhedra(int sides, double startPhi, double deltaPhi, const std::vector< double > &z, const std::vector< double > &rmin, const std::vector< double > &rmax)
DDSolidShape shape() const
#define DCOUT(M_v_Y, M_v_S)