CMS 3D CMS Logo

List of all members | Public Member Functions
DDI::Polycone Class Reference

#include <Polycone.h>

Inheritance diagram for DDI::Polycone:
DDI::Solid

Public Member Functions

 Polycone (double startPhi, double deltaPhi, const std::vector< double > &z, const std::vector< double > &rmin, const std::vector< double > &rmax)
 
 Polycone (double startPhi, double deltaPhi, const std::vector< double > &z, const std::vector< double > &r)
 
void stream (std::ostream &) const override
 
double volume () const override
 
- Public Member Functions inherited from DDI::Solid
const std::vector< double > & parameters () const
 
void setParameters (std::vector< double > const &p)
 
DDSolidShape shape () const
 
 Solid ()
 
 Solid (DDSolidShape shape)
 
virtual ~Solid ()
 

Additional Inherited Members

- Protected Attributes inherited from DDI::Solid
std::vector< double > p_
 
DDSolidShape shape_
 

Detailed Description

Definition at line 11 of file Polycone.h.

Constructor & Destructor Documentation

◆ Polycone() [1/2]

Polycone::Polycone ( double  startPhi,
double  deltaPhi,
const std::vector< double > &  z,
const std::vector< double > &  rmin,
const std::vector< double > &  rmax 
)

Definition at line 15 of file Polycone.cc.

References ddpolycone_rrz, SiPixelRawToDigiRegional_cfi::deltaPhi, Exception, mps_fire::i, and DDI::Solid::p_.

21  p_.emplace_back(startPhi);
22  p_.emplace_back(deltaPhi);
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";
25  } else {
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]);
30  }
31  }
32 }
Solid()
Definition: Solid.h:12
std::vector< double > p_
Definition: Solid.h:30

◆ Polycone() [2/2]

Polycone::Polycone ( double  startPhi,
double  deltaPhi,
const std::vector< double > &  z,
const std::vector< double > &  r 
)

Definition at line 34 of file Polycone.cc.

References ddpolycone_rz, SiPixelRawToDigiRegional_cfi::deltaPhi, Exception, mps_fire::i, and DDI::Solid::p_.

36  p_.emplace_back(startPhi);
37  p_.emplace_back(deltaPhi);
38  if (z.size() != r.size()) {
39  throw cms::Exception("DDException") << "Polycone(..): std::vectors z,rmin,rmax not of same length";
40  } else {
41  for (unsigned int i = 0; i < z.size(); ++i) {
42  p_.emplace_back(z[i]);
43  p_.emplace_back(r[i]);
44  }
45  }
46 }
Solid()
Definition: Solid.h:12
std::vector< double > p_
Definition: Solid.h:30

Member Function Documentation

◆ stream()

void DDI::Polycone::stream ( std::ostream &  os) const
overridevirtual

Reimplemented from DDI::Solid.

Definition at line 108 of file Polycone.cc.

References angle_units::operators::convertMmToCm(), angle_units::operators::convertRadToDeg(), and dqmdumpme::k.

108  {
109  os << " startPhi[deg]=" << convertRadToDeg(p_[0]) << " dPhi[deg]=" << convertRadToDeg(p_[1]) << " Sizes[cm]=";
110  for (unsigned k = 2; k < p_.size(); ++k)
111  os << convertMmToCm(p_[k]) << " ";
112 }
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
constexpr NumType convertMmToCm(NumType millimeters)
Definition: angle_units.h:44
std::vector< double > p_
Definition: Solid.h:30

◆ volume()

double Polycone::volume ( void  ) const
overridevirtual

Reimplemented from DDI::Solid.

Definition at line 48 of file Polycone.cc.

References cms::cuda::assert(), ddpolycone_rrz, ddpolycone_rz, PVValHelper::dz, mps_fire::i, dqmiolumiharvest::j, heppy_loop::loop, DDI::Solid::p_, mps_fire::result, alignCSCRings::s, fileinputsource_cfi::sec, DDI::Solid::shape_, and mergeAndRegister::slice.

48  {
49  double result = -1.;
51  unsigned int loop = (p_.size() - 2) / 3 - 1;
52  assert(loop > 0);
53  double sec = 0;
54  int i = 2;
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;
60  //assert(s>=0);
61  sec += s;
62  i += 3;
63  }
64  result = sec * std::fabs(p_[1]) / 2._pi;
65  }
66 
68  double volume = 0;
69  double phiFrom = p_[0];
70  double phiTo = p_[0] + p_[1];
71  double slice = (std::fabs(phiFrom - phiTo)) / 2_pi;
72  double zBegin = 0;
73  double zEnd = 0;
74  double rBegin = 0;
75  double rEnd = 0;
76  double z = 0;
77  unsigned int i = 2;
78 
79  while (i < (p_.size() - 2)) {
80  zBegin = p_[i];
81  zEnd = p_[i + 2];
82  rBegin = p_[i + 1];
83  rEnd = p_[i + 3];
84  z = zBegin - zEnd;
85 
86  /* for calculation of volume1 look at calculation of DDConsImpl of a volume1. Furthermore z can be smaller than zero. This makes sense since volumes we have to substract */
87  double volume1 = (rEnd * rEnd + rBegin * rBegin + rBegin * rEnd) * z / 3;
88  volume = volume + volume1;
89  i = i + 2;
90  }
91 
92  /* last line (goes from last z/r value to first */
93  i = p_.size() - 2;
94  zBegin = p_[i];
95  zEnd = p_[2];
96  rBegin = p_[i + 1];
97  rEnd = p_[3];
98  z = zBegin - zEnd;
99 
100  double volume2 = (rEnd * rEnd + rBegin * rBegin + rBegin * rEnd) * z / 3;
101  volume = volume + volume2;
102  volume = std::fabs(slice * 1_pi * volume);
103  result = volume;
104  }
105  return result;
106 }
DDSolidShape shape_
Definition: Solid.h:29
assert(be >=bs)
double volume() const override
Definition: Polycone.cc:48
std::vector< double > p_
Definition: Solid.h:30