18#ifndef CLASSIC_TravelingWave_HH
19#define CLASSIC_TravelingWave_HH
51 virtual void setPhasem(
double phase)
override;
57 virtual double getAutoPhaseEstimate(
const double& E0,
const double& t0,
const double& q,
const double& m)
override;
69 virtual bool bends()
const override;
71 virtual void goOnline(
const double& kineticEnergy)
override;
77 virtual void getDimensions(
double& zBegin,
double& zEnd)
const override;
82 double&
end)
const override;
104 inline double getdE(
const int& i,
106 const std::vector<double>& t,
108 const std::vector<std::pair<double, double> >& F)
const;
110 inline double getdT(
const int& i,
112 const std::vector<double>& E,
113 const std::vector<std::pair<double, double> >& F,
114 const double mass)
const;
116 inline double getdA(
const int& i,
118 const std::vector<double>& t,
120 const std::vector<std::pair<double, double> >& F)
const;
122 inline double getdB(
const int& i,
124 const std::vector<double>& t,
126 const std::vector<std::pair<double, double> >& F)
const;
133 const std::vector<double>& t,
135 const std::vector<std::pair<double, double> >& F)
const {
143 const std::vector<double>& E,
144 const std::vector<std::pair<double, double> >& F,
145 const double mass)
const {
146 double gamma1 = 1. + (19. * E[i-1] + 1. * E[i]) / (20. * mass);
147 double gamma2 = 1. + (17. * E[i-1] + 3. * E[i]) / (20. * mass);
148 double gamma3 = 1. + (15. * E[i-1] + 5. * E[i]) / (20. * mass);
149 double gamma4 = 1. + (13. * E[i-1] + 7. * E[i]) / (20. * mass);
150 double gamma5 = 1. + (11. * E[i-1] + 9. * E[i]) / (20. * mass);
151 double gamma6 = 1. + (9. * E[i-1] + 11. * E[i]) / (20. * mass);
152 double gamma7 = 1. + (7. * E[i-1] + 13. * E[i]) / (20. * mass);
153 double gamma8 = 1. + (5. * E[i-1] + 15. * E[i]) / (20. * mass);
154 double gamma9 = 1. + (3. * E[i-1] + 17. * E[i]) / (20. * mass);
155 double gamma10 = 1. + (1. * E[i-1] + 19. * E[i]) / (20. * mass);
156 return (F[I].first - F[I-1].first) *
157 (1. /
std::sqrt(1. - 1. / (gamma1 * gamma1)) +
158 1. /
std::sqrt(1. - 1. / (gamma2 * gamma2)) +
159 1. /
std::sqrt(1. - 1. / (gamma3 * gamma3)) +
160 1. /
std::sqrt(1. - 1. / (gamma4 * gamma4)) +
161 1. /
std::sqrt(1. - 1. / (gamma5 * gamma5)) +
162 1. /
std::sqrt(1. - 1. / (gamma6 * gamma6)) +
163 1. /
std::sqrt(1. - 1. / (gamma7 * gamma7)) +
164 1. /
std::sqrt(1. - 1. / (gamma8 * gamma8)) +
165 1. /
std::sqrt(1. - 1. / (gamma9 * gamma9)) +
171 const std::vector<double>& t,
173 const std::vector<std::pair<double, double> >& F)
const {
174 double dt = t[i] - t[i-1];
182 const std::vector<double>& t,
184 const std::vector<std::pair<double, double> >& F)
const {
185 double dt = t[i] - t[i-1];
PartBunchBase< T, Dim >::ConstIterator end(PartBunchBase< T, Dim > const &bunch)
PartBunchBase< T, Dim >::ConstIterator begin(PartBunchBase< T, Dim > const &bunch)
Tps< T > cos(const Tps< T > &x)
Cosine.
Tps< T > sin(const Tps< T > &x)
Sine.
Tps< T > sqrt(const Tps< T > &x)
Square root.
PETE_TUTree< FnFloor, typename T::PETE_Expr_t > floor(const PETE_Expr< T > &l)
constexpr double two_pi
The value of.
constexpr double c
The velocity of light in m/s.
constexpr double pi
The value of.
virtual double getElementLength() const override
Get design length.
double mappedStartExitField_m
double getdA(const int &i, const int &I, const std::vector< double > &t, const double &phi, const std::vector< std::pair< double, double > > &F) const
virtual double getAmplitude() const override=0
Get RF amplitude.
virtual ElementType getType() const override
Get element type std::string.
virtual double getPhase() const override=0
Get RF phase.
virtual bool bends() const override
virtual void accept(BeamlineVisitor &) const override
Apply visitor to TravelingWave.
virtual void getDimensions(double &zBegin, double &zEnd) const override
virtual double getFrequency() const override=0
Get RF frequency.
void setNumCells(int NumCells)
void setMode(double mode)
void operator=(const TravelingWave &)
double getdB(const int &i, const int &I, const std::vector< double > &t, const double &phi, const std::vector< std::pair< double, double > > &F) const
virtual void setPhasem(double phase) override
virtual double getAutoPhaseEstimate(const double &E0, const double &t0, const double &q, const double &m) override
virtual bool isInside(const Vector_t &r) const override
virtual void goOffline() override
double getdE(const int &i, const int &I, const std::vector< double > &t, const double &phi, const std::vector< std::pair< double, double > > &F) const
virtual CoordinateSystemTrafo getEdgeToEnd() const override
virtual bool apply(const size_t &i, const double &t, Vector_t &E, Vector_t &B) override
virtual void finalise() override
virtual CoordinateSystemTrafo getEdgeToBegin() const override
virtual void initialise(PartBunchBase< double, 3 > *bunch, double &startField, double &endField) override
virtual void getElementDimensions(double &begin, double &end) const override
virtual bool applyToReferenceParticle(const Vector_t &R, const Vector_t &P, const double &t, Vector_t &E, Vector_t &B) override
double getdT(const int &i, const int &I, const std::vector< double > &E, const std::vector< std::pair< double, double > > &F, const double mass) const
virtual void goOnline(const double &kineticEnergy) override
Vektor< double, 3 > Vector_t