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 <<
" Beta must be between zero and one.\n";
131 <<
" Gamma must be greater than one.\n";
136 m_beta2 = 1. - 1. / (gamma * gamma);
143 <<
" Particle momentum must be greater than zero.\n";
148 const double bg = p /
m_mass;
149 m_beta2 = bg * bg / (1. + bg * bg);
155 std::cerr <<
m_className <<
"::SetKineticEnergy:\n"
156 <<
" Kinetic energy must be greater than zero.\n";
161 const double gamma = 1. + ekin /
m_mass;
162 m_beta2 = 1. - 1. / (gamma * gamma);
168 std::cerr <<
m_className <<
"::SetSensor: Null pointer.\n";
177 std::cerr <<
m_className <<
"::EnablePlotting: Null pointer.\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 size_t iL, const float x, const float y, const float z)
void NewChargedParticleTrack(const size_t np, size_t &id, const float x0, const float y0, const float z0)