1 #ifndef GREENWAKEFUNCTION_HH
2 #define GREENWAKEFUNCTION_HH
29 std::vector<Filter *> filters,
44 virtual const std::string
getType()
const;
51 Wake(
double s,
double Z0,
double a,
double sigma,
int acMode,
double tau,
int direction)
64 std::complex <double> i(0, 1);
65 std::complex <double> Z(0, 0);
66 double signK = (k > 0 ? 1 : -1);
86 ERRORMSG(
"We should not be here: " << __FILE__ <<
" L" << __LINE__ <<
endl);
121 template<
class F>
double simpson(F &f,
double a,
double b,
unsigned int N) {
126 double h = (b - a) / N;
129 result += (f(a) + 4 * f(a + h / 2) + f(b)) / 2.0;
132 for(
unsigned int i = 1; i < N; ++ i) {
133 result += f(a + i * h) + 2 * f(a + (i + 0.5) * h);
168 void compEnergy(
const double K,
const double charge,
const double *lambda,
double *OutEnergy);
169 void compEnergy(
const double K,
const double charge, std::vector<double> lambda,
double *OutEnergy);
172 #endif //GREENWAKEFUNCTION_HH
std::vector< double > FftWField_m
FFT of the zero padded wakefield.
void setWakeFromFile(int NBin, double spacing)
reads in the wakefield from file
PETE_TUTree< FnAbs, typename T::PETE_Expr_t > abs(const PETE_Expr< T > &l)
std::map< std::string, int > FilterOptions
Interface for basic beam line object.
GreenWakeFunction(const std::string &name, ElementBase *element, std::vector< Filter * > filters, int NBIN, double Z0, double radius, double sigma, int acMode, double tau, int direction, bool constLength, std::string fname)
just a Testfunction! Calculate the energy of the Wakefunction with the lambda
std::vector< double > lineDensity_m
save the line Density of the particle bunch
double operator()(double k)
Used to integrate the function.
double tau_
material constant
double s_
distance from the particle
Wake(double s, double Z0, double a, double sigma, int acMode, double tau, int direction)
double sigma_m
material constant
double sigma_
material constant
std::pair< int, int > distrIndices(int vectLen)
given a vector of length N, distribute the indexes among the available processors ...
FLieGenerator< T, N > real(const FLieGenerator< std::complex< T >, N > &)
Take real part of a complex generator.
virtual const std::string getType() const
int acMode_
conductivity either 1="AC" or 2="DC"
double simpson(F &f, double a, double b, unsigned int N)
Simpson-Integration from the function f from a to b with N steps.
int acMode_m
conductivity either 1="AC" or 2="DC"
constexpr double pi
The value of .
constexpr double c
The velocity of light in m/s.
int direction_m
direction either 1="Longitudinal" 2= "Transversal"
void testApply(PartBunchBase< double, 3 > *bunch)
Just a test function.
void apply(PartBunchBase< double, 3 > *bunch)
double tau_m
material constant
void CalcWakeFFT(double spacing)
Calculate the FFT of the Wakefunction.
std::vector< Filter * > filters_m
Tps< T > sqrt(const Tps< T > &x)
Square root.
int NBin_m
divides the particle bunch in NBin slices
Tps< T > cos(const Tps< T > &x)
Cosine.
bool constLength_m
true if the length of the particle bunch is considered as constant
std::string filename_m
filename of the wakefield
void compEnergy(const double K, const double charge, const double *lambda, double *OutEnergy)
just a Testfunction! Calculate the energy of the Wakefunction with the lambda
int direction_
direction either 1="Longitudinal" 0= "Transversal"
Inform & endl(Inform &inf)