Garfield 0.3
Toolkit for the detailed simulation of particle detectors based on ionization measurement in gases and semiconductors
Loading...
Searching...
No Matches
SolidTube.hh
Go to the documentation of this file.
1#ifndef G_SOLID_TUBE_H
2#define G_SOLID_TUBE_H
3
4#include <array>
5#include <mutex>
6
7#include "Garfield/Solid.hh"
8
9namespace Garfield {
10
12
13class SolidTube : public Solid {
14 public:
16 SolidTube(const double cx, const double cy, const double cz, const double r,
17 const double lz);
19 SolidTube(const double cx, const double cy, const double cz, const double r,
20 const double lz, const double dx, const double dy, const double dz);
22 SolidTube(const double cx, const double cy, const double cz, const double ri,
23 const double ro, const double lz);
26 SolidTube(const double cx, const double cy, const double cz, const double ri,
27 const double ro, const double lz, const double dx, const double dy,
28 const double dz);
31
32 bool IsInside(const double x, const double y, const double z,
33 const bool tesselated) const override;
34 bool GetBoundingBox(double& xmin, double& ymin, double& zmin, double& xmax,
35 double& ymax, double& zmax) const override;
36 bool IsTube() const override { return true; }
37
39 void SetHalfLength(const double lz);
41 void SetRadius(const double r);
43 double GetHalfLengthZ() const override { return m_lZ; }
45 double GetRadius() const override { return m_rO; }
47 double GetOuterRadius() const override { return m_rO; }
49 double GetInnerRadius() const override { return m_rI; }
50
55 void SetSectors(const unsigned int n);
59 void SetRotation(const double angle) { m_rot = angle; }
65 void SetAverageRadius(const bool average) { m_average = average; }
67 void SetTopLid(const bool closed) { m_toplid = closed; }
69 void SetBottomLid(const bool closed) { m_botlid = closed; }
70
72 unsigned int GetSectors() const { return m_n; }
74 double GetRotation() const { return m_rot; }
76 bool GetAverage() const { return m_average; }
77
78 bool SolidPanels(std::vector<Panel>& panels) override;
79 void SetDiscretisationLevel(const double dis) override { m_dis.fill(dis); }
80 double GetDiscretisationLevel(const Panel& panel) override;
81
82 void Cut(const double x0, const double y0, const double z0, const double xn,
83 const double yn, const double zn,
84 std::vector<Panel>& panels) override;
85
86 private:
88 std::mutex m_mutex;
89
91 double m_rO;
93 double m_rI = 0.;
95 double m_lZ;
96
98 double m_rot = 0.;
100 unsigned int m_n = 2;
102 bool m_average = false;
104 double m_rpO;
106 double m_rpI = 0.;
108 double m_riO;
110 double m_riI = 0.;
112 std::vector<double> m_xpO;
114 std::vector<double> m_ypO;
116 std::vector<double> m_xpI;
118 std::vector<double> m_ypI;
119
121 bool m_toplid = true;
123 bool m_botlid = true;
124
126 std::array<double, 3> m_dis{{-1., -1., -1.}};
127
129};
130} // namespace Garfield
131
132#endif
bool SolidPanels(std::vector< Panel > &panels) override
Retrieve the surface panels of the solid.
void SetBottomLid(const bool closed)
Request the cylinder to be closed with a (polygonal) lid at -z.
Definition SolidTube.hh:69
unsigned int GetSectors() const
Return the number of sectors.
Definition SolidTube.hh:72
double GetDiscretisationLevel(const Panel &panel) override
Retrieve the discretisation level of a panel.
std::array< double, 3 > m_dis
Discretisation levels.
Definition SolidTube.hh:126
bool m_toplid
Have a top lid?
Definition SolidTube.hh:121
double m_rO
Outer radius.
Definition SolidTube.hh:91
std::vector< double > m_xpI
X-coordinates of the inner approximating polygon.
Definition SolidTube.hh:116
double m_rpO
Radius of the outer approximating polygon.
Definition SolidTube.hh:104
std::vector< double > m_xpO
X-coordinates of the outer approximating polygon.
Definition SolidTube.hh:112
bool IsTube() const override
Return true if the solid is a tube.
Definition SolidTube.hh:36
bool m_botlid
Have a bottom lid?
Definition SolidTube.hh:123
unsigned int m_n
Number of sectors.
Definition SolidTube.hh:100
void SetSectors(const unsigned int n)
When calculating the surface panels, the cylinder is approximated as a polygon with a finite number o...
double m_rI
Inner radius.
Definition SolidTube.hh:93
~SolidTube()
Destructor.
Definition SolidTube.hh:30
SolidTube(const double cx, const double cy, const double cz, const double r, const double lz)
Constructor from centre, outer radius, and half-length.
std::vector< double > m_ypO
Y-coordinates of the outer approximating polygon.
Definition SolidTube.hh:114
double m_riI
Inradius of the inner approximating polygon.
Definition SolidTube.hh:110
double GetHalfLengthZ() const override
Retrieve the half-length of the tube.
Definition SolidTube.hh:43
double m_lZ
Half-length.
Definition SolidTube.hh:95
void SetHalfLength(const double lz)
Set the half-length of the tube.
void SetAverageRadius(const bool average)
By default, the polygon used for approximating the cylinder when calculating surface panels is inscri...
Definition SolidTube.hh:65
void SetRadius(const double r)
Set the outer radius.
double GetRotation() const
Return the current rotation angle.
Definition SolidTube.hh:74
double m_rot
Rotation angle.
Definition SolidTube.hh:98
double GetOuterRadius() const override
Retrieve the outer radius.
Definition SolidTube.hh:47
std::vector< double > m_ypI
Y-coordinates of the inner approximating polygon.
Definition SolidTube.hh:118
bool m_average
Average chord over the sectors.
Definition SolidTube.hh:102
void Cut(const double x0, const double y0, const double z0, const double xn, const double yn, const double zn, std::vector< Panel > &panels) override
double GetInnerRadius() const override
Retrieve the inner radius.
Definition SolidTube.hh:49
SolidTube(const double cx, const double cy, const double cz, const double ri, const double ro, const double lz)
Constructor from centre, inner radius, outer radius, and half-length.
void SetRotation(const double angle)
Specify a rotation angle (radian) of the cylinder.
Definition SolidTube.hh:59
bool GetAverage() const
Return the status of the "average-radius" flag.
Definition SolidTube.hh:76
std::mutex m_mutex
Mutex.
Definition SolidTube.hh:88
bool IsInside(const double x, const double y, const double z, const bool tesselated) const override
Check whether a given point is inside the solid.
void SetTopLid(const bool closed)
Request the cylinder to be closed with a (polygonal) lid at +z.
Definition SolidTube.hh:67
double GetRadius() const override
Retrieve the outer radius.
Definition SolidTube.hh:45
SolidTube(const double cx, const double cy, const double cz, const double ri, const double ro, const double lz, const double dx, const double dy, const double dz)
Constructor from centre, inner radius, outer radius, half-length and orientation.
double m_rpI
Radius of the inner approximating polygon.
Definition SolidTube.hh:106
SolidTube(const double cx, const double cy, const double cz, const double r, const double lz, const double dx, const double dy, const double dz)
Constructor from centre, outer radius, half-length and orientation.
double m_riO
Inradius of the outer approximating polygon.
Definition SolidTube.hh:108
bool GetBoundingBox(double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) const override
Return the bounding box of the solid.
void SetDiscretisationLevel(const double dis) override
Set the discretisation level (for all panels).
Definition SolidTube.hh:79
Solid()=delete
Default constructor.
Surface panel.
Definition Solid.hh:11