OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
CorrectionBase.h
Go to the documentation of this file.
1 #ifndef OPAL_CorrectionBase_HH
2 #define OPAL_CorrectionBase_HH
3 
4 // ------------------------------------------------------------------------
5 // $RCSfile: CorrectionBase.h,v $
6 // ------------------------------------------------------------------------
7 // $Revision: 1.2 $
8 // ------------------------------------------------------------------------
9 // Copyright: see Copyright.readme
10 // ------------------------------------------------------------------------
11 //
12 // Classes: CorrectionBase
13 //
14 // ------------------------------------------------------------------------
15 //
16 // $Date: 2001/08/13 15:25:22 $
17 // $Author: jowett $
18 //
19 // ------------------------------------------------------------------------
20 
21 #include "AbstractObjects/Action.h"
22 #include "Algorithms/PartData.h"
24 #include "Beamlines/TBeamline.h"
25 #include "FixedAlgebra/FMatrix.h"
26 #include "FixedAlgebra/FVector.h"
27 
28 
29 #include <list>
30 
31 class ElementBase;
32 
33 
34 // Class CorrectionBase
35 // ------------------------------------------------------------------------
37 // Factors out all common behaviour for these algorithms.
38 // A CorrectionBase contains a RBeamline<CorrectionBase::Row> which
39 // holds pointers to the elements in the line, together with the ideal
40 // transfer matrices from the beginning to the current position and the
41 // orbit computed from the algorithm. This information is used to find
42 // the required corrections. This class also contains a method to set
43 // the orbit corrector strength once it has been found.
44 
45 class CorrectionBase: public Action {
46 
47 public:
48 
49  virtual ~CorrectionBase();
50 
51 protected:
52 
54  enum {
55  // User-definable attributes:
56  LINE, // The beam line for the table,
57  BEAM, // The beam to be used.
58  RANGE, // The range in the lattice.
60  };
61 
63  struct Row: public FlaggedElmPtr {
64 
65  Row(ElementBase *, int);
66  explicit Row(const FlaggedElmPtr &);
67  ~Row();
68 
71 
74 
76  double arc;
77 
79  bool isUsed[2];
80  };
81 
82  // The contained beamline type.
84 
85 
87  CorrectionBase(int size, const char *name, const char *help);
88 
90  CorrectionBase(const std::string &name, CorrectionBase *parent);
91 
93  // Arguments:
94  // [ol]
95  // [li] The plane: (0 = x, 1 = y).
96  // [li] The position, given by an iterator into the Twiss table.
97  // [li] The kick change.
98  // [/ol]
99  void addKick(int plane, Row &, double kick);
100 
102  void listCorrectors(bool list, int plane);
103 
105  void listMonitors(bool list, int plane);
106 
108  void setupTables();
109 
111  void test(ElementBase *);
112 
113 
116 
119 
122 
124  bool isCorr[2];
125 
127  bool isMoni[2];
128 
129  // Types used for corrector and monitor tables.
130  typedef std::list<Row *> LocalList;
132 
133  // The table of correctors per plane.
135 
136  // The table of monitors per plane.
138 
139 private:
140 
141  // Not implemented.
142  CorrectionBase();
144  void operator=(const CorrectionBase &);
145 };
146 
147 #endif // OPAL_CorrectionBase_HH
Abstract base class for all orbit correction commands.
Interface for basic beam line object.
Definition: ElementBase.h:128
The base class for all OPAL actions.
Definition: Action.h:30
FMatrix< double, 6, 6 > matrix
The transfer matrix up to and including the element.
Particle reference data.
Definition: PartData.h:38
void test(ElementBase *)
Routine to test for corrector or monitor.
LocalList monitorTable[2]
void listCorrectors(bool list, int plane)
List correctors before or after correction.
bool isUsed[2]
Flag telling when observation has been used.
void listMonitors(bool list, int plane)
List monitors before or after correction.
TLine itsLine
The flat beam line on which the correction is done.
std::list< Row * > LocalList
LocalList::iterator LocalIter
LocalList correctorTable[2]
FVector< double, 6 > orbit
The closed orbit after the element.
Row(ElementBase *, int)
bool isMoni[2]
Flag telling wether a monitor exists.
PartData reference
The particle reference data.
FVector< double, 6 > orbitGuess
The closed orbit guess.
virtual ~CorrectionBase()
const std::string name
std::string::iterator iterator
Definition: MSLang.h:16
TBeamline< Row > TLine
double arc
The accumulated arc length.
bool isCorr[2]
Flags telling wether a corrector exists.
void operator=(const CorrectionBase &)
void setupTables()
Set up the corrector and monitor tables.
void addKick(int plane, Row &, double kick)
Add to kicker strength.
Structure for a row of the Twiss table.
A section of a beam line.
Definition: FlaggedElmPtr.h:36