1#ifndef G_COMPONENT_PP_H
2#define G_COMPONENT_PP_H
38 void Setup(
const unsigned int N, std::vector<double> eps,
39 std::vector<double> d,
40 const double V, std::vector<int> sigmaIndex = {});
42 void ElectricField(
const double x,
const double y,
const double z,
double &ex,
43 double &ey,
double &ez, Medium *&m,
int &status)
override;
44 void ElectricField(
const double x,
const double y,
const double z,
double &ex,
45 double &ey,
double &ez,
double &v, Medium *&m,
46 int &status)
override;
47 using Component::ElectricField;
49 const std::string &label)
override;
61 void AddPixel(
double x,
double z,
double lx,
double lz,
62 const std::string &label,
bool fromAnode =
true);
64 void AddStrip(
double z,
double lz,
const std::string &label,
65 bool fromAnode =
true);
69 void AddPlane(
const std::string &label,
bool fromAnode =
true);
82 const double xsteps,
const double ymin,
83 const double ymax,
const double ysteps,
84 const double zmin,
const double zmax,
85 const double zsteps,
const std::string &label);
90 const double xsteps,
const double ymin,
91 const double ymax,
const double ysteps,
92 const double zmin,
const double zmax,
99 if (electrode.label != label)
continue;
100 if (electrode.grid.LoadWeightingField(label +
"map",
"xyz",
true)) {
101 std::cout << m_className <<
"::LoadWeightingPotentialGrid: "
102 <<
"Weighting potential set for " << label <<
".\n";
103 electrode.m_usegrid =
true;
107 std::cerr << m_className
108 <<
"::LoadWeightingPotentialGrid: Could not find file for "
112 Medium *
GetMedium(
const double x,
const double y,
const double z)
override;
115 double &ymax,
double &zmax)
override;
119 bool getLayer(
const double y,
int &m,
double &epsM) {
121 if (y <
m_z[0])
return false;
122 for (
int i = 1; i <
m_N; i++) {
128 if (m == -1)
return false;
139 zbottom =
m_z.at(m - 1);
146 for (
int i = 1; i <
m_N; i++) {
161 static constexpr double m_Vw = 1.;
222 const double y,
const double z);
227 const double y,
const double z);
231 bool Nsigma(
int N, std::vector<std::vector<int>> &sigmaMatrix);
235 bool Ntheta(
int N, std::vector<std::vector<int>> &thetaMatrix,
236 std::vector<std::vector<int>> &sigmaMatrix);
258 for (
int i = 1; i <=
m_N - 1; i++) {
268 if (!
getLayer(z, im, epsM))
return 0.;
270 for (
int i = 1; i <= im - 1; i++) {
281 for (
int i = 1; i <=
m_N - 1; i++) {
293 void LayerUpdate(
const double z,
const int im,
const double epsM) {
301 m_eps[im - 1] = epsM;
306 double diff1 =
m_z[im] - z;
307 double diff2 = z -
m_z[im - 1];
309 std::vector<double> d(
m_N, 0.);
310 for (
int i = 0; i < im - 1; i++) d[i] =
m_d[i];
313 for (
int i = im + 1; i <
m_N; i++) d[i] =
m_d[i - 1];
Component for interpolating field maps on a regular mesh.
void CalculateDynamicalWeightingPotential(const Electrode &el)
double wpPlane(const double z)
std::vector< bool > m_conductive
Flag whether a layer is conductive.
void constructGeometryMatrices(const int N)
std::vector< double > m_z
std::vector< Electrode > m_readout_p
void AddPlane(const std::string &label, bool fromAnode=true)
Add plane electrode, if you want to read the signal from the cathode set the second argument to false...
ComponentParallelPlate()
Constructor.
int m_currentLayer
Index of the current layer.
std::vector< std::string > m_readout
void AddStrip(double z, double lz, const std::string &label, bool fromAnode=true)
Add strip electrode.
TF2 m_wpPixelIntegral
Weighting potential integrand for pixels.
double m_upperBoundIntegration
double m_V
Voltage difference between the parallel plates.
static constexpr double m_Vw
void ElectricField(const double x, const double y, const double z, double &ex, double &ey, double &ez, double &v, Medium *&m, int &status) override
double WeightingPotential(const double x, const double y, const double z, const std::string &label) override
double FindWeightingPotentialInGrid(Electrode &el, const double x, const double y, const double z)
std::vector< std::vector< double > > m_cMatrix
c-matrixl.
void LoadWeightingPotentialGrid(const std::string &label)
This will load a previously calculated grid of time-dependent weighting potential values.
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)
This will calculate all electrodes time-dependent weighting potential on the specified grid.
~ComponentParallelPlate()
Destructor.
std::vector< std::vector< std::vector< int > > > m_sigmaMatrix
void setwpStripIntegrand()
std::vector< double > m_eps
relative permittivity of each layer
void constructGeometryFunction(const int N, const std::vector< double > &d)
void SetMedium(Medium *medium)
Setting the medium.
void SetIntegrationPrecision(const double eps)
void setwpPixelIntegrand()
void getZBoundFromLayer(int m, double &zbottom, double &ztop)
void ElectricField(const double x, const double y, const double z, double &ex, double &ey, double &ez, Medium *&m, int &status) override
std::vector< std::vector< double > > m_wMatrix
w-matrixl.
void SetWeightingPotentialGrid(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 std::string &label)
Calculate time-dependent weighting potential on a grid.
bool decToBinary(int n, std::vector< int > &binaryNum)
std::vector< std::vector< std::vector< int > > > m_thetaMatrix
bool m_getPotentialInPlate
double constWEFieldLayer(const int indexLayer)
void SetIntegrationUpperbound(const double p)
void Setup(const unsigned int N, std::vector< double > eps, std::vector< double > d, const double V, std::vector< int > sigmaIndex={})
Define the geometry.
bool Ntheta(int N, std::vector< std::vector< int > > &thetaMatrix, std::vector< std::vector< int > > &sigmaMatrix)
Medium * GetMedium(const double x, const double y, const double z) override
void IndexOfGasGaps(std::vector< int > &indexGasGap)
void UpdatePeriodicity() override
std::vector< double > m_epsHolder
double IntegratePromptPotential(const Electrode &el, const double x, const double y, const double z)
std::vector< double > m_d
thickness of each layer
double constEFieldLayer(const int indexLayer)
std::vector< std::vector< double > > m_vMatrix
v-matrixl.
bool getLayer(const double y, int &m, double &epsM)
bool GetVoltageRange(double &vmin, double &vmax) override
void LayerUpdate(const double z, const int im, const double epsM)
TF1 m_wpStripIntegral
Weighting potential integrand for strips.
void AddPixel(double x, double z, double lx, double lz, const std::string &label, bool fromAnode=true)
Add a pixel electrode.
void getPermittivityFromLayer(int m, double &eps)
bool GetBoundingBox(double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) override
void DisablePotentialCalculationOutsideGasGap()
std::vector< std::vector< double > > m_gMatrix
g-matrixl.
bool Nsigma(int N, std::vector< std::vector< int > > &sigmaMatrix)
Structure that captures the information of the electrodes under study.
double ypos
Coordinates in x/y.
ComponentGrid grid
grid object.
bool m_usegrid
Enabling grid based calculations.
double ly
Dimensions in the x-y plane.