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

Retrieve electric and magnetic field from Sensor. More...

#include <HeedFieldMap.h>

Public Member Functions

 HeedFieldMap ()=default
 
void SetSensor (Garfield::Sensor *sensor)
 
void SetCentre (const double x, const double y, const double z)
 
void UseEfield (const bool flag)
 
void UseBfield (const bool flag)
 
void field_map (const point &pt, vec &efield, vec &bfield, vfloat &mrange) const
 
bool inside (const point &pt)
 

Detailed Description

Retrieve electric and magnetic field from Sensor.

Definition at line 15 of file HeedFieldMap.h.

Constructor & Destructor Documentation

◆ HeedFieldMap()

Heed::HeedFieldMap::HeedFieldMap ( )
default

Member Function Documentation

◆ field_map()

void Heed::HeedFieldMap::field_map ( const point pt,
vec efield,
vec bfield,
vfloat mrange 
) const

Definition at line 11 of file HeedFieldMap.cpp.

12 {
13
14 const double x = pt.v.x * conv + m_x;
15 const double y = pt.v.y * conv + m_y;
16 const double z = pt.v.z * conv + m_z;
17
18 // Initialise the electric and magnetic field.
19 efield.x = bfield.x = 0.;
20 efield.y = bfield.y = 0.;
21 efield.z = bfield.z = 0.;
22 mrange = DBL_MAX;
23
24 if (!m_sensor) {
25 std::cerr << "HeedFieldMap::field_map: Sensor not defined.\n";
26 return;
27 }
28
29 if (m_useEfield) {
30 double ex = 0., ey = 0., ez = 0.;
31 int status = 0;
32 Garfield::Medium* m = nullptr;
33 m_sensor->ElectricField(x, y, z, ex, ey, ez, m, status);
34 efield.x = ex * 1.e-7;
35 efield.y = ey * 1.e-7;
36 efield.z = ez * 1.e-7;
37 }
38
39 if (m_useBfield) {
40 double bx = 0., by = 0., bz = 0.;
41 int status = 0;
42 m_sensor->MagneticField(x, y, z, bx, by, bz, status);
43 bfield.x = bx * 1.e-3;
44 bfield.y = by * 1.e-3;
45 bfield.z = bz * 1.e-3;
46 }
47}
Abstract base class for media.
Definition: Medium.hh:13
void MagneticField(const double x, const double y, const double z, double &bx, double &by, double &bz, int &status)
Get the magnetic field at (x, y, z).
Definition: Sensor.cc:116
void ElectricField(const double x, const double y, const double z, double &ex, double &ey, double &ez, double &v, Medium *&medium, int &status)
Get the drift field and potential at (x, y, z).
Definition: Sensor.cc:65

Referenced by Heed::eparticle::force().

◆ inside()

bool Heed::HeedFieldMap::inside ( const point pt)

Definition at line 49 of file HeedFieldMap.cpp.

49 {
50
51 const double x = pt.v.x * conv + m_x;
52 const double y = pt.v.y * conv + m_y;
53 const double z = pt.v.z * conv + m_z;
54 // Check if the point is inside the drift area.
55 if (!m_sensor->IsInArea(x, y, z)) return false;
56 // Check if the point is inside a medium.
57 Garfield::Medium* m = nullptr;
58 if (!m_sensor->GetMedium(x, y, z, m) || !m) return false;
59 return m->IsIonisable();
60}
bool IsIonisable() const
Is charge deposition by charged particles/photon enabled in this medium?
Definition: Medium.hh:78
bool IsInArea(const double x, const double y, const double z)
Check if a point is inside the user area.
Definition: Sensor.cc:254
bool GetMedium(const double x, const double y, const double z, Medium *&medium)
Get the medium at (x, y, z).
Definition: Sensor.cc:159

Referenced by Heed::HeedDeltaElectron::physics_after_new_speed().

◆ SetCentre()

void Heed::HeedFieldMap::SetCentre ( const double  x,
const double  y,
const double  z 
)
inline

Definition at line 20 of file HeedFieldMap.h.

20 {
21 m_x = x;
22 m_y = y;
23 m_z = z;
24 }

◆ SetSensor()

void Heed::HeedFieldMap::SetSensor ( Garfield::Sensor sensor)
inline

Definition at line 19 of file HeedFieldMap.h.

19{ m_sensor = sensor; }

◆ UseBfield()

void Heed::HeedFieldMap::UseBfield ( const bool  flag)
inline

Definition at line 26 of file HeedFieldMap.h.

26{ m_useBfield = flag; }

◆ UseEfield()

void Heed::HeedFieldMap::UseEfield ( const bool  flag)
inline

Definition at line 25 of file HeedFieldMap.h.

25{ m_useEfield = flag; }

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