40 "The \"MULTIPOLE\" element defines a thick multipole.\n"
41 "* If the length is non-zero, the strengths are per unit "
42 "length.\n* If the length is zero, the strengths are the "
43 "values integrated over the length.\n"
44 "* With zero length no synchrotron radiation can be calculated.") {
46 (
"KN",
"Normalised multipole strengths (normal) in m^(-k)");
48 (
"DKN",
"Normalised multipole strengths errors(normal) in m^(-k)");
50 (
"KS",
"Normalised multipole strengths (skew) in m^(-k)");
52 (
"DKS",
"Normalised multipole strength errors (skew) in m^(-k)");
98 if(length != 0.0) scale *= length;
100 for(
int order = 1; order <= field.
order(); ++order) {
101 std::ostringstream ss;
102 ss << (order - 1) << std::ends;
103 std::string orderString = ss.str();
105 std::string normName =
"K" + orderString +
"L";
108 std::string skewName =
"K" + orderString +
"SL";
111 scale *= double(order);
132 int normSize = norm.size();
133 int skewSize = skew.size();
134 normErrors.resize(normSize, 0.0);
135 skewErrors.resize(skewSize, 0.0);
137 int top = (normSize > skewSize) ? normSize : skewSize;
139 for(
int comp = 1; comp <= top; comp++) {
140 factor /= double(comp);
141 if(comp <= normSize) {
145 if(comp <= skewSize) {
virtual ElementBase * removeAlignWrapper()
Remove align wrapper.
virtual const Multipole & getDesign() const
Get design corrector.
void setSkewComponent(int, double)
Set skew component.
Interface for basic beam line object.
virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag)
Fill in all registered attributes.
double normal(int) const
Get component.
virtual void setField(const BMultipoleField &field)
Set mulitpole field.
double getP0() const
Return value of global reference momentum.
Representation for a general multipole.
virtual BMultipoleField & getField() override=0
Get multipole field.
ValueFlag
Switch for value desired on ATTLIST command.
void setNormalComponent(int n, double Bn)
Set component.
virtual BMultipoleField & getField()
Get field.
virtual ElementBase * removeWrappers()
Return the design element.
void setNormalComponent(int, double)
Set normal component.
virtual void setElementLength(double length)
Set design length.
virtual double getLength() const
Return element length.
Representation of a perturbed multipole.
std::vector< Attribute > itsAttr
The object attributes (see Attribute.hh).
void setSkewComponent(int n, double Bn)
Set component.
static OpalData * getInstance()
double skew(int) const
Get component.
constexpr double c
The velocity of light in m/s.
Base class for all beam line elements.
std::vector< double > getRealArray(const Attribute &attr)
Get array value.
OpalMultipole()
Exemplar constructor.
void setElement(ElementBase *)
Assign new CLASSIC element.
void registerOwnership() const
virtual void update()
Update the embedded CLASSIC element.
virtual OpalMultipole * clone(const std::string &name)
Make clone.
virtual void updateUnknown(ElementBase *)
Transmit the ``unknown'' (not known to OPAL) attributes to CLASSIC.
ElementBase * getElement() const
Return the embedded CLASSIC element.
The magnetic field of a multipole.
virtual BMultipoleField & errorField() const
Get multipole field error.
Attribute makeRealArray(const std::string &name, const std::string &help)
Create real array attribute.
virtual void print(std::ostream &) const
Print the object.
virtual void update()
Update the embedded CLASSIC multipole.
static AttCell * registerRealAttribute(const std::string &name)
Register a ``real'' element attribute.
int order() const
Return order.
virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag)
Fill in all registered attributes.
virtual void print(std::ostream &) const
Print the object.
virtual void setReal(double)
Store the value.