Garfield 0.3
Toolkit for the detailed simulation of particle detectors based on ionization measurement in gases and semiconductors
Loading...
Searching...
No Matches
SolidSphere.hh
Go to the documentation of this file.
1#ifndef G_SOLID_SPHERE_H
2#define G_SOLID_SPHERE_H
3
4#include <mutex>
5
6#include "Garfield/Solid.hh"
7
8namespace Garfield {
9
11
12class SolidSphere : public Solid {
13 public:
15 SolidSphere(const double cx, const double cy, const double cz,
16 const double r);
18 SolidSphere(const double cx, const double cy, const double cz,
19 const double rmin, const double rmax);
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 IsSphere() const override { return true; }
28
30 void SetRadius(const double r);
32 void SetRadii(const double rmin, const double rmax);
33
34 double GetRadius() const override { return m_rMax; }
35 double GetInnerRadius() const override { return m_rMin; }
36 double GetOuterRadius() const override { return m_rMax; }
37
41 void SetMeridians(const unsigned int n);
42
43 bool SolidPanels(std::vector<Panel>& panels) override;
44 void SetDiscretisationLevel(const double dis) override { m_dis = dis; }
45 double GetDiscretisationLevel(const Panel& panel) override;
46
47 void Cut(const double x0, const double y0, const double z0, const double xn,
48 const double yn, const double zn,
49 std::vector<Panel>& panels) override;
50
51 private:
53 std::mutex m_mutex;
54
56 double m_rMin = 0., m_rMax = 1.;
57
59 unsigned int m_n = 10;
60
62 double m_dis = -1.;
63
65 std::vector<Panel> m_panelsO;
66 std::vector<Panel> m_panelsI;
67
69 void MakePanels(const int vol, const double r, const bool out,
70 std::vector<Panel>& panels) const;
71};
72} // namespace Garfield
73
74#endif
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.
double m_rMin
Inner and outer radii.
SolidSphere(const double cx, const double cy, const double cz, const double rmin, const double rmax)
Constructor from centre and inner/outer radii.
double m_dis
Discretisation level.
void SetDiscretisationLevel(const double dis) override
Set the discretisation level (for all panels).
~SolidSphere()
Destructor.
std::vector< Panel > m_panelsI
bool GetBoundingBox(double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) const override
Return the bounding box of the solid.
double GetOuterRadius() const override
Return the outer radius.
void SetRadii(const double rmin, const double rmax)
Set the inner and outer radius of the sphere.
void MakePanels(const int vol, const double r, const bool out, std::vector< Panel > &panels) const
std::vector< Panel > m_panelsO
Surface panels.
double GetInnerRadius() const override
Return the inner radius.
void SetRadius(const double r)
Set the radius of the sphere.
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 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.
bool IsSphere() const override
Return true if the solid is a sphere.
SolidSphere(const double cx, const double cy, const double cz, const double r)
Constructor from centre and outer radius.
unsigned int m_n
Number of meridians.
double GetRadius() const override
Return the radius.
std::mutex m_mutex
Mutex.
void SetMeridians(const unsigned int n)
When calculating surface panels, the sphere is approximated by a set of parallelograms,...
Solid()=delete
Default constructor.
Surface panel.
Definition Solid.hh:11