Garfield 0.3
Toolkit for the detailed simulation of particle detectors based on ionization measurement in gases and semiconductors
Loading...
Searching...
No Matches
Garfield::ComponentConstant Class Reference

Component with constant electric field. More...

#include <ComponentConstant.hh>

Inheritance diagram for Garfield::ComponentConstant:
Garfield::Component

Public Member Functions

 ComponentConstant ()
 Constructor.
 ~ComponentConstant ()
 Destructor.
void SetElectricField (const double ex, const double ey, const double ez)
 Set the components of the electric field [V / cm].
void SetPotential (const double x, const double y, const double z, const double v=0.)
 Specify the potential at a given point.
void SetWeightingField (const double wx, const double wy, const double wz, const std::string label)
 Set the components of the weighting field [1 / cm].
void SetWeightingPotential (const double x, const double y, const double z, const double v=0.)
 Specify the weighting potential at a given point.
void SetArea (const double xmin, const double ymin, const double zmin, const double xmax, const double ymax, const double zmax)
 Set the limits of the active area explicitly (instead of using a Geometry object).
void UnsetArea ()
 Remove the explicit limits of the active area.
void SetMedium (Medium *medium)
 Set the medium in the active area.
MediumGetMedium (const double x, const double y, const double z) override
 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) override
 Calculate the drift field at given point.
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).
bool GetVoltageRange (double &vmin, double &vmax) override
 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) override
 Calculate the weighting field at a given point and for a given electrode.
double WeightingPotential (const double x, const double y, const double z, const std::string &label) override
 Calculate the weighting potential at a given point.
bool GetBoundingBox (double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) override
 Get the bounding box coordinates.
std::array< double, 3 > ElectricField (const double x, const double y, const double z)
 Calculate the drift field [V/cm] at (x, y, z).
Public Member Functions inherited from Garfield::Component
 Component ()=delete
 Default constructor.
 Component (const std::string &name)
 Constructor.
virtual ~Component ()=default
 Destructor.
virtual void SetGeometry (Geometry *geo)
 Define the geometry.
virtual void Clear ()
 Reset.
std::array< double, 3 > ElectricField (const double x, const double y, const double z)
 Calculate the drift field [V/cm] at (x, y, z).
virtual double ElectricPotential (const double x, const double y, const double z)
 Calculate the (drift) electrostatic potential [V] at (x, y, z).
virtual const std::vector< double > & DelayedSignalTimes (const std::string &)
 Return the time steps at which the delayed weighting potential/field are stored/evaluated.
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)
 Calculate the delayed weighting field at a given point and time and for a given electrode.
virtual double DelayedWeightingPotential (const double x, const double y, const double z, const double t, const std::string &label)
 Calculate the delayed weighting potential at a given point and time and for a given electrode.
virtual void DelayedWeightingPotentials (const double x, const double y, const double z, const std::string &label, std::vector< double > &dwp)
 Calculate the delayed weighting potentials at a given point and for a given electrode, for a set of pre-defined times.
virtual void MagneticField (const double x, const double y, const double z, double &bx, double &by, double &bz, int &status)
 Calculate the magnetic field at a given point.
void SetMagneticField (const double bx, const double by, const double bz)
 Set a constant magnetic field.
virtual bool IsReady ()
 Ready for use?
virtual bool Is3d ()
 Does the component have a 3D field (map)?
virtual bool GetElementaryCell (double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax)
 Get the coordinates of the elementary cell.
double CellSizeX ()
double CellSizeY ()
double CellSizeZ ()
virtual size_t GetNumberOfElements () const
 Return the number of mesh elements.
virtual bool GetElementNodes (const size_t, std::vector< size_t > &) const
 Get the indices of the nodes constituting a given element.
virtual bool GetElementRegion (const size_t, size_t &, bool &) const
 Get the region/material of a mesh element and a flag whether it is associated to an active medium.
virtual size_t GetNumberOfNodes () const
 Return the number of mesh nodes.
virtual bool GetNode (const size_t i, double &x, double &y, double &z) const
 Get the coordinates of a mesh node.
double IntegrateFluxCircle (const double xc, const double yc, const double r, const unsigned int nI=50)
 Integrate the normal component of the electric field over a circle.
double IntegrateFluxSphere (const double xc, const double yc, const double zc, const double r, const unsigned int nI=20)
 Integrate the normal component of the electric field over a sphere.
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)
 Integrate the normal component of the electric field over a parallelogram.
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)
 Integrate the normal component of the weighting field over a parallelogram.
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)
 Integrate the electric field flux through a line from (x0,y0,z0) to (x1,y1,z1) along a direction (xp,yp,zp).
virtual bool CrossedWire (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)
 Determine whether the line between two points crosses a wire.
virtual bool InTrapRadius (const double q0, const double x0, const double y0, const double z0, double &xw, double &yw, double &rw)
 Determine whether a particle is inside the trap radius of a wire.
virtual bool CrossedPlane (const double x0, const double y0, const double z0, const double x1, const double y1, const double z1, double &xc, double &yc, double &zc)
 Determine whether the line between two points crosses a plane.
void EnablePeriodicityX (const bool on=true)
 Enable simple periodicity in the $x$ direction.
void EnablePeriodicityY (const bool on=true)
 Enable simple periodicity in the $y$ direction.
void EnablePeriodicityZ (const bool on=true)
 Enable simple periodicity in the $z$ direction.
void IsPeriodic (bool &perx, bool &pery, bool &perz)
 Return periodicity flags.
void EnableMirrorPeriodicityX (const bool on=true)
 Enable mirror periodicity in the $x$ direction.
void EnableMirrorPeriodicityY (const bool on=true)
 Enable mirror periodicity in the $y$ direction.
void EnableMirrorPeriodicityZ (const bool on=true)
 Enable mirror periodicity in the $y$ direction.
void IsMirrorPeriodic (bool &perx, bool &pery, bool &perz)
 Return mirror periodicity flags.
void EnableAxialPeriodicityX (const bool on=true)
 Enable axial periodicity in the $x$ direction.
void EnableAxialPeriodicityY (const bool on=true)
 Enable axial periodicity in the $y$ direction.
void EnableAxialPeriodicityZ (const bool on=true)
 Enable axial periodicity in the $z$ direction.
void IsAxiallyPeriodic (bool &perx, bool &pery, bool &perz)
 Return axial periodicity flags.
void EnableRotationSymmetryX (const bool on=true)
 Enable rotation symmetry around the $x$ axis.
void EnableRotationSymmetryY (const bool on=true)
 Enable rotation symmetry around the $y$ axis.
void EnableRotationSymmetryZ (const bool on=true)
 Enable rotation symmetry around the $z$ axis.
void IsRotationSymmetric (bool &rotx, bool &roty, bool &rotz)
 Return rotation symmetry flags.
void EnableTriangleSymmetricXY (const bool on=true, const bool oct=2)
 Enable triangular periodicity in the $xy$ plane.
void EnableTriangleSymmetricXZ (const bool on=true, const bool oct=2)
 Enable triangular periodicity in the $xz$ plane.
void EnableTriangleSymmetricYZ (const bool on=true, const bool oct=2)
 Enable triangular periodicity in the $yz$ plane.
void EnableDebugging (const bool on=true)
 Switch on debugging messages.
void DisableDebugging ()
 Switch off debugging messages.
virtual bool HasMagneticField () const
 Does the component have a non-zero magnetic field?
virtual bool HasTownsendMap () const
 Does the component have maps of the Townsend coefficient?
virtual bool HasAttachmentMap () const
 Does the component have maps of the attachment coefficient?
virtual bool HasMobilityMap () const
 Does the component have maps of the low-field mobility?
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 ElectronMobility (const double, const double, const double, double &mu)
virtual bool HoleMobility (const double, const double, const double, double &mu)
 Get the hole Mobility coefficient.
virtual bool ElectronTownsend (const double, const double, const double, double &alpha)
 Get the electron Townsend coefficient.
virtual bool HoleTownsend (const double, const double, const double, double &alpha)
 Get the hole Townsend 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 double StepSizeHint ()
virtual double CreateGPUTransferObject (ComponentGPU *&comp_gpu)
 Create and initialise GPU Transfer class.

Private Member Functions

void Reset () override
 Reset the component.
void UpdatePeriodicity () override
 Verify periodicities.
bool InArea (const double x, const double y, const double z)

Private Attributes

std::array< double, 3 > m_efield = {{0., 0., 0.}}
bool m_hasPotential = false
double m_x0 = 0.
double m_y0 = 0.
double m_z0 = 0.
double m_v0 = 0.
bool m_hasWeightingField = false
std::string m_label = ""
std::array< double, 3 > m_wfield = {{0., 0., 0.}}
bool m_hasWeightingPotential = false
double m_wx0 = 0.
double m_wy0 = 0.
double m_wz0 = 0.
double m_w0 = 0.
std::array< double, 3 > m_xmin = {{0., 0., 0.}}
std::array< double, 3 > m_xmax = {{0., 0., 0.}}
bool m_hasArea = false
Mediumm_medium = nullptr

Additional Inherited Members

Protected Attributes inherited from Garfield::Component
std::string m_className {"Component"}
 Class name.
Geometrym_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.
std::array< bool, 3 > m_triangleSymmetric = {{false, false, false}}
 Triangle symmetric in the xy, xz, and yz plane.
int m_triangleSymmetricOct = 0
 Triangle symmetric octant of imported map (0 < phi < Pi/4 --> octant 1).
const std::array< int, 4 > m_triangleOctRules = {1, 4, 5, 8}
 Octants where |x| >= |y|.
bool m_outsideCone = false
std::vector< double > m_wdtimes
 Time steps at which the delayed weighting potentials/fields are stored.

Detailed Description

Component with constant electric field.

Definition at line 13 of file ComponentConstant.hh.

Constructor & Destructor Documentation

◆ ComponentConstant()

Garfield::ComponentConstant::ComponentConstant ( )

Constructor.

◆ ~ComponentConstant()

Garfield::ComponentConstant::~ComponentConstant ( )
inline

Destructor.

Definition at line 18 of file ComponentConstant.hh.

18{}

Member Function Documentation

◆ ElectricField() [1/3]

std::array< double, 3 > Garfield::Component::ElectricField ( const double x,
const double y,
const double z )

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

◆ ElectricField() [2/3]

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

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

Implements Garfield::Component.

◆ ElectricField() [3/3]

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

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::Component.

◆ GetBoundingBox()

bool Garfield::ComponentConstant::GetBoundingBox ( double & xmin,
double & ymin,
double & zmin,
double & xmax,
double & ymax,
double & zmax )
overridevirtual

Get the bounding box coordinates.

Reimplemented from Garfield::Component.

◆ GetMedium()

Medium * Garfield::ComponentConstant::GetMedium ( const double x,
const double y,
const double z )
overridevirtual

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

Reimplemented from Garfield::Component.

◆ GetVoltageRange()

bool Garfield::ComponentConstant::GetVoltageRange ( double & vmin,
double & vmax )
overridevirtual

Calculate the voltage range [V].

Implements Garfield::Component.

◆ InArea()

bool Garfield::ComponentConstant::InArea ( const double x,
const double y,
const double z )
inlineprivate

Definition at line 94 of file ComponentConstant.hh.

94 {
95 if (x < m_xmin[0] || x > m_xmax[0] || y < m_xmin[1] || y > m_xmax[1] ||
96 z < m_xmin[2] || z > m_xmax[2]) {
97 return false;
98 }
99 return true;
100 }
std::array< double, 3 > m_xmin
std::array< double, 3 > m_xmax

◆ Reset()

void Garfield::ComponentConstant::Reset ( )
overrideprivatevirtual

Reset the component.

Implements Garfield::Component.

◆ SetArea()

void Garfield::ComponentConstant::SetArea ( const double xmin,
const double ymin,
const double zmin,
const double xmax,
const double ymax,
const double zmax )

Set the limits of the active area explicitly (instead of using a Geometry object).

◆ SetElectricField()

void Garfield::ComponentConstant::SetElectricField ( const double ex,
const double ey,
const double ez )

Set the components of the electric field [V / cm].

◆ SetMedium()

void Garfield::ComponentConstant::SetMedium ( Medium * medium)
inline

Set the medium in the active area.

Definition at line 40 of file ComponentConstant.hh.

40{ m_medium = medium; }

◆ SetPotential()

void Garfield::ComponentConstant::SetPotential ( const double x,
const double y,
const double z,
const double v = 0. )

Specify the potential at a given point.

◆ SetWeightingField()

void Garfield::ComponentConstant::SetWeightingField ( const double wx,
const double wy,
const double wz,
const std::string label )

Set the components of the weighting field [1 / cm].

◆ SetWeightingPotential()

void Garfield::ComponentConstant::SetWeightingPotential ( const double x,
const double y,
const double z,
const double v = 0. )

Specify the weighting potential at a given point.

◆ UnsetArea()

void Garfield::ComponentConstant::UnsetArea ( )

Remove the explicit limits of the active area.

◆ UpdatePeriodicity()

void Garfield::ComponentConstant::UpdatePeriodicity ( )
overrideprivatevirtual

Verify periodicities.

Implements Garfield::Component.

◆ WeightingField()

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

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::Component.

◆ WeightingPotential()

double Garfield::ComponentConstant::WeightingPotential ( const double x,
const double y,
const double z,
const std::string & label )
overridevirtual

Calculate the weighting potential at a given point.

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

Reimplemented from Garfield::Component.

Member Data Documentation

◆ m_efield

std::array<double, 3> Garfield::ComponentConstant::m_efield = {{0., 0., 0.}}
private

Definition at line 61 of file ComponentConstant.hh.

61{{0., 0., 0.}};

◆ m_hasArea

bool Garfield::ComponentConstant::m_hasArea = false
private

Definition at line 87 of file ComponentConstant.hh.

◆ m_hasPotential

bool Garfield::ComponentConstant::m_hasPotential = false
private

Definition at line 64 of file ComponentConstant.hh.

◆ m_hasWeightingField

bool Garfield::ComponentConstant::m_hasWeightingField = false
private

Definition at line 71 of file ComponentConstant.hh.

◆ m_hasWeightingPotential

bool Garfield::ComponentConstant::m_hasWeightingPotential = false
private

Definition at line 77 of file ComponentConstant.hh.

◆ m_label

std::string Garfield::ComponentConstant::m_label = ""
private

Definition at line 73 of file ComponentConstant.hh.

◆ m_medium

Medium* Garfield::ComponentConstant::m_medium = nullptr
private

Definition at line 89 of file ComponentConstant.hh.

◆ m_v0

double Garfield::ComponentConstant::m_v0 = 0.
private

Definition at line 68 of file ComponentConstant.hh.

◆ m_w0

double Garfield::ComponentConstant::m_w0 = 0.
private

Definition at line 81 of file ComponentConstant.hh.

◆ m_wfield

std::array<double, 3> Garfield::ComponentConstant::m_wfield = {{0., 0., 0.}}
private

Definition at line 75 of file ComponentConstant.hh.

75{{0., 0., 0.}};

◆ m_wx0

double Garfield::ComponentConstant::m_wx0 = 0.
private

Definition at line 79 of file ComponentConstant.hh.

◆ m_wy0

double Garfield::ComponentConstant::m_wy0 = 0.
private

Definition at line 79 of file ComponentConstant.hh.

◆ m_wz0

double Garfield::ComponentConstant::m_wz0 = 0.
private

Definition at line 79 of file ComponentConstant.hh.

◆ m_x0

double Garfield::ComponentConstant::m_x0 = 0.
private

Definition at line 66 of file ComponentConstant.hh.

◆ m_xmax

std::array<double, 3> Garfield::ComponentConstant::m_xmax = {{0., 0., 0.}}
private

Definition at line 85 of file ComponentConstant.hh.

85{{0., 0., 0.}};

◆ m_xmin

std::array<double, 3> Garfield::ComponentConstant::m_xmin = {{0., 0., 0.}}
private

Definition at line 84 of file ComponentConstant.hh.

84{{0., 0., 0.}};

◆ m_y0

double Garfield::ComponentConstant::m_y0 = 0.
private

Definition at line 66 of file ComponentConstant.hh.

◆ m_z0

double Garfield::ComponentConstant::m_z0 = 0.
private

Definition at line 66 of file ComponentConstant.hh.


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