15 Polycone::Polycone(
double startPhi,
17 const std::vector<double>& z,
18 const std::vector<double>& rmin,
19 const std::vector<double>& rmax)
21 p_.emplace_back(startPhi);
23 if ((z.size() != rmin.size()) || (z.size() != rmax.size())) {
24 throw cms::Exception(
"DDException") <<
"Polycone(..): std::vectors z,rmin,rmax not of same length";
26 for (
unsigned int i = 0;
i < z.size(); ++
i) {
27 p_.emplace_back(z[
i]);
28 p_.emplace_back(rmin[
i]);
29 p_.emplace_back(rmax[
i]);
36 p_.emplace_back(startPhi);
38 if (z.size() !=
r.size()) {
39 throw cms::Exception(
"DDException") <<
"Polycone(..): std::vectors z,rmin,rmax not of same length";
41 for (
unsigned int i = 0;
i < z.size(); ++
i) {
42 p_.emplace_back(z[
i]);
43 p_.emplace_back(
r[
i]);
51 unsigned int loop = (
p_.size() - 2) / 3 - 1;
55 for (
unsigned int j = 2;
j < (
loop + 2); ++
j) {
56 double dz = std::fabs(
p_[
i] -
p_[
i + 3]);
57 double v_min =
dz * 1_pi / 3. * (
p_[
i + 1] *
p_[
i + 1] +
p_[
i + 4] *
p_[
i + 4] +
p_[
i + 1] *
p_[
i + 4]);
58 double v_max =
dz * 1_pi / 3. * (
p_[
i + 2] *
p_[
i + 2] +
p_[
i + 5] *
p_[
i + 5] +
p_[
i + 2] *
p_[
i + 5]);
59 double s = v_max - v_min;
69 double phiFrom =
p_[0];
70 double phiTo =
p_[0] +
p_[1];
71 double slice = (std::fabs(phiFrom - phiTo)) / 2_pi;
79 while (
i < (
p_.size() - 2)) {
87 double volume1 = (rEnd * rEnd + rBegin * rBegin + rBegin * rEnd) * z / 3;
100 double volume2 = (rEnd * rEnd + rBegin * rBegin + rBegin * rEnd) * z / 3;
110 for (
unsigned k = 2;
k < p_.size(); ++
k)
constexpr NumType convertRadToDeg(NumType radians)
Polycone(double startPhi, double deltaPhi, const std::vector< double > &z, const std::vector< double > &rmin, const std::vector< double > &rmax)
constexpr NumType convertMmToCm(NumType millimeters)
void stream(std::ostream &) const override
double volume() const override