Garfield 0.3
Toolkit for the detailed simulation of particle detectors based on ionization measurement in gases and semiconductors
Loading...
Searching...
No Matches
TrackTrim.hh
Go to the documentation of this file.
1#ifndef G_TRACK_TRIM_H
2#define G_TRACK_TRIM_H
3
4#include <array>
5#include <string>
6#include <vector>
7
8#include "Garfield/Track.hh"
9
10namespace Garfield {
11
14
15class TrackTrim : public Track {
16 public:
18 TrackTrim() : TrackTrim(nullptr) {}
20 TrackTrim(Sensor* sensor);
22 virtual ~TrackTrim() {}
23
25 bool ReadFile(const std::string& file, const unsigned int nIons = 0,
26 const unsigned int nSkip = 0);
28 void Print();
29
31 void SetCharge(const double q) {
32 if (fabs(q) > 0.) m_q = q;
33 }
34
35 void SetWorkFunction(const double w) { m_work = w; }
37 double GetWorkFunction() const { return m_work; }
39 void SetFanoFactor(const double f) {
40 m_fano = f;
41 m_fset = true;
42 }
43
44 void UnsetFanoFactor() { m_fset = false; }
46 double GetFanoFactor() const { return m_fano; }
47
49 void EnableStepSizeLimit(const double dmax) { m_maxStepSize = dmax; }
53 void EnableEnergyLossLimit(const double emax) { m_maxLossPerStep = emax; }
57
58 void SetParticle(const std::string& part) override;
59
60 struct Cluster {
61 double x, y, z;
62 double t;
63 double energy;
64 double ekin;
65 int n;
66 };
67
68 bool NewTrack(const double x0, const double y0, const double z0,
69 const double t0, const double dx0, const double dy0,
70 const double dz0) override;
71 const std::vector<Cluster>& GetClusters() const { return m_clusters; }
72 bool GetCluster(double& xc, double& yc, double& zc, double& tc, int& nc,
73 double& ec, double& extra);
74
75 protected:
77 double m_work = -1.;
79 bool m_fset = false;
81 double m_fano = -1.;
82
84 double m_ekin = 0.;
86 std::vector<std::vector<std::array<float, 6> > > m_ions;
88 size_t m_ion = 0;
89
91 std::vector<Cluster> m_clusters;
93 size_t m_cluster = 0;
94
96 double m_maxStepSize = -1.;
98 double m_maxLossPerStep = -1.;
99
100 void AddIon(const std::vector<float>& x, const std::vector<float>& y,
101 const std::vector<float>& z, const std::vector<float>& dedx,
102 const std::vector<float>& ekin);
103};
104} // namespace Garfield
105
106#endif
double m_ekin
Projectile energy [eV].
Definition TrackTrim.hh:84
void EnableStepSizeLimit(const double dmax)
Set a max. distance between subsequent steps.
Definition TrackTrim.hh:49
size_t m_cluster
Index of the next cluster to be returned.
Definition TrackTrim.hh:93
void SetParticle(const std::string &part) override
Set the type of charged particle.
void AddIon(const std::vector< float > &x, const std::vector< float > &y, const std::vector< float > &z, const std::vector< float > &dedx, const std::vector< float > &ekin)
TrackTrim(Sensor *sensor)
Constructor.
double GetWorkFunction() const
Get the W value [eV].
Definition TrackTrim.hh:37
TrackTrim()
Default constructor.
Definition TrackTrim.hh:18
void DisableStepSizeLimit()
Do not reduce the steps with respect to the TRIM input file (default).
Definition TrackTrim.hh:51
std::vector< Cluster > m_clusters
Clusters on the current track.
Definition TrackTrim.hh:91
bool m_fset
Has the Fano factor been set?
Definition TrackTrim.hh:79
double m_fano
Fano factor [-] of the target.
Definition TrackTrim.hh:81
void DisableEnergyLossLimit()
Do not limit the energy loss per cluster (default).
Definition TrackTrim.hh:56
void SetWorkFunction(const double w)
Set the W value [eV].
Definition TrackTrim.hh:35
size_t m_ion
Index of the current track.
Definition TrackTrim.hh:88
void EnableEnergyLossLimit(const double emax)
Set a max. energy loss per cluster.
Definition TrackTrim.hh:53
virtual ~TrackTrim()
Destructor.
Definition TrackTrim.hh:22
double m_work
Work function [eV] of the target.
Definition TrackTrim.hh:77
void Print()
Print a summary of the available TRIM data.
const std::vector< Cluster > & GetClusters() const
Definition TrackTrim.hh:71
void SetFanoFactor(const double f)
Set the Fano factor.
Definition TrackTrim.hh:39
void SetCharge(const double q)
Set the projectile charge [-].
Definition TrackTrim.hh:31
void UnsetFanoFactor()
Use the default Fano factor.
Definition TrackTrim.hh:44
double m_maxLossPerStep
Energy loss limit per step.
Definition TrackTrim.hh:98
bool GetCluster(double &xc, double &yc, double &zc, double &tc, int &nc, double &ec, double &extra)
double GetFanoFactor() const
Get the Fano factor.
Definition TrackTrim.hh:46
bool ReadFile(const std::string &file, const unsigned int nIons=0, const unsigned int nSkip=0)
Load data from an EXYZ.txt file.
double m_maxStepSize
Step size limit.
Definition TrackTrim.hh:96
bool NewTrack(const double x0, const double y0, const double z0, const double t0, const double dx0, const double dy0, const double dz0) override
Calculate a new track starting from (x0, y0, z0) at time t0 in direction (dx0, dy0,...
std::vector< std::vector< std::array< float, 6 > > > m_ions
List of tracks.
Definition TrackTrim.hh:86
double m_q
Definition Track.hh:98
Track()=delete
Default constructor.
double energy
Energy spent to make the cluster.
Definition TrackTrim.hh:63
int n
Number of electrons in this cluster.
Definition TrackTrim.hh:65
double ekin
Ion energy when cluster was created.
Definition TrackTrim.hh:64