5 #include "CLHEP/Units/GlobalSystemOfUnits.h" 6 #include "CLHEP/Units/SystemOfUnits.h" 19 const std::vector<double> &
z,
20 const std::vector<double> & rmin,
21 const std::vector<double> & rmax)
24 p_.emplace_back(sides);
25 p_.emplace_back(startPhi);
26 p_.emplace_back(deltaPhi);
27 if((z.size()!=rmin.size()) || (z.size()!=rmax.size()) )
29 throw cms::Exception(
"DDException") <<
"Polyhedra(..): std::vectors z,rmin,rmax not of same length";
33 for(
unsigned int i=0;
i<z.size(); ++
i)
35 p_.emplace_back(z[
i]);
36 p_.emplace_back(rmin[i]);
37 p_.emplace_back(rmax[i]);
43 const std::vector<double> & z,
46 p_.emplace_back(sides);
47 p_.emplace_back(startPhi);
48 p_.emplace_back(deltaPhi);
49 if(z.size()!=r.size())
51 throw cms::Exception(
"DDException") <<
"Polyhedra(..): std::vectors z,rmin,rmax not of same length";
55 for(
unsigned int i=0;
i<z.size(); ++
i)
57 p_.emplace_back(z[
i]);
58 p_.emplace_back(r[i]);
91 int loop = (
p_.size()-3)/3 -1;
93 double a = 0.5*fabs(
p_[2]/rad /
p_[0]);
95 for (
int j=3; j<(loop+3); ++j)
97 double dz= fabs(
p_[i]-
p_[i+3]);
107 double H1=(
p_[i+2]-
p_[i+1])*
cos(a);
108 double Bl1=
p_[i+1]*
sin(a);
109 double Tl1=
p_[i+2]*
sin(a);
112 double Bl2=
p_[i+4]*
sin(a);
113 double Tl2=
p_[i+5]*
sin(a);
115 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;
123 int sides=
int(
p_[0]);
125 double phiDelta=
p_[2]/rad;
136 alpha=fabs(phiDelta);
137 beta=0.5*(alpha/sides);
139 while(i<(
p_.size()-2))
148 double volume1=(rEnd*rEnd+rBegin*rBegin+rBegin*rEnd)*z/3;
150 volume=volume+volume1;
164 double volume2=(rEnd*rEnd+rBegin*rBegin+rBegin*rEnd)*z/3;
166 volume=volume+volume2;
168 volume=fabs(sides*
cos(beta)*
sin(beta)*volume);
175 os <<
" sides=" <<
p_[0]
176 <<
" startPhi[deg]=" <<
p_[1]/deg
177 <<
" dPhi[deg]=" <<
p_[2]/deg
179 for (
unsigned k=3;
k<
p_.size(); ++
k)
180 os <<
p_[
k]/cm <<
" ";
void stream(std::ostream &) const override
double volume() const override
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