1#ifndef G_AVALANCHE_GRID_H
2#define G_AVALANCHE_GRID_H
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))
35 int nx = (int)vx / vel;
36 int ny = (int)vy / vel;
37 int nz = (int)vz / vel;
56 void AddElectron(
const double x,
const double y,
const double z,
57 const double t = 0,
const int n = 1);
70 void SetGrid(
const double xmin,
const double xmax,
const int xsteps,
71 const double ymin,
const double ymax,
const int ysteps,
72 const double zmin,
const double zmax,
const int zsteps);
125 std::vector<double>
ts = {};
126 std::vector<std::array<double, 3> >
xs = {};
127 std::vector<double>
qs = {};
157 bool SnapToGrid(
const double x,
const double y,
const double z,
158 const double v,
const int n = 1);
~AvalancheGrid()=default
Destructor.
std::vector< AvalancheNode > m_activeNodes
void SetMaxAvalancheSize(const double size)
Set the maximum avalanche size (1e7 by default).
double m_yStepSize
Distance between the grid points.
void SetSensor(Sensor *sensor)
Set the sensor.
std::vector< double > m_nLayer
int m_nTotal
Total amount of charge.
bool m_gridset
Keeps track if the grid has been defined.
void DeactivateNode(AvalancheNode &node)
void SetElectronTownsend(const double town)
Set the electron Townsend coefficient (in 1 / cm).
double m_xStepSize
Distance between the grid points.
int GetAmountOfStartingElectrons()
Returns the initial number of electrons in the avalanche.
void StartGridAvalanche()
Start grid based avalanche simulation.
std::vector< double > m_ygrid
Grid points of y-coordinate.
double m_zStepSize
Distance between the grid points.
void SetElectronAttachment(const double att)
Set the electron attachment coefficient (in 1 / cm).
AvalancheGrid()
Default constructor.
bool GetParameters(AvalancheNode &node)
bool m_run
Tracking if the charges are still in the drift gap.
void NextAvalancheGridPoint()
void SetElectronVelocity(const double vx, const double vy, const double vz)
Set the electron drift velocity (in cm / ns).
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 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 GetAvalancheSize()
Returns the final number of electrons in the avalanche.
std::vector< int > m_velNormal
std::vector< double > m_zgrid
Grid points of z-coordinate.
void AddElectrons(AvalancheMicroscopic *avmc)
Import electrons from AvalancheMicroscopic object.
std::vector< double > m_xgrid
Grid points of x-coordinate.
bool SnapToGrid(const double x, const double y, const double z, const double v, const int n=1)
AvalancheGrid(Sensor *sensor)
Constructor.
Calculate electron drift lines and avalanches using microscopic tracking.
Component for parallel-plate geometries.
std::vector< int > velNormal
std::vector< std::array< double, 3 > > xs