Commit 52751225 authored by adelmann's avatar adelmann 🎗
Browse files

Some fixed w.r.t. Ekin

parent 99b66bec
......@@ -2070,16 +2070,18 @@ void PartBunch::calcBeamParameters_cycl() {
void PartBunch::calcEMean() {
const double locNp = static_cast<double>(this->getLocalNum());
const double TotalNp = static_cast<double>(this->getTotalNum());
const double totalNp = static_cast<double>(this->getTotalNum());
Vector_t pm(0.0);
eKin_m = 0.0;
for(unsigned int k = 0; k < locNp; k++)
eKin_m += (sqrt(dot(P[k], P[k]) + 1.0) - 1.0) * getM() * 1e-6;
//eKin_m += (sqrt(P[k](2)*P[k](2) + 1.0) - 1.0) * getM() * 1e-6;
reduce(eKin_m, eKin_m, OpAddAssign());
eKin_m /= TotalNp;
std::for_each(P.begin(), P.end(), [&](Vector_t x) { pm += x; });
double bega = std::sqrt(dot(pm,pm));
reduce(bega, bega, OpAddAssign());
bega /= totalNp;
double ga = std::sqrt(bega*bega + 1.0);
eKin_m = (ga-1.0) * getM() * 1e-6;
}
......
......@@ -2820,13 +2820,13 @@ void Distribution::GenerateGaussZ(size_t numberOfParticles) {
}
}
/*
//std::for_each(v.rbegin(), v.rend(), [&](int n) { sum_of_elements += n; });
double pxm = std::accumulate(pxDist_m.begin(), pxDist_m.end(), 0.0);
double pym = std::accumulate(pyDist_m.begin(), pyDist_m.end(), 0.0);
double pzm = std::accumulate(pzDist_m.begin(), pzDist_m.end(), 0.0);
*gmsg << "pxm= " << pxm << " pym= " << pym << " pzm= " << pzm << endl;
std::cout << "bega= " << std::sqrt(pxm*pxm + pym*pym + pzm*pzm) << std::endl;
*/
if (randGen)
delete randGen;
}
......
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