Garfield++ 4.0
A toolkit for the detailed simulation of particle detectors based on ionisation 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 <string>
5#include <vector>
6
7#include "Track.hh"
8
9namespace Garfield {
10
11/// Generate tracks based on TRIM output files.
12/// - http://www.srim.org
13
14class TrackTrim : public Track {
15 public:
16 /// Constructor
17 TrackTrim();
18 /// Destructor
19 virtual ~TrackTrim() {}
20
21 /// Load data from an EXYZ.txt file.
22 bool ReadFile(const std::string& file, const unsigned int nIons = 0,
23 const unsigned int nSkip = 0);
24 /// Print a summary of the available TRIM data.
25 void Print();
26
27 /// Set the W value [eV].
28 void SetWorkFunction(const double w) { m_work = w; }
29 /// Get the W value [eV].
30 double GetWorkFunction() const { return m_work; }
31 /// Set the Fano factor.
32 void SetFanoFactor(const double f) { m_fano = f; }
33 /// Get the Fano factor.
34 double GetFanoFactor() const { return m_fano; }
35
36 bool NewTrack(const double x0, const double y0, const double z0,
37 const double t0, const double dx0, const double dy0,
38 const double dz0) override;
39 bool GetCluster(double& xcls, double& ycls, double& zcls,
40 double& tcls, int& n, double& e, double& extra) override;
41
42 protected:
43 /// Work function [eV].
44 double m_work = -1.;
45 /// Fano factor [-].
46 double m_fano = -1.;
47
48 /// Projectile energy [eV].
49 double m_ekin = 0.;
50 /// List of tracks.
51 std::vector<std::vector<std::array<float, 5> > > m_ions;
52 /// Index of the current track.
53 size_t m_ion = 0;
54
55 struct Cluster {
56 double x, y, z, t; ///< Cluster location and time
57 double ec; ///< Energy spent to make the cluster
58 double ekin; ///< Ion energy when cluster was created
59 int electrons; ///< Number of electrons in this cluster
60 };
61 /// Clusters on the current track.
62 std::vector<Cluster> m_clusters;
63 /// Index of the next cluster to be returned.
64 size_t m_cluster = 0;
65
66 void AddIon(const std::vector<float>& x, const std::vector<float>& y,
67 const std::vector<float>& z, const std::vector<float>& dedx,
68 const std::vector<float>& ekin);
69};
70}
71
72#endif
double m_ekin
Projectile energy [eV].
Definition: TrackTrim.hh:49
std::vector< std::vector< std::array< float, 5 > > > m_ions
List of tracks.
Definition: TrackTrim.hh:51
size_t m_cluster
Index of the next cluster to be returned.
Definition: TrackTrim.hh:64
bool GetCluster(double &xcls, double &ycls, double &zcls, double &tcls, int &n, double &e, double &extra) override
Definition: TrackTrim.cc:272
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)
Definition: TrackTrim.cc:117
double GetWorkFunction() const
Get the W value [eV].
Definition: TrackTrim.hh:30
TrackTrim()
Constructor.
Definition: TrackTrim.cc:28
std::vector< Cluster > m_clusters
Clusters on the current track.
Definition: TrackTrim.hh:62
double m_fano
Fano factor [-].
Definition: TrackTrim.hh:46
void SetWorkFunction(const double w)
Set the W value [eV].
Definition: TrackTrim.hh:28
size_t m_ion
Index of the current track.
Definition: TrackTrim.hh:53
virtual ~TrackTrim()
Destructor.
Definition: TrackTrim.hh:19
double m_work
Work function [eV].
Definition: TrackTrim.hh:44
void Print()
Print a summary of the available TRIM data.
Definition: TrackTrim.cc:146
void SetFanoFactor(const double f)
Set the Fano factor.
Definition: TrackTrim.hh:32
double GetFanoFactor() const
Get the Fano factor.
Definition: TrackTrim.hh:34
bool ReadFile(const std::string &file, const unsigned int nIons=0, const unsigned int nSkip=0)
Load data from an EXYZ.txt file.
Definition: TrackTrim.cc:30
bool NewTrack(const double x0, const double y0, const double z0, const double t0, const double dx0, const double dy0, const double dz0) override
Definition: TrackTrim.cc:159
Abstract base class for track generation.
Definition: Track.hh:14
double t
Cluster location and time.
Definition: TrackTrim.hh:56
double ekin
Ion energy when cluster was created.
Definition: TrackTrim.hh:58
int electrons
Number of electrons in this cluster.
Definition: TrackTrim.hh:59
double ec
Energy spent to make the cluster.
Definition: TrackTrim.hh:57