CMS 3D CMS Logo

ExtrudedPolygon.cc
Go to the documentation of this file.
2 
3 #include "CLHEP/Units/GlobalSystemOfUnits.h"
4 #include "CLHEP/Units/SystemOfUnits.h"
9 
10 #include <cassert>
11 
13 
14 ExtrudedPolygon::ExtrudedPolygon( const std::vector<double> & x,
15  const std::vector<double> & y,
16  const std::vector<double> & z,
17  const std::vector<double> & zx,
18  const std::vector<double> & zy,
19  const std::vector<double> & zscale) : Solid( ddextrudedpolygon )
20 {
21  assert( x.size() == y.size());
22  assert( z.size() == zx.size());
23  assert( z.size() == zy.size());
24  assert( z.size() == zscale.size());
25 
26  p_.reserve( x.size() + y.size() + z.size() + zx.size() + zy.size() + zscale.size() + 1 );
27  p_.emplace_back( z.size());
28  p_.insert( p_.end(), x.begin(), x.end());
29  p_.insert( p_.end(), y.begin(), y.end());
30  p_.insert( p_.end(), z.begin(), z.end());
31  p_.insert( p_.end(), zx.begin(), zx.end());
32  p_.insert( p_.end(), zy.begin(), zy.end());
33  p_.insert( p_.end(), zscale.begin(), zscale.end());
34 }
35 
37 {
38  double volume = 0;
39  /* FIXME: volume is not implemented */
40  return volume;
41 }
42 
43 void
44 DDI::ExtrudedPolygon::stream( std::ostream & os ) const
45 {
46  auto xysize = ( unsigned int )(( p_.size() - 4*p_[0]) * 0.5 );
47  os << " XY Points[cm]=";
48  for( unsigned int k = 1; k <= xysize; ++k )
49  os << p_[k]/cm << ", " << p_[k + xysize]/cm << "; ";
50  os << " with " << p_[0] << " Z sections:";
51  unsigned int m0 = p_.size() - 4*p_[0];
52  for( unsigned int m = m0; m < m0 + p_[0]; ++m )
53  {
54  os << " z[cm]=" << p_[m]/cm;
55  os << ", x[cm]=" << p_[m+p_[0]]/cm;
56  os << ", y[cm]=" << p_[m+2*p_[0]]/cm;
57  os << ", scale[cm]=" << p_[m+3*p_[0]]/cm << ";";
58  }
59 }
float float float z
double volume() const override
T x() const
Cartesian x coordinate.
int k[5][pyjets_maxn]
std::vector< double > p_
Definition: Solid.h:32
void stream(std::ostream &) const override