Garfield++ 4.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
ComponentParallelPlate.hh
Go to the documentation of this file.
1#ifndef G_COMPONENT_PP_H
2#define G_COMPONENT_PP_H
3
4#include <string>
5
6#include "Component.hh"
7#include "Medium.hh"
8
9namespace Garfield {
10
11/// Component for parallel-plate geometries.
12
14 public:
15 /// Constructor
17 /// Destructor
19
20 /** Define the geometry.
21 * \param g size of the gap along positive \f$z\f$.
22 * \param b thickness of the resistive layer along negative \f$z\f$.
23 * \param eps relative permittivity of the resistive layer.
24 * \param sigma conductivity of the resistive layer (must be larger then zero,
25 * otherwise do not pass it in the function).
26 * \param V applied potential difference between the parallel plates.
27 */
28 void Setup(double g, double b, double eps, double v, double sigma = 0.);
29
30 void ElectricField(const double x, const double y, const double z, double& ex,
31 double& ey, double& ez, Medium*& m, int& status) override;
32 void ElectricField(const double x, const double y, const double z, double& ex,
33 double& ey, double& ez, double& v, Medium*& m,
34 int& status) override;
35
36 void WeightingField(const double x, const double y, const double z,
37 double& wx, double& wy, double& wz,
38 const std::string& label) override;
39
40 double WeightingPotential(const double x, const double y, const double z,
41 const std::string& label) override;
42
43 double DelayedWeightingPotential(const double x, const double y,
44 const double z, const double t,
45 const std::string& label) override;
46
47 void DelayedWeightingField(const double x, const double y, const double z,
48 const double t, double& wx, double& wy, double& wz,
49 const std::string& label) override;
50
51 bool GetVoltageRange(double& vmin, double& vmax) override;
52
53 /** Add a pixel electrode.
54 * \param x,z position of the center of the electrode in the xy-plane.
55 * \param lx width in the along \f$x\f$.
56 * \param ly width in the along \f$y\f$.
57 * \param label give name using a string.
58 */
59 void AddPixel(double x, double y, double lx, double ly,
60 const std::string& label);
61 /// Add strip electrode.
62 void AddStrip(double x, double lx, const std::string& label);
63
64 /// Add plane electrode, if you want to read the signal from the cathode set
65 /// the second argument to false.
66 void AddPlane(const std::string& label, bool anode = true);
67
68 // Setting the medium
69 void SetMedium(Medium* medium) { m_medium = medium; }
70
71 // This will calculate the electrode's time-dependent weighting potential on
72 // the specified grid.
73 void SetWeightingPotentialGrid(const std::string& label, const double xmin,
74 const double xmax, const double xsteps,
75 const double ymin, const double ymax,
76 const double ysteps, const double zmin,
77 const double zmax, const double zsteps,
78 const double tmin, const double tmax,
79 const double tsteps);
80
81 // This will calculate all electrodes time-dependent weighting potential on
82 // the specified grid.
83 void SetWeightingPotentialGrids(const double xmin, const double xmax,
84 const double xsteps, const double ymin,
85 const double ymax, const double ysteps,
86 const double zmin, const double zmax,
87 const double zsteps, const double tmin,
88 const double tmax, const double tsteps);
89
90 Medium* GetMedium(const double x, const double y, const double z) override;
91
92 bool GetBoundingBox(double& xmin, double& ymin, double& zmin,
93 double& xmax, double& ymax, double& zmax) override;
94 private:
95 static constexpr double m_precision = 1.e-30;
96 // Size of the gap.
97 double m_g = 0.;
98 // Thickness of the resistive element.
99 double m_b = 0.;
100 // Applied voltage on the electrode to
101 // calculate the weighting potential.
102 static constexpr double m_Vw = 1.;
103 double m_eps = 1.;
104 double m_eps0 = 8.85418782e-3;
105 // Voltage difference between the parallel plates.
106 double m_V = 0.;
107 // Electric field in the gap.
108 double m_ezg = 0.;
109 // Electric field in the resistive layer.
110 double m_ezb = 0.;
111 // Conductivity of the resistive layer.
112 double m_sigma = 0.;
113
114 Medium* m_medium = nullptr;
115
116 /// Structure that captures the information of the electrodes under study
117 struct Electrode {
118 std::string label; ///< Label.
119 int ind = structureelectrode::NotSet; ///< Readout group.
120 double xpos, ypos; ///< Coordinates in x/y.
121 double lx, ly; ///< Dimensions in the x-y plane.
122 double flip = 1; ///< Dimensions in the x-y plane.
123
124 bool m_usegrid = false;
125 std::vector<std::vector<std::vector<double>>> gridPromptV;
126 std::vector<std::vector<std::vector<std::vector<double>>>> gridDelayedV;
127
128 double gridXSteps = 0;
129 double gridYSteps = 0;
130 double gridZSteps = 0;
131 double gridTSteps = 0;
132
133 double gridX0 = 0;
134 double gridY0 = 0;
135 double gridZ0 = 0;
136 double gridT0 = 0;
137
138 double gridXStepSize = 0;
139 double gridYStepSize = 0;
140 double gridZStepSize = 0;
141 double gridTStepSize = 0;
142 };
143
144 enum fieldcomponent { xcomp = 0, ycomp, zcomp };
145
146 /// Possible readout groups
147 enum structureelectrode { NotSet = -1, Plane, Strip, Pixel };
148
149 // Vectors storing the readout electrodes.
150 std::vector<std::string> m_readout;
151 std::vector<Electrode> m_readout_p;
152
153 // Functions that calculate the electric field and potential
154 double IntegrateField(const Electrode& el, int comp, const double x,
155 const double y, const double z);
156
157 double IntegrateDelayedField(const Electrode& el, int comp, const double x,
158 const double y, const double z, const double t);
159
160 double IntegratePromptPotential(const Electrode& el, const double x,
161 const double y, const double z);
162 double IntegrateDelayedPotential(const Electrode& el, const double x,
163 const double y, const double z,
164 const double t);
165
166 void CalculateDynamicalWeightingPotential(const Electrode& el);
167
168 double FindWeightingPotentialInGrid(const Electrode& el, const double x,
169 const double y, const double z);
170
171 double FindDelayedWeightingPotentialInGrid(const Electrode& el,
172 const double x, const double y,
173 const double z, const double t);
174
175 double FindWeightFactor(const Electrode& el, const double dx, const double dy,
176 const double dz);
177
178 double FindWeightFactor(const Electrode& el, const double dx, const double dy,
179 const double dz, const double dt);
180
181 void UpdatePeriodicity() override;
182 void Reset() override;
183};
184} // namespace Garfield
185#endif
Component for parallel-plate geometries.
void Setup(double g, double b, double eps, double v, double sigma=0.)
void DelayedWeightingField(const double x, const double y, const double z, const double t, double &wx, double &wy, double &wz, const std::string &label) override
double WeightingPotential(const double x, const double y, const double z, const std::string &label) override
void AddStrip(double x, double lx, const std::string &label)
Add strip electrode.
double DelayedWeightingPotential(const double x, const double y, const double z, const double t, const std::string &label) override
void WeightingField(const double x, const double y, const double z, double &wx, double &wy, double &wz, const std::string &label) override
void ElectricField(const double x, const double y, const double z, double &ex, double &ey, double &ez, Medium *&m, int &status) override
void AddPlane(const std::string &label, bool anode=true)
void SetWeightingPotentialGrid(const std::string &label, const double xmin, const double xmax, const double xsteps, const double ymin, const double ymax, const double ysteps, const double zmin, const double zmax, const double zsteps, const double tmin, const double tmax, const double tsteps)
Medium * GetMedium(const double x, const double y, const double z) override
Get the medium at a given location (x, y, z).
void SetWeightingPotentialGrids(const double xmin, const double xmax, const double xsteps, const double ymin, const double ymax, const double ysteps, const double zmin, const double zmax, const double zsteps, const double tmin, const double tmax, const double tsteps)
bool GetVoltageRange(double &vmin, double &vmax) override
Calculate the voltage range [V].
bool GetBoundingBox(double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) override
Get the bounding box coordinates.
void AddPixel(double x, double y, double lx, double ly, const std::string &label)
Abstract base class for components.
Definition: Component.hh:13
Abstract base class for media.
Definition: Medium.hh:13