Garfield++ v1r0
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// Abstract base class for track generation
2
3#ifndef G_TRACK_H
4#define G_TRACK_H
5
6#include <string>
7#include <cmath>
8
9namespace Garfield {
10
11class Sensor;
12class ViewDrift;
13
14class Track {
15
16 public:
17 // Constructor
18 Track();
19 // Destructor
20 virtual ~Track() {}
21
22 virtual void SetParticle(std::string part);
23
24 void SetEnergy(const double e);
25 void SetBetaGamma(const double bg);
26 void SetBeta(const double beta);
27 void SetGamma(const double gamma);
28 void SetMomentum(const double p);
29 void SetKineticEnergy(const double ekin);
30
31 double GetEnergy() const { return energy; }
32 double GetBetaGamma() const { return sqrt(beta2 / (1. - beta2)); }
33 double GetBeta() const { return sqrt(beta2); }
34 double GetGamma() const { return sqrt(1. / (1. - beta2)); }
35 double GetMomentum() const { return mass * sqrt(beta2 / (1. - beta2)); }
36 double GetKineticEnergy() const { return energy - mass; }
37
38 void SetSensor(Sensor* s);
39
40 // Calculate a new track starting from (x0, y0, z0) at time t0
41 // in direction (dx0, dy0, dz0).
42 virtual bool NewTrack(const double x0, const double y0, const double z0,
43 const double t0, const double dx0, const double dy0,
44 const double dz0) = 0;
45 virtual bool GetCluster(double& xcls, double& ycls, double& zcls,
46 double& tcls, int& n, double& e, double& extra) = 0;
47
48 // Get the cluster density (number of ionizing collisions per cm or
49 // inverse mean free path for ionization).
50 virtual double GetClusterDensity() { return 0.; }
51 // Get the stopping power (mean energy loss [eV] per cm).
52 virtual double GetStoppingPower() { return 0.; }
53
55 void DisablePlotting();
56
57 void EnableDebugging() { debug = true; }
58 void DisableDebugging() { debug = false; }
59
60 protected:
61 std::string className;
62
63 double q;
64 int spin;
65 double mass;
66 double energy;
67 double beta2;
69 std::string particleName;
70
72
74
77
78 bool debug;
79
80 int plotId;
81 void PlotNewTrack(const double x0, const double y0, const double z0);
82 void PlotCluster(const double x0, const double y0, const double z0);
83};
84}
85
86#endif
DoubleAc sqrt(const DoubleAc &f)
Definition: DoubleAc.cpp:313
double GetKineticEnergy() const
Definition: Track.hh:36
double energy
Definition: Track.hh:66
void DisablePlotting()
Definition: Track.cc:208
double GetEnergy() const
Definition: Track.hh:31
double GetBetaGamma() const
Definition: Track.hh:32
void EnablePlotting(ViewDrift *viewer)
Definition: Track.cc:196
void SetBetaGamma(const double bg)
Definition: Track.cc:116
double GetBeta() const
Definition: Track.hh:33
double GetGamma() const
Definition: Track.hh:34
ViewDrift * viewer
Definition: Track.hh:76
virtual double GetClusterDensity()
Definition: Track.hh:50
void SetSensor(Sensor *s)
Definition: Track.cc:185
bool isChanged
Definition: Track.hh:73
void SetKineticEnergy(const double ekin)
Definition: Track.cc:171
virtual ~Track()
Definition: Track.hh:20
bool usePlotting
Definition: Track.hh:75
void SetMomentum(const double p)
Definition: Track.cc:157
std::string className
Definition: Track.hh:61
void EnableDebugging()
Definition: Track.hh:57
double mass
Definition: Track.hh:65
virtual void SetParticle(std::string part)
Definition: Track.cc:29
std::string particleName
Definition: Track.hh:69
double q
Definition: Track.hh:63
double beta2
Definition: Track.hh:67
void PlotCluster(const double x0, const double y0, const double z0)
Definition: Track.cc:221
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
void SetEnergy(const double e)
Definition: Track.cc:102
void SetGamma(const double gamma)
Definition: Track.cc:144
void SetBeta(const double beta)
Definition: Track.cc:130
double GetMomentum() const
Definition: Track.hh:35
bool isElectron
Definition: Track.hh:68
bool debug
Definition: Track.hh:78
virtual double GetStoppingPower()
Definition: Track.hh:52
void DisableDebugging()
Definition: Track.hh:58
Sensor * sensor
Definition: Track.hh:71
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