Garfield++ 5.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 constexpr double voltpercm = CLHEP::volt / CLHEP::cm;
35 efield.x = ex * voltpercm;
36 efield.y = ey * voltpercm;
37 efield.z = ez * voltpercm;
38 }
39
40 if (m_useBfield) {
41 double bx = 0., by = 0., bz = 0.;
42 int status = 0;
43 m_sensor->MagneticField(x, y, z, bx, by, bz, status);
44 bfield.x = bx * CLHEP::tesla;
45 bfield.y = by * CLHEP::tesla;
46 bfield.z = bz * CLHEP::tesla;
47 }
48}

◆ inside()

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

Definition at line 50 of file HeedFieldMap.cpp.

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

◆ 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: