OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
Corrector.h
Go to the documentation of this file.
1#ifndef CLASSIC_Corrector_HH
2#define CLASSIC_Corrector_HH
3
4// ------------------------------------------------------------------------
5// $RCSfile: Corrector.h,v $
6// ------------------------------------------------------------------------
7// $Revision: 1.1.1.1 $
8// ------------------------------------------------------------------------
9// Copyright: see Copyright.readme
10// ------------------------------------------------------------------------
11//
12// Class: Corrector
13// Defines the abstract interface for a orbit corrector.
14//
15// ------------------------------------------------------------------------
16// Class category: AbsBeamline
17// ------------------------------------------------------------------------
18//
19// $Date: 2000/03/27 09:32:31 $
20// $Author: fci $
21//
22// ------------------------------------------------------------------------
23
27#include "Fields/BDipoleField.h"
28
29// Class Corrector
30// ------------------------------------------------------------------------
32// Class Corrector defines the abstract interface for closed orbit
33// correctors.
34
35class Corrector: public Component {
36
37public:
38
40 enum Plane {
48 XY
49 };
50
52 explicit Corrector(const std::string &name);
53
54 Corrector();
55 Corrector(const Corrector &right);
56 virtual ~Corrector();
57
59 virtual void accept(BeamlineVisitor &) const;
60
61
63 // Version for non-constant object.
64 virtual BDipoleField &getField() = 0;
65
67 // Version for constant object.
68 virtual const BDipoleField &getField() const = 0;
69
72
74 virtual const StraightGeometry &getGeometry() const = 0;
75
77 virtual Plane getPlane() const = 0;
78
79 virtual bool apply(const size_t &i,
80 const double &t,
81 Vector_t &E,
82 Vector_t &B);
83
84 virtual bool apply(const Vector_t &R,
85 const Vector_t &P,
86 const double &t,
87 Vector_t &E,
88 Vector_t &B);
89
90 virtual void initialise(PartBunchBase<double, 3> *bunch, double &startField, double &endField);
91
92 virtual void goOnline(const double &kineticEnergy);
93
94 virtual void finalise();
95
96 virtual bool bends() const;
97
98 virtual ElementType getType() const;
99
100 virtual void getDimensions(double &zBegin, double &zEnd) const;
101
102 void setKickX(double k);
103
104 void setKickY(double k);
105
106 virtual void setDesignEnergy(const double& ekin, bool changeable = true);
107
108 double getKickX() const;
109
110 double getKickY() const;
111
112 void setKickField(const Vector_t &k0);
113
114private:
115 double kickX_m;
116 double kickY_m;
120
122
123protected:
124
125 // Not implemented.
126 void operator=(const Corrector &);
127
129};
130
131inline
132void Corrector::setKickX(double k) {
133 kickX_m = k;
134}
135
136inline
137void Corrector::setKickY(double k) {
138 kickY_m = k;
139}
140
141inline
142double Corrector::getKickX() const {
143 return kickX_m;
144}
145
146inline
147double Corrector::getKickY() const {
148 return kickY_m;
149}
150
151inline
153 kickField_m = k0;
154 kickFieldSet_m = true;
155}
156#endif // CLASSIC_Corrector_HH
ElementType
Definition: ElementBase.h:88
const std::string name
Interface for a single beam element.
Definition: Component.h:50
Interface for general corrector.
Definition: Corrector.h:35
virtual StraightGeometry & getGeometry()=0
Return the corrector geometry.
virtual ~Corrector()
Definition: Corrector.cpp:59
virtual void getDimensions(double &zBegin, double &zEnd) const
Definition: Corrector.cpp:145
virtual void goOnline(const double &kineticEnergy)
Definition: Corrector.cpp:108
void setKickField(const Vector_t &k0)
Definition: Corrector.h:152
virtual bool bends() const
Definition: Corrector.cpp:141
virtual void initialise(PartBunchBase< double, 3 > *bunch, double &startField, double &endField)
Definition: Corrector.cpp:100
void operator=(const Corrector &)
virtual ElementType getType() const
Get element type std::string.
Definition: Corrector.cpp:151
double designEnergy_m
Definition: Corrector.h:117
virtual const BDipoleField & getField() const =0
Return the corrector field.
Plane
Plane selection.
Definition: Corrector.h:40
@ OFF
Corrector is off (inactive).
Definition: Corrector.h:42
@ X
Corrector acts on x-plane.
Definition: Corrector.h:44
@ Y
Corrector acts on y-plane.
Definition: Corrector.h:46
@ XY
Corrector acts on both planes.
Definition: Corrector.h:48
double kickX_m
Definition: Corrector.h:115
bool designEnergyChangeable_m
Definition: Corrector.h:118
virtual void accept(BeamlineVisitor &) const
Apply a visitor to Corrector.
Definition: Corrector.cpp:63
double getKickX() const
Definition: Corrector.h:142
virtual Plane getPlane() const =0
Return the plane on which the corrector acts.
Vector_t kickField_m
Definition: Corrector.h:121
virtual bool apply(const size_t &i, const double &t, Vector_t &E, Vector_t &B)
Definition: Corrector.cpp:67
void setKickY(double k)
Definition: Corrector.h:137
double kickY_m
Definition: Corrector.h:116
virtual const StraightGeometry & getGeometry() const =0
Return the corrector geometry. Version for const object.
virtual BDipoleField & getField()=0
Return the corrector field.
Plane plane_m
Definition: Corrector.h:128
virtual void setDesignEnergy(const double &ekin, bool changeable=true)
Definition: Corrector.cpp:126
void setKickX(double k)
Definition: Corrector.h:132
bool kickFieldSet_m
Definition: Corrector.h:119
virtual void finalise()
Definition: Corrector.cpp:105
double getKickY() const
Definition: Corrector.h:147
A geometry representing a straight line.
The field of a magnetic dipole.
Definition: BDipoleField.h:31