Garfield++ v1r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
Garfield::Track Class Referenceabstract

#include <Track.hh>

+ Inheritance diagram for Garfield::Track:

Public Member Functions

 Track ()
 
virtual ~Track ()
 
virtual void SetParticle (std::string part)
 
void SetEnergy (const double e)
 
void SetBetaGamma (const double bg)
 
void SetBeta (const double beta)
 
void SetGamma (const double gamma)
 
void SetMomentum (const double p)
 
void SetKineticEnergy (const double ekin)
 
double GetEnergy () const
 
double GetBetaGamma () const
 
double GetBeta () const
 
double GetGamma () const
 
double GetMomentum () const
 
double GetKineticEnergy () const
 
void SetSensor (Sensor *s)
 
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
 
virtual bool GetCluster (double &xcls, double &ycls, double &zcls, double &tcls, int &n, double &e, double &extra)=0
 
virtual double GetClusterDensity ()
 
virtual double GetStoppingPower ()
 
void EnablePlotting (ViewDrift *viewer)
 
void DisablePlotting ()
 
void EnableDebugging ()
 
void DisableDebugging ()
 

Protected Member Functions

void PlotNewTrack (const double x0, const double y0, const double z0)
 
void PlotCluster (const double x0, const double y0, const double z0)
 

Protected Attributes

std::string className
 
double q
 
int spin
 
double mass
 
double energy
 
double beta2
 
bool isElectron
 
std::string particleName
 
Sensorsensor
 
bool isChanged
 
bool usePlotting
 
ViewDriftviewer
 
bool debug
 
int plotId
 

Detailed Description

Definition at line 14 of file Track.hh.

Constructor & Destructor Documentation

◆ Track()

Garfield::Track::Track ( )

Definition at line 11 of file Track.cc.

12 : className("Track"),
13 q(-1.),
14 spin(1),
15 mass(MuonMass),
16 energy(0.),
17 isElectron(false),
18 particleName("mu-"),
19 sensor(0),
20 isChanged(true),
21 usePlotting(false),
22 viewer(0),
23 debug(false),
24 plotId(-1) {
25
26 SetBetaGamma(3.);
27}
double energy
Definition: Track.hh:66
void SetBetaGamma(const double bg)
Definition: Track.cc:116
ViewDrift * viewer
Definition: Track.hh:76
bool isChanged
Definition: Track.hh:73
bool usePlotting
Definition: Track.hh:75
std::string className
Definition: Track.hh:61
double mass
Definition: Track.hh:65
std::string particleName
Definition: Track.hh:69
double q
Definition: Track.hh:63
bool isElectron
Definition: Track.hh:68
bool debug
Definition: Track.hh:78
Sensor * sensor
Definition: Track.hh:71

◆ ~Track()

virtual Garfield::Track::~Track ( )
inlinevirtual

Definition at line 20 of file Track.hh.

20{}

Member Function Documentation

◆ DisableDebugging()

void Garfield::Track::DisableDebugging ( )
inline

Definition at line 58 of file Track.hh.

58{ debug = false; }

◆ DisablePlotting()

void Garfield::Track::DisablePlotting ( )

Definition at line 208 of file Track.cc.

208 {
209
210 usePlotting = false;
211 viewer = 0;
212}

◆ EnableDebugging()

void Garfield::Track::EnableDebugging ( )
inline

Definition at line 57 of file Track.hh.

57{ debug = true; }

Referenced by GarfieldPhysics::InitializePhysics().

◆ EnablePlotting()

void Garfield::Track::EnablePlotting ( ViewDrift viewer)

Definition at line 196 of file Track.cc.

196 {
197
198 if (view == 0) {
199 std::cerr << className << "::EnablePlotting:\n";
200 std::cerr << " Pointer is null.\n";
201 return;
202 }
203
204 viewer = view;
205 usePlotting = true;
206}

◆ GetBeta()

double Garfield::Track::GetBeta ( ) const
inline

Definition at line 33 of file Track.hh.

33{ return sqrt(beta2); }
DoubleAc sqrt(const DoubleAc &f)
Definition: DoubleAc.cpp:313
double beta2
Definition: Track.hh:67

Referenced by Garfield::TrackBichsel::NewTrack(), and Garfield::TrackHeed::NewTrack().

◆ GetBetaGamma()

double Garfield::Track::GetBetaGamma ( ) const
inline

◆ GetCluster()

virtual bool Garfield::Track::GetCluster ( double &  xcls,
double &  ycls,
double &  zcls,
double &  tcls,
int &  n,
double &  e,
double &  extra 
)
pure virtual

◆ GetClusterDensity()

virtual double Garfield::Track::GetClusterDensity ( )
inlinevirtual

Reimplemented in Garfield::TrackBichsel, Garfield::TrackElectron, Garfield::TrackHeed, Garfield::TrackPAI, and Garfield::TrackSimple.

Definition at line 50 of file Track.hh.

50{ return 0.; }

◆ GetEnergy()

double Garfield::Track::GetEnergy ( ) const
inline

Definition at line 31 of file Track.hh.

31{ return energy; }

◆ GetGamma()

double Garfield::Track::GetGamma ( ) const
inline

Definition at line 34 of file Track.hh.

34{ return sqrt(1. / (1. - beta2)); }

◆ GetKineticEnergy()

double Garfield::Track::GetKineticEnergy ( ) const
inline

Definition at line 36 of file Track.hh.

36{ return energy - mass; }

◆ GetMomentum()

double Garfield::Track::GetMomentum ( ) const
inline

Definition at line 35 of file Track.hh.

35{ return mass * sqrt(beta2 / (1. - beta2)); }

◆ GetStoppingPower()

virtual double Garfield::Track::GetStoppingPower ( )
inlinevirtual

Reimplemented in Garfield::TrackBichsel, Garfield::TrackElectron, Garfield::TrackHeed, Garfield::TrackPAI, and Garfield::TrackSimple.

Definition at line 52 of file Track.hh.

52{ return 0.; }

◆ NewTrack()

virtual bool Garfield::Track::NewTrack ( const double  x0,
const double  y0,
const double  z0,
const double  t0,
const double  dx0,
const double  dy0,
const double  dz0 
)
pure virtual

◆ PlotCluster()

void Garfield::Track::PlotCluster ( const double  x0,
const double  y0,
const double  z0 
)
protected

Definition at line 221 of file Track.cc.

221 {
222
223 if (plotId < 0 || !usePlotting || viewer == 0) {
224 std::cerr << className << "::PlotCluster:\n";
225 std::cerr << " No track set. Program bug!\n";
226 return;
227 }
228 viewer->AddTrackPoint(plotId, x0, y0, z0);
229}
void AddTrackPoint(const unsigned int iL, const double x, const double y, const double z)
Definition: ViewDrift.cc:297

Referenced by Garfield::TrackHeed::GetCluster().

◆ PlotNewTrack()

void Garfield::Track::PlotNewTrack ( const double  x0,
const double  y0,
const double  z0 
)
protected

Definition at line 214 of file Track.cc.

214 {
215
216 if (!usePlotting || viewer == 0) return;
217
218 viewer->NewChargedParticleTrack(1, plotId, x0, y0, z0);
219}
void NewChargedParticleTrack(const unsigned int np, int &id, const double x0, const double y0, const double z0)
Definition: ViewDrift.cc:233

Referenced by Garfield::TrackHeed::NewTrack().

◆ SetBeta()

void Garfield::Track::SetBeta ( const double  beta)

Definition at line 130 of file Track.cc.

130 {
131
132 if (beta <= 0. && beta >= 1.) {
133 std::cerr << className << "::SetBeta:\n";
134 std::cerr << " Particle speed must be between zero"
135 << " and speed of light.\n";
136 return;
137 }
138
139 beta2 = beta * beta;
140 energy = mass * sqrt(1. / (1. - beta2));
141 isChanged = true;
142}

◆ SetBetaGamma()

void Garfield::Track::SetBetaGamma ( const double  bg)

Definition at line 116 of file Track.cc.

116 {
117
118 if (bg <= 0.) {
119 std::cerr << className << "::SetBetaGamma:\n";
120 std::cerr << " Particle speed must be greater than zero.\n";
121 return;
122 }
123
124 const double bg2 = bg * bg;
125 energy = mass * sqrt(1. + bg2);
126 beta2 = bg2 / (1. + bg2);
127 isChanged = true;
128}

Referenced by Track(), and Garfield::TrackElectron::TrackElectron().

◆ SetEnergy()

void Garfield::Track::SetEnergy ( const double  e)

Definition at line 102 of file Track.cc.

102 {
103
104 if (e <= mass) {
105 std::cerr << className << "::SetEnergy:\n";
106 std::cerr << " Particle energy must be greater than the mass.\n";
107 return;
108 }
109
110 energy = e;
111 const double gamma = energy / mass;
112 beta2 = 1. - 1. / (gamma * gamma);
113 isChanged = true;
114}

◆ SetGamma()

void Garfield::Track::SetGamma ( const double  gamma)

Definition at line 144 of file Track.cc.

144 {
145
146 if (gamma <= 1.) {
147 std::cerr << className << "::SetGamma:\n";
148 std::cerr << " Particle speed must be greater than zero.\n";
149 return;
150 }
151
152 energy = mass * gamma;
153 beta2 = 1. - 1. / (gamma * gamma);
154 isChanged = true;
155}

◆ SetKineticEnergy()

void Garfield::Track::SetKineticEnergy ( const double  ekin)

Definition at line 171 of file Track.cc.

171 {
172
173 if (ekin <= 0.) {
174 std::cerr << className << "::SetKineticEnergy:\n";
175 std::cerr << " Kinetic energy must be greater than zero.\n";
176 return;
177 }
178
179 energy = mass + ekin;
180 const double gamma = 1. + ekin / mass;
181 beta2 = 1. - 1. / (gamma * gamma);
182 isChanged = true;
183}

Referenced by GarfieldPhysics::DoIt().

◆ SetMomentum()

void Garfield::Track::SetMomentum ( const double  p)

Definition at line 157 of file Track.cc.

157 {
158
159 if (p <= 0.) {
160 std::cerr << className << "::SetMomentum:\n";
161 std::cerr << " Particle momentum must be greater than zero.\n";
162 return;
163 }
164
165 energy = sqrt(mass * mass + p * p);
166 const double bg = p / mass;
167 beta2 = bg * bg / (1. + bg * bg);
168 isChanged = true;
169}

◆ SetParticle()

void Garfield::Track::SetParticle ( std::string  part)
virtual

Reimplemented in Garfield::TrackElectron.

Definition at line 29 of file Track.cc.

29 {
30
31 isElectron = false;
32 if (part == "electron" || part == "Electron" || part == "e-") {
33 q = -1;
34 mass = ElectronMass;
35 spin = 1;
36 isElectron = true;
37 particleName = "e-";
38 } else if (part == "positron" || part == "Positron" || part == "e+") {
39 q = 1;
40 mass = ElectronMass;
41 spin = 1;
42 particleName = "e+";
43 } else if (part == "muon" || part == "Muon" || part == "mu" ||
44 part == "mu-") {
45 q = -1;
46 mass = MuonMass;
47 spin = 1;
48 particleName = "mu-";
49 } else if (part == "mu+") {
50 q = 1;
51 mass = MuonMass;
52 spin = 1;
53 particleName = "mu+";
54 } else if (part == "pion" || part == "Pion" || part == "pi" ||
55 part == "pi-") {
56 q = -1;
57 mass = 139.57018e6;
58 spin = 0;
59 particleName = "pi-";
60 } else if (part == "pi+") {
61 q = 1;
62 mass = 139.57018e6;
63 spin = 0;
64 particleName = "pi+";
65 } else if (part == "kaon" || part == "Kaon" || part == "K" || part == "K-") {
66 q = -1;
67 mass = 493.677e6;
68 spin = 0;
69 particleName = "K-";
70 } else if (part == "K+") {
71 q = 1;
72 mass = 493.677e6;
73 spin = 0;
74 particleName = "K+";
75 } else if (part == "proton" || part == "Proton" || part == "p") {
76 q = 1;
77 mass = ProtonMass;
78 spin = 1;
79 particleName = "p";
80 } else if (part == "anti-proton" || part == "Anti-Proton" ||
81 part == "antiproton" || part == "Antiproton" || part == "p-bar") {
82 q = -1;
83 mass = ProtonMass;
84 spin = 1;
85 particleName = "pbar";
86 } else if (part == "deuteron" || part == "Deuteron" || part == "d") {
87 q = 1;
88 mass = 1875.612793e6;
89 spin = 2;
90 particleName = "d";
91 } else if (part == "alpha" || part == "Alpha") {
92 q = 2;
93 mass = 3.727379240e9;
94 spin = 0;
95 particleName = "alpha";
96 } else {
97 std::cerr << className << "::SetParticle:\n";
98 std::cerr << " Particle " << part << " is not defined.\n";
99 }
100}

Referenced by GarfieldPhysics::DoIt().

◆ SetSensor()

void Garfield::Track::SetSensor ( Sensor s)

Definition at line 185 of file Track.cc.

185 {
186
187 if (s == 0) {
188 std::cerr << className << "::SetSensor:\n";
189 std::cerr << " Sensor pointer is null.\n";
190 return;
191 }
192
193 sensor = s;
194}

Referenced by GarfieldPhysics::InitializePhysics().

Member Data Documentation

◆ beta2

◆ className

◆ debug

◆ energy

double Garfield::Track::energy
protected

◆ isChanged

◆ isElectron

bool Garfield::Track::isElectron
protected

◆ mass

◆ particleName

std::string Garfield::Track::particleName
protected

◆ plotId

int Garfield::Track::plotId
protected

Definition at line 80 of file Track.hh.

Referenced by PlotCluster(), and PlotNewTrack().

◆ q

double Garfield::Track::q
protected

◆ sensor

◆ spin

int Garfield::Track::spin
protected

◆ usePlotting

bool Garfield::Track::usePlotting
protected

◆ viewer

ViewDrift* Garfield::Track::viewer
protected

Definition at line 76 of file Track.hh.

Referenced by DisablePlotting(), EnablePlotting(), PlotCluster(), and PlotNewTrack().


The documentation for this class was generated from the following files: