Garfield 0.3
Toolkit for the detailed simulation of particle detectors based on ionization measurement in gases and semiconductors
Loading...
Searching...
No Matches
SolidHole.hh
Go to the documentation of this file.
1#ifndef G_SOLID_HOLE_H
2#define G_SOLID_HOLE_H
3
4#include <array>
5#include <mutex>
6
7#include "Garfield/Solid.hh"
8
9namespace Garfield {
10
12
13class SolidHole : public Solid {
14 public:
16 SolidHole(const double cx, const double cy, const double cz, const double rup,
17 const double rlow, const double lx, const double ly,
18 const double lz);
21 SolidHole(const double cx, const double cy, const double cz, const double rup,
22 const double rlow, const double lx, const double ly,
23 const double lz, const double dx, const double dy, const double dz);
26
27 bool IsInside(const double x, const double y, const double z,
28 const bool tesselated) const override;
29 bool GetBoundingBox(double& xmin, double& ymin, double& zmin, double& xmax,
30 double& ymax, double& zmax) const override;
31 bool IsHole() const override { return true; }
32
34 void SetHalfLengthX(const double lx);
36 void SetHalfLengthY(const double ly);
38 void SetHalfLengthZ(const double lz);
40 void SetUpperRadius(const double r);
42 void SetLowerRadius(const double r);
43
44 double GetHalfLengthX() const override { return m_lX; }
45 double GetHalfLengthY() const override { return m_lY; }
46 double GetHalfLengthZ() const override { return m_lZ; }
47 double GetUpperRadius() const override { return m_rUp; }
48 double GetLowerRadius() const override { return m_rLow; }
49
54 void SetSectors(const unsigned int n);
60 void SetAverageRadius(const bool average) {
61 m_average = average;
62 Update();
63 }
64
66 unsigned int GetSectors() const { return m_n; }
68 bool GetAverage() const { return m_average; }
69
70 bool SolidPanels(std::vector<Panel>& panels) override;
71 void SetDiscretisationLevel(const double dis) override { m_dis.fill(dis); }
72 double GetDiscretisationLevel(const Panel& panel) override;
73
74 void Cut(const double x0, const double y0, const double z0, const double xn,
75 const double yn, const double zn,
76 std::vector<Panel>& panels) override;
77
78 private:
80 std::mutex m_mutex;
81
83 double m_rUp;
85 double m_rLow;
87 double m_lX;
89 double m_lY;
91 double m_lZ;
92
94 unsigned int m_n = 2;
96 bool m_average = false;
97
99 double m_fp = 1.;
101 double m_fi = 1.;
102
104 std::array<double, 7> m_dis{{-1., -1., -1., -1., -1., -1., -1.}};
105
106 void Update();
107};
108} // namespace Garfield
109
110#endif
void SetHalfLengthY(const double ly)
Set the half-length of the box along y.
bool GetBoundingBox(double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) const override
Return the bounding box of the solid.
double m_lZ
Half-length in z.
Definition SolidHole.hh:91
bool IsHole() const override
Return true if the solid is a hole.
Definition SolidHole.hh:31
double GetHalfLengthY() const override
Return the half-length along y.
Definition SolidHole.hh:45
~SolidHole()
Destructor.
Definition SolidHole.hh:25
double m_rUp
Upper radius.
Definition SolidHole.hh:83
double GetDiscretisationLevel(const Panel &panel) override
Retrieve the discretisation level of a panel.
std::array< double, 7 > m_dis
Discretisation levels.
Definition SolidHole.hh:104
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 m_rLow
Lower radius.
Definition SolidHole.hh:85
double GetHalfLengthZ() const override
Return the half-length along z.
Definition SolidHole.hh:46
void SetSectors(const unsigned int n)
When calculating the surface panels, the hole is approximated as a polygon with a finite number of pa...
void SetHalfLengthX(const double lx)
Set the half-length of the box along x.
void SetLowerRadius(const double r)
Set the radius at z = -lz.
double m_lX
Half-length in x.
Definition SolidHole.hh:87
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.
unsigned int m_n
Number of sectors.
Definition SolidHole.hh:94
bool SolidPanels(std::vector< Panel > &panels) override
Retrieve the surface panels of the solid.
double m_lY
Half-length in y.
Definition SolidHole.hh:89
bool GetAverage() const
Return the state of the "average-radius" flag.
Definition SolidHole.hh:68
void SetHalfLengthZ(const double lz)
Set the half-length of the box along z.
SolidHole(const double cx, const double cy, const double cz, const double rup, const double rlow, const double lx, const double ly, const double lz, const double dx, const double dy, const double dz)
Constructor from centre, upper/lower radii, half-lengths of the box and orientation.
void SetUpperRadius(const double r)
Set the radius at z = +lz.
double GetLowerRadius() const override
Return the lower radius (of a hole).
Definition SolidHole.hh:48
std::mutex m_mutex
Mutex.
Definition SolidHole.hh:80
void SetAverageRadius(const bool average)
By default, the polygon used for approximating the hole when calculating surface panels is inscribed ...
Definition SolidHole.hh:60
SolidHole(const double cx, const double cy, const double cz, const double rup, const double rlow, const double lx, const double ly, const double lz)
Constructor from centre, upper/lower radii, half-lengths of the box.
double GetUpperRadius() const override
Return the upper radius (of a hole).
Definition SolidHole.hh:47
double GetHalfLengthX() const override
Return the half-length along x.
Definition SolidHole.hh:44
void SetDiscretisationLevel(const double dis) override
Set the discretisation level (for all panels).
Definition SolidHole.hh:71
unsigned int GetSectors() const
Return the order of the approximating polygon.
Definition SolidHole.hh:66
bool m_average
Average chord over the sectors.
Definition SolidHole.hh:96
double m_fp
Ratio between the approximating polygon's radius and the hole radius.
Definition SolidHole.hh:99
double m_fi
Ratio between inradius and exradius of the approximating polygon.
Definition SolidHole.hh:101
Solid()=delete
Default constructor.
Surface panel.
Definition Solid.hh:11