Garfield++ v2r0
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 ()
 
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 ( )

Definition at line 13 of file HeedFieldMap.cpp.

14 : m_x(0.),
15 m_y(0.),
16 m_z(0.),
17 m_sensor(NULL),
18 m_useEfield(false),
19 m_useBfield(false) {}

Member Function Documentation

◆ field_map()

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

Definition at line 21 of file HeedFieldMap.cpp.

22 {
23
24 const double x = pt.v.x * conv + m_x;
25 const double y = pt.v.y * conv + m_y;
26 const double z = pt.v.z * conv + m_z;
27
28 // Initialise the electric and magnetic field.
29 efield = vec(0., 0., 0.);
30 bfield = vec(0., 0., 0.);
31 mrange = DBL_MAX;
32
33 if (!m_sensor) {
34 std::cerr << "HeedFieldMap::field_map: Sensor not defined.\n";
35 return;
36 }
37
38 if (m_useEfield) {
39 double ex = 0., ey = 0., ez = 0.;
40 int status = 0;
41 Garfield::Medium* m = NULL;
42 m_sensor->ElectricField(x, y, z, ex, ey, ez, m, status);
43 efield.x = ex * 1.e-7;
44 efield.y = ey * 1.e-7;
45 efield.z = ez * 1.e-7;
46 }
47
48 if (m_useBfield) {
49 double bx = 0., by = 0., bz = 0.;
50 int status = 0;
51 m_sensor->MagneticField(x, y, z, bx, by, bz, status);
52 bfield.x = bx * 1.e-3;
53 bfield.y = by * 1.e-3;
54 bfield.z = bz * 1.e-3;
55 }
56}
Abstract base class for media.
Definition: Medium.hh:11
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:101
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:48

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

◆ inside()

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

Definition at line 58 of file HeedFieldMap.cpp.

58 {
59
60 const double x = pt.v.x * conv + m_x;
61 const double y = pt.v.y * conv + m_y;
62 const double z = pt.v.z * conv + m_z;
63 // Check if the point is inside the drift area.
64 if (!m_sensor->IsInArea(x, y, z)) return false;
65 // Check if the point is inside a medium.
66 Garfield::Medium* m = NULL;
67 if (!m_sensor->GetMedium(x, y, z, m) || !m) return false;
68 return m->IsIonisable();
69}
bool IsIonisable() const
Definition: Medium.hh:59
bool IsInArea(const double x, const double y, const double z)
Check if a point is inside the user area.
Definition: Sensor.cc:264
bool GetMedium(const double x, const double y, const double z, Medium *&medium)
Get the medium at (x, y, z).
Definition: Sensor.cc:150

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 }

Referenced by Garfield::TrackHeed::NewTrack(), Garfield::TrackHeed::TransportDeltaElectron(), and Garfield::TrackHeed::TransportPhoton().

◆ SetSensor()

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

◆ UseBfield()

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

Definition at line 26 of file HeedFieldMap.h.

26{ m_useBfield = flag; }

Referenced by Garfield::TrackHeed::DisableMagneticField(), and Garfield::TrackHeed::EnableMagneticField().

◆ UseEfield()

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

Definition at line 25 of file HeedFieldMap.h.

25{ m_useEfield = flag; }

Referenced by Garfield::TrackHeed::DisableElectricField(), and Garfield::TrackHeed::EnableElectricField().


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