1#ifndef G_AVALANCHE_MC_H
2#define G_AVALANCHE_MC_H
82 m_scaleElectronSignal = scale;
86 m_scaleHoleSignal = scale;
90 m_scaleIonSignal = scale;
108 return m_endpointsElectrons.size();
111 return m_endpointsHoles.size();
114 return m_endpointsIons.size();
125 double& z0,
double& t0,
double& x1,
double& y1,
126 double& z1,
double& t1,
int& status)
const;
127 void GetHoleEndpoint(
const unsigned int i,
double& x0,
double& y0,
double& z0,
128 double& t0,
double& x1,
double& y1,
double& z1,
129 double& t1,
int& status)
const;
130 void GetIonEndpoint(
const unsigned int i,
double& x0,
double& y0,
double& z0,
131 double& t0,
double& x1,
double& y1,
double& z1,
132 double& t1,
int& status)
const;
135 bool DriftElectron(
const double x0,
const double y0,
const double z0,
137 bool DriftHole(
const double x0,
const double y0,
const double z0,
139 bool DriftIon(
const double x0,
const double y0,
const double z0,
143 const double t0,
const bool hole =
false);
144 bool AvalancheHole(
const double x0,
const double y0,
const double z0,
145 const double t0,
const bool electron =
false);
154 std::string m_className;
166 std::vector<DriftPoint> m_drift;
183 bool m_hasTimeWindow;
185 double m_tMin, m_tMax;
188 unsigned int m_nElectrons;
190 unsigned int m_nHoles;
192 unsigned int m_nIons;
195 double x0, y0, z0, t0;
196 double x1, y1, z1, t1;
200 std::vector<EndPoint> m_endpointsElectrons;
202 std::vector<EndPoint> m_endpointsHoles;
204 std::vector<EndPoint> m_endpointsIons;
209 bool m_useInducedCharge;
210 bool m_useEquilibration;
212 bool m_useAttachment;
215 bool m_withElectrons;
217 double m_scaleElectronSignal;
218 double m_scaleHoleSignal;
219 double m_scaleIonSignal;
222 bool m_useTcadTrapping;
224 bool m_useTcadVelocity;
229 bool DriftLine(
const double x0,
const double y0,
const double z0,
230 const double t0,
const int type,
const bool aval =
false);
232 bool Avalanche(
const double x0,
const double y0,
const double z0,
233 const double t0,
const unsigned int ne,
const unsigned int nh,
234 const unsigned int ni);
237 int GetField(
const double x,
const double y,
const double z,
238 double& ex,
double& ey,
double& ez,
239 double& bx,
double& by,
double& bz, Medium*& medium);
241 bool GetVelocity(
const int type, Medium* medium,
242 const double x,
const double y,
const double z,
243 const double ex,
const double ey,
const double ez,
244 const double bx,
const double by,
const double bz,
245 double& vx,
double& vy,
double& vz);
247 bool AddDiffusion(
const int type, Medium* medium,
const double step,
248 double& x,
double& y,
double& z,
249 const double vx,
const double vy,
const double vz,
250 const double ex,
const double ey,
const double ez,
251 const double bx,
const double by,
const double bz);
253 void TerminateLine(
double x0,
double y0,
double z0,
double t0,
254 double& x,
double& y,
double& z,
double& t)
const;
256 bool ComputeGainLoss(
const int type,
int& status);
258 bool ComputeAlphaEta(
const int q, std::vector<double>& alphas,
259 std::vector<double>& etas)
const;
260 bool Equilibrate(std::vector<double>& alphas)
const;
262 void ComputeSignal(
const double q)
const;
264 void ComputeInducedCharge(
const double q)
const;
void EnableInducedChargeCalculation()
Switch on calculation of induced charge (default: disabled).
void GetDriftLinePoint(const unsigned int i, double &x, double &y, double &z, double &t) const
Return the coordinates and time of a point along the last drift line.
void EnablePlotting(ViewDrift *view)
Switch on drift line plotting.
void EnableDebugging()
Switch on debugging messages (default: off).
void SetTimeSteps(const double d=0.02)
Use fixed-time steps (default 20 ps).
bool AvalancheElectronHole(const double x0, const double y0, const double z0, const double t0)
bool DriftIon(const double x0, const double y0, const double z0, const double t0)
unsigned int GetNumberOfIonEndpoints() const
void SetIonSignalScalingFactor(const double scale)
Set multiplication factor for the signal induced by ions.
void DisableProjectedPathIntegration()
void SetTimeWindow(const double t0, const double t1)
Define a time interval (only carriers inside the interval are drifted).
void DisableMagneticField()
void GetIonEndpoint(const unsigned int i, double &x0, double &y0, double &z0, double &t0, double &x1, double &y1, double &z1, double &t1, int &status) const
bool DriftElectron(const double x0, const double y0, const double z0, const double t0)
Simulate the drift line of an electron with a given starting point.
void GetElectronEndpoint(const unsigned int i, double &x0, double &y0, double &z0, double &t0, double &x1, double &y1, double &z1, double &t1, int &status) const
void SetCollisionSteps(const int n=100)
void DisableSignalCalculation()
void GetHoleEndpoint(const unsigned int i, double &x0, double &y0, double &z0, double &t0, double &x1, double &y1, double &z1, double &t1, int &status) const
~AvalancheMC()
Destructor.
AvalancheMC()
Constructor.
void SetSensor(Sensor *s)
Set the sensor.
void EnableTcadVelocity()
Switch on TCAD velocity maps.
void EnableDiffusion()
Switch on diffusion (default: enabled)
void EnableMagneticField()
Enable use of magnetic field in stepping algorithm.
void GetAvalancheSize(int &ne, int &ni) const
Return the number of electrons and ions/holes in the avalanche.
unsigned int GetNumberOfHoleEndpoints() const
void EnableTcadTraps()
Switch on calculating trapping with TCAD traps.
void SetElectronSignalScalingFactor(const double scale)
Set multiplication factor for the signal induced by electrons.
void SetHoleSignalScalingFactor(const double scale)
Set multiplication factor for the signal induced by holes.
void SetHoles()
Treat positive charge carriers as holes (default: ions).
unsigned int GetNumberOfDriftLinePoints() const
Return the number of points along the last simulated drift line.
unsigned int GetNumberOfElectronEndpoints() const
bool AvalancheElectron(const double x0, const double y0, const double z0, const double t0, const bool hole=false)
Simulate an avalanche initiated by an electron with given starting point.
void DisableInducedChargeCalculation()
void EnableProjectedPathIntegration()
void SetDistanceSteps(const double d=0.001)
Use fixed distance steps (default 10 um).
void EnableSignalCalculation()
Switch on calculation of induced currents (default: disabled).
void DisableTcadVelocity()
bool AvalancheHole(const double x0, const double y0, const double z0, const double t0, const bool electron=false)
bool DriftHole(const double x0, const double y0, const double z0, const double t0)
Visualize drift lines and tracks.