Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects
Commit 317bbb4e authored by kraus's avatar kraus
Browse files

fixing problems in Autophasing algorithm with DC guns

parent 5d5d445d
No related branches found
No related tags found
No related merge requests found
......@@ -52,7 +52,6 @@ double CavityAutophaser::getPhaseAtMaxEnergy(const Vector_t &R,
if (!apVeto) {
double initialEnergy = Util::getEnergy(P, itsReference_m.getM()) * 1e-6;
double AstraPhase = 0.0;
double initialPhase = guessCavityPhase(t + tErr);
double designEnergy = element->getDesignEnergy();
if (amplitude < 0.0) {
......@@ -60,6 +59,8 @@ double CavityAutophaser::getPhaseAtMaxEnergy(const Vector_t &R,
element->setAmplitudem(amplitude);
}
double initialPhase = guessCavityPhase(t + tErr);
if (amplitude == 0.0 && designEnergy <= 0.0) {
throw OpalException("CavityAutophaser::getPhaseAtMaxEnergy()",
"neither amplitude or design energy given to cavity " + element->getName());
......@@ -245,11 +246,9 @@ double CavityAutophaser::track(Vector_t R,
itsReference_m.getQ(),
itsReference_m.getM() * 1e-6,
out);
double finalMomentum = pe.first;
rfc->setPhasem(initialPhase);
double finalGamma = sqrt(1.0 + finalMomentum * finalMomentum);
double finalKineticEnergy = (finalGamma - 1.0) * itsReference_m.getM() * 1e-6;
double finalKineticEnergy = Util::getEnergy(pe.first, itsReference_m.getM() * 1e-6);
return finalKineticEnergy;
}
\ No newline at end of file
......@@ -35,15 +35,6 @@ extern Inform *gmsg;
using namespace std;
class NegativeMomentumError: public GeneralClassicException
{
public:
NegativeMomentumError(const std::string &where,
const std::string &what):
GeneralClassicException(where, what)
{ }
};
// Class RFCavity
// ------------------------------------------------------------------------
......@@ -619,6 +610,8 @@ ElementBase::ElementType RFCavity::getType() const {
double RFCavity::getAutoPhaseEstimateFallback(double E0, double t0, double q, double mass) {
const double dt = 1e-13;
const double p0 = Util::getP(E0, mass);
const double origPhase =getPhasem();
double dphi = pi / 18;
double phi = 0.0;
......@@ -652,6 +645,7 @@ double RFCavity::getAutoPhaseEstimateFallback(double E0, double t0, double q, do
<< phimax * Physics::rad2deg << " deg \n"
<< "Ekin= " << Emax << " MeV" << setprecision(prevPrecision) << endl);
setPhasem(origPhase);
return phimax;
}
......@@ -815,9 +809,6 @@ pair<double, double> RFCavity::trackOnAxisParticle(const double &p0,
applyToReferenceParticle(z, p, t + 0.5 * dt, Ef, Bf);
}
integrator.kick(z, p, Ef, Bf, dt);
if (z[2] < zbegin)
throw NegativeMomentumError("RFCavit::trackOnAxisParticle",
"registered negative momentum");
dz = 0.5 * p(2) / sqrt(1.0 + dot(p, p)) * cdt;
z /= cdt;
......
  • adelmann :reminder_ribbon: @adelmann ·
    Owner

    Looks like the DC gun tests are broken now

  • Author Developer

    Ok, that's fixed now.

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment