Commit 993ba266 authored by kraus's avatar kraus

Merge branch 'cherry-pick-5ff2f5ae' into 'OPAL-2.2'

Merge branch '609-transversely-shifted-distribution-in-temporal-monitors' into 'master'

See merge request !446
parents f9be6c67 eef262ab
...@@ -104,7 +104,7 @@ bool Monitor::applyToReferenceParticle(const Vector_t &R, ...@@ -104,7 +104,7 @@ bool Monitor::applyToReferenceParticle(const Vector_t &R,
dt * (R(2) + P(2) * recpgamma) > dt * middle) { dt * (R(2) + P(2) * recpgamma) > dt * middle) {
double frac = (middle - R(2)) / (P(2) * recpgamma); double frac = (middle - R(2)) / (P(2) * recpgamma);
double time = t + frac * dt; double time = t + frac * dt;
Vector_t dR = (0.5 + frac) * P * recpgamma; Vector_t dR = frac * P * recpgamma;
double ds = euclidean_norm(dR); double ds = euclidean_norm(dR);
lossDs_m->addReferenceParticle(csTrafoGlobal2Local_m.transformFrom(R + dR), lossDs_m->addReferenceParticle(csTrafoGlobal2Local_m.transformFrom(R + dR),
csTrafoGlobal2Local_m.rotateFrom(P), csTrafoGlobal2Local_m.rotateFrom(P),
...@@ -117,9 +117,12 @@ bool Monitor::applyToReferenceParticle(const Vector_t &R, ...@@ -117,9 +117,12 @@ bool Monitor::applyToReferenceParticle(const Vector_t &R,
for (unsigned int i = 0; i < localNum; ++ i) { for (unsigned int i = 0; i < localNum; ++ i) {
const double recpgamma = Physics::c * dt / Util::getGamma(RefPartBunch_m->P[i]); const double recpgamma = Physics::c * dt / Util::getGamma(RefPartBunch_m->P[i]);
lossDs_m->addParticle(RefPartBunch_m->R[i] + frac * RefPartBunch_m->P[i] * recpgamma - halfLength_s, Vector_t shift = frac * recpgamma * RefPartBunch_m->P[i] - Vector_t(0, 0, middle);
RefPartBunch_m->P[i], RefPartBunch_m->ID[i], lossDs_m->addParticle(RefPartBunch_m->R[i] + shift,
time, 0); RefPartBunch_m->P[i],
RefPartBunch_m->ID[i],
time,
0);
} }
OpalData::OPENMODE openMode; OpalData::OPENMODE openMode;
if (numPassages_m > 0) { if (numPassages_m > 0) {
......
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