1#ifndef G_AVALANCHE_MICROSCOPIC_H
2#define G_AVALANCHE_MICROSCOPIC_H
127 return m_endpointsElectrons.size();
138 double& t0,
double& e0,
double& x1,
double& y1,
139 double& z1,
double& t1,
double& e1,
142 double& t0,
double& e0,
double& x1,
double& y1,
143 double& z1,
double& t1,
double& e1,
double& dx1,
144 double& dy1,
double& dz1,
int& status)
const;
148 const int ip,
const unsigned int iel = 0)
const;
150 const int ip,
const unsigned int iel = 0)
const;
153 return m_endpointsHoles.size();
155 void GetHoleEndpoint(
const unsigned int i,
double& x0,
double& y0,
double& z0,
156 double& t0,
double& e0,
double& x1,
double& y1,
157 double& z1,
double& t1,
double& e1,
int& status)
const;
162 void GetPhoton(
const unsigned int i,
double& e,
double& x0,
double& y0,
double& z0,
163 double& t0,
double& x1,
double& y1,
double& z1,
double& t1,
172 bool DriftElectron(
const double x0,
const double y0,
const double z0,
173 const double t0,
const double e0,
const double dx0 = 0.,
174 const double dy0 = 0.,
const double dz0 = 0.);
178 const double t0,
const double e0,
179 const double dx0 = 0.,
const double dy0 = 0.,
180 const double dz0 = 0.);
184 double e,
double dx,
double dy,
double dz,
189 int type,
int level,
Medium* m));
193 int type,
int level,
Medium* m));
197 int type,
int level,
Medium* m));
205 std::string m_className;
216 double x0, y0, z0, t0;
222 std::vector<point> driftLine;
223 double xLast, yLast, zLast;
225 std::vector<Electron> m_endpointsElectrons;
226 std::vector<Electron> m_endpointsHoles;
231 double x0, y0, z0, t0;
232 double x1, y1, z1, t1;
234 std::vector<photon> m_photons;
245 bool m_plotExcitations;
246 bool m_plotIonisations;
247 bool m_plotAttachments;
249 TH1* m_histElectronEnergy;
250 TH1* m_histHoleEnergy;
252 char m_distanceOption;
253 std::vector<int> m_distanceHistogramType;
255 TH1* m_histSecondary;
258 bool m_useInducedCharge;
259 bool m_useDriftLines;
261 bool m_useBandStructureDefault;
262 bool m_useNullCollisionSteps;
266 double m_rb11, m_rb12, m_rb13;
267 double m_rb21, m_rb22, m_rb23;
268 double m_rb31, m_rb32, m_rb33;
269 double m_rx22, m_rx23, m_rx32, m_rx33;
276 unsigned int m_sizeCut;
278 unsigned int m_nCollSkip;
280 bool m_hasTimeWindow;
281 double m_tMin, m_tMax;
284 bool m_hasUserHandleStep;
285 bool m_hasUserHandleAttachment;
286 bool m_hasUserHandleInelastic;
287 bool m_hasUserHandleIonisation;
288 void (*m_userHandleStep)(
double x,
double y,
double z,
double t,
double e,
289 double dx,
double dy,
double dz,
bool hole);
290 void (*m_userHandleAttachment)(
double x,
double y,
double z,
double t,
int type,
291 int level, Medium* m);
292 void (*m_userHandleInelastic)(
double x,
double y,
double z,
double t,
int type,
293 int level, Medium* m);
294 void (*m_userHandleIonisation)(
double x,
double y,
double z,
double t,
int type,
295 int level, Medium* m);
301 bool TransportElectron(
const double x0,
const double y0,
const double z0,
302 const double t0,
double e0,
const double dx0,
303 const double dy0,
const double dz0,
const bool aval,
306 void TransportPhoton(
const double x,
const double y,
const double z,
307 const double t,
const double e,
308 std::vector<Electron>& stack);
310 void ComputeRotationMatrix(
const double bx,
const double by,
const double bz,
311 const double bmag,
const double ex,
312 const double ey,
const double ez);
314 void RotateGlobal2Local(
double& dx,
double& dy,
double& dz)
const;
315 void RotateLocal2Global(
double& dx,
double& dy,
double& dz)
const;
317 static bool IsInactive(
const Electron& item) {
319 return item.status == StatusLeftDriftMedium ||
320 item.status == StatusBelowTransportCut ||
321 item.status == StatusOutsideTimeWindow ||
322 item.status == StatusLeftDriftArea ||
323 item.status == StatusAttached;
325 void Update(std::vector<Electron>::iterator it,
326 const double x,
const double y,
const double z,
327 const double t,
const double energy,
328 const double kx,
const double ky,
const double kz,
330 void AddToEndPoints(
const Electron& item,
const bool hole) {
332 m_endpointsHoles.push_back(item);
334 m_endpointsElectrons.push_back(item);
339 void AddToStack(
const double x,
const double y,
const double z,
340 const double t,
const double energy,
342 std::vector<Electron>& container)
const;
344 void AddToStack(
const double x,
const double y,
const double z,
345 const double t,
const double energy,
346 const double dx,
const double dy,
const double dz,
347 const int band,
const bool hole,
348 std::vector<Electron>& container)
const;
349 void Terminate(
double x0,
double y0,
double z0,
double t0,
350 double& x1,
double& y1,
double& z1,
double& t1);
Calculate electron drift lines and avalanches using microscopic tracking.
void EnableDistanceHistogramming(const int type)
void SetDistanceHistogram(TH1 *histo, const char opt='r')
void EnablePhotonTransport()
void EnableAvalancheSizeLimit(const unsigned int size)
void EnableSignalCalculation()
Switch on calculation of induced currents.
void EnableNullCollisionSteps()
Switch on update of coordinates for null-collision steps (default: off).
void SetUserHandleStep(void(*f)(double x, double y, double z, double t, double e, double dx, double dy, double dz, bool hole))
Set a user handling procedure. This function is called at every step.
void EnableHoleEnergyHistogramming(TH1 *histo)
void EnableInducedChargeCalculation()
Switch on calculation of the total induced charge.
void EnablePlotting(ViewDrift *view)
Switch on drift line plotting.
void SetUserHandleIonisation(void(*f)(double x, double y, double z, double t, int type, int level, Medium *m))
Set a user handling procedure, to be called at every ionising collision.
void UnsetUserHandleAttachment()
void DisableHoleEnergyHistogramming()
void DisableIonisationMarkers()
bool DriftElectron(const double x0, const double y0, const double z0, const double t0, const double e0, const double dx0=0., const double dy0=0., const double dz0=0.)
void SetPhotonTransportCut(const double cut)
Set an energy threshold for photon transport.
void DisableAttachmentMarkers()
void EnableExcitationMarkers()
Draw a marker at every excitation.
void DisableSecondaryEnergyHistogramming()
unsigned int GetNumberOfElectronDriftLinePoints(const unsigned int i=0) const
unsigned int GetNumberOfHoleEndpoints() const
~AvalancheMicroscopic()
Destructor.
void DisableAvalancheSizeLimit()
void DisableMagneticField()
void EnableIonisationMarkers()
Draw a marker at every ionising collision.
AvalancheMicroscopic()
Constructor.
void EnableMagneticField()
Enable magnetic field in stepping algorithm (default: off).
void EnableDriftLines()
Switch on storage of drift lines.
unsigned int GetNumberOfPhotons() const
double GetPhotonTransportCut() const
void SetCollisionSteps(const unsigned int n)
Set number of collisions to be skipped for plotting.
void GetAvalancheSize(int &ne, int &ni) const
Return the number of electrons and ions in the avalanche.
void SetUserHandleAttachment(void(*f)(double x, double y, double z, double t, int type, int level, Medium *m))
Set a user handling procedure, to be called at every attachment.
void SetSensor(Sensor *sensor)
Set the sensor.
void GetHoleDriftLinePoint(double &x, double &y, double &z, double &t, const int ip, const unsigned int iel=0) const
void DisableBandStructure()
void DisableInducedChargeCalculation()
void DisableNullCollisionSteps()
void GetElectronEndpoint(const unsigned int i, double &x0, double &y0, double &z0, double &t0, double &e0, double &x1, double &y1, double &z1, double &t1, double &e1, int &status) const
void GetHoleEndpoint(const unsigned int i, double &x0, double &y0, double &z0, double &t0, double &e0, double &x1, double &y1, double &z1, double &t1, double &e1, int &status) const
void GetElectronDriftLinePoint(double &x, double &y, double &z, double &t, const int ip, const unsigned int iel=0) const
void UnsetUserHandleStep()
double GetElectronTransportCut() const
void EnableElectronEnergyHistogramming(TH1 *histo)
Switch on filling histograms for electron energy distribution.
void DisablePhotonTransport()
void DisableExcitationMarkers()
void UnsetUserHandleIonisation()
void DisableDistanceHistogramming()
void GetPhoton(const unsigned int i, double &e, double &x0, double &y0, double &z0, double &t0, double &x1, double &y1, double &z1, double &t1, int &status) const
void GetAvalancheSize(int &ne, int &nh, int &ni) const
void EnableSecondaryEnergyHistogramming(TH1 *histo)
Fill histograms of the energy of electrons emitted in ionising collisions.
void EnableAttachmentMarkers()
Draw a marker at every attachment.
bool AvalancheElectron(const double x0, const double y0, const double z0, const double t0, const double e0, const double dx0=0., const double dy0=0., const double dz0=0.)
Calculate an avalanche initiated by a given electron.
void EnableBandStructure()
Switch on stepping according to band structure E(k), for semiconductors.
void SetElectronTransportCut(const double cut)
int GetAvalancheSizeLimit() const
unsigned int GetNumberOfElectronEndpoints() const
void DisableElectronEnergyHistogramming()
void EnableDebugging()
Switch on debugging messages.
unsigned int GetNumberOfHoleDriftLinePoints(const unsigned int i=0) const
void SetUserHandleInelastic(void(*f)(double x, double y, double z, double t, int type, int level, Medium *m))
Set a user handling procedure, to be called at every inelastic collision.
void DisableSignalCalculation()
void UnsetUserHandleInelastic()
void SetTimeWindow(const double t0, const double t1)
Define a time interval (only carriers inside the interval are simulated).
Abstract base class for media.
Visualize drift lines and tracks.