Garfield++ 3.0
A toolkit for the detailed simulation of particle detectors based on ionisation 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 "Solid.hh"
5
6namespace Garfield {
7
8/// Cylindrical tube.
9
10class SolidTube : public Solid {
11 public:
12 /// Constructor from centre, inner/outer radii, and half-length.
13 SolidTube(const double cx, const double cy, const double cz,
14 const double rmin, const double rmax, const double lz);
15 /// Constructor from centre, outer radius, and half-length.
16 SolidTube(const double cx, const double cy, const double cz, const double r,
17 const double lz);
18 /// Constructor from centre, inner/outer radii, half-length and orientation.
19 SolidTube(const double cx, const double cy, const double cz,
20 const double rmin, const double rmax, const double lz,
21 const double dx, const double dy, const double dz);
22 /// Constructor from centre, outer radius, half-length and orientation.
23 SolidTube(const double cx, const double cy, const double cz, const double r,
24 const double lz, const double dx, const double dy, const double dz);
25 /// Destructor
27
28 bool IsInside(const double x, const double y, const double z) const override;
29 bool GetBoundingBox(double& xmin, double& ymin, double& zmin, double& xmax,
30 double& ymax, double& zmax) const override;
31 bool IsTube() const override { return true; }
32
33 void SetHalfLength(const double lz);
34 void SetInnerRadius(const double rmin);
35 void SetOuterRadius(const double rmax);
36 void SetRadius(const double r);
37
38 double GetHalfLengthZ() const override { return m_lZ; }
39 double GetInnerRadius() const override { return m_rMin; }
40 double GetOuterRadius() const override { return m_rMax; }
41 double GetRadius() const override { return m_r; }
42
43 /// When calculating the surface panels, the cylinder is
44 /// approximated as a polygon with a finite number of panels.
45 /// The number of corners of the polygon equals \f$4(n - 1)\f$.
46 /// Thus, \f$n = 2\f$ will produce a square, \f$n = 3\f$ an octagon etc.
47 void SetSectors(const unsigned int n);
48 /// Specify a rotation angle (radian) of the cylinder.
49 /// Such a rotation is meaningful only if the number of sectors
50 /// (when approximating the circle with a polygon) has been chosen small.
51 void SetRotation(const double angle) { m_rot = angle; }
52 /// By default, the polygon used for approximating the cylinder when
53 /// calculating surface panels is inscribed in a circle
54 /// of the specified radius. If the "average-radius" flag is activated,
55 /// then the radius will be interpreted as the mean radius of the polygon
56 /// that approximates the cylinder.
57 void SetAverageRadius(const bool average) { m_average = average; }
58 /// Request the cylinder to be closed with a (polygonal) lid at +z.
59 void SetToplid(const bool toplid) { m_toplid = toplid; }
60 /// Request the cylinder to be closed with a (polygonal) lid at -z.
61 void SetBottomlid(const bool bottomlid) { m_bottomlid = bottomlid; }
62
63 unsigned int GetSectors() const { return m_n; }
64 double GetRotation() const { return m_rot; }
65 bool GetAverage() const { return m_average; }
66
67 bool SolidPanels(std::vector<Panel>& panels) override;
68 double GetDiscretisationLevel(const Panel& panel) override;
69
70 private:
71 // Inner and outer radius
72 double m_rMin, m_rMax;
73 double m_r;
74 /// Half-length
75 double m_lZ;
76
77 /// Rotation angle
78 double m_rot = 0.;
79 /// Number of sectors
80 unsigned int m_n = 2;
81 /// Average chord over the sectors.
82 bool m_average = false;
83 /// Have a top lid?
84 bool m_toplid = true;
85 /// Have a bottom lid?
86 bool m_bottomlid = true;
87
88 /// Discretisation levels.
89 std::array<double, 3> m_dis{{-1.,-1.,-1.}};
90};
91}
92
93#endif
Cylindrical tube.
Definition: SolidTube.hh:10
bool SolidPanels(std::vector< Panel > &panels) override
Retrieve the surface panels of the solid.
Definition: SolidTube.cc:134
void SetInnerRadius(const double rmin)
Definition: SolidTube.cc:84
void SetToplid(const bool toplid)
Request the cylinder to be closed with a (polygonal) lid at +z.
Definition: SolidTube.hh:59
unsigned int GetSectors() const
Definition: SolidTube.hh:63
double GetDiscretisationLevel(const Panel &panel) override
Retrieve the discretization level of a panel.
Definition: SolidTube.cc:260
void SetOuterRadius(const double rmax)
Definition: SolidTube.cc:97
bool IsTube() const override
Return true if the solid is a tube.
Definition: SolidTube.hh:31
void SetBottomlid(const bool bottomlid)
Request the cylinder to be closed with a (polygonal) lid at -z.
Definition: SolidTube.hh:61
void SetSectors(const unsigned int n)
Definition: SolidTube.cc:126
~SolidTube()
Destructor.
Definition: SolidTube.hh:26
double GetHalfLengthZ() const override
Return the half-length along z.
Definition: SolidTube.hh:38
void SetHalfLength(const double lz)
Definition: SolidTube.cc:118
void SetAverageRadius(const bool average)
Definition: SolidTube.hh:57
void SetRadius(const double r)
Definition: SolidTube.cc:110
double GetRotation() const
Definition: SolidTube.hh:64
double GetOuterRadius() const override
Return the outer radius.
Definition: SolidTube.hh:40
double GetInnerRadius() const override
Return the inner radius.
Definition: SolidTube.hh:39
bool IsInside(const double x, const double y, const double z) const override
Check whether a given point is inside the solid.
Definition: SolidTube.cc:33
void SetRotation(const double angle)
Definition: SolidTube.hh:51
bool GetAverage() const
Definition: SolidTube.hh:65
double GetRadius() const override
Return the radius.
Definition: SolidTube.hh:41
bool GetBoundingBox(double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) const override
Return the bounding box of the solid.
Definition: SolidTube.cc:62
Abstract base class for solids.
Definition: Solid.hh:28
Surface panel.
Definition: Solid.hh:11