22 const std::vector<double>& z,
23 const std::vector<double>& rmin,
24 const std::vector<double>& rmax)
26 p_.emplace_back(sides);
27 p_.emplace_back(startPhi);
29 if ((z.size() != rmin.size()) || (z.size() != rmax.size())) {
30 throw cms::Exception(
"DDException") <<
"Polyhedra(..): std::vectors z,rmin,rmax not of same length";
32 for (
unsigned int i = 0;
i < z.size(); ++
i) {
33 p_.emplace_back(z[
i]);
34 p_.emplace_back(rmin[
i]);
35 p_.emplace_back(rmax[
i]);
41 int sides,
double startPhi,
double deltaPhi,
const std::vector<double>& z,
const std::vector<double>& r)
43 p_.emplace_back(sides);
44 p_.emplace_back(startPhi);
46 if (z.size() != r.size()) {
47 throw cms::Exception(
"DDException") <<
"Polyhedra(..): std::vectors z,rmin,rmax not of same length";
49 for (
unsigned int i = 0;
i < z.size(); ++
i) {
50 p_.emplace_back(z[
i]);
51 p_.emplace_back(r[
i]);
82 int loop = (
p_.size() - 3) / 3 - 1;
84 double a = 0.5 * fabs(
p_[2] /
p_[0]);
86 for (
int j = 3;
j < (
loop + 3); ++
j) {
98 double Bl1 =
p_[
i + 1] *
sin(
a);
99 double Tl1 =
p_[
i + 2] *
sin(
a);
102 double Bl2 =
p_[
i + 4] *
sin(
a);
103 double Tl2 =
p_[
i + 5] *
sin(
a);
105 double s = (2 * H1 * Bl1 + 2 * H1 * Tl1) * z +
106 (H1 * Bl2 - 2 * H1 * Bl1 + H1 * Tl2 - 2 * H1 * Tl1 +
H2 * Bl1 +
H2 * Tl1 +
H2 * Tl2 -
H2 * Tl1) * z +
107 (2 / 3) * (
H2 * Bl2 -
H2 * Bl1 - H1 * Bl2 + H1 * Bl1 - H1 * Tl2 + H1 * Tl1) * z;
115 int sides =
int(
p_[0]);
117 double phiDelta =
p_[2];
128 alpha = fabs(phiDelta);
131 while (
i < (
p_.size() - 2)) {
139 double volume1 = (rEnd * rEnd + rBegin * rBegin + rBegin * rEnd) * z / 3;
155 double volume2 = (rEnd * rEnd + rBegin * rBegin + rBegin * rEnd) * z / 3;
167 for (
unsigned k = 3;
k < p_.size(); ++
k)
constexpr NumType convertRadToDeg(NumType radians)
Sin< T >::type sin(const T &t)
DDSolidShape shape() const
Cos< T >::type cos(const T &t)
constexpr NumType convertMmToCm(NumType millimeters)
Polyhedra(int sides, double startPhi, double deltaPhi, const std::vector< double > &z, const std::vector< double > &rmin, const std::vector< double > &rmax)
double volume() const override
void stream(std::ostream &) const override