Garfield 0.3
Toolkit for the detailed simulation of particle detectors based on ionization 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 <array>
5#include <cmath>
6#include <string>
7
8namespace Garfield {
9
10class Sensor;
11class ViewDrift;
12
14
15class Track {
16 public:
18 Track() = delete;
20 Track(const std::string& name);
22 virtual ~Track() {}
23
37 virtual void SetParticle(const std::string& part);
38
40 void SetEnergy(const double e);
42 void SetBetaGamma(const double bg);
44 void SetBeta(const double beta);
46 void SetGamma(const double gamma);
48 void SetMomentum(const double p);
50 void SetKineticEnergy(const double ekin);
51
53 double GetEnergy() const { return m_energy; }
55 double GetBetaGamma() const { return sqrt(m_beta2 / (1. - m_beta2)); }
57 double GetBeta() const { return sqrt(m_beta2); }
59 double GetGamma() const { return sqrt(1. / (1. - m_beta2)); }
61 double GetMomentum() const { return m_mass * sqrt(m_beta2 / (1. - m_beta2)); }
63 double GetKineticEnergy() const { return m_energy - m_mass; }
64
66 double GetCharge() const { return m_q; }
68 double GetMass() const { return m_mass; }
69
71 void SetSensor(Sensor* s);
72
75 virtual bool NewTrack(const double x0, const double y0, const double z0,
76 const double t0, const double dx0, const double dy0,
77 const double dz0) = 0;
78
81 virtual double GetClusterDensity() { return 0.; }
83 virtual double GetStoppingPower() { return 0.; }
84
89
91 void EnableDebugging() { m_debug = true; }
93 void DisableDebugging() { m_debug = false; }
94
95 protected:
96 std::string m_className = "Track";
97
98 double m_q = -1.;
99 int m_spin = 1;
100 double m_mass;
101 double m_energy = 0.;
102 double m_beta2 = 1.;
103 bool m_isElectron = false;
104 std::string m_particleName = "mu-";
105
106 Sensor* m_sensor = nullptr;
107
108 bool m_isChanged = true;
109
110 ViewDrift* m_viewer = nullptr;
111
112 bool m_debug = false;
113
114 size_t m_plotId = 0;
115 void PlotNewTrack(const double x0, const double y0, const double z0);
116 void PlotCluster(const double x0, const double y0, const double z0);
117
118 static std::array<double, 3> StepBfield(const double dt, const double qoverm,
119 const double vmag, double bx,
120 double by, double bz,
121 std::array<double, 3>& dir);
122};
123} // namespace Garfield
124
125#endif
double GetMass() const
Get the mass [eV / c2] of the projectile.
Definition Track.hh:68
double GetKineticEnergy() const
Return the kinetic energy of the projectile.
Definition Track.hh:63
size_t m_plotId
Definition Track.hh:114
void DisablePlotting()
Switch off plotting.
double GetEnergy() const
Return the particle energy.
Definition Track.hh:53
double GetBetaGamma() const
Return the of the projectile.
Definition Track.hh:55
void EnablePlotting(ViewDrift *viewer)
Switch on plotting.
Sensor * m_sensor
Definition Track.hh:106
void SetBetaGamma(const double bg)
Set the relative momentum of the particle.
double GetBeta() const
Return the speed ( ) of the projectile.
Definition Track.hh:57
double GetGamma() const
Return the Lorentz factor of the projectile.
Definition Track.hh:59
double GetCharge() const
Get the charge of the projectile.
Definition Track.hh:66
virtual double GetClusterDensity()
Get the cluster density (number of ionizing collisions per cm or inverse mean free path for ionizatio...
Definition Track.hh:81
void SetSensor(Sensor *s)
Set the sensor through which to transport the particle.
static std::array< double, 3 > StepBfield(const double dt, const double qoverm, const double vmag, double bx, double by, double bz, std::array< double, 3 > &dir)
Track(const std::string &name)
Constructor.
bool m_isElectron
Definition Track.hh:103
bool m_isChanged
Definition Track.hh:108
virtual void SetParticle(const std::string &part)
Set the type of charged particle.
void SetKineticEnergy(const double ekin)
Set the kinetic energy of the particle.
virtual ~Track()
Destructor.
Definition Track.hh:22
void SetMomentum(const double p)
Set the particle momentum.
void EnableDebugging()
Switch on debugging messages.
Definition Track.hh:91
double m_q
Definition Track.hh:98
ViewDrift * m_viewer
Definition Track.hh:110
std::string m_particleName
Definition Track.hh:104
void PlotCluster(const double x0, const double y0, const double z0)
double m_beta2
Definition Track.hh:102
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
Calculate a new track starting from (x0, y0, z0) at time t0 in direction (dx0, dy0,...
std::string m_className
Definition Track.hh:96
void SetEnergy(const double e)
Set the particle energy.
void SetGamma(const double gamma)
Set the Lorentz factor of the particle.
double m_mass
Definition Track.hh:100
Track()=delete
Default constructor.
void SetBeta(const double beta)
Set the speed ( ) of the particle.
double GetMomentum() const
Return the particle momentum.
Definition Track.hh:61
virtual double GetStoppingPower()
Get the stopping power (mean energy loss [eV] per cm).
Definition Track.hh:83
void DisableDebugging()
Switch off debugging messages.
Definition Track.hh:93
double m_energy
Definition Track.hh:101
void PlotNewTrack(const double x0, const double y0, const double z0)
Visualize drift lines and tracks.
Definition ViewDrift.hh:18