Garfield++ 3.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
Garfield::ComponentUserMapBase Class Referenceabstract

#include <ComponentUserMapBase.hh>

+ Inheritance diagram for Garfield::ComponentUserMapBase:

Public Member Functions

 ComponentUserMapBase ()
 
virtual ~ComponentUserMapBase ()
 
MediumGetMedium (const double x, const double y, const double z)
 Get the medium at a given location (x, y, z).
 
void ElectricField (const double x, const double y, const double z, double &ex, double &ey, double &ez, Medium *&m, int &status)
 
void ElectricField (const double x, const double y, const double z, double &ex, double &ey, double &ez, double &v, Medium *&m, int &status)
 Calculate the drift field [V/cm] and potential [V] at (x, y, z).
 
bool GetVoltageRange (double &vmin, double &vmax)
 Calculate the voltage range [V].
 
void WeightingField (const double x, const double y, const double z, double &wx, double &wy, double &wz, const std::string &label)
 
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)
 
- Public Member Functions inherited from Garfield::ComponentBase
 ComponentBase ()
 Constructor.
 
virtual ~ComponentBase ()
 Destructor.
 
virtual void SetGeometry (GeometryBase *geo)
 Define the geometry.
 
virtual void Clear ()
 Reset.
 
virtual MediumGetMedium (const double x, const double y, const double z)
 Get the medium at a given location (x, y, z).
 
virtual void ElectricField (const double x, const double y, const double z, double &ex, double &ey, double &ez, Medium *&m, int &status)=0
 
virtual void ElectricField (const double x, const double y, const double z, double &ex, double &ey, double &ez, double &v, Medium *&m, int &status)=0
 Calculate the drift field [V/cm] and potential [V] at (x, y, z).
 
virtual bool GetVoltageRange (double &vmin, double &vmax)=0
 Calculate the voltage range [V].
 
virtual void WeightingField (const double x, const double y, const double z, double &wx, double &wy, double &wz, const std::string &label)
 
virtual double WeightingPotential (const double x, const double y, const double z, const std::string &label)
 
virtual void DelayedWeightingField (const double x, const double y, const double z, const double t, double &wx, double &wy, double &wz, const std::string &label)
 
virtual void MagneticField (const double x, const double y, const double z, double &bx, double &by, double &bz, int &status)
 
void SetMagneticField (const double bx, const double by, const double bz)
 Set a constant magnetic field.
 
virtual bool IsReady ()
 Ready for use?
 
virtual bool GetBoundingBox (double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax)
 Get the bounding box coordinates.
 
double IntegrateFluxCircle (const double xc, const double yc, const double r, const unsigned int nI=50)
 
double IntegrateFluxSphere (const double xc, const double yc, const double zc, const double r, const unsigned int nI=20)
 
double IntegrateFlux (const double x0, const double y0, const double z0, const double dx1, const double dy1, const double dz1, const double dx2, const double dy2, const double dz2, const unsigned int nU=20, const unsigned int nV=20)
 
virtual bool IsWireCrossed (const double x0, const double y0, const double z0, const double x1, const double y1, const double z1, double &xc, double &yc, double &zc, const bool centre, double &rc)
 
virtual bool IsInTrapRadius (const double q0, const double x0, const double y0, const double z0, double &xw, double &yw, double &rw)
 
void EnablePeriodicityX (const bool on=true)
 Enable simple periodicity in the $x$ direction.
 
void DisablePeriodicityX ()
 
void EnablePeriodicityY (const bool on=true)
 Enable simple periodicity in the $y$ direction.
 
void DisablePeriodicityY ()
 
void EnablePeriodicityZ (const bool on=true)
 Enable simple periodicity in the $z$ direction.
 
void DisablePeriodicityZ ()
 
void EnableMirrorPeriodicityX (const bool on=true)
 Enable mirror periodicity in the $x$ direction.
 
void DisableMirrorPeriodicityX ()
 
void EnableMirrorPeriodicityY (const bool on=true)
 Enable mirror periodicity in the $y$ direction.
 
void DisableMirrorPeriodicityY ()
 
void EnableMirrorPeriodicityZ (const bool on=true)
 Enable mirror periodicity in the $y$ direction.
 
void DisableMirrorPeriodicityZ ()
 
void EnableAxialPeriodicityX (const bool on=true)
 Enable axial periodicity in the $x$ direction.
 
void DisableAxialPeriodicityX ()
 
void EnableAxialPeriodicityY (const bool on=true)
 Enable axial periodicity in the $y$ direction.
 
void DisableAxialPeriodicityY ()
 
void EnableAxialPeriodicityZ (const bool on=true)
 Enable axial periodicity in the $z$ direction.
 
void DisableAxialPeriodicityZ ()
 
void EnableRotationSymmetryX (const bool on=true)
 Enable rotation symmetry around the $x$ axis.
 
void DisableRotationSymmetryX ()
 
void EnableRotationSymmetryY (const bool on=true)
 Enable rotation symmetry around the $y$ axis.
 
void DisableRotationSymmetryY ()
 
void EnableRotationSymmetryZ (const bool on=true)
 Enable rotation symmetry around the $z$ axis.
 
void DisableRotationSymmetryZ ()
 
void EnableDebugging ()
 Switch on debugging messages.
 
void DisableDebugging ()
 Switch off debugging messages.
 
void ActivateTraps ()
 Request trapping to be taken care of by the component (for TCAD).
 
void DeactivateTraps ()
 
bool IsTrapActive ()
 
void ActivateVelocityMap ()
 Request velocity to be taken care of by the component (for TCAD).
 
void DectivateVelocityMap ()
 
bool IsVelocityActive ()
 
virtual bool ElectronAttachment (const double, const double, const double, double &eta)
 Get the electron attachment coefficient.
 
virtual bool HoleAttachment (const double, const double, const double, double &eta)
 Get the hole attachment coefficient.
 
virtual void ElectronVelocity (const double, const double, const double, double &vx, double &vy, double &vz, Medium *&, int &status)
 Get the electron drift velocity.
 
virtual void HoleVelocity (const double, const double, const double, double &vx, double &vy, double &vz, Medium *&, int &status)
 Get the hole drift velocity.
 
virtual bool GetElectronLifetime (const double, const double, const double, double &etau)
 
virtual bool GetHoleLifetime (const double, const double, const double, double &htau)
 

Protected Member Functions

void Reset ()
 Reset the component.
 
void UpdatePeriodicity ()
 Verify periodicities.
 
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
 
virtual void Reset ()=0
 Reset the component.
 
virtual void UpdatePeriodicity ()=0
 Verify periodicities.
 

Additional Inherited Members

- Protected Attributes inherited from Garfield::ComponentBase
std::string m_className = "ComponentBase"
 Class name.
 
GeometryBasem_geometry = nullptr
 Pointer to the geometry.
 
bool m_ready = false
 Ready for use?
 
bool m_activeTraps = false
 Does the component have traps?
 
bool m_hasVelocityMap = false
 Does the component have velocity maps?
 
std::array< bool, 3 > m_periodic = {{false, false, false}}
 Simple periodicity in x, y, z.
 
std::array< bool, 3 > m_mirrorPeriodic = {{false, false, false}}
 Mirror periodicity in x, y, z.
 
std::array< bool, 3 > m_axiallyPeriodic = {{false, false, false}}
 Axial periodicity in x, y, z.
 
std::array< bool, 3 > m_rotationSymmetric = {{false, false, false}}
 Rotation symmetry around x-axis, y-axis, z-axis.
 
double m_bx0 = 0.
 
double m_by0 = 0.
 
double m_bz0 = 0.
 
bool m_debug = false
 Switch on/off debugging messages.
 

Detailed Description

Definition at line 9 of file ComponentUserMapBase.hh.

Constructor & Destructor Documentation

◆ ComponentUserMapBase()

Garfield::ComponentUserMapBase::ComponentUserMapBase ( )

Definition at line 5 of file ComponentUserMapBase.cc.

5 {
6 m_className = "ComponentUserMapBase";
7}
std::string m_className
Class name.

◆ ~ComponentUserMapBase()

Garfield::ComponentUserMapBase::~ComponentUserMapBase ( )
virtual

Definition at line 9 of file ComponentUserMapBase.cc.

9{}

Member Function Documentation

◆ ElectricField() [1/2]

void Garfield::ComponentUserMapBase::ElectricField ( const double  x,
const double  y,
const double  z,
double &  ex,
double &  ey,
double &  ez,
double &  v,
Medium *&  m,
int &  status 
)
virtual

Calculate the drift field [V/cm] and potential [V] at (x, y, z).

Implements Garfield::ComponentBase.

Definition at line 51 of file ComponentUserMapBase.cc.

54 {
55 double p1 = x, p2 = y, p3 = z;
56 double u1x = 1., u2x = 0., u3x = 0.;
57 double u1y = 0., u2y = 1., u3y = 0.;
58 double u1z = 0., u2z = 0., u3z = 1.;
59 double e1 = 0., e2 = 0., e3 = 0.;
60 ComponentBase* pComponent = NULL;
61
62 MapCoordinates(p1, p2, p3, u1x, u2x, u3x, u1y, u2y, u3y, u1z, u2z, u3z,
63 pComponent);
64
65 if (!pComponent) {
66 if (m_debug) {
67 std::cerr << m_className << "::ElectricField:\n";
68 std::cerr << " ComponentBase pointer is NULL for point (" << x << ", "
69 << y << "," << z << ")\n";
70 }
71 status = -6;
72 m = NULL;
73 return;
74 }
75
76 if (m_debug) {
77 std::cerr << m_className << "::ElectricField:\n";
78 std::cerr << " Coordinates: \n";
79 std::cerr << " Global: (" << x << ", " << y << ", " << z << ")\n";
80 std::cerr << " Local: (" << p1 << ", " << p2 << ", " << p3 << ")\n";
81 std::cerr << " Local base vectors: \n";
82 std::cerr << " u1: (" << u1x << ", " << u1y << ", " << u1z << ")\n";
83 std::cerr << " u2: (" << u2x << ", " << u2y << ", " << u2z << ")\n";
84 std::cerr << " u3: (" << u3x << ", " << u3y << ", " << u3z << ")\n";
85 }
86
87 pComponent->ElectricField(p1, p2, p3, e1, e2, e3, v, m, status);
88 UnmapField(e1, e2, e3, u1x, u2x, u3x, u1y, u2y, u3y, u1z, u2z, u3z, ex, ey,
89 ez);
90}
ComponentBase()
Constructor.
Definition: ComponentBase.cc:9
bool m_debug
Switch on/off debugging messages.
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
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

◆ ElectricField() [2/2]

void Garfield::ComponentUserMapBase::ElectricField ( const double  x,
const double  y,
const double  z,
double &  ex,
double &  ey,
double &  ez,
Medium *&  m,
int &  status 
)
virtual

Calculate the drift field at given point.

Parameters
x,y,zcoordinates [cm].
ex,ey,ezcomponents of the electric field [V/cm].
mpointer to the medium at this location.
statusstatus flag

Status flags:

        0: Inside an active medium
      > 0: Inside a wire of type X
-4 ... -1: On the side of a plane where no wires are
       -5: Inside the mesh but not in an active medium
       -6: Outside the mesh
      -10: Unknown potential type (should not occur)
    other: Other cases (should not occur)

Implements Garfield::ComponentBase.

Definition at line 44 of file ComponentUserMapBase.cc.

46 {
47 double v;
48 ElectricField(x, y, z, ex, ey, ez, v, m, status);
49}
void ElectricField(const double x, const double y, const double z, double &ex, double &ey, double &ez, Medium *&m, int &status)

Referenced by ElectricField().

◆ GetMedium()

Medium * Garfield::ComponentUserMapBase::GetMedium ( const double  x,
const double  y,
const double  z 
)
virtual

Get the medium at a given location (x, y, z).

Reimplemented from Garfield::ComponentBase.

Definition at line 11 of file ComponentUserMapBase.cc.

12 {
13 double p1 = x, p2 = y, p3 = z;
14 double u1x = 1., u2x = 0., u3x = 0.;
15 double u1y = 0., u2y = 1., u3y = 0.;
16 double u1z = 0., u2z = 0., u3z = 1.;
17 ComponentBase* pComponent = NULL;
18 MapCoordinates(p1, p2, p3, u1x, u2x, u3x, u1y, u2y, u3y, u1z, u2z, u3z,
19 pComponent);
20
21 if (!pComponent) {
22 if (m_debug) {
23 std::cerr << m_className << "::GetMedium:\n";
24 std::cerr << " ComponentBase pointer is NULL for point (" << x << ", "
25 << y << "," << z << ")\n";
26 }
27 return NULL;
28 }
29
30 if (m_debug) {
31 std::cerr << m_className << "::GetMedium:\n";
32 std::cerr << " Coordinates: \n";
33 std::cerr << " Global: (" << x << ", " << y << ", " << z << ")\n";
34 std::cerr << " Local: (" << p1 << ", " << p2 << ", " << p3 << ")\n";
35 std::cerr << " Local base vectors: \n";
36 std::cerr << " u1: (" << u1x << ", " << u1y << ", " << u1z << ")\n";
37 std::cerr << " u2: (" << u2x << ", " << u2y << ", " << u2z << ")\n";
38 std::cerr << " u3: (" << u3x << ", " << u3y << ", " << u3z << ")\n";
39 }
40
41 return pComponent->GetMedium(p1, p2, p3);
42}

◆ GetVoltageRange()

bool Garfield::ComponentUserMapBase::GetVoltageRange ( double &  vmin,
double &  vmax 
)
inlinevirtual

Calculate the voltage range [V].

Implements Garfield::ComponentBase.

Definition at line 21 of file ComponentUserMapBase.hh.

21 {
22 vmin = vmax = 0.;
23 return false;
24 }

◆ MapCoordinates() [1/2]

virtual void Garfield::ComponentUserMapBase::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 
)
pure virtual

◆ MapCoordinates() [2/2]

virtual void Garfield::ComponentUserMapBase::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 
)
inlinevirtual

Definition at line 49 of file ComponentUserMapBase.hh.

53 {
54 (void)label; // Suppress compiler warning
55 MapCoordinates(p1, p2, p3, u1x, u2x, u3x, u1y, u2y, u3y, u1z, u2z, u3z,
56 pComponent);
57 }

◆ Reset()

void Garfield::ComponentUserMapBase::Reset ( )
inlineprotectedvirtual

Reset the component.

Implements Garfield::ComponentBase.

Definition at line 60 of file ComponentUserMapBase.hh.

60{}

◆ UnmapField()

void Garfield::ComponentUserMapBase::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
inlineprotected

Definition at line 63 of file ComponentUserMapBase.hh.

67 {
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 }

Referenced by ElectricField(), and WeightingField().

◆ UpdatePeriodicity()

void Garfield::ComponentUserMapBase::UpdatePeriodicity ( )
protectedvirtual

Verify periodicities.

Implements Garfield::ComponentBase.

Definition at line 168 of file ComponentUserMapBase.cc.

168 {
169 if (m_debug) {
170 std::cerr << m_className << "::UpdatePeriodicity:\n";
171 std::cerr << " Periodicities should be implemented by overloading the "
172 << "MapCoordinates function.\n";
173 }
174}

◆ WeightingField()

void Garfield::ComponentUserMapBase::WeightingField ( const double  x,
const double  y,
const double  z,
double &  wx,
double &  wy,
double &  wz,
const std::string &  label 
)
virtual

Calculate the weighting field at a given point and for a given electrode.

Parameters
x,y,zcoordinates [cm].
wx,wy,wzcomponents of the weighting field [1/cm].
labelname of the electrode

Reimplemented from Garfield::ComponentBase.

Definition at line 92 of file ComponentUserMapBase.cc.

95 {
96 double p1 = x, p2 = y, p3 = z;
97 double u1x = 1., u2x = 0., u3x = 0.;
98 double u1y = 0., u2y = 1., u3y = 0.;
99 double u1z = 0., u2z = 0., u3z = 1.;
100 double w1 = 0., w2 = 0., w3 = 0.;
101 ComponentBase* pComponent = NULL;
102 std::string label_ = label;
103
104 MapCoordinates(p1, p2, p3, u1x, u2x, u3x, u1y, u2y, u3y, u1z, u2z, u3z,
105 pComponent, label_);
106
107 if (!pComponent) {
108 if (m_debug) {
109 std::cerr << m_className << "::WeightingField:\n";
110 std::cerr << " ComponentBase pointer is NULL for point (" << x << ", "
111 << y << "," << z << ")\n";
112 }
113 wx = wy = wz = 0.;
114 return;
115 }
116
117 if (m_debug) {
118 std::cerr << m_className << "::WeightingField:\n";
119 std::cerr << " Coordinates: \n";
120 std::cerr << " Global: (" << x << ", " << y << ", " << z << ")\n";
121 std::cerr << " Local: (" << p1 << ", " << p2 << ", " << p3 << ")\n";
122 std::cerr << " Local base vectors: \n";
123 std::cerr << " u1: (" << u1x << ", " << u1y << ", " << u1z << ")\n";
124 std::cerr << " u2: (" << u2x << ", " << u2y << ", " << u2z << ")\n";
125 std::cerr << " u3: (" << u3x << ", " << u3y << ", " << u3z << ")\n";
126 }
127
128 pComponent->WeightingField(p1, p2, p3, w1, w2, w3, label_);
129 UnmapField(w1, w2, w3, u1x, u2x, u3x, u1y, u2y, u3y, u1z, u2z, u3z, wx, wy,
130 wz);
131}

◆ WeightingPotential()

double Garfield::ComponentUserMapBase::WeightingPotential ( const double  x,
const double  y,
const double  z,
const std::string &  label 
)
virtual

Calculate the weighting potential at a given point.

Parameters
x,y,zcoordinates [cm].
labelname of the electrode.
Returns
weighting potential [dimensionless].

Reimplemented from Garfield::ComponentBase.

Definition at line 133 of file ComponentUserMapBase.cc.

135 {
136 double p1 = x, p2 = y, p3 = z;
137 double u1x = 1., u2x = 0., u3x = 0.;
138 double u1y = 0., u2y = 1., u3y = 0.;
139 double u1z = 0., u2z = 0., u3z = 1.;
140 ComponentBase* pComponent = NULL;
141 std::string label_ = label;
142 MapCoordinates(p1, p2, p3, u1x, u2x, u3x, u1y, u2y, u3y, u1z, u2z, u3z,
143 pComponent, label_);
144
145 if (!pComponent) {
146 if (m_debug) {
147 std::cerr << m_className << "::WeightingPotential:\n";
148 std::cerr << " ComponentBase pointer is NULL for point (" << x << ", "
149 << y << "," << z << ")\n";
150 }
151 return 0.;
152 }
153
154 if (m_debug) {
155 std::cerr << m_className << "::WeightingPotential:\n";
156 std::cerr << " Coordinates: \n";
157 std::cerr << " Global: (" << x << ", " << y << ", " << z << ")\n";
158 std::cerr << " Local: (" << p1 << ", " << p2 << ", " << p3 << ")\n";
159 std::cerr << " Local base vectors: \n";
160 std::cerr << " u1: (" << u1x << ", " << u1y << ", " << u1z << ")\n";
161 std::cerr << " u2: (" << u2x << ", " << u2y << ", " << u2z << ")\n";
162 std::cerr << " u3: (" << u3x << ", " << u3y << ", " << u3z << ")\n";
163 }
164
165 return pComponent->WeightingPotential(p1, p2, p3, label_);
166}

The documentation for this class was generated from the following files: