31#include "gsl/gsl_sf_pow_int.h"
36 const std::string &name):
39 planarArcGeometry_m(1.0, 1.0),
46 maxOrderX_m(right.maxOrderX_m),
47 recursion_m(right.recursion_m),
48 planarArcGeometry_m(right.planarArcGeometry_m),
49 angle_m(right.angle_m) {
62 double alpha = atan(R[2] / (R[0] + radius ));
64 R[0] = R[2] / sin(
alpha) - radius;
65 R[2] = radius *
alpha;
76 B[0] = Bx * cos(theta) - Bs * sin(theta);
77 B[2] = Bx * sin(theta) + Bs * cos(theta);
83 while (maxOrder >= N) {
113 for (std::size_t j = 0;
117 for (std::size_t i = 0;
123 func += (
recursion_m.at(n).evaluatePolynomial(x / rho, i, j)
125 / gsl_sf_pow_int(rho, 2 * n - i - 2 * j);
128 func *= gsl_sf_pow_int(-1.0, n);
constexpr double alpha
The fine structure constant, no dimension.
PartBunch_t * RefPartBunch_m
std::size_t getTransMaxOrder() const
Get the maximum order in the given transverse profile.
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...
double getLength() const
Get the length of the magnet.
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.
std::vector< polynomial::RecursionRelation > recursion_m
Object for storing differential operator acting on Fn.
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...
std::size_t maxOrderX_m
Highest order of polynomial expansions in x.
virtual void transformCoords(Vector_t< double, 3 > &R) override
Transform to Frenet-Serret coordinates for sector magnets.
MultipoleTCurvedConstRadius(const std::string &name)
Constructor.
virtual double getRadius(const double &s) override
Radius of curvature If radius of curvature is infinite, -1 is returned .
virtual void transformBField(Vector_t< double, 3 > &B, const Vector_t< double, 3 > &R) override
Transform B-field from Frenet-Serret coordinates to lab coordinates.
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...
~MultipoleTCurvedConstRadius()
Destructor.
virtual double getScaleFactor(const double &x, const double &s) override
Returns the scale factor .
virtual ElementBase * clone() const override
Inheritable copy constructor.
void resizeX(const std::size_t &xDerivatives)
Change number of x-derivatives to xDerivatives.
void truncate(std::size_t highestXorder)
Truncate series in x at highestXorder.