Garfield 0.3
Toolkit for the detailed simulation of particle detectors based on ionization measurement in gases and semiconductors
Loading...
Searching...
No Matches
ComponentConstant.hh
Go to the documentation of this file.
1#ifndef G_COMPONENT_CONSTANT_H
2#define G_COMPONENT_CONSTANT_H
3
4#include <array>
5#include <string>
6
8
9namespace Garfield {
10
12
14 public:
19
21 void SetElectricField(const double ex, const double ey, const double ez);
23 void SetPotential(const double x, const double y, const double z,
24 const double v = 0.);
25
27 void SetWeightingField(const double wx, const double wy, const double wz,
28 const std::string label);
30 void SetWeightingPotential(const double x, const double y, const double z,
31 const double v = 0.);
32
35 void SetArea(const double xmin, const double ymin, const double zmin,
36 const double xmax, const double ymax, const double zmax);
38 void UnsetArea();
40 void SetMedium(Medium* medium) { m_medium = medium; }
41
42 Medium* GetMedium(const double x, const double y, const double z) override;
43 void ElectricField(const double x, const double y, const double z, double& ex,
44 double& ey, double& ez, Medium*& m, int& status) override;
45 void ElectricField(const double x, const double y, const double z, double& ex,
46 double& ey, double& ez, double& v, Medium*& m,
47 int& status) override;
49 bool GetVoltageRange(double& vmin, double& vmax) override;
50 void WeightingField(const double x, const double y, const double z,
51 double& wx, double& wy, double& wz,
52 const std::string& label) override;
53 double WeightingPotential(const double x, const double y, const double z,
54 const std::string& label) override;
55
56 bool GetBoundingBox(double& xmin, double& ymin, double& zmin, double& xmax,
57 double& ymax, double& zmax) override;
58
59 private:
60 // Electric field.
61 std::array<double, 3> m_efield = {{0., 0., 0.}};
62
63 // Is the potential defined?
64 bool m_hasPotential = false;
65 // Point where potential was specified.
66 double m_x0 = 0., m_y0 = 0., m_z0 = 0.;
67 // Potential at this point.
68 double m_v0 = 0.;
69
70 // Is the weighting field defined?
71 bool m_hasWeightingField = false;
72 // Identifier of the weighting field.
73 std::string m_label = "";
74 // Weighting field.
75 std::array<double, 3> m_wfield = {{0., 0., 0.}};
76 // Is the weighting potential defined?
78 // Point where the weighting potential was specified.
79 double m_wx0 = 0., m_wy0 = 0., m_wz0 = 0.;
80 // Weighting potential at this point.
81 double m_w0 = 0.;
82
83 // Active area.
84 std::array<double, 3> m_xmin = {{0., 0., 0.}};
85 std::array<double, 3> m_xmax = {{0., 0., 0.}};
86 // Did we specify the active area explicitly?
87 bool m_hasArea = false;
88 // Medium in the active area.
89 Medium* m_medium = nullptr;
90
91 void Reset() override;
92 void UpdatePeriodicity() override;
93
94 bool InArea(const double x, const double y, const double z) {
95 if (x < m_xmin[0] || x > m_xmax[0] || y < m_xmin[1] || y > m_xmax[1] ||
96 z < m_xmin[2] || z > m_xmax[2]) {
97 return false;
98 }
99 return true;
100 }
101};
102} // namespace Garfield
103#endif
double WeightingPotential(const double x, const double y, const double z, const std::string &label) override
Calculate the weighting potential at a given point.
bool GetVoltageRange(double &vmin, double &vmax) override
Calculate the voltage range [V].
void ElectricField(const double x, const double y, const double z, double &ex, double &ey, double &ez, Medium *&m, int &status) override
Calculate the drift field at given point.
Medium * GetMedium(const double x, const double y, const double z) override
Get the medium at a given location (x, y, z).
void UpdatePeriodicity() override
Verify periodicities.
void SetElectricField(const double ex, const double ey, const double ez)
Set the components of the electric field [V / cm].
void WeightingField(const double x, const double y, const double z, double &wx, double &wy, double &wz, const std::string &label) override
Calculate the weighting field at a given point and for a given electrode.
std::array< double, 3 > m_efield
void ElectricField(const double x, const double y, const double z, double &ex, double &ey, double &ez, double &v, Medium *&m, int &status) override
Calculate the drift field [V/cm] and potential [V] at (x, y, z).
void UnsetArea()
Remove the explicit limits of the active area.
void SetArea(const double xmin, const double ymin, const double zmin, const double xmax, const double ymax, const double zmax)
Set the limits of the active area explicitly (instead of using a Geometry object).
bool GetBoundingBox(double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) override
Get the bounding box coordinates.
std::array< double, 3 > m_wfield
std::array< double, 3 > m_xmin
std::array< double, 3 > m_xmax
void SetPotential(const double x, const double y, const double z, const double v=0.)
Specify the potential at a given point.
void Reset() override
Reset the component.
void SetWeightingPotential(const double x, const double y, const double z, const double v=0.)
Specify the weighting potential at a given point.
bool InArea(const double x, const double y, const double z)
void SetWeightingField(const double wx, const double wy, const double wz, const std::string label)
Set the components of the weighting field [1 / cm].
void SetMedium(Medium *medium)
Set the medium in the active area.
ComponentConstant()
Constructor.
virtual void ElectricField(const double x, const double y, const double z, double &ex, double &ey, double &ez, Medium *&m, int &status)=0
Calculate the drift field at given point.
Component()=delete
Default constructor.
Abstract base class for components.
Definition Medium.hh:17