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

#include <ComponentUser.hh>

+ Inheritance diagram for Garfield::ComponentUser:

Public Member Functions

 ComponentUser ()
 
 ~ComponentUser ()
 
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)
 
bool GetVoltageRange (double &vmin, double &vmax)
 
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)
 
void SetElectricField (void(*f)(const double, const double, const double, double &, double &, double &))
 
void SetPotential (void(*f)(const double, const double, const double, double &))
 
void SetWeightingField (void(*f)(const double, const double, const double, double &, double &, double &, const std::string))
 
void SetWeightingPotential (void(*f)(const double, const double, const double, double &, const std::string))
 
- Public Member Functions inherited from Garfield::ComponentBase
 ComponentBase ()
 
virtual ~ComponentBase ()
 
virtual void SetGeometry (GeometryBase *geo)
 
virtual void Clear ()
 
virtual MediumGetMedium (const double &x, const double &y, const double &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
 
virtual bool GetVoltageRange (double &vmin, double &vmax)=0
 
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 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)
 
virtual bool IsReady ()
 
virtual bool GetBoundingBox (double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax)
 
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)
 
virtual bool IsInTrapRadius (double x0, double y0, double z0, double &xw, double &yw, double &rw)
 
void EnablePeriodicityX ()
 
void DisablePeriodicityX ()
 
void EnablePeriodicityY ()
 
void DisablePeriodicityY ()
 
void EnablePeriodicityZ ()
 
void DisablePeriodicityZ ()
 
void EnableMirrorPeriodicityX ()
 
void DisableMirrorPeriodicityX ()
 
void EnableMirrorPeriodicityY ()
 
void DisableMirrorPeriodicityY ()
 
void EnableMirrorPeriodicityZ ()
 
void DisableMirrorPeriodicityZ ()
 
void EnableAxialPeriodicityX ()
 
void DisableAxialPeriodicityX ()
 
void EnableAxialPeriodicityY ()
 
void DisableAxialPeriodicityY ()
 
void EnableAxialPeriodicityZ ()
 
void DisableAxialPeriodicityZ ()
 
void EnableRotationSymmetryX ()
 
void DisableRotationSymmetryX ()
 
void EnableRotationSymmetryY ()
 
void DisableRotationSymmetryY ()
 
void EnableRotationSymmetryZ ()
 
void DisableRotationSymmetryZ ()
 
void EnableDebugging ()
 
void DisableDebugging ()
 

Additional Inherited Members

virtual void Reset ()=0
 
virtual void UpdatePeriodicity ()=0
 
- Protected Attributes inherited from Garfield::ComponentBase
std::string m_className
 
GeometryBasetheGeometry
 
bool ready
 
bool xPeriodic
 
bool yPeriodic
 
bool zPeriodic
 
bool xMirrorPeriodic
 
bool yMirrorPeriodic
 
bool zMirrorPeriodic
 
bool xAxiallyPeriodic
 
bool yAxiallyPeriodic
 
bool zAxiallyPeriodic
 
bool xRotationSymmetry
 
bool yRotationSymmetry
 
bool zRotationSymmetry
 
double bx0
 
double by0
 
double bz0
 
bool debug
 

Detailed Description

Definition at line 10 of file ComponentUser.hh.

Constructor & Destructor Documentation

◆ ComponentUser()

Garfield::ComponentUser::ComponentUser ( )

Definition at line 7 of file ComponentUser.cc.

9 hasField(false),
10 field(0),
11 hasPotential(false),
12 potential(0),
13 hasWeightingField(false),
14 wfield(0),
15 hasWeightingPotential(false),
16 wpot(0) {
17
18 m_className = "ComponentUser";
19}

◆ ~ComponentUser()

Garfield::ComponentUser::~ComponentUser ( )
inline

Definition at line 16 of file ComponentUser.hh.

16{}

Member Function Documentation

◆ ElectricField() [1/2]

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

Implements Garfield::ComponentBase.

Definition at line 51 of file ComponentUser.cc.

54 {
55
56 if (!hasField) {
57 ex = ey = ez = v = 0.;
58 m = 0;
59 status = -10;
60 return;
61 }
62 field(x, y, z, ex, ey, ez);
63
64 if (hasPotential) {
65 potential(x, y, z, v);
66 } else {
67 v = 0.;
68 }
69
70 m = GetMedium(x, y, z);
71 if (m == NULL) {
72 if (debug) {
73 std::cerr << m_className << "::ElectricField:\n";
74 std::cerr << " (" << x << ", " << y << ", " << z << ")"
75 << " is not inside a medium.\n";
76 }
77 status = -6;
78 return;
79 }
80
81 if (m->IsDriftable()) {
82 status = 0;
83 } else {
84 status = -5;
85 }
86}
virtual Medium * GetMedium(const double &x, const double &y, const double &z)

◆ ElectricField() [2/2]

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

Implements Garfield::ComponentBase.

Definition at line 21 of file ComponentUser.cc.

23 {
24
25 if (!hasField) {
26 ex = ey = ez = 0.;
27 m = 0;
28 status = -10;
29 return;
30 }
31
32 field(x, y, z, ex, ey, ez);
33 m = GetMedium(x, y, z);
34 if (m == NULL) {
35 if (debug) {
36 std::cerr << m_className << "::ElectricField:\n";
37 std::cerr << " (" << x << ", " << y << ", " << z << ")"
38 << " is not inside a medium.\n";
39 }
40 status = -6;
41 return;
42 }
43
44 if (m->IsDriftable()) {
45 status = 0;
46 } else {
47 status = -5;
48 }
49}

◆ GetVoltageRange()

bool Garfield::ComponentUser::GetVoltageRange ( double &  vmin,
double &  vmax 
)
virtual

Implements Garfield::ComponentBase.

Definition at line 88 of file ComponentUser.cc.

88 {
89
90 vmin = vmax = 0.;
91 return false;
92}

◆ SetElectricField()

void Garfield::ComponentUser::SetElectricField ( void(*)(const double, const double, const double, double &, double &, double &)  f)

Definition at line 114 of file ComponentUser.cc.

116 {
117
118 if (f == 0) {
119 std::cerr << m_className << "::SetElectricField:\n";
120 std::cerr << " Function pointer is null.\n";
121 return;
122 }
123 field = f;
124 hasField = true;
125 ready = true;
126}

◆ SetPotential()

void Garfield::ComponentUser::SetPotential ( void(*)(const double, const double, const double, double &)  f)

Definition at line 128 of file ComponentUser.cc.

129 {
130
131 if (f == 0) {
132 std::cerr << m_className << "::SetPotential:\n";
133 std::cerr << " Function pointer is null.\n";
134 return;
135 }
136 potential = f;
137 hasPotential = true;
138}

◆ SetWeightingField()

void Garfield::ComponentUser::SetWeightingField ( void(*)(const double, const double, const double, double &, double &, double &, const std::string)  f)

Definition at line 140 of file ComponentUser.cc.

142 {
143
144 if (f == 0) {
145 std::cerr << m_className << "::SetWeightingField:\n";
146 std::cerr << " Function pointer is null.\n";
147 return;
148 }
149 wfield = f;
150 hasWeightingField = true;
151}

◆ SetWeightingPotential()

void Garfield::ComponentUser::SetWeightingPotential ( void(*)(const double, const double, const double, double &, const std::string)  f)

Definition at line 153 of file ComponentUser.cc.

155 {
156
157 if (f == 0) {
158 std::cerr << m_className << "::SetWeightingPotential:\n";
159 std::cerr << " Function pointer is null.\n";
160 return;
161 }
162 wpot = f;
163 hasWeightingPotential = true;
164}

◆ WeightingField()

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

Reimplemented from Garfield::ComponentBase.

Definition at line 94 of file ComponentUser.cc.

96 {
97
98 wx = wy = wz = 0.;
99 if (!hasWeightingField) return;
100 wfield(x, y, z, wx, wy, wz, label);
101}

◆ WeightingPotential()

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

Reimplemented from Garfield::ComponentBase.

Definition at line 103 of file ComponentUser.cc.

105 {
106
107 double v = 0.;
108 if (hasWeightingPotential) {
109 wpot(x, y, z, v, label);
110 }
111 return v;
112}

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