Commit 9b8d1ab2 authored by Heinrich Schindler's avatar Heinrich Schindler
Browse files

Fix warnings in AliceTPC example.

parent 81ae57a9
Pipeline #3132192 passed with stage
in 5 minutes and 49 seconds
......@@ -157,6 +157,7 @@ int main(int argc, char * argv[]) {
z0 += RndmGaussian() * sigma;
sensor.EnableComponent(0, true);
sensor.EnableComponent(1, false);
if (x0 < xmin || x0 > xmax) continue;
drift.DriftElectron(x0, 1.2, z0, 0.);
double x1 = 0., y1 = gap, z1 = 0., t1 = 0.;
int status = 0;
......@@ -170,7 +171,10 @@ int main(int argc, char * argv[]) {
for (int j = 0; j < nIons; ++j) {
constexpr double r = 0.01;
const double angle = RndmGaussian(0, 1.4);
drift.DriftIon(x1 + r * sin(angle), gap + r * cos(angle), 0, 0);
const double xi = x1 + r * sin(angle);
const double yi = gap + r * cos(angle);
if (xi < xmin || xi > xmax) continue;
drift.DriftIon(xi, yi, 0, 0);
}
}
}
......
......@@ -293,19 +293,20 @@ bool DriftLineRKF::DriftLine(const double xi, const double yi, const double zi,
Vec v0 = {0., 0., 0.};
if (!GetVelocity(x0, particle, v0, flag)) {
flag = StatusCalculationAbandoned;
std::cerr << m_className << "::DriftLine:\n"
<< " Cannot retrieve drift velocity.\n";
std::cerr << m_className << "::DriftLine: "
<< "Cannot retrieve drift velocity.\n";
return false;
} else if (flag != 0) {
std::cerr << m_className << "::DriftLine:\n"
<< " No valid field at initial position.\n";
std::cerr << m_className << "::DriftLine: "
<< "No valid field at initial position.\n";
std::cerr << PrintVec(x0) << "\n";
return false;
}
const double speed0 = Mag(v0);
if (speed0 < Small) {
std::cerr << m_className << "::DriftLine:\n"
<< " Zero velocity at initial position.\n";
std::cerr << m_className << "::DriftLine: "
<< "Zero velocity at initial position.\n";
return false;
}
......@@ -1522,8 +1523,8 @@ bool DriftLineRKF::FieldLine(const double xi, const double yi, const double zi,
int stat = 0;
m_sensor->ElectricField(xi, yi, zi, ex, ey, ez, medium, stat);
if (!medium || stat != 0) {
std::cerr << m_className << "::FieldLine:\n"
<< " No valid field at initial position.\n";
std::cerr << m_className << "::FieldLine: "
<< "No valid field at initial position.\n";
return false;
}
Vec x0 = {xi, yi, zi};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment