Garfield++ 4.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
|
Component for interpolating field maps on a regular mesh. More...
#include <ComponentGrid.hh>
Public Member Functions | |
ComponentGrid () | |
Constructor. | |
~ComponentGrid () | |
Destructor. | |
void | Clear () override |
Reset. | |
void | ElectricField (const double x, const double y, const double z, double &ex, double &ey, double &ez, double &v, Medium *&m, int &status) override |
Calculate the drift field [V/cm] and potential [V] at (x, y, z). | |
void | ElectricField (const double x, const double y, const double z, double &ex, double &ey, double &ez, Medium *&m, int &status) override |
void | WeightingField (const double x, const double y, const double z, double &wx, double &wy, double &wz, const std::string &label) override |
double | WeightingPotential (const double x, const double y, const double z, const std::string &label) override |
void | DelayedWeightingField (const double x, const double y, const double z, const double t, double &wx, double &wy, double &wz, const std::string &label) override |
void | MagneticField (const double x, const double y, const double z, double &bx, double &by, double &bz, int &status) override |
Medium * | GetMedium (const double x, const double y, const double z) override |
Get the medium at a given location (x, y, z). | |
bool | GetVoltageRange (double &vmin, double &vmax) override |
Calculate the voltage range [V]. | |
bool | GetElectricFieldRange (double &exmin, double &exmax, double &eymin, double &eymax, double &ezmin, double &ezmax) |
bool | GetBoundingBox (double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) override |
Get the bounding box coordinates. | |
bool | GetElementaryCell (double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) override |
Get the coordinates of the elementary cell. | |
bool | SetMesh (const unsigned int nx, const unsigned int ny, const unsigned int nz, const double xmin, const double xmax, const double ymin, const double ymax, const double zmin, const double zmax) |
bool | GetMesh (unsigned int &nx, unsigned int &ny, unsigned int &nz, double &xmin, double &xmax, double &ymin, double &ymax, double &zmin, double &zmax) const |
Retrieve the parameters of the grid. | |
bool | LoadElectricField (const std::string &filename, const std::string &format, const bool withPotential, const bool withFlag, const double scaleX=1., const double scaleE=1., const double scaleP=1.) |
bool | LoadWeightingField (const std::string &filename, const std::string &format, const bool withPotential, const double scaleX=1., const double scaleE=1., const double scaleP=1.) |
Import (prompt) weighting field from file. | |
bool | LoadWeightingField (const std::string &filename, const std::string &format, const double time, const bool withPotential, const double scaleX=1., const double scaleE=1., const double scaleP=1.) |
Import delayed weighting field from file. | |
void | SetWeightingFieldOffset (const double x, const double y, const double z) |
bool | LoadMagneticField (const std::string &filename, const std::string &format, const double scaleX=1., const double scaleB=1.) |
Import magnetic field values from a file. | |
bool | SaveElectricField (Component *cmp, const std::string &filename, const std::string &format) |
bool | SaveWeightingField (Component *cmp, const std::string &id, const std::string &filename, const std::string &format) |
bool | GetElectricField (const unsigned int i, const unsigned int j, const unsigned int k, double &v, double &ex, double &ey, double &ez) const |
Return the field at a given node. | |
void | SetMedium (Medium *m) |
Set the medium. | |
Medium * | GetMedium () const |
Get the medium. | |
void | Print () |
Print information about the mesh and the available data. | |
bool | LoadElectronAttachment (const std::string &fname, const std::string &fmt, const unsigned int col, const double scaleX=1.) |
bool | LoadHoleAttachment (const std::string &fname, const std::string &fmt, const unsigned int col, const double scaleX=1.) |
Import hole attachment coefficients from a file. | |
bool | HasAttachmentMap () const override |
Does the component have attachment maps? | |
bool | ElectronAttachment (const double x, const double y, const double z, double &att) override |
Get the electron attachment coefficient. | |
bool | HoleAttachment (const double x, const double y, const double z, double &att) override |
Get the hole attachment coefficient. | |
bool | LoadElectronVelocity (const std::string &fname, const std::string &fmt, const double scaleX=1., const double scaleV=1.e-9) |
bool | LoadHoleVelocity (const std::string &fname, const std::string &fmt, const double scaleX=1., const double scaleV=1.e-9) |
Import a map of hole drift velocities from a file. | |
bool | HasVelocityMap () const override |
Does the component have velocity maps? | |
bool | ElectronVelocity (const double x, const double y, const double z, double &vx, double &vy, double &vz) override |
Get the electron drift velocity. | |
bool | HoleVelocity (const double x, const double y, const double z, double &vx, double &vy, double &vz) override |
Get the hole drift velocity. | |
Public Member Functions inherited from Garfield::Component | |
Component ()=delete | |
Default constructor. | |
Component (const std::string &name) | |
Constructor. | |
virtual | ~Component () |
Destructor. | |
virtual void | SetGeometry (Geometry *geo) |
Define the geometry. | |
virtual void | Clear () |
Reset. | |
virtual Medium * | GetMedium (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 double | DelayedWeightingPotential (const double x, const double y, const double z, const double t, 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. | |
virtual bool | GetElementaryCell (double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) |
Get the coordinates of the elementary cell. | |
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 | IntegrateFluxParallelogram (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) |
double | IntegrateWeightingFluxParallelogram (const std::string &label, 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) |
double | IntegrateFluxLine (const double x0, const double y0, const double z0, const double x1, const double y1, const double z1, const double xp, const double yp, const double zp, const unsigned int nI, const int isign=0) |
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 direction. | |
void | EnablePeriodicityY (const bool on=true) |
Enable simple periodicity in the direction. | |
void | EnablePeriodicityZ (const bool on=true) |
Enable simple periodicity in the direction. | |
void | IsPeriodic (bool &perx, bool &pery, bool &perz) |
Return periodicity flags. | |
void | EnableMirrorPeriodicityX (const bool on=true) |
Enable mirror periodicity in the direction. | |
void | EnableMirrorPeriodicityY (const bool on=true) |
Enable mirror periodicity in the direction. | |
void | EnableMirrorPeriodicityZ (const bool on=true) |
Enable mirror periodicity in the direction. | |
void | IsMirrorPeriodic (bool &perx, bool &pery, bool &perz) |
Return mirror periodicity flags. | |
void | EnableAxialPeriodicityX (const bool on=true) |
Enable axial periodicity in the direction. | |
void | EnableAxialPeriodicityY (const bool on=true) |
Enable axial periodicity in the direction. | |
void | EnableAxialPeriodicityZ (const bool on=true) |
Enable axial periodicity in the direction. | |
void | IsAxiallyPeriodic (bool &perx, bool &pery, bool &perz) |
Return axial periodicity flags. | |
void | EnableRotationSymmetryX (const bool on=true) |
Enable rotation symmetry around the axis. | |
void | EnableRotationSymmetryY (const bool on=true) |
Enable rotation symmetry around the axis. | |
void | EnableRotationSymmetryZ (const bool on=true) |
Enable rotation symmetry around the axis. | |
void | IsRotationSymmetric (bool &rotx, bool &roty, bool &rotz) |
Return rotation symmetry flags. | |
void | EnableDebugging () |
Switch on debugging messages. | |
void | DisableDebugging () |
Switch off debugging messages. | |
virtual bool | HasAttachmentMap () const |
Does the component have attachment maps? | |
virtual bool | HasVelocityMap () const |
Does the component have velocity maps? | |
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 bool | ElectronVelocity (const double, const double, const double, double &vx, double &vy, double &vz) |
Get the electron drift velocity. | |
virtual bool | HoleVelocity (const double, const double, const double, double &vx, double &vy, double &vz) |
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) |
Additional Inherited Members | |
virtual void | Reset ()=0 |
Reset the component. | |
virtual void | UpdatePeriodicity ()=0 |
Verify periodicities. | |
Protected Attributes inherited from Garfield::Component | |
std::string | m_className = "Component" |
Class name. | |
Geometry * | m_geometry = nullptr |
Pointer to the geometry. | |
std::array< double, 3 > | m_b0 = {{0., 0., 0.}} |
Constant magnetic field. | |
bool | m_ready = false |
Ready for use? | |
bool | m_debug = false |
Switch on/off debugging messages. | |
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. | |
Component for interpolating field maps on a regular mesh.
Definition at line 12 of file ComponentGrid.hh.
Garfield::ComponentGrid::ComponentGrid | ( | ) |
|
inline |
|
inlineoverridevirtual |
Reset.
Reimplemented from Garfield::Component.
Definition at line 19 of file ComponentGrid.hh.
|
overridevirtual |
Calculate the delayed weighting field at a given point and time and for a given electrode.
x,y,z | coordinates [cm]. |
t | time [ns]. |
wx,wy,wz | components of the weighting field [1/cm]. |
label | name of the electrode |
Reimplemented from Garfield::Component.
Definition at line 118 of file ComponentGrid.cc.
|
overridevirtual |
Calculate the drift field [V/cm] and potential [V] at (x, y, z).
Implements Garfield::Component.
Definition at line 56 of file ComponentGrid.cc.
Referenced by ElectricField().
|
overridevirtual |
Calculate the drift field at given point.
x,y,z | coordinates [cm]. |
ex,ey,ez | components of the electric field [V/cm]. |
m | pointer to the medium at this location. |
status | status 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::Component.
Definition at line 84 of file ComponentGrid.cc.
|
overridevirtual |
Get the electron attachment coefficient.
Reimplemented from Garfield::Component.
Definition at line 1670 of file ComponentGrid.cc.
|
overridevirtual |
Get the electron drift velocity.
Reimplemented from Garfield::Component.
Definition at line 1341 of file ComponentGrid.cc.
|
overridevirtual |
Get the bounding box coordinates.
Reimplemented from Garfield::Component.
Definition at line 987 of file ComponentGrid.cc.
bool Garfield::ComponentGrid::GetElectricField | ( | const unsigned int | i, |
const unsigned int | j, | ||
const unsigned int | k, | ||
double & | v, | ||
double & | ex, | ||
double & | ey, | ||
double & | ez | ||
) | const |
Return the field at a given node.
Definition at line 1158 of file ComponentGrid.cc.
bool Garfield::ComponentGrid::GetElectricFieldRange | ( | double & | exmin, |
double & | exmax, | ||
double & | eymin, | ||
double & | eymax, | ||
double & | ezmin, | ||
double & | ezmax | ||
) |
Definition at line 1037 of file ComponentGrid.cc.
|
overridevirtual |
Get the coordinates of the elementary cell.
Reimplemented from Garfield::Component.
Definition at line 1016 of file ComponentGrid.cc.
|
inline |
|
overridevirtual |
Get the medium at a given location (x, y, z).
Reimplemented from Garfield::Component.
Definition at line 178 of file ComponentGrid.cc.
bool Garfield::ComponentGrid::GetMesh | ( | unsigned int & | nx, |
unsigned int & | ny, | ||
unsigned int & | nz, | ||
double & | xmin, | ||
double & | xmax, | ||
double & | ymin, | ||
double & | ymax, | ||
double & | zmin, | ||
double & | zmax | ||
) | const |
Retrieve the parameters of the grid.
Definition at line 259 of file ComponentGrid.cc.
|
overridevirtual |
Calculate the voltage range [V].
Implements Garfield::Component.
Definition at line 1030 of file ComponentGrid.cc.
|
inlineoverridevirtual |
Does the component have attachment maps?
Reimplemented from Garfield::Component.
Definition at line 150 of file ComponentGrid.hh.
|
inlineoverridevirtual |
Does the component have velocity maps?
Reimplemented from Garfield::Component.
Definition at line 174 of file ComponentGrid.hh.
|
overridevirtual |
Get the hole attachment coefficient.
Reimplemented from Garfield::Component.
Definition at line 1680 of file ComponentGrid.cc.
|
overridevirtual |
Get the hole drift velocity.
Reimplemented from Garfield::Component.
Definition at line 1353 of file ComponentGrid.cc.
bool Garfield::ComponentGrid::LoadElectricField | ( | const std::string & | filename, |
const std::string & | format, | ||
const bool | withPotential, | ||
const bool | withFlag, | ||
const double | scaleX = 1. , |
||
const double | scaleE = 1. , |
||
const double | scaleP = 1. |
||
) |
Import electric field and potential values from a file. The file is supposed to contain one line for each grid point starting with
followed by
Format types are:
Definition at line 276 of file ComponentGrid.cc.
bool Garfield::ComponentGrid::LoadElectronAttachment | ( | const std::string & | fname, |
const std::string & | fmt, | ||
const unsigned int | col, | ||
const double | scaleX = 1. |
||
) |
Import electron attachment coefficients from a file.
fname | name of the text file. |
fmt | format string ("XY", "XYZ", "IJ", "IJK"). |
col | column in the file which has the attachment coefficient. |
scaleX | scaling factor to be applied to the coordinates. |
Definition at line 1365 of file ComponentGrid.cc.
bool Garfield::ComponentGrid::LoadElectronVelocity | ( | const std::string & | fname, |
const std::string & | fmt, | ||
const double | scaleX = 1. , |
||
const double | scaleV = 1.e-9 |
||
) |
Import a map of electron drift velocities from a file.
fname | name of the text file. |
fmt | format string ("XY", "XYZ", "IJ", "IJK"). |
scaleX | scaling factor to be applied to the coordinates. |
scaleV | scaling factor to be applied to the velocity components. |
Definition at line 1319 of file ComponentGrid.cc.
bool Garfield::ComponentGrid::LoadHoleAttachment | ( | const std::string & | fname, |
const std::string & | fmt, | ||
const unsigned int | col, | ||
const double | scaleX = 1. |
||
) |
Import hole attachment coefficients from a file.
Definition at line 1373 of file ComponentGrid.cc.
bool Garfield::ComponentGrid::LoadHoleVelocity | ( | const std::string & | fname, |
const std::string & | fmt, | ||
const double | scaleX = 1. , |
||
const double | scaleV = 1.e-9 |
||
) |
Import a map of hole drift velocities from a file.
Definition at line 1330 of file ComponentGrid.cc.
bool Garfield::ComponentGrid::LoadMagneticField | ( | const std::string & | filename, |
const std::string & | format, | ||
const double | scaleX = 1. , |
||
const double | scaleB = 1. |
||
) |
Import magnetic field values from a file.
Definition at line 332 of file ComponentGrid.cc.
bool Garfield::ComponentGrid::LoadWeightingField | ( | const std::string & | filename, |
const std::string & | format, | ||
const bool | withPotential, | ||
const double | scaleX = 1. , |
||
const double | scaleE = 1. , |
||
const double | scaleP = 1. |
||
) |
Import (prompt) weighting field from file.
Definition at line 298 of file ComponentGrid.cc.
Referenced by main().
bool Garfield::ComponentGrid::LoadWeightingField | ( | const std::string & | filename, |
const std::string & | format, | ||
const double | time, | ||
const bool | withPotential, | ||
const double | scaleX = 1. , |
||
const double | scaleE = 1. , |
||
const double | scaleP = 1. |
||
) |
Import delayed weighting field from file.
Definition at line 310 of file ComponentGrid.cc.
|
overridevirtual |
Calculate the magnetic field at a given point.
x,y,z | coordinates [cm]. |
bx,by,bz | components of the magnetic field [Tesla]. |
status | status flag. |
Reimplemented from Garfield::Component.
Definition at line 163 of file ComponentGrid.cc.
void Garfield::ComponentGrid::Print | ( | ) |
Print information about the mesh and the available data.
Definition at line 1182 of file ComponentGrid.cc.
Referenced by main().
bool Garfield::ComponentGrid::SaveElectricField | ( | Component * | cmp, |
const std::string & | filename, | ||
const std::string & | format | ||
) |
Export the electric field and potential of a component to a text file.
cmp | Component object for which to export the field/potential |
filename | name of the text file |
format | "xy", "xyz", "ij" or "ijk", see LoadElectricField |
Definition at line 344 of file ComponentGrid.cc.
bool Garfield::ComponentGrid::SaveWeightingField | ( | Component * | cmp, |
const std::string & | id, | ||
const std::string & | filename, | ||
const std::string & | format | ||
) |
Export the weighting field and potential of a component to a text file.
cmp | Component object for which to export the field/potential |
id | identifier of the weighting field |
filename | name of the text file |
format | "xy", "xyz", "ij" or "ijk", see LoadElectricField |
Definition at line 419 of file ComponentGrid.cc.
void Garfield::ComponentGrid::SetMedium | ( | Medium * | m | ) |
Set the medium.
Definition at line 1064 of file ComponentGrid.cc.
bool Garfield::ComponentGrid::SetMesh | ( | const unsigned int | nx, |
const unsigned int | ny, | ||
const unsigned int | nz, | ||
const double | xmin, | ||
const double | xmax, | ||
const double | ymin, | ||
const double | ymax, | ||
const double | zmin, | ||
const double | zmax | ||
) |
Define the grid.
nx,ny,nz | number of nodes along . |
xmin,xmax | range along . |
ymin,ymax | range along . |
zmin,zmax | range along . |
Definition at line 217 of file ComponentGrid.cc.
void Garfield::ComponentGrid::SetWeightingFieldOffset | ( | const double | x, |
const double | y, | ||
const double | z | ||
) |
Offset coordinates in the weighting field, such that the same numerical weighting field map can be used for electrodes at different positions.
Definition at line 158 of file ComponentGrid.cc.
|
overridevirtual |
Calculate the weighting field at a given point and for a given electrode.
x,y,z | coordinates [cm]. |
wx,wy,wz | components of the weighting field [1/cm]. |
label | name of the electrode |
Reimplemented from Garfield::Component.
Definition at line 91 of file ComponentGrid.cc.
|
overridevirtual |
Calculate the weighting potential at a given point.
x,y,z | coordinates [cm]. |
label | name of the electrode. |
Reimplemented from Garfield::Component.
Definition at line 104 of file ComponentGrid.cc.