16 std::string
id = part;
17 std::transform(
id.begin(),
id.end(),
id.begin(),
18 [](
unsigned char c) ->
unsigned char {
19 return std::toupper(c);
22 if (
id ==
"ELECTRON" ||
id ==
"E-") {
28 }
else if (
id ==
"POSITRON" ||
id ==
"E+") {
33 }
else if (
id ==
"MUON" ||
id ==
"MU" ||
id ==
"MU-") {
38 }
else if (
id ==
"MU+") {
43 }
else if (
id ==
"PION" ||
id ==
"PI" ||
id ==
"PI-") {
48 }
else if (
id ==
"PI+") {
53 }
else if (
id ==
"KAON" ||
id ==
"K" ||
id ==
"K-") {
58 }
else if (
id ==
"K+") {
63 }
else if (
id ==
"PROTON" ||
id ==
"P") {
68 }
else if (
id ==
"ANTI-PROTON" ||
id ==
"ANTIPROTON" ||
69 id ==
"P-BAR" ||
id ==
"PBAR") {
74 }
else if (
id ==
"DEUTERON" ||
id ==
"D") {
79 }
else if (
id ==
"ALPHA") {
86 <<
" Particle " << part <<
" is not defined.\n";
93 <<
" Particle energy must be greater than the mass.\n";
99 m_beta2 = 1. - 1. / (gamma * gamma);
106 <<
" Particle speed must be greater than zero.\n";
110 const double bg2 = bg * bg;
117 if (beta <= 0. && beta >= 1.) {
119 std::cerr <<
" Particle speed must be between zero"
120 <<
" and speed of light.\n";
132 std::cerr <<
" Particle speed must be greater than zero.\n";
137 m_beta2 = 1. - 1. / (gamma * gamma);
144 std::cerr <<
" Particle momentum must be greater than zero.\n";
149 const double bg = p /
m_mass;
150 m_beta2 = bg * bg / (1. + bg * bg);
156 std::cerr <<
m_className <<
"::SetKineticEnergy:\n";
157 std::cerr <<
" Kinetic energy must be greater than zero.\n";
162 const double gamma = 1. + ekin /
m_mass;
163 m_beta2 = 1. - 1. / (gamma * gamma);
170 std::cerr <<
" Sensor pointer is null.\n";
180 std::cerr <<
" Pointer is null.\n";
202 std::cerr <<
" No track set. Program bug!\n";
void DisablePlotting()
Switch off plotting.
void EnablePlotting(ViewDrift *viewer)
Switch on plotting.
void SetBetaGamma(const double bg)
Set the relative momentum of the particle.
void SetSensor(Sensor *s)
Set the sensor through which to transport the particle.
void SetKineticEnergy(const double ekin)
Set the kinetic energy of the particle.
void SetMomentum(const double p)
Set the particle momentum.
virtual void SetParticle(const std::string &part)
std::string m_particleName
void PlotCluster(const double x0, const double y0, const double z0)
void SetEnergy(const double e)
Set the particle energy.
void SetGamma(const double gamma)
Set the Lorentz factor of the particle.
void SetBeta(const double beta)
Set the speed ( ) of the particle.
void PlotNewTrack(const double x0, const double y0, const double z0)
Visualize drift lines and tracks.
void AddTrackPoint(const unsigned int iL, const double x, const double y, const double z)
void NewChargedParticleTrack(const unsigned int np, int &id, const double x0, const double y0, const double z0)