CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
 
double volume () const
 
- 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::Polycone ( double  startPhi,
double  deltaPhi,
const std::vector< double > &  z,
const std::vector< double > &  rmin,
const std::vector< double > &  rmax 
)

Definition at line 16 of file Polycone.cc.

References Exception, i, and DDI::Solid::p_.

20 {
21  p_.push_back(startPhi);
22  p_.push_back(deltaPhi);
23  if((z.size()!=rmin.size()) || (z.size()!=rmax.size()) )
24  {
25  throw cms::Exception("DDException") << "Polycone(..): std::vectors z,rmin,rmax not of same length";
26  }
27  else
28  {
29  for(unsigned int i=0;i<z.size(); ++i)
30  {
31  p_.push_back(z[i]);
32  p_.push_back(rmin[i]);
33  p_.push_back(rmax[i]);
34  }
35  }
36 }
int i
Definition: DBlmapReader.cc:9
float float float z
Solid()
Definition: Solid.h:14
std::vector< double > p_
Definition: Solid.h:32
Polycone::Polycone ( double  startPhi,
double  deltaPhi,
const std::vector< double > &  z,
const std::vector< double > &  r 
)

Definition at line 39 of file Polycone.cc.

References Exception, i, and DDI::Solid::p_.

41  : Solid (ddpolycone_rz)
42 {
43  p_.push_back(startPhi);
44  p_.push_back(deltaPhi);
45  if(z.size()!=r.size())
46  {
47  throw cms::Exception("DDException") << "Polycone(..): std::vectors z,rmin,rmax not of same length";
48  }
49  else
50  {
51  for( unsigned int i = 0; i < z.size(); ++i )
52  {
53  p_.push_back(z[i]);
54  p_.push_back(r[i]);
55  }
56  }
57 }
int i
Definition: DBlmapReader.cc:9
float float float z
Solid()
Definition: Solid.h:14
std::vector< double > p_
Definition: Solid.h:32

Member Function Documentation

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

Reimplemented from DDI::Solid.

Definition at line 125 of file Polycone.cc.

References relval_2017::k.

126 {
127  os << " startPhi[deg]=" << p_[0]/deg
128  << " dPhi[deg]=" << p_[1]/deg
129  << " Sizes[cm]=";
130  for (unsigned k=2; k<p_.size(); ++k)
131  os << p_[k]/cm << " ";
132 }
std::vector< double > p_
Definition: Solid.h:32
double Polycone::volume ( void  ) const
virtual

Reimplemented from DDI::Solid.

Definition at line 59 of file Polycone.cc.

References assert(), ddpolycone_rrz, ddpolycone_rz, i, j, cmsHarvester::loop, DDI::Solid::p_, pi, mps_fire::result, alignCSCRings::s, and DDI::Solid::shape_.

60 {
61  double result = -1.;
62  if (shape_==ddpolycone_rrz)
63  {
64  unsigned int loop = (p_.size()-2)/3 -1;
65  assert(loop>0);
66  double sec=0;
67  int i=2;
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]
71  + p_[i+1]*p_[i+4] );
72  double v_max = dz * pi/3. *( p_[i+2]*p_[i+2] + p_[i+5]*p_[i+5]
73  + p_[i+2]*p_[i+5] );
74  double s = v_max - v_min;
75  //assert(s>=0);
76  sec += s;
77  i += 3;
78  }
79  result = sec * std::fabs(p_[1])/rad/(2.*pi);
80  }
81 
82  if (shape_==ddpolycone_rz)
83  {
84  double volume=0;
85  double phiFrom=p_[0]/rad;
86  double phiTo=(p_[0]+p_[1])/rad;
87  double slice=(std::fabs(phiFrom-phiTo))/(2*pi);
88  double zBegin=0;
89  double zEnd=0;
90  double rBegin=0;
91  double rEnd=0;
92  double z=0;
93  unsigned int i=2;
94 
95  while(i<(p_.size()-2))
96  {
97  zBegin=p_[i];
98  zEnd=p_[i+2];
99  rBegin=p_[i+1];
100  rEnd=p_[i+3];
101  z=zBegin-zEnd;
102 
103  /* 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 */
104  double volume1=(rEnd*rEnd+rBegin*rBegin+rBegin*rEnd)*z/3;
105  volume=volume+volume1;
106  i=i+2;
107  }
108 
109  /* last line (goes from last z/r value to first */
110  i=p_.size()-2;
111  zBegin=p_[i];
112  zEnd=p_[2];
113  rBegin=p_[i+1];
114  rEnd=p_[3];
115  z=zBegin-zEnd;
116 
117  double volume2=(rEnd*rEnd+rBegin*rBegin+rBegin*rEnd)*z/3;
118  volume=volume+volume2;
119  volume=std::fabs(slice*pi*volume);
120  result = volume;
121  }
122  return result;
123 }
int i
Definition: DBlmapReader.cc:9
double volume() const
Definition: Polycone.cc:59
DDSolidShape shape_
Definition: Solid.h:31
assert(m_qm.get())
int loop
CMSSW
float float float z
tuple result
Definition: mps_fire.py:84
const Double_t pi
int j
Definition: DBlmapReader.cc:9
std::vector< double > p_
Definition: Solid.h:32