1 #ifndef CLASSIC_TravelingWave_HH
2 #define CLASSIC_TravelingWave_HH
61 virtual void setPhasem(
double phase)
override;
67 virtual double getAutoPhaseEstimate(
const double & E0,
const double & t0,
const double & q,
const double & m)
override;
79 virtual bool bends()
const override;
81 virtual void goOnline(
const double &kineticEnergy)
override;
87 virtual void getDimensions(
double &zBegin,
double &zEnd)
const override;
92 double &
end)
const override;
114 inline double getdE(
const int & i,
116 const std::vector<double> & t,
118 const std::vector<std::pair<double, double> > & F)
const;
120 inline double getdT(
const int & i,
122 const std::vector<double> & E,
123 const std::vector<std::pair<double, double> > & F,
124 const double mass)
const;
126 inline double getdA(
const int & i,
128 const std::vector<double> & t,
130 const std::vector<std::pair<double, double> > & F)
const;
132 inline double getdB(
const int & i,
134 const std::vector<double> & t,
136 const std::vector<std::pair<double, double> > & F)
const;
143 const std::vector<double> & t,
145 const std::vector<std::pair<double, double> > & F)
const {
153 const std::vector<double> & E,
154 const std::vector<std::pair<double, double> > & F,
155 const double mass)
const {
156 double gamma1 = 1. + (19. * E[i-1] + 1. * E[i]) / (20. * mass);
157 double gamma2 = 1. + (17. * E[i-1] + 3. * E[i]) / (20. * mass);
158 double gamma3 = 1. + (15. * E[i-1] + 5. * E[i]) / (20. * mass);
159 double gamma4 = 1. + (13. * E[i-1] + 7. * E[i]) / (20. * mass);
160 double gamma5 = 1. + (11. * E[i-1] + 9. * E[i]) / (20. * mass);
161 double gamma6 = 1. + (9. * E[i-1] + 11. * E[i]) / (20. * mass);
162 double gamma7 = 1. + (7. * E[i-1] + 13. * E[i]) / (20. * mass);
163 double gamma8 = 1. + (5. * E[i-1] + 15. * E[i]) / (20. * mass);
164 double gamma9 = 1. + (3. * E[i-1] + 17. * E[i]) / (20. * mass);
165 double gamma10 = 1. + (1. * E[i-1] + 19. * E[i]) / (20. * mass);
166 return (F[I].first - F[I-1].first) *
167 (1. /
std::sqrt(1. - 1. / (gamma1 * gamma1)) +
168 1. /
std::sqrt(1. - 1. / (gamma2 * gamma2)) +
169 1. /
std::sqrt(1. - 1. / (gamma3 * gamma3)) +
170 1. /
std::sqrt(1. - 1. / (gamma4 * gamma4)) +
171 1. /
std::sqrt(1. - 1. / (gamma5 * gamma5)) +
172 1. /
std::sqrt(1. - 1. / (gamma6 * gamma6)) +
173 1. /
std::sqrt(1. - 1. / (gamma7 * gamma7)) +
174 1. /
std::sqrt(1. - 1. / (gamma8 * gamma8)) +
175 1. /
std::sqrt(1. - 1. / (gamma9 * gamma9)) +
181 const std::vector<double> & t,
183 const std::vector<std::pair<double, double> > & F)
const {
184 double dt = t[i] - t[i-1];
192 const std::vector<double> & t,
194 const std::vector<std::pair<double, double> > & F)
const {
195 double dt = t[i] - t[i-1];
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.
PartBunchBase< T, Dim >::ConstIterator end(PartBunchBase< T, Dim > const &bunch)
PartBunchBase< T, Dim >::ConstIterator begin(PartBunchBase< T, Dim > const &bunch)
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.
Interface for Traveling Wave.
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 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 frequencey.
virtual ElementBase::ElementType getType() const override
Get element type std::string.
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