Garfield++ 4.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
SolidExtrusion.hh
Go to the documentation of this file.
1#ifndef G_SOLID_EXTRUSION_H
2#define G_SOLID_EXTRUSION_H
3
4#include "Solid.hh"
5
6namespace Garfield {
7
8/// Extrusion.
9
10class SolidExtrusion : public Solid {
11 public:
12 /// Constructor from half-length and profile.
13 SolidExtrusion(const double lz,
14 const std::vector<double>& xp, const std::vector<double>& yp);
15 /// Constructor from half-length, profile, offset and orientation.
16 SolidExtrusion(const double lz,
17 const std::vector<double>& xp, const std::vector<double>& yp,
18 const double cx, const double cy, const double cz,
19 const double dx, const double dy, const double dz);
20 /// Destructor
22
23 bool IsInside(const double x, const double y, const double z,
24 const bool tesselated) const override;
25 bool GetBoundingBox(double& xmin, double& ymin, double& zmin, double& xmax,
26 double& ymax, double& zmax) const override;
27 bool IsExtrusion() const override { return true; }
28
29 double GetHalfLengthZ() const override { return m_lZ; }
30 bool GetProfile(std::vector<double>& xp,
31 std::vector<double>& yp) const override {
32 xp = m_xp;
33 yp = m_yp;
34 return !m_xp.empty();
35 }
36 /// Set the half-length of the extrusion.
37 void SetHalfLengthZ(const double lz);
38 /// Set the coordinates of the extrusion profile.
39 void SetProfile(const std::vector<double>& xp,
40 const std::vector<double>& yp);
41 /// Request the extrusion to be closed with a lid at +z.
42 void SetTopLid(const bool closed) { m_toplid = closed; }
43 /// Request the extrusion to be closed with a lid at -z.
44 void SetBottomLid(const bool closed) { m_botlid = closed; }
45
46 bool SolidPanels(std::vector<Panel>& panels) override;
47 void SetDiscretisationLevel(const double dis) override {
48 m_dis.fill(dis);
49 }
50 double GetDiscretisationLevel(const Panel& panel) override;
51
52 void Cut(const double x0, const double y0, const double z0,
53 const double xn, const double yn, const double zn,
54 std::vector<Panel>& panels) override;
55
56 private:
57 /// Half length.
58 double m_lZ = 0.;
59 /// X coordinates of the profile.
60 std::vector<double> m_xp;
61 /// Y coordinates of the profile.
62 std::vector<double> m_yp;
63
64 /// Have a top lid?
65 bool m_toplid = true;
66 /// Have a bottom lid?
67 bool m_botlid = true;
68
69 /// Orientation of the polygon.
70 bool m_clockwise = true;
71
72 /// Discretisation levels.
73 std::array<double, 3> m_dis{{-1, -1, -1}};
74};
75}
76
77#endif
bool IsInside(const double x, const double y, const double z, const bool tesselated) const override
bool GetBoundingBox(double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) const override
Return the bounding box of the solid.
bool GetProfile(std::vector< double > &xp, std::vector< double > &yp) const override
Get the vertices defining an extrusion.
double GetDiscretisationLevel(const Panel &panel) override
Retrieve the discretisation level of a panel.
bool SolidPanels(std::vector< Panel > &panels) override
Retrieve the surface panels of the solid.
void SetBottomLid(const bool closed)
Request the extrusion to be closed with a lid at -z.
void SetHalfLengthZ(const double lz)
Set the half-length of the extrusion.
void SetTopLid(const bool closed)
Request the extrusion to be closed with a lid at +z.
double GetHalfLengthZ() const override
Return the half-length along z.
void SetProfile(const std::vector< double > &xp, const std::vector< double > &yp)
Set the coordinates of the extrusion profile.
void SetDiscretisationLevel(const double dis) override
Set the discretisation level (for all panels).
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
bool IsExtrusion() const override
Return true if the solid is an extrusion.
Abstract base class for solids.
Definition: Solid.hh:28
Surface panel.
Definition: Solid.hh:11