20 const std::vector<double> & z,
21 const std::vector<double> & rmin,
22 const std::vector<double> & rmax)
25 p_.emplace_back(sides);
26 p_.emplace_back(startPhi);
27 p_.emplace_back(deltaPhi);
28 if((z.size()!=rmin.size()) || (z.size()!=rmax.size()) )
30 throw cms::Exception(
"DDException") <<
"Polyhedra(..): std::vectors z,rmin,rmax not of same length";
34 for(
unsigned int i=0;
i<z.size(); ++
i)
36 p_.emplace_back(z[
i]);
37 p_.emplace_back(rmin[i]);
38 p_.emplace_back(rmax[i]);
44 const std::vector<double> & z,
47 p_.emplace_back(sides);
48 p_.emplace_back(startPhi);
49 p_.emplace_back(deltaPhi);
50 if(z.size()!=r.size())
52 throw cms::Exception(
"DDException") <<
"Polyhedra(..): std::vectors z,rmin,rmax not of same length";
56 for(
unsigned int i=0;
i<z.size(); ++
i)
58 p_.emplace_back(z[
i]);
59 p_.emplace_back(r[i]);
92 int loop = (
p_.size()-3)/3 -1;
94 double a = 0.5*fabs(
p_[2] /
p_[0]);
96 for (
int j=3; j<(loop+3); ++j)
98 double dz= fabs(
p_[i]-
p_[i+3]);
108 double H1=(
p_[i+2]-
p_[i+1])*
cos(a);
109 double Bl1=
p_[i+1]*
sin(a);
110 double Tl1=
p_[i+2]*
sin(a);
113 double Bl2=
p_[i+4]*
sin(a);
114 double Tl2=
p_[i+5]*
sin(a);
116 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;
124 int sides=
int(
p_[0]);
126 double phiDelta=
p_[2];
137 alpha=fabs(phiDelta);
138 beta=0.5*(alpha/sides);
140 while(i<(
p_.size()-2))
149 double volume1=(rEnd*rEnd+rBegin*rBegin+rBegin*rEnd)*z/3;
151 volume=volume+volume1;
165 double volume2=(rEnd*rEnd+rBegin*rBegin+rBegin*rEnd)*z/3;
167 volume=volume+volume2;
169 volume=fabs(sides*
cos(beta)*
sin(beta)*volume);
176 os <<
" sides=" <<
p_[0]
180 for (
unsigned k=3;
k<
p_.size(); ++
k)
void stream(std::ostream &) const override
double volume() const override
Sin< T >::type sin(const T &t)
constexpr NumType convertRadToDeg(NumType radians)
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)
constexpr NumType convertMmToCm(NumType millimeters)
DDSolidShape shape() const