Garfield++ 3.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
ComponentUserMapBase.hh
Go to the documentation of this file.
1#ifndef COMPONENT_USER_MAP_BASE_H
2#define COMPONENT_USER_MAP_BASE_H
3
4#include <iostream>
5#include "ComponentBase.hh"
6
7namespace Garfield {
8
10 public:
12 virtual ~ComponentUserMapBase();
13
14 Medium* GetMedium(const double x, const double y, const double z);
15
16 void ElectricField(const double x, const double y, const double z, double& ex,
17 double& ey, double& ez, Medium*& m, int& status);
18 void ElectricField(const double x, const double y, const double z, double& ex,
19 double& ey, double& ez, double& v, Medium*& m,
20 int& status);
21 bool GetVoltageRange(double& vmin, double& vmax) {
22 vmin = vmax = 0.;
23 return false;
24 }
25
26 void WeightingField(const double x, const double y, const double z,
27 double& wx, double& wy, double& wz,
28 const std::string& label);
29 double WeightingPotential(const double x, const double y, const double z,
30 const std::string& label);
31
32 // This method should be overloaded in derived classes to implement the
33 // coordinate mapping. For example, when ComponentUserMapBase::ElectricField
34 // calls this method, the parameters p1, p2, and p3 will contain the global
35 // coordinates (x, y, z). MapCoordinates should then map them to local
36 // coordinates. It should also set pComponent to the component that will be
37 // used with these coordinates. In order to properly unmap the field, this
38 // method should also set the local base vectors u1, u2 and u3. Their initial
39 // values will be u1 = (1, 0, 0), u2 = (0, 1, 0), and u3 = (0, 0, 1).
40 virtual void MapCoordinates(double& p1, double& p2, double& p3, double& u1x,
41 double& u2x, double& u3x, double& u1y,
42 double& u2y, double& u3y, double& u1z,
43 double& u2z, double& u3z,
44 ComponentBase*& pComponent) = 0;
45
46 // Overloading this method is optional. It enables the use of a separate
47 // coordinate mapping for weighting fields. And allows the user to parse the
48 // label and change it.
49 virtual void MapCoordinates(double& p1, double& p2, double& p3, double& u1x,
50 double& u2x, double& u3x, double& u1y,
51 double& u2y, double& u3y, double& u1z,
52 double& u2z, double& u3z,
53 ComponentBase*& pComponent, std::string& label) {
54 (void)label; // Suppress compiler warning
55 MapCoordinates(p1, p2, p3, u1x, u2x, u3x, u1y, u2y, u3y, u1z, u2z, u3z,
56 pComponent);
57 }
58
59 protected:
60 void Reset() {}
61 void UpdatePeriodicity();
62
63 void UnmapField(const double e1, const double e2, const double e3,
64 const double u1x, const double u2x, const double u3x,
65 const double u1y, const double u2y, const double u3y,
66 const double u1z, const double u2z, const double u3z,
67 double& ex, double& ey, double& ez) const {
68 ex = u1x * e1 + u2x * e2 + u3x * e3;
69 ey = u1y * e1 + u2y * e2 + u3y * e3;
70 ez = u1z * e1 + u2z * e2 + u3z * e3;
71 }
72};
73}
74
75#endif // COMPONENT_USER_MAP_BASE_H
Abstract base class for components.
Medium * GetMedium(const double x, const double y, const double z)
Get the medium at a given location (x, y, z).
void Reset()
Reset the component.
bool GetVoltageRange(double &vmin, double &vmax)
Calculate the voltage range [V].
void UnmapField(const double e1, const double e2, const double e3, const double u1x, const double u2x, const double u3x, const double u1y, const double u2y, const double u3y, const double u1z, const double u2z, const double u3z, double &ex, double &ey, double &ez) const
void ElectricField(const double x, const double y, const double z, double &ex, double &ey, double &ez, Medium *&m, int &status)
void WeightingField(const double x, const double y, const double z, double &wx, double &wy, double &wz, const std::string &label)
void UpdatePeriodicity()
Verify periodicities.
double WeightingPotential(const double x, const double y, const double z, const std::string &label)
virtual void MapCoordinates(double &p1, double &p2, double &p3, double &u1x, double &u2x, double &u3x, double &u1y, double &u2y, double &u3y, double &u1z, double &u2z, double &u3z, ComponentBase *&pComponent)=0
virtual void MapCoordinates(double &p1, double &p2, double &p3, double &u1x, double &u2x, double &u3x, double &u1y, double &u2y, double &u3y, double &u1z, double &u2z, double &u3z, ComponentBase *&pComponent, std::string &label)
Abstract base class for media.
Definition: Medium.hh:13