CMS 3D CMS Logo

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

#include <Trap.h>

Inheritance diagram for DDI::Trap:
DDI::Solid

Public Member Functions

void stream (std::ostream &) const override
 
 Trap (double pDz, double pTheta, double pPhi, double pDy1, double pDx1, double pDx2, double pAlp1, double pDy2, double pDx3, double pDx4, double pAlp2)
 
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 9 of file Trap.h.

Constructor & Destructor Documentation

◆ Trap()

DDI::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 at line 13 of file Trap.cc.

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 }

References ddtrap, and DDI::Solid::p_.

Member Function Documentation

◆ stream()

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

Reimplemented from DDI::Solid.

Definition at line 38 of file Trap.cc.

38  {
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 }

References geant_units::operators::convertMmToCm(), and angle_units::operators::convertRadToDeg().

◆ volume()

double DDI::Trap::volume ( void  ) const
overridevirtual

Reimplemented from DDI::Solid.

Definition at line 45 of file Trap.cc.

45  {
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 }

References PVValHelper::dz.

DDSolidShape::ddtrap
angle_units::operators::convertRadToDeg
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
DDI::Trap::volume
double volume() const override
Definition: Trap.cc:45
DDI::Solid::Solid
Solid()
Definition: Solid.h:12
PVValHelper::dz
Definition: PVValidationHelpers.h:51
geant_units::operators::convertMmToCm
constexpr NumType convertMmToCm(NumType millimeters)
Definition: GeantUnits.h:63
DDI::Solid::p_
std::vector< double > p_
Definition: Solid.h:30