43 "The \"THREADALL\" command threads the closed orbit "
44 "using the position and angle at all positions.") {
46 (
"TOLQ",
"The tolerance for the closed orbit positions.");
48 (
"TOLP",
"The tolerance for the closed orbit angles.");
50 (
"LISTM",
"List the monitors after correction");
52 (
"LISTC",
"List the correctors after correction");
97 std::cerr <<
"\n### Warning ### Lattice function table \""
98 << lineName <<
"\" contains no elements.\n" <<
std::endl;
108 static const int iteration_limit = 100;
121 if(! iter->isUsed[0] &&
124 if(count++ > iteration_limit)
break;
126 }
else if(! iter->isUsed[1] &&
129 if(count++ > iteration_limit)
break;
148 std::cout <<
"After threading with \"THREADALL\":\n";
149 for(
int plane = 0; plane < 2; ++plane) {
159 int p2 = 2 * plane + 1;
170 while(iter !=
itsLine.begin()) {
173 iter->isUsed[plane] =
true;
174 test(iter->getElement());
178 if(count > 0) --count;
180 cmat[count] = iter->matrix;
184 double r1 = orbit(p1);
185 double r2 = orbit(p2);
188 omat(p1, 1) * cmat[0](p1, 0) - omat(p1, 0) * cmat[0](p1, 1) +
189 omat(p1, 3) * cmat[0](p1, 2) - omat(p1, 2) * cmat[0](p1, 3) +
190 omat(p1, 5) * cmat[0](p1, 4) - omat(p1, 4) * cmat[0](p1, 5);
192 omat(p1, 1) * cmat[1](p1, 0) - omat(p1, 0) * cmat[1](p1, 1) +
193 omat(p1, 3) * cmat[1](p1, 2) - omat(p1, 2) * cmat[1](p1, 3) +
194 omat(p1, 5) * cmat[1](p1, 4) - omat(p1, 4) * cmat[1](p1, 5);
196 omat(p2, 1) * cmat[0](p1, 0) - omat(p2, 0) * cmat[0](p1, 1) +
197 omat(p2, 3) * cmat[0](p1, 2) - omat(p2, 2) * cmat[0](p1, 3) +
198 omat(p2, 5) * cmat[0](p1, 4) - omat(p2, 4) * cmat[0](p1, 5);
200 omat(p2, 1) * cmat[1](p1, 0) - omat(p2, 0) * cmat[1](p1, 1) +
201 omat(p2, 3) * cmat[1](p1, 2) - omat(p2, 2) * cmat[1](p1, 3) +
202 omat(p2, 5) * cmat[1](p1, 4) - omat(p2, 4) * cmat[1](p1, 5);
203 double det = a11 * a22 - a12 * a21;
206 double k1 = - (a22 * r1 - a12 * r2) / det;
207 double k2 = - (a11 * r2 - a21 * r1) / det;
Abstract base class for all orbit correction commands.
PETE_TUTree< FnAbs, typename T::PETE_Expr_t > abs(const PETE_Expr< T > &l)
ThreadAll()
Exemplar constructor.
RangeRep getRange(const Attribute &attr)
Get range value.
T det(const AntiSymTenzor< T, 3 > &t)
OwnPtr< OrbitTracker > itsTracker
virtual void execute()
Check validity of the table definition.
void test(ElementBase *)
Routine to test for corrector or monitor.
void update()
Update all objects.
std::vector< Attribute > itsAttr
The object attributes (see Attribute.hh).
void setOrbit(const FVector< double, 6 > orbit)
Reset the current orbit.
bool getBool(const Attribute &attr)
Return logical value.
void listCorrectors(bool list, int plane)
List correctors before or after correction.
static OpalData * getInstance()
static BeamSequence * find(const std::string &name)
Find a BeamSequence by name.
A templated representation of a LU-decomposition.
void listMonitors(bool list, int plane)
List monitors before or after correction.
TLine itsLine
The flat beam line on which the correction is done.
static Beam * find(const std::string &name)
Find named BEAM.
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
virtual Beamline * fetchLine() const =0
Return the embedded CLASSIC beam line.
virtual void correct(int plane, TLine::iterator &)
virtual void execute()
Apply the algorithm to the top-level beamline.
virtual void accept(BeamlineVisitor &) const
Apply BeamlineVisitor to this line.
PartData reference
The particle reference data.
Representation of a range within a beam line or sequence.
FVector< double, 6 > orbitGuess
The closed orbit guess.
The base class for all OPAL beam lines and sequences.
const PartData & getReference() const
Return the embedded CLASSIC PartData.
Attribute makeBool(const std::string &name, const std::string &help)
Make logical attribute.
const FVector< double, 6 > & getOrbit() const
Return the current orbit.
std::string::iterator iterator
double getReal(const Attribute &attr)
Return real value.
virtual ThreadAll * clone(const std::string &name)
Make clone.
bool isCorr[2]
Flags telling wether a corrector exists.
void setupTables()
Set up the corrector and monitor tables.
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
void addKick(int plane, Row &, double kick)
Add to kicker strength.
Inform & endl(Inform &inf)
std::string getString(const Attribute &attr)
Get string value.