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::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 ddpolycone_rrz, Exception, mps_fire::i, and DDI::Solid::p_.

20 {
21  p_.emplace_back(startPhi);
22  p_.emplace_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_.emplace_back(z[i]);
32  p_.emplace_back(rmin[i]);
33  p_.emplace_back(rmax[i]);
34  }
35  }
36 }
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 ddpolycone_rz, Exception, mps_fire::i, and DDI::Solid::p_.

42 {
43  p_.emplace_back(startPhi);
44  p_.emplace_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_.emplace_back(z[i]);
54  p_.emplace_back(r[i]);
55  }
56  }
57 }
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
overridevirtual

Reimplemented from DDI::Solid.

Definition at line 125 of file Polycone.cc.

References gen::k, and DDI::Solid::p_.

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 }
int k[5][pyjets_maxn]
std::vector< double > p_
Definition: Solid.h:32
double Polycone::volume ( void  ) const
overridevirtual

Reimplemented from DDI::Solid.

Definition at line 59 of file Polycone.cc.

References ddpolycone_rrz, ddpolycone_rz, PVValHelper::dz, mps_fire::i, heppy_loop::loop, DDI::Solid::p_, pi, mps_fire::result, alignCSCRings::s, and DDI::Solid::shape_.

60 {
61  double result = -1.;
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 
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 }
DDSolidShape shape_
Definition: Solid.h:31
float float float z
const Double_t pi
double volume() const override
Definition: Polycone.cc:59
std::vector< double > p_
Definition: Solid.h:32