CMS 3D CMS Logo

Trap.cc
Go to the documentation of this file.
3 
4 #include <cmath>
5 #include <vector>
6 
9 
10 using std::sqrt;
11 using namespace geant_units::operators;
12 
13 DDI::Trap::Trap(double pDz,
14  double pTheta,
15  double pPhi,
16  double pDy1,
17  double pDx1,
18  double pDx2,
19  double pAlp1,
20  double pDy2,
21  double pDx3,
22  double pDx4,
23  double pAlp2)
25  p_.emplace_back(pDz); // ......... 0
26  p_.emplace_back(pTheta); // .. 1
27  p_.emplace_back(pPhi); // ....... 2
28  p_.emplace_back(pDy1); // ........ 3
29  p_.emplace_back(pDx1); // ........ 4
30  p_.emplace_back(pDx2); // ........ 5
31  p_.emplace_back(pAlp1); // ....... 6
32  p_.emplace_back(pDy2); // ........ 7
33  p_.emplace_back(pDx3); // ......... 8
34  p_.emplace_back(pDx4); // ........ 9
35  p_.emplace_back(pAlp2);
36 }
37 
38 void DDI::Trap::stream(std::ostream& os) const {
39  os << " dz=" << convertMmToCm(p_[0]) << " theta=" << convertRadToDeg(p_[1]) << " phi=" << convertRadToDeg(p_[2])
40  << " dy1=" << convertMmToCm(p_[3]) << " dx1=" << convertMmToCm(p_[4]) << " dx2=" << convertMmToCm(p_[5])
41  << " alpha1=" << convertRadToDeg(p_[6]) << " dy2=" << convertMmToCm(p_[7]) << " dx3=" << convertMmToCm(p_[8])
42  << " dx4=" << convertMmToCm(p_[9]) << " alpha2=" << convertRadToDeg(p_[10]);
43 }
44 
45 double DDI::Trap::volume() const {
46  double volume = 0;
47 
48  double dz = p_[0] * 2.;
49  double dy1 = p_[3] * 2.;
50  double dx1 = p_[4] * 2.;
51  double dx2 = p_[5] * 2.;
52  double dy2 = p_[7] * 2.;
53  double dx3 = p_[8] * 2.;
54  double dx4 = p_[9] * 2.;
55 
56  volume = ((dx1 + dx2 + dx3 + dx4) * (dy1 + dy2) + (dx4 + dx3 - dx2 - dx1) * (dy2 - dy1) / 3) * dz * 0.125;
57 
58  return volume;
59 }
DDSolidShapes.h
DDSolidShape
DDSolidShape
Definition: DDSolidShapes.h:6
DDSolidShape::ddtrap
angle_units::operators::convertRadToDeg
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
Trap.h
DDI::Trap::volume
double volume() const override
Definition: Trap.cc:45
geant_units::operators
Definition: GeantUnits.h:18
Solid.h
DDI::Trap::Trap
Trap(double pDz, double pTheta, double pPhi, double pDy1, double pDx1, double pDx2, double pAlp1, double pDy2, double pDx3, double pDx4, double pAlp2)
Definition: Trap.cc:13
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
GeantUnits.h
DDI::Solid
Definition: Solid.h:10
DDI::Trap::stream
void stream(std::ostream &) const override
Definition: Trap.cc:38
PVValHelper::dz
Definition: PVValidationHelpers.h:50
geant_units::operators::convertMmToCm
constexpr NumType convertMmToCm(NumType millimeters)
Definition: GeantUnits.h:62
DDI::Solid::p_
std::vector< double > p_
Definition: Solid.h:30