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

new version

parent ad089acd
......@@ -2067,12 +2067,20 @@ void PartBunch::calcBeamParameters_cycl() {
eps_m = eps_norm_m / Vector_t(betagamma);
}
void PartBunch::calcEMean() {
const double totalNp = static_cast<double>(this->getTotalNum());
const double locNp = static_cast<double>(this->getLocalNum());
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;
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));
......@@ -2082,6 +2090,7 @@ void PartBunch::calcEMean() {
double ga = std::sqrt(bega*bega + 1.0);
eKin_m = (ga-1.0) * getM() * 1e-6;
*/
}
......
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