25 planarArcGeometry_m(1., 1.),
32 planarArcGeometry_m(right.planarArcGeometry_m),
33 dummy(), maxOrder_m(right.maxOrder_m), tanDelta_m(right.tanDelta_m),
34 k_m(right.k_m), Bz_m(right.Bz_m), r0_m(right.r0_m),
35 rMin_m(right.rMin_m), rMax_m(right.rMax_m), phiStart_m(right.phiStart_m),
36 phiEnd_m(right.phiEnd_m), azimuthalExtent_m(right.azimuthalExtent_m),
37 verticalExtent_m(right.verticalExtent_m), centre_m(right.centre_m),
38 endField_m(nullptr), endFieldName_m(right.endFieldName_m),
39 dfCoefficients_m(right.dfCoefficients_m)
115 if (r < rMin_m || r >
rMax_m) {
129 std::vector<double> fringeDerivatives(
maxOrder_m+1, 0.);
130 for (
size_t i = 0; i < fringeDerivatives.size(); ++i) {
137 for (
size_t n = 1;
n < zOverRVec.size(); ++
n) {
138 zOverRVec[
n] = zOverRVec[
n-1] * zOverR;
146 deltaB[1] = f2n * h * zOverRVec[
n];
153 deltaB[2] =
r0Sign_m * f2nplus1 * h * zOverRVec[
n+1];
196 std::shared_ptr<endfieldmodel::EndFieldModel> efm
Tps< T > log(const Tps< T > &x)
Natural logarithm.
Tps< T > cos(const Tps< T > &x)
Cosine.
Tps< T > pow(const Tps< T > &x, int y)
Integer power.
Tps< T > sin(const Tps< T > &x)
Sine.
Tps< T > sqrt(const Tps< T > &x)
Square root.
PETE_TUTree< FnAbs, typename T::PETE_Expr_t > abs(const PETE_Expr< T > &l)
PETE_TBTree< FnArcTan2, PETE_Scalar< Vektor< T1, Dim > >, typename T2::PETE_Expr_t > atan2(const Vektor< T1, Dim > &l, const PETE_Expr< T2 > &r)
virtual void visitScalingFFAMagnet(const ScalingFFAMagnet &)=0
Apply the algorithm to a scaling FFA magnet.
Interface for a single beam element.
PartBunchBase< double, 3 > * RefPartBunch_m
static std::shared_ptr< EndFieldModel > getEndFieldModel(std::string name)
Look up the EndFieldModel that has a given name.
virtual void rescale(double scaleFactor)=0
Rescale the end field lengths and offsets by a factor x0.
virtual double getCentreLength() const =0
Return the nominal flat top length of the magnet.
virtual double getEndLength() const =0
Return the nominal end field length of the magnet.
virtual void setMaximumDerivative(size_t n)=0
Set the maximum derivative that will be required to be calculated.
virtual double function(double x, int n) const =0
Return the value of the function or its n^th derivative.
virtual EndFieldModel * clone() const =0
Inheritable copy constructor - returns a deep copy of the EndFieldModel.
Sector bending magnet with an FFA-style field index and spiral end shape.
bool getFieldValue(const Vector_t &R, Vector_t &B) const
Calculate the field at some arbitrary position in cartesian coordinates.
std::string endFieldName_m
void setupEndField()
setupEndField does some end field and geometry set-up
void accept(BeamlineVisitor &visitor) const override
Accept a beamline visitor.
void setAzimuthalExtent(double azimuthalExtent)
Set the maximum azimuthal displacement from \psi=0.
void finalise() override
Finalise the ScalingFFAMagnet - sets bunch to nullptr.
endfieldmodel::EndFieldModel * endField_m
void initialise()
Initialise the ScalingFFAMagnet.
ScalingFFAMagnet * clone() const override
Inheritable copy constructor.
ScalingFFAMagnet(const std::string &name)
Construct a new ScalingFFAMagnet.
bool getFieldValueCylindrical(const Vector_t &R, Vector_t &B) const
Calculate the field at some arbitrary position in cylindrical coordinates.
void calculateDfCoefficients()
Calculate the df coefficients, ready for field generation.
void setPhiStart(double phiStart)
Set the offset of the magnet centre from the start.
EMField & getField() override
Return a dummy (0.) field value (what is this for?)
~ScalingFFAMagnet()
Destructor - deletes map.
void setEndField(endfieldmodel::EndFieldModel *endField)
Set the fringe field.
void setPhiEnd(double phiEnd)
Set the offset of the magnet end from the start.
std::vector< std::vector< double > > dfCoefficients_m
void initialise(PartBunchBase< double, 3 > *bunch, double &startField, double &endField) override
Initialise the ScalingFFAMagnet.
double getPhiStart() const
Get the offset of the magnet centre from the start.
BGeometryBase & getGeometry() override
Return the cell geometry.
bool bends() const override
Return true - ScalingFFAMagnet always bends the reference particle.
PlanarArcGeometry planarArcGeometry_m
Abstract base class for accelerator geometry classes.
void setCurvature(double)
Set curvature.
virtual void setElementLength(double)
Set length.
Abstract base class for electromagnetic fields.