Garfield++ v2r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
Track.hh
Go to the documentation of this file.
1#ifndef G_TRACK_H
2#define G_TRACK_H
3
4#include <string>
5#include <cmath>
6
7namespace Garfield {
8
9class Sensor;
10class ViewDrift;
11
12/// Abstract base class for track generation.
13
14class Track {
15
16 public:
17 /// Constructor
18 Track();
19 /// Destructor
20 virtual ~Track() {}
21
22 /// Set the type of particle.
23 virtual void SetParticle(const std::string& part);
24
25 /// Set the particle energy.
26 void SetEnergy(const double e);
27 /// Set the relative momentum of the particle.
28 void SetBetaGamma(const double bg);
29 /// Set the speed (\f$\beta = v/c\f$) of the particle.
30 void SetBeta(const double beta);
31 /// Set the Lorentz factor of the particle.
32 void SetGamma(const double gamma);
33 /// Set the particle momentum.
34 void SetMomentum(const double p);
35 /// Set the kinetic energy of the particle.
36 void SetKineticEnergy(const double ekin);
37
38 double GetEnergy() const { return m_energy; }
39 double GetBetaGamma() const { return sqrt(m_beta2 / (1. - m_beta2)); }
40 double GetBeta() const { return sqrt(m_beta2); }
41 double GetGamma() const { return sqrt(1. / (1. - m_beta2)); }
42 double GetMomentum() const { return m_mass * sqrt(m_beta2 / (1. - m_beta2)); }
43 double GetKineticEnergy() const { return m_energy - m_mass; }
44
45 /// Get the charge of the projectile.
46 double GetCharge() const { return m_q; }
47 /// Get the mass [eV / c2] of the projectile.
48 double GetMass() const { return m_mass; }
49
50 void SetSensor(Sensor* s);
51
52 /// Calculate a new track starting from (x0, y0, z0) at time t0
53 /// in direction (dx0, dy0, dz0).
54 virtual bool NewTrack(const double x0, const double y0, const double z0,
55 const double t0, const double dx0, const double dy0,
56 const double dz0) = 0;
57 /** Get the next "cluster" (ionising collision of the charged particle).
58 * \param xcls,ycls,zcls coordinates of the collision
59 * \param tcls time of the collision
60 * \param n number of electrons produced
61 * \param e deposited energy
62 * \param extra additional information (not always implemented)
63 */
64 virtual bool GetCluster(double& xcls, double& ycls, double& zcls,
65 double& tcls, int& n, double& e, double& extra) = 0;
66
67 /// Get the cluster density (number of ionizing collisions per cm or
68 /// inverse mean free path for ionization).
69 virtual double GetClusterDensity() { return 0.; }
70 /// Get the stopping power (mean energy loss [eV] per cm).
71 virtual double GetStoppingPower() { return 0.; }
72
73 void EnablePlotting(ViewDrift* viewer);
74 void DisablePlotting();
75
76 void EnableDebugging() { m_debug = true; }
77 void DisableDebugging() { m_debug = false; }
78
79 protected:
80 std::string m_className;
81
82 double m_q;
83 int m_spin;
84 double m_mass;
85 double m_energy;
86 double m_beta2;
88 std::string m_particleName;
89
91
93
96
97 bool m_debug;
98
100 void PlotNewTrack(const double x0, const double y0, const double z0);
101 void PlotCluster(const double x0, const double y0, const double z0);
102};
103}
104
105#endif
Abstract base class for track generation.
Definition: Track.hh:14
double GetMass() const
Get the mass [eV / c2] of the projectile.
Definition: Track.hh:48
double GetKineticEnergy() const
Definition: Track.hh:43
void DisablePlotting()
Definition: Track.cc:208
double GetEnergy() const
Definition: Track.hh:38
double GetBetaGamma() const
Definition: Track.hh:39
void EnablePlotting(ViewDrift *viewer)
Definition: Track.cc:196
Sensor * m_sensor
Definition: Track.hh:90
void SetBetaGamma(const double bg)
Set the relative momentum of the particle.
Definition: Track.cc:116
bool m_debug
Definition: Track.hh:97
double GetBeta() const
Definition: Track.hh:40
double GetGamma() const
Definition: Track.hh:41
double GetCharge() const
Get the charge of the projectile.
Definition: Track.hh:46
virtual double GetClusterDensity()
Definition: Track.hh:69
void SetSensor(Sensor *s)
Definition: Track.cc:185
bool m_isElectron
Definition: Track.hh:87
bool m_isChanged
Definition: Track.hh:92
void SetKineticEnergy(const double ekin)
Set the kinetic energy of the particle.
Definition: Track.cc:171
virtual ~Track()
Destructor.
Definition: Track.hh:20
void SetMomentum(const double p)
Set the particle momentum.
Definition: Track.cc:157
virtual void SetParticle(const std::string &part)
Set the type of particle.
Definition: Track.cc:29
void EnableDebugging()
Definition: Track.hh:76
double m_q
Definition: Track.hh:82
ViewDrift * m_viewer
Definition: Track.hh:95
std::string m_particleName
Definition: Track.hh:88
void PlotCluster(const double x0, const double y0, const double z0)
Definition: Track.cc:221
double m_beta2
Definition: Track.hh:86
virtual bool NewTrack(const double x0, const double y0, const double z0, const double t0, const double dx0, const double dy0, const double dz0)=0
std::string m_className
Definition: Track.hh:80
int m_plotId
Definition: Track.hh:99
bool m_usePlotting
Definition: Track.hh:94
void SetEnergy(const double e)
Set the particle energy.
Definition: Track.cc:102
void SetGamma(const double gamma)
Set the Lorentz factor of the particle.
Definition: Track.cc:144
double m_mass
Definition: Track.hh:84
void SetBeta(const double beta)
Set the speed ( ) of the particle.
Definition: Track.cc:130
double GetMomentum() const
Definition: Track.hh:42
Track()
Constructor.
Definition: Track.cc:11
virtual double GetStoppingPower()
Get the stopping power (mean energy loss [eV] per cm).
Definition: Track.hh:71
void DisableDebugging()
Definition: Track.hh:77
double m_energy
Definition: Track.hh:85
void PlotNewTrack(const double x0, const double y0, const double z0)
Definition: Track.cc:214
virtual bool GetCluster(double &xcls, double &ycls, double &zcls, double &tcls, int &n, double &e, double &extra)=0
Visualize drift lines and tracks.
Definition: ViewDrift.hh:15