1#ifndef G_AVALANCHE_GRID_H
2#define G_AVALANCHE_GRID_H
38 double vel = sqrt(vx * vx + vy * vy + vz * vz);
39 if (vel != std::abs(vx) && vel != std::abs(vy) && vel != std::abs(vz))
return;
40 int nx = (int)vx / vel;
41 int ny = (int)vy / vel;
42 int nz = (int)vz / vel;
43 m_velNormal = {nx, ny, nz};
44 m_Velocity = -std::abs(vel);
56 m_DiffSigma = diffSigma;
66 const double t = 0,
const int n = 1);
71 void SetGrid(
const double xmin,
const double xmax,
const int xsteps,
72 const double ymin,
const double ymax,
const int ysteps,
73 const double zmin,
const double zmax,
const int zsteps);
83 double m_Townsend = -1;
85 double m_Attachment = -1;
87 double m_Velocity = 0.;
89 std::vector<int> m_velNormal = {0, 0, -1};
91 double m_MaxSize = 1.6e7;
93 bool m_Saturated =
false;
95 double m_SaturationTime =
98 bool m_diffusion =
false;
100 double m_DiffSigma = 0.;
104 bool m_driftAvalanche =
false;
105 bool m_importAvalanche =
false;
106 bool m_SensorParameters =
false;
108 std::string m_className =
"AvalancheGrid";
110 Sensor* m_sensor =
nullptr;
112 AvalancheMicroscopic* m_avmc =
nullptr;
115 std::vector<double> zgrid;
120 std::vector<double> ygrid;
121 double yStepSize = 0.;
124 std::vector<double> xgrid;
125 double xStepSize = 0.;
128 std::vector<std::vector<int>> gridPosition = {
131 bool gridset =
false;
133 std::vector<std::vector<std::vector<int>>>
149 void SetZGrid(Grid& av,
const double top,
const double bottom,
152 void SetYGrid(Grid& av,
const double top,
const double bottom,
155 void SetXGrid(Grid& av,
const double top,
const double bottom,
158 int GetAvalancheSize(
double dz,
const int nsize,
const double alpha,
161 bool SnapToGrid(Grid& av,
const double x,
const double y,
const double z,
162 const double v,
const int n = 1);
164 void NextAvalancheGridPoint(Grid& av);
167 void DiffusionFactors(Grid& av);
170 void GetParametersFromSensor();
172 void SortPositionVector();
void SetMaxAvalancheSize(const double size)
Set the maximum avalanche size (1e7 by default).
void GetElectronsFromAvalancheMicroscopic()
Import electron data from AvalancheMicroscopic class.
void SetSensor(Sensor *sensor)
Set the sensor.
void SetElectronTownsend(const double town)
Set the electron Townsend coefficient (in 1 / cm).
int GetAmountOfStartingElectrons()
void StartGridAvalanche()
void SetElectronAttachment(const double att)
Set the electron attachment coefficient (in 1 / cm).
AvalancheGrid()
Constructor.
void SetAvalancheMicroscopic(AvalancheMicroscopic *avmc)
Set the AvalancheMicroscopic.
void SetElectronVelocity(const double vx, const double vy, const double vz)
Set the electron drift velocity (in cm / ns).
void EnableDiffusion(const double diffSigma)
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)
Import electron data from AvalancheMicroscopic class.
void CreateAvalanche(const double x, const double y, const double z, const double t=0, const int n=1)
~AvalancheGrid()
Destructor.
Calculate electron drift lines and avalanches using microscopic tracking.