15 Polycone::Polycone (
double startPhi,
double deltaPhi,
16 const std::vector<double> & z,
17 const std::vector<double> & rmin,
18 const std::vector<double> & rmax)
21 p_.emplace_back(startPhi);
22 p_.emplace_back(deltaPhi);
23 if((z.size()!=rmin.size()) || (z.size()!=rmax.size()) )
26 <<
"Polycone(..): std::vectors z,rmin,rmax not of same length";
30 for(
unsigned int i=0;
i<z.size(); ++
i)
32 p_.emplace_back(z[
i]);
33 p_.emplace_back(rmin[i]);
34 p_.emplace_back(rmax[i]);
41 const std::vector<double> & z,
42 const std::vector<double> &
r)
45 p_.emplace_back(startPhi);
46 p_.emplace_back(deltaPhi);
47 if(z.size()!=r.size())
50 <<
"Polycone(..): std::vectors z,rmin,rmax not of same length";
54 for(
unsigned int i = 0;
i < z.size(); ++
i )
56 p_.emplace_back(z[
i]);
57 p_.emplace_back(r[i]);
67 unsigned int loop = (
p_.size()-2)/3 -1;
71 for (
unsigned int j=2; j<(loop+2); ++j) {
72 double dz= std::fabs(
p_[i]-
p_[i+3]);
73 double v_min = dz * 1_pi/3. *(
p_[i+1]*
p_[i+1] +
p_[i+4]*
p_[i+4]
75 double v_max = dz * 1_pi/3. *(
p_[i+2]*
p_[i+2] +
p_[i+5]*
p_[i+5]
77 double s = v_max - v_min;
82 result = sec * std::fabs(
p_[1])/2._pi;
89 double phiTo=
p_[0]+
p_[1];
90 double slice=(std::fabs(phiFrom-phiTo))/2_pi;
98 while(i<(p_.size()-2))
107 double volume1=(rEnd*rEnd+rBegin*rBegin+rBegin*rEnd)*z/3;
108 volume=volume+volume1;
120 double volume2=(rEnd*rEnd+rBegin*rBegin+rBegin*rEnd)*z/3;
121 volume=volume+volume2;
122 volume=std::fabs(slice*1_pi*volume);
133 for (
unsigned k=2;
k<
p_.size(); ++
k)
constexpr NumType convertRadToDeg(NumType radians)
void stream(std::ostream &) const override
Polycone(double startPhi, double deltaPhi, const std::vector< double > &z, const std::vector< double > &rmin, const std::vector< double > &rmax)
double volume() const override
constexpr NumType convertMmToCm(NumType millimeters)