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

Wire. More...

#include <SolidWire.hh>

+ Inheritance diagram for Garfield::SolidWire:

Public Member Functions

 SolidWire (const double cx, const double cy, const double cz, const double r, const double lz)
 Constructor from centre, radius, and half-length.
 
 SolidWire (const double cx, const double cy, const double cz, const double r, const double lz, const double dx, const double dy, const double dz)
 Constructor from centre, radius, half-length and orientation.
 
 ~SolidWire ()
 Destructor.
 
bool IsInside (const double x, const double y, const double z, const bool tesselated) const override
 
bool GetBoundingBox (double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) const override
 Return the bounding box of the solid.
 
bool IsWire () const override
 Return true if the solid is a wire.
 
void SetHalfLength (const double lz)
 
void SetRadius (const double r)
 
double GetHalfLengthZ () const override
 Return the half-length along z.
 
double GetRadius () const override
 Return the radius.
 
bool SolidPanels (std::vector< Panel > &panels) override
 Retrieve the surface panels of the solid.
 
void SetDiscretisationLevel (const double dis) override
 Set the discretisation level (for all panels).
 
double GetDiscretisationLevel (const Panel &panel) override
 Retrieve the discretisation level of a panel.
 
void Cut (const double x0, const double y0, const double z0, const double xn, const double yn, const double zn, std::vector< Panel > &panels) override
 
- Public Member Functions inherited from Garfield::Solid
 Solid ()=delete
 Default constructor.
 
 Solid (const double cx, const double cy, const double cz, const std::string &name)
 Constructor.
 
virtual ~Solid ()
 Destructor.
 
virtual bool IsInside (const double x, const double y, const double z, const bool tesselated=false) const =0
 
virtual bool GetBoundingBox (double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) const =0
 Return the bounding box of the solid.
 
virtual bool IsBox () const
 Return true if the solid is a box.
 
virtual bool IsTube () const
 Return true if the solid is a tube.
 
virtual bool IsSphere () const
 Return true if the solid is a sphere.
 
virtual bool IsHole () const
 Return true if the solid is a hole.
 
virtual bool IsRidge () const
 Return true if the solid is a ridge.
 
virtual bool IsExtrusion () const
 Return true if the solid is an extrusion.
 
virtual bool IsWire () const
 Return true if the solid is a wire.
 
void SetLabel (const std::string &label)
 Set a label.
 
std::string GetLabel () const
 Return the label.
 
bool GetCentre (double &x, double &y, double &z) const
 Retrieve the centre point of the solid.
 
bool GetDirection (double &dx, double &dy, double &dz) const
 Retrieve the direction vector.
 
bool GetOrientation (double &ctheta, double &stheta, double &cphi, double &sphi) const
 Retrieve the orientation (azimuthal and polar angles) of the solid.
 
virtual double GetHalfLengthX () const
 Return the half-length along x.
 
virtual double GetHalfLengthY () const
 Return the half-length along y.
 
virtual double GetHalfLengthZ () const
 Return the half-length along z.
 
virtual double GetInnerRadius () const
 Return the inner radius.
 
virtual double GetOuterRadius () const
 Return the outer radius.
 
virtual double GetRadius () const
 Return the radius.
 
virtual double GetLowerRadius () const
 Return the lower radius (of a hole).
 
virtual double GetUpperRadius () const
 Return the upper radius (of a hole).
 
virtual double GetRidgeOffset () const
 Return the x-offset of a ridge.
 
virtual double GetRidgeHeight () const
 Return the height of a ridge.
 
virtual bool GetProfile (std::vector< double > &xv, std::vector< double > &yv) const
 Get the vertices defining an extrusion.
 
unsigned int GetId () const
 Get the ID of the solid.
 
virtual bool SolidPanels (std::vector< Panel > &panels)=0
 Retrieve the surface panels of the solid.
 
virtual void SetDiscretisationLevel (const double dis)=0
 Set the discretisation level (for all panels).
 
virtual double GetDiscretisationLevel (const Panel &panel)=0
 Retrieve the discretisation level of a panel.
 
virtual void Cut (const double x0, const double y0, const double z0, const double xn, const double yn, const double zn, std::vector< Panel > &panels)=0
 
void SetBoundaryPotential (const double v)
 Apply Dirichlet boundary conditions (fixed voltage).
 
void SetBoundaryChargeDensity (const double q)
 Apply fixed-charge boundary conditions.
 
void SetBoundaryFloat ()
 Make the potential at the surface of the solid floating.
 
void SetBoundaryDielectric ()
 Make the surfaces of the solid dielectric-dielectric interfaces.
 
void SetBoundaryParallelField ()
 
void SetBoundaryPerpendicularField ()
 
BoundaryCondition GetBoundaryConditionType () const
 Retrieve the type of boundary condition.
 
double GetBoundaryPotential () const
 Retrieve the potential.
 
double GetBoundaryChargeDensity () const
 Retrieve the surface charge density.
 
void EnableDebugging (const bool on=true)
 Switch debugging messages on/off.
 
void SetColour (const int col)
 Set the colour of the solid.
 
int GetColour () const
 Get the colour of the solid.
 

Additional Inherited Members

- Public Types inherited from Garfield::Solid
enum  BoundaryCondition {
  Unknown = 0 , Voltage , Charge , Float ,
  Dielectric , DielectricCharge , ParallelField , PerpendicularField
}
 
- Static Public Member Functions inherited from Garfield::Solid
static bool Intersect (const double x1, const double y1, const double z1, const double x2, const double y2, const double z2, const double x0, const double y0, const double z0, const double a, const double b, const double c, double &xc, double &yc, double &zc)
 
- Protected Member Functions inherited from Garfield::Solid
void ToLocal (const double x, const double y, const double z, double &u, double &v, double &w) const
 
void ToGlobal (const double u, const double v, const double w, double &x, double &y, double &z) const
 
void VectorToLocal (const double x, const double y, const double z, double &u, double &v, double &w)
 Transform a vector from global to local coordinates.
 
void SetDirection (const double dx, const double dy, const double dz)
 
- Protected Attributes inherited from Garfield::Solid
double m_cX = 0.
 Centre of the solid.
 
double m_cY = 0.
 
double m_cZ = 0.
 
double m_dX = 0.
 Direction vector.
 
double m_dY = 0.
 
double m_dZ = 1.
 
double m_cPhi = 1.
 Azimuthal angle.
 
double m_sPhi = 0.
 
double m_cTheta = 1.
 Polar angle.
 
double m_sTheta = 0.
 
std::string m_className = "Solid"
 Class name.
 
std::string m_label = ""
 Label.
 
bool m_debug = false
 Debug flag.
 
BoundaryCondition m_bctype = Unknown
 Type of boundary condition.
 
double m_volt = 0.
 Potential at the surface.
 
double m_charge = 0.
 Surface charge density.
 
double m_eps = 0.
 Dielectric constant.
 
int m_colour = -1
 Colour.
 

Detailed Description

Wire.

Definition at line 10 of file SolidWire.hh.

Constructor & Destructor Documentation

◆ SolidWire() [1/2]

Garfield::SolidWire::SolidWire ( const double  cx,
const double  cy,
const double  cz,
const double  r,
const double  lz 
)

Constructor from centre, radius, and half-length.

Definition at line 9 of file SolidWire.cc.

11 : Solid(cx, cy, cz, "SolidWire"),
12 m_r(rw),
13 m_lZ(lz) {}
Solid()=delete
Default constructor.

◆ SolidWire() [2/2]

Garfield::SolidWire::SolidWire ( const double  cx,
const double  cy,
const double  cz,
const double  r,
const double  lz,
const double  dx,
const double  dy,
const double  dz 
)

Constructor from centre, radius, half-length and orientation.

Definition at line 15 of file SolidWire.cc.

18 : SolidWire(cx, cy, cz, rw, lz) {
19 SetDirection(dx, dy, dz);
20}
SolidWire(const double cx, const double cy, const double cz, const double r, const double lz)
Constructor from centre, radius, and half-length.
Definition: SolidWire.cc:9
void SetDirection(const double dx, const double dy, const double dz)
Definition: Solid.cc:12

◆ ~SolidWire()

Garfield::SolidWire::~SolidWire ( )
inline

Destructor.

Definition at line 19 of file SolidWire.hh.

19{}

Member Function Documentation

◆ Cut()

void Garfield::SolidWire::Cut ( const double  x0,
const double  y0,
const double  z0,
const double  xn,
const double  yn,
const double  zn,
std::vector< Panel > &  panels 
)
overridevirtual

Implements Garfield::Solid.

Definition at line 80 of file SolidWire.cc.

83 {
84
85}

◆ GetBoundingBox()

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

Return the bounding box of the solid.

Implements Garfield::Solid.

Definition at line 34 of file SolidWire.cc.

35 {
36 if (m_cTheta == 1. && m_cPhi == 1.) {
37 xmin = m_cX - m_r;
38 xmax = m_cX + m_r;
39 ymin = m_cY - m_r;
40 ymax = m_cY + m_r;
41 zmin = m_cZ - m_lZ;
42 zmax = m_cZ + m_lZ;
43 return true;
44 }
45
46 const double dd = sqrt(m_r * m_r + m_lZ * m_lZ);
47 xmin = m_cX - dd;
48 xmax = m_cX + dd;
49 ymin = m_cY - dd;
50 ymax = m_cY + dd;
51 zmin = m_cZ - dd;
52 zmax = m_cZ + dd;
53 return true;
54}
double m_cZ
Definition: Solid.hh:202
double m_cTheta
Polar angle.
Definition: Solid.hh:209
double m_cY
Definition: Solid.hh:202
double m_cX
Centre of the solid.
Definition: Solid.hh:202
double m_cPhi
Azimuthal angle.
Definition: Solid.hh:207
DoubleAc sqrt(const DoubleAc &f)
Definition: DoubleAc.cpp:314

◆ GetDiscretisationLevel()

double Garfield::SolidWire::GetDiscretisationLevel ( const Panel panel)
overridevirtual

Retrieve the discretisation level of a panel.

Implements Garfield::Solid.

Definition at line 76 of file SolidWire.cc.

76 {
77 return m_dis;
78}

◆ GetHalfLengthZ()

double Garfield::SolidWire::GetHalfLengthZ ( ) const
inlineoverridevirtual

Return the half-length along z.

Reimplemented from Garfield::Solid.

Definition at line 30 of file SolidWire.hh.

30{ return m_lZ; }

◆ GetRadius()

double Garfield::SolidWire::GetRadius ( ) const
inlineoverridevirtual

Return the radius.

Reimplemented from Garfield::Solid.

Definition at line 31 of file SolidWire.hh.

31{ return m_r; }

◆ IsInside()

bool Garfield::SolidWire::IsInside ( const double  x,
const double  y,
const double  z,
const bool  tesselated 
) const
overridevirtual

Check whether a given point is inside the solid. If requested, use the tesselated approximation of the solid (if applicable).

Implements Garfield::Solid.

Definition at line 22 of file SolidWire.cc.

23 {
24 // Transform the point to local coordinates.
25 double u = x, v = y, w = z;
26 ToLocal(x, y, z, u, v, w);
27
28 if (fabs(w) > m_lZ) return false;
29
30 const double r = sqrt(u * u + v * v);
31 return r < m_r;
32}
void ToLocal(const double x, const double y, const double z, double &u, double &v, double &w) const
Definition: Solid.hh:234
DoubleAc fabs(const DoubleAc &f)
Definition: DoubleAc.h:615

◆ IsWire()

bool Garfield::SolidWire::IsWire ( ) const
inlineoverridevirtual

Return true if the solid is a wire.

Reimplemented from Garfield::Solid.

Definition at line 25 of file SolidWire.hh.

25{ return true; }

◆ SetDiscretisationLevel()

void Garfield::SolidWire::SetDiscretisationLevel ( const double  dis)
inlineoverridevirtual

Set the discretisation level (for all panels).

Implements Garfield::Solid.

Definition at line 34 of file SolidWire.hh.

34{ m_dis = dis; }

◆ SetHalfLength()

void Garfield::SolidWire::SetHalfLength ( const double  lz)

Definition at line 64 of file SolidWire.cc.

64 {
65 if (lz <= 0.) {
66 std::cerr << "SolidWire::SetHalfLength: Half-length must be > 0.\n";
67 return;
68 }
69 m_lZ = lz;
70}

◆ SetRadius()

void Garfield::SolidWire::SetRadius ( const double  r)

Definition at line 56 of file SolidWire.cc.

56 {
57 if (r <= 0.) {
58 std::cerr << "SolidWire::SetRadius: Radius must be > 0.\n";
59 return;
60 }
61 m_r = r;
62}

◆ SolidPanels()

bool Garfield::SolidWire::SolidPanels ( std::vector< Panel > &  panels)
overridevirtual

Retrieve the surface panels of the solid.

Implements Garfield::Solid.

Definition at line 72 of file SolidWire.cc.

72 {
73 return true;
74}

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