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 *
CONVERT_TO( std::fabs(
p_[1]), rad )/2._pi;
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)
#define CONVERT_TO(_x, _y)
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 long double _pi(M_PI)