31#ifndef CLASSIC_MULTIPOLET_H
32#define CLASSIC_MULTIPOLET_H
137 double& endField)
override;
141 bool bends()
const override;
167 const double& lambda_right);
202 void setAperture(
const double& vertAp,
const double& horizAp);
253 double getTransDeriv(
const std::size_t&
n,
const double& x)
const;
Interface for a single beam element.
Calculate the Tanh function (e.g.
Vector_t toMagnetCoords(const Vector_t &R)
void setRotation(double rot)
Set the angle of rotation of the magnet around its axis To make skew components.
std::size_t getTransMaxOrder() const
Get the maximum order in the given transverse profile.
std::vector< double > transProfile_m
List of transverse profile coefficients.
double getBoundingBoxLength() const
Get the bounding box size.
void setScalingName(const std::string &name)
Vector_t localCartesianToOpalCartesian(const Vector_t &r)
std::size_t maxFOrder_m
Number of terms in z expansion used in calculating field components.
BMultipoleField dummy
Not implemented.
size_t getMaxFOrder() const
Get the number of terms used in calculation of field components.
const EMField & getField() const override
Return a dummy field value.
bool getVariableRadius() const
Get the variable radius of the magnet.
void setBendAngle(double angle, bool variableRadius)
Set the bending angle of the magnet.
std::size_t maxXOrder_m
Highest order of polynomial expansions in x.
double getFringeDeriv(const std::size_t &n, const double &s)
Returns the value of the fringe field n-th derivative at s.
void setElementLength(double length) override
Set the length of the magnet If straight-> Actual length If curved -> Arc length.
endfieldmodel::Tanh fringeField_r
endfieldmodel::Tanh fringeField_l
void setEntranceAngle(double entranceAngle)
Set the entrance angle.
void initialise(PartBunchBase< double, 3 > *bunch, double &startField, double &endField) override
Initialise the MultipoleT.
ElementBase * clone() const override
Inheritable copy constructor.
std::tuple< double, double > getAperture()
Get the aperture dimensions.
std::string scalingName_m
double getLength() const
Get the length of the magnet.
EMField & getField() override
Return a dummy field value.
void accept(BeamlineVisitor &visitor) const override
Accept a beamline visitor.
double verticalApert_m
Assume rectangular aperture with these dimensions.
void setAperture(const double &vertAp, const double &horizAp)
Set the aperture dimensions This element only supports a rectangular aperture.
void setMaxOrder(size_t orderZ, size_t orderX)
Set the number of terms used in calculation of field components .
double length_m
Magnet parameters.
const std::vector< double > & getTransProfile() const
Get all terms of transverse profile.
double localCartesianRotation()
bool apply(const Vector_t &R, const Vector_t &P, const double &t, Vector_t &E, Vector_t &B) override
Calculate the field at some arbitrary position If particle is outside field map true is returned,...
void finalise() override
Finalise the MultipoleT - sets bunch to nullptr.
Vector_t rotateFrame(const Vector_t &R) const
Rotate the frame to account for the rotation and entry angles.
~MultipoleT() override=default
Destructor.
bool insideAperture(const Vector_t &R) const
double getTransDeriv(const std::size_t &n, const double &x) const
Returns the value of the transverse field n-th derivative at x Transverse field is a polynomial in x...
size_t getMaxXOrder() const
BGeometryBase & getGeometry() override
Return the cell geometry.
void setScalingModel(const std::shared_ptr< AbstractTimeDependence > &td)
bool bends() const override
Return true if dipole component not zero.
double getRotation() const
Get the angle of rotation of the magnet around its axis.
void initialiseTimeDepencencies() const
std::shared_ptr< AbstractTimeDependence > scalingTD_m
double getFnDerivS(const std::size_t &n, const double &x, const double &s)
Calculate partial derivative of fn wrt s using a 5-point finite difference formula Error of order ste...
double getFnDerivX(const std::size_t &n, const double &x, const double &s)
Calculate partial derivative of fn wrt x using a 5-point finite difference formula Error of order ste...
void chooseImplementation()
bool insideBoundingBox(const Vector_t &R) const
double boundingBoxLength_m
MultipoleT(const std::string &name)
Constructor.
std::string getScalingName() const
double getEntranceAngle() const
Get the entrance angle.
void setFringeField(const double &s0, const double &lambda_left, const double &lambda_right)
Set fringe field model Tanh model used here .
std::tuple< double, double, double > getFringeField() const
Get the fringe field model.
double getBendAngle() const
Get the bending angle of the magnet.
void setEntryOffset(double offset)
Set the offset of the entry point from the standard position.
void setBoundingBoxLength(double boundingBoxLength)
Set the bounding box size.
double getEntryOffset() const
Get the offset of the entry point from the standard position.
void setTransProfile(const std::vector< double > &profile)
Set the the transverse profile.
void getDimensions(double &, double &) const override
Not implemented.
std::unique_ptr< MultipoleTBase > implementation_
Abstract base class for accelerator geometry classes.
The magnetic field of a multipole.
Abstract base class for electromagnetic fields.