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

Calculate avalanches in a uniform electric field using avalanche statistics. More...

#include <AvalancheGrid.hh>

Classes

struct  AvalancheNode
struct  Path

Public Member Functions

 AvalancheGrid ()
 Default constructor.
 AvalancheGrid (Sensor *sensor)
 Constructor.
 ~AvalancheGrid ()=default
 Destructor.
void SetSensor (Sensor *sensor)
 Set the sensor.
void StartGridAvalanche ()
 Start grid based avalanche simulation.
void SetElectronVelocity (const double vx, const double vy, const double vz)
 Set the electron drift velocity (in cm / ns).
void SetElectronTownsend (const double town)
 Set the electron Townsend coefficient (in 1 / cm).
void SetElectronAttachment (const double att)
 Set the electron attachment coefficient (in 1 / cm).
void SetMaxAvalancheSize (const double size)
 Set the maximum avalanche size (1e7 by default).
void AddElectron (const double x, const double y, const double z, const double t=0, const int n=1)
 Add an electron to the initial configuration.
void AddElectrons (AvalancheMicroscopic *avmc)
 Import electrons from AvalancheMicroscopic object.
void SetGrid (const double xmin, const double xmax, const int xsteps, const double ymin, const double ymax, const int ysteps, const double zmin, const double zmax, const int zsteps)
 Set the grid.
int GetAmountOfStartingElectrons ()
 Returns the initial number of electrons in the avalanche.
int GetAvalancheSize ()
 Returns the final number of electrons in the avalanche.
void EnableDebugging ()
void Reset ()

Private Member Functions

bool SnapToGrid (const double x, const double y, const double z, const double v, const int n=1)
void NextAvalancheGridPoint ()
bool GetParameters (AvalancheNode &node)
void DeactivateNode (AvalancheNode &node)

Private Attributes

bool m_debug = false
double m_Townsend = -1
double m_Attachment = -1
double m_Velocity = 0.
std::vector< int > m_velNormal = {0, 0, 0}
double m_MaxSize = 1.6e7
bool m_Saturated = false
double m_SaturationTime = -1.
int m_nestart = 0.
std::vector< double > m_nLayer
std::string m_className = "AvalancheGrid"
Sensor * m_sensor = nullptr
bool m_printPar = false
std::vector< double > m_zgrid
 Grid points of z-coordinate.
double m_zStepSize = 0.
 Distance between the grid points.
std::vector< double > m_ygrid
 Grid points of y-coordinate.
double m_yStepSize = 0.
 Distance between the grid points.
std::vector< double > m_xgrid
 Grid points of x-coordinate.
double m_xStepSize = 0.
 Distance between the grid points.
bool m_gridset = false
 Keeps track if the grid has been defined.
int m_nTotal = 0
 Total amount of charge.
double m_time = 0
 Clock.
bool m_run = true
 Tracking if the charges are still in the drift gap.
std::vector< AvalancheNodem_activeNodes = {}

Detailed Description

Calculate avalanches in a uniform electric field using avalanche statistics.

Definition at line 16 of file AvalancheGrid.hh.

Constructor & Destructor Documentation

◆ AvalancheGrid() [1/2]

Garfield::AvalancheGrid::AvalancheGrid ( )
inline

Default constructor.

Definition at line 19 of file AvalancheGrid.hh.

19: AvalancheGrid(nullptr) {}
AvalancheGrid()
Default constructor.

◆ AvalancheGrid() [2/2]

Garfield::AvalancheGrid::AvalancheGrid ( Sensor * sensor)

Constructor.

◆ ~AvalancheGrid()

Garfield::AvalancheGrid::~AvalancheGrid ( )
default

Destructor.

Member Function Documentation

◆ AddElectron()

void Garfield::AvalancheGrid::AddElectron ( const double x,
const double y,
const double z,
const double t = 0,
const int n = 1 )

Add an electron to the initial configuration.

Parameters
xx-coordinate of initial electron.
yy-coordinate of initial electron.
zt-coordinate of initial electron.
tstarting time of avalanche.
nnumber of electrons at this point.

◆ AddElectrons()

void Garfield::AvalancheGrid::AddElectrons ( AvalancheMicroscopic * avmc)

Import electrons from AvalancheMicroscopic object.

◆ DeactivateNode()

void Garfield::AvalancheGrid::DeactivateNode ( AvalancheNode & node)
private

◆ EnableDebugging()

void Garfield::AvalancheGrid::EnableDebugging ( )
inline

Definition at line 79 of file AvalancheGrid.hh.

79{ m_debug = true; }

◆ GetAmountOfStartingElectrons()

int Garfield::AvalancheGrid::GetAmountOfStartingElectrons ( )
inline

Returns the initial number of electrons in the avalanche.

Definition at line 75 of file AvalancheGrid.hh.

◆ GetAvalancheSize()

int Garfield::AvalancheGrid::GetAvalancheSize ( )
inline

Returns the final number of electrons in the avalanche.

Definition at line 77 of file AvalancheGrid.hh.

77{ return m_nTotal; }
int m_nTotal
Total amount of charge.

◆ GetParameters()

bool Garfield::AvalancheGrid::GetParameters ( AvalancheNode & node)
private

◆ NextAvalancheGridPoint()

void Garfield::AvalancheGrid::NextAvalancheGridPoint ( )
private

◆ Reset()

void Garfield::AvalancheGrid::Reset ( )

◆ SetElectronAttachment()

void Garfield::AvalancheGrid::SetElectronAttachment ( const double att)
inline

Set the electron attachment coefficient (in 1 / cm).

Definition at line 44 of file AvalancheGrid.hh.

◆ SetElectronTownsend()

void Garfield::AvalancheGrid::SetElectronTownsend ( const double town)
inline

Set the electron Townsend coefficient (in 1 / cm).

Definition at line 42 of file AvalancheGrid.hh.

42{ m_Townsend = town; }

◆ SetElectronVelocity()

void Garfield::AvalancheGrid::SetElectronVelocity ( const double vx,
const double vy,
const double vz )
inline

Set the electron drift velocity (in cm / ns).

Definition at line 31 of file AvalancheGrid.hh.

31 {
32 double vel = std::sqrt(vx * vx + vy * vy + vz * vz);
33 if (vel != std::abs(vx) && vel != std::abs(vy) && vel != std::abs(vz))
34 return;
35 int nx = (int)vx / vel;
36 int ny = (int)vy / vel;
37 int nz = (int)vz / vel;
38 m_velNormal = {nx, ny, nz};
39 m_Velocity = -std::abs(vel);
40 }
std::vector< int > m_velNormal

◆ SetGrid()

void Garfield::AvalancheGrid::SetGrid ( const double xmin,
const double xmax,
const int xsteps,
const double ymin,
const double ymax,
const int ysteps,
const double zmin,
const double zmax,
const int zsteps )

Set the grid.

Parameters
xmin,xmaxx-coordinate range of the grid [cm].
xstepsnumber of x-coordinate points in the grid.
ymin,ymaxy-coordinate range of the grid [cm].
ystepsnumber of y-coordinate points in the grid.
zmin,zmaxz-coordinate range of the grid [cm].
zstepsnumber of z-coordinate points in the grid.

◆ SetMaxAvalancheSize()

void Garfield::AvalancheGrid::SetMaxAvalancheSize ( const double size)
inline

Set the maximum avalanche size (1e7 by default).

Definition at line 46 of file AvalancheGrid.hh.

46{ m_MaxSize = size; }

◆ SetSensor()

void Garfield::AvalancheGrid::SetSensor ( Sensor * sensor)
inline

Set the sensor.

Definition at line 26 of file AvalancheGrid.hh.

26{ m_sensor = sensor; }

◆ SnapToGrid()

bool Garfield::AvalancheGrid::SnapToGrid ( const double x,
const double y,
const double z,
const double v,
const int n = 1 )
private

◆ StartGridAvalanche()

void Garfield::AvalancheGrid::StartGridAvalanche ( )

Start grid based avalanche simulation.

Member Data Documentation

◆ m_activeNodes

std::vector<AvalancheNode> Garfield::AvalancheGrid::m_activeNodes = {}
private

Definition at line 154 of file AvalancheGrid.hh.

154{};

◆ m_Attachment

double Garfield::AvalancheGrid::m_Attachment = -1
private

Definition at line 88 of file AvalancheGrid.hh.

◆ m_className

std::string Garfield::AvalancheGrid::m_className = "AvalancheGrid"
private

Definition at line 104 of file AvalancheGrid.hh.

◆ m_debug

bool Garfield::AvalancheGrid::m_debug = false
private

Definition at line 84 of file AvalancheGrid.hh.

◆ m_gridset

bool Garfield::AvalancheGrid::m_gridset = false
private

Keeps track if the grid has been defined.

Definition at line 119 of file AvalancheGrid.hh.

◆ m_MaxSize

double Garfield::AvalancheGrid::m_MaxSize = 1.6e7
private

Definition at line 94 of file AvalancheGrid.hh.

◆ m_nestart

int Garfield::AvalancheGrid::m_nestart = 0.
private

Definition at line 100 of file AvalancheGrid.hh.

◆ m_nLayer

std::vector<double> Garfield::AvalancheGrid::m_nLayer
private

Definition at line 102 of file AvalancheGrid.hh.

◆ m_nTotal

int Garfield::AvalancheGrid::m_nTotal = 0
private

Total amount of charge.

Definition at line 120 of file AvalancheGrid.hh.

◆ m_printPar

bool Garfield::AvalancheGrid::m_printPar = false
private

Definition at line 108 of file AvalancheGrid.hh.

◆ m_run

bool Garfield::AvalancheGrid::m_run = true
private

Tracking if the charges are still in the drift gap.

Definition at line 122 of file AvalancheGrid.hh.

◆ m_Saturated

bool Garfield::AvalancheGrid::m_Saturated = false
private

Definition at line 96 of file AvalancheGrid.hh.

◆ m_SaturationTime

double Garfield::AvalancheGrid::m_SaturationTime = -1.
private

Definition at line 98 of file AvalancheGrid.hh.

◆ m_sensor

Sensor* Garfield::AvalancheGrid::m_sensor = nullptr
private

Definition at line 106 of file AvalancheGrid.hh.

◆ m_time

double Garfield::AvalancheGrid::m_time = 0
private

Clock.

Definition at line 121 of file AvalancheGrid.hh.

◆ m_Townsend

double Garfield::AvalancheGrid::m_Townsend = -1
private

Definition at line 86 of file AvalancheGrid.hh.

◆ m_velNormal

std::vector<int> Garfield::AvalancheGrid::m_velNormal = {0, 0, 0}
private

Definition at line 92 of file AvalancheGrid.hh.

92{0, 0, 0};

◆ m_Velocity

double Garfield::AvalancheGrid::m_Velocity = 0.
private

Definition at line 90 of file AvalancheGrid.hh.

◆ m_xgrid

std::vector<double> Garfield::AvalancheGrid::m_xgrid
private

Grid points of x-coordinate.

Definition at line 116 of file AvalancheGrid.hh.

◆ m_xStepSize

double Garfield::AvalancheGrid::m_xStepSize = 0.
private

Distance between the grid points.

Definition at line 117 of file AvalancheGrid.hh.

◆ m_ygrid

std::vector<double> Garfield::AvalancheGrid::m_ygrid
private

Grid points of y-coordinate.

Definition at line 113 of file AvalancheGrid.hh.

◆ m_yStepSize

double Garfield::AvalancheGrid::m_yStepSize = 0.
private

Distance between the grid points.

Definition at line 114 of file AvalancheGrid.hh.

◆ m_zgrid

std::vector<double> Garfield::AvalancheGrid::m_zgrid
private

Grid points of z-coordinate.

Definition at line 110 of file AvalancheGrid.hh.

◆ m_zStepSize

double Garfield::AvalancheGrid::m_zStepSize = 0.
private

Distance between the grid points.

Definition at line 111 of file AvalancheGrid.hh.


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