29#include "gsl/gsl_sf_gamma.h"
30#include "gsl/gsl_sf_pow_int.h"
37 straightGeometry_m(getLength()) {
42 straightGeometry_m(right.straightGeometry_m) {
66 for(std::size_t i = 0; i <= n; i++) {
70 f_n *= gsl_sf_pow_int(-1.0, n);
71 Bx += f_n * gsl_sf_pow_int(R[1], 2 * n + 1) / gsl_sf_fact(2 * n + 1);
80 for(std::size_t i = 0; i <= n; i++) {
84 f_n *= gsl_sf_pow_int(-1.0, n);
85 Bs += f_n * gsl_sf_pow_int(R[1], 2 * n + 1) / gsl_sf_fact(2 * n + 1);
97 for (std::size_t i = 0; i <= n; i++) {
101 f_n *= gsl_sf_pow_int(-1.0, n);
PartBunch_t * RefPartBunch_m
virtual void setMaxOrder(const std::size_t &maxOrder)
Set the number of terms used in calculation of field components Maximum power of z in Bz is 2 * maxO...
std::size_t getMaxOrder() const
Get the number of terms used in calculation of field components.
double getTransDeriv(const std::size_t &n, const double &x)
Returns the value of the transverse field n-th derivative at x Transverse field is a polynomial in x...
double getFringeDeriv(const std::size_t &n, const double &s)
Returns the value of the fringe field n-th derivative at s.
virtual double getBs(const Vector_t< double, 3 > &R) override
Get s-component of the B-field This function has been overloaded because calculating the B-field di...
virtual double getBx(const Vector_t< double, 3 > &R) override
Get x-component of the B-field This function has been overloaded because calculating the B-field di...
~MultipoleTStraight()
Destructor.
virtual double getFn(const std::size_t &n, const double &x, const double &s) override
Calculate fn(x, s) by expanding the differential operator (from Laplacian and scalar potential) in te...
virtual void setMaxOrder(const std::size_t &maxOrder) override
Set the number of terms used in calculation of field components Maximum power of z in Bz is 2 * maxO...
virtual ElementBase * clone() const override
Inheritable copy constructor.
MultipoleTStraight(const std::string &name)
Constructor.
virtual void transformCoords(Vector_t< double, 3 > &R) override
Transform to Frenet-Serret coordinates for sector magnets.