Garfield++ v1r0
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{
9
11{
12 public:
14 virtual ~ComponentUserMapBase();
15
16 Medium* GetMedium(const double& x, const double& y, const double& z);
17
18 void ElectricField(const double x, const double y, const double z, double& ex,
19 double& ey, double& ez, Medium*& m, int& status);
20 void ElectricField(const double x, const double y, const double z, double& ex,
21 double& ey, double& ez, double& v, Medium*& m,
22 int& status);
23 bool GetVoltageRange(double& vmin, double& vmax){ vmin = vmax = 0.; return false; }
24
25 void WeightingField(const double x, const double y, const double z,
26 double& wx, double& wy, double& wz,
27 const std::string label);
28 double WeightingPotential(const double x, const double y, const double z,
29 const std::string label);
30
31 // This method should be overloaded in derived classes to implement the
32 // coordinate mapping. For example, when ComponentUserMapBase::ElectricField
33 // calls this method, the parameters p1, p2, and p3 will contain the global
34 // coordinates (x, y, z). MapCoordinates should then map them to local
35 // coordinates. It should also set pComponent to the component that will be
36 // used with these coordinates. In order to properly unmap the field, this
37 // method should also set the local base vectors u1, u2 and u3. Their initial
38 // values will be u1 = (1, 0, 0), u2 = (0, 1, 0), and u3 = (0, 0, 1).
39 virtual void MapCoordinates(double& p1 , double& p2 , double& p3 ,
40 double& u1x, double& u2x, double& u3x,
41 double& u1y, double& u2y, double& u3y,
42 double& u1z, double& u2z, double& u3z,
43 ComponentBase*& pComponent) = 0;
44
45 // Overloading this method is optional. It enables the use of a separate
46 // coordinate mapping for weighting fields. And allows the user to parse the
47 // label and change it.
48 virtual void MapCoordinates(double& p1 , double& p2 , double& p3 ,
49 double& u1x, double& u2x, double& u3x,
50 double& u1y, double& u2y, double& u3y,
51 double& u1z, double& u2z, double& u3z,
52 ComponentBase*& pComponent,
53 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
61 void Reset(){}
62 void UpdatePeriodicity();
63
64 void UnmapField(const double e1 , const double e2 , const double e3 ,
65 const double u1x, const double u2x, const double u3x,
66 const double u1y, const double u2y, const double u3y,
67 const double u1z, const double u2z, const double u3z,
68 double& ex, double& ey, double& ez) const
69 {
70 ex = u1x*e1 + u2x*e2 + u3x*e3;
71 ey = u1y*e1 + u2y*e2 + u3y*e3;
72 ez = u1z*e1 + u2z*e2 + u3z*e3;
73 }
74};
75
76}
77
78#endif //COMPONENT_USER_MAP_BASE_H
79
void WeightingField(const double x, const double y, const double z, double &wx, double &wy, double &wz, const std::string label)
bool GetVoltageRange(double &vmin, double &vmax)
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)
double WeightingPotential(const double x, const double y, const double z, const std::string label)
Medium * GetMedium(const double &x, const double &y, const double &z)
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)