Garfield++ 3.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
GeometrySimple.hh
Go to the documentation of this file.
1#ifndef G_GEOMETRY_SIMPLE_H
2#define G_GEOMETRY_SIMPLE_H
3
4#include <vector>
5
6#include "GeometryBase.hh"
7
8namespace Garfield {
9
10/// "Native" geometry, using simple shapes.
11
13 public:
14 /// Constructor
16 /// Destructor
17 virtual ~GeometrySimple() {}
18
19 Medium* GetMedium(const double x, const double y,
20 const double z) const override;
21 /// Get the number of media in the geometry.
22 unsigned int GetNumberOfMedia() const { return m_media.size(); }
23 /// Get a medium from the list.
24 Medium* GetMedium(const unsigned int i) const;
25
26 unsigned int GetNumberOfSolids() const override { return m_solids.size(); }
27 Solid* GetSolid(const unsigned int i) const override;
28 Solid* GetSolid(const unsigned int i, Medium*& medium) const override;
29
30 /// Add a solid to the geometry, together with the medium inside.
31 void AddSolid(Solid* s, Medium* m);
32 /// Get the solid at a given location (x, y, z).
33 Solid* GetSolid(const double x, const double y, const double z) const;
34
35 /// Reset the geometry.
36 void Clear();
37 void PrintSolids();
38
39 bool IsInside(const double x, const double y, const double z) const override;
40 // Bounding box (envelope of geometry)
41 bool IsInBoundingBox(const double x, const double y, const double z) const;
42 bool GetBoundingBox(double& xmin, double& ymin, double& zmin, double& xmax,
43 double& ymax, double& zmax) override {
44 xmin = m_xMinBoundingBox;
45 ymin = m_yMinBoundingBox;
46 zmin = m_zMinBoundingBox;
47 xmax = m_xMaxBoundingBox;
48 ymax = m_yMaxBoundingBox;
49 zmax = m_zMaxBoundingBox;
50 return true;
51 }
52
53 // Switch on/off debugging and warning messages
54 void EnableDebugging(const bool on = true) { m_debug = on; }
55
56 protected:
57 /// List of media.
58 std::vector<Medium*> m_media;
59
60 /// List of solids
61 std::vector<std::pair<Solid*, int> > m_solids;
62
63 // Bounding box ranges
64 bool m_hasBoundingBox = false;
67
68 /// Switch on/off debugging messages
69 bool m_debug = false;
70};
71}
72
73#endif
Abstract base class for geometry classes.
Definition: GeometryBase.hh:13
"Native" geometry, using simple shapes.
Solid * GetSolid(const unsigned int i) const override
Get a solid from the list.
bool IsInside(const double x, const double y, const double z) const override
Check if a point is inside the geometry.
unsigned int GetNumberOfSolids() const override
Return the number of solids in the geometry.
std::vector< std::pair< Solid *, int > > m_solids
List of solids.
Medium * GetMedium(const double x, const double y, const double z) const override
Retrieve the medium at a given point.
void EnableDebugging(const bool on=true)
bool IsInBoundingBox(const double x, const double y, const double z) const
std::vector< Medium * > m_media
List of media.
void Clear()
Reset the geometry.
bool GetBoundingBox(double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) override
Get the bounding box (envelope of the geometry).
bool m_debug
Switch on/off debugging messages.
void AddSolid(Solid *s, Medium *m)
Add a solid to the geometry, together with the medium inside.
unsigned int GetNumberOfMedia() const
Get the number of media in the geometry.
virtual ~GeometrySimple()
Destructor.
GeometrySimple()
Constructor.
Abstract base class for media.
Definition: Medium.hh:13
Abstract base class for solids.
Definition: Solid.hh:28