Garfield++ 4.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
SolidBox.hh
Go to the documentation of this file.
1#ifndef G_SOLID_BOX_H
2#define G_SOLID_BOX_H
3
4#include "Solid.hh"
5
6namespace Garfield {
7
8/// Box.
9
10class SolidBox : public Solid {
11 public:
12 /// Constructor from centre and half-widths.
13 SolidBox(const double cx, const double cy, const double cz, const double lx,
14 const double ly, const double lz);
15 /// Constructor from centre, half-widths, and orientation.
16 SolidBox(const double cx, const double cy, const double cz, const double lx,
17 const double ly, const double lz, const double dx, const double dy,
18 const double dz);
19 /// Destructor
21
22 bool IsInside(const double x, const double y, const double z,
23 const bool tesselated) const override;
24 bool GetBoundingBox(double& xmin, double& ymin, double& zmin, double& xmax,
25 double& ymax, double& zmax) const override;
26 bool IsBox() const override { return true; }
27
28 double GetHalfLengthX() const override { return m_lX; }
29 double GetHalfLengthY() const override { return m_lY; }
30 double GetHalfLengthZ() const override { return m_lZ; }
31
32 void SetHalfLengthX(const double lx);
33 void SetHalfLengthY(const double ly);
34 void SetHalfLengthZ(const double lz);
35
36 bool SolidPanels(std::vector<Panel>& panels) override;
37 void SetDiscretisationLevel(const double dis) override {
38 m_dis.fill(dis);
39 }
40 double GetDiscretisationLevel(const Panel& panel) override;
41
42 void Cut(const double x0, const double y0, const double z0,
43 const double xn, const double yn, const double zn,
44 std::vector<Panel>& panels) override;
45
46 private:
47 /// Half lengths.
48 double m_lX = 0., m_lY = 0., m_lZ = 0.;
49 /// Discretisation levels.
50 std::array<double, 6> m_dis{{-1, -1, -1, -1, -1, -1}};
51};
52}
53
54#endif
double GetHalfLengthZ() const override
Return the half-length along z.
Definition: SolidBox.hh:30
void SetHalfLengthX(const double lx)
Definition: SolidBox.cc:57
bool IsBox() const override
Return true if the solid is a box.
Definition: SolidBox.hh:26
double GetHalfLengthY() const override
Return the half-length along y.
Definition: SolidBox.hh:29
bool SolidPanels(std::vector< Panel > &panels) override
Retrieve the surface panels of the solid.
Definition: SolidBox.cc:81
~SolidBox()
Destructor.
Definition: SolidBox.hh:20
bool IsInside(const double x, const double y, const double z, const bool tesselated) const override
Definition: SolidBox.cc:22
void SetHalfLengthZ(const double lz)
Definition: SolidBox.cc:73
bool GetBoundingBox(double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) const override
Return the bounding box of the solid.
Definition: SolidBox.cc:35
double GetHalfLengthX() const override
Return the half-length along x.
Definition: SolidBox.hh:28
double GetDiscretisationLevel(const Panel &panel) override
Retrieve the discretisation level of a panel.
Definition: SolidBox.cc:196
void SetDiscretisationLevel(const double dis) override
Set the discretisation level (for all panels).
Definition: SolidBox.hh:37
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
Definition: SolidBox.cc:222
void SetHalfLengthY(const double ly)
Definition: SolidBox.cc:65
Abstract base class for solids.
Definition: Solid.hh:28
Surface panel.
Definition: Solid.hh:11