6 #include "CLHEP/Units/GlobalPhysicalConstants.h" 7 #include "CLHEP/Units/GlobalSystemOfUnits.h" 8 #include "CLHEP/Units/SystemOfUnits.h" 16 Polycone::Polycone (
double startPhi,
double deltaPhi,
17 const std::vector<double> &
z,
18 const std::vector<double> & rmin,
21 p_.emplace_back(startPhi);
22 p_.emplace_back(deltaPhi);
23 if((z.size()!=rmin.size()) || (z.size()!=rmax.size()) )
25 throw cms::Exception(
"DDException") <<
"Polycone(..): std::vectors z,rmin,rmax not of same length";
29 for(
unsigned int i=0;
i<z.size(); ++
i)
31 p_.emplace_back(z[
i]);
32 p_.emplace_back(rmin[i]);
33 p_.emplace_back(rmax[i]);
40 const std::vector<double> & z,
43 p_.emplace_back(startPhi);
44 p_.emplace_back(deltaPhi);
45 if(z.size()!=r.size())
47 throw cms::Exception(
"DDException") <<
"Polycone(..): std::vectors z,rmin,rmax not of same length";
51 for(
unsigned int i = 0;
i < z.size(); ++
i )
53 p_.emplace_back(z[
i]);
54 p_.emplace_back(r[i]);
64 unsigned int loop = (
p_.size()-2)/3 -1;
68 for (
unsigned int j=2; j<(loop+2); ++j) {
69 double dz= std::fabs(
p_[i]-
p_[i+3]);
70 double v_min = dz *
pi/3. *(
p_[i+1]*
p_[i+1] +
p_[i+4]*
p_[i+4]
72 double v_max = dz *
pi/3. *(
p_[i+2]*
p_[i+2] +
p_[i+5]*
p_[i+5]
74 double s = v_max - v_min;
79 result = sec * std::fabs(
p_[1])/rad/(2.*
pi);
85 double phiFrom=
p_[0]/rad;
86 double phiTo=(
p_[0]+
p_[1])/rad;
87 double slice=(std::fabs(phiFrom-phiTo))/(2*
pi);
95 while(i<(
p_.size()-2))
104 double volume1=(rEnd*rEnd+rBegin*rBegin+rBegin*rEnd)*z/3;
105 volume=volume+volume1;
117 double volume2=(rEnd*rEnd+rBegin*rBegin+rBegin*rEnd)*z/3;
118 volume=volume+volume2;
119 volume=std::fabs(slice*
pi*volume);
127 os <<
" startPhi[deg]=" <<
p_[0]/deg
128 <<
" dPhi[deg]=" <<
p_[1]/deg
130 for (
unsigned k=2;
k<
p_.size(); ++
k)
131 os <<
p_[
k]/cm <<
" ";
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