43 "The \"THREADBPM\" command threads the closed orbit "
44 "using the positions at all orbit monitors.") {
46 (
"TOL",
"The tolerance for the closed orbit positions.");
48 (
"LISTC",
"List the correctors after correction");
50 (
"LISTM",
"List the monitors after correction");
94 std::cerr <<
"\n### Warning ### Lattice function table \""
95 << lineName <<
"\" contains no elements.\n" <<
std::endl;
99 const int iteration_limit = 100;
119 test(iter->getElement());
123 if(++count > iteration_limit)
break;
124 iter->isUsed[0] =
true;
126 }
else if(
isMoni[1] && !iter->isUsed[1] &&
std::abs(orbit[2]) > tol) {
128 if(++count > iteration_limit)
break;
129 iter->isUsed[1] =
true;
140 std::cout <<
"After threading with \"THREADBPM\":\n";
141 for(
int plane = 0; plane < 2; ++plane) {
151 int p2 = 2 * plane + 1;
162 while(iter !=
itsLine.begin()) {
165 test(iter->getElement());
169 if(count > 0) --count;
171 cmat[count] = iter->matrix;
175 double r1 = orbit(p1);
176 double r2 = orbit(p2);
179 omat(p1, 1) * cmat[0](p1, 0) - omat(p1, 0) * cmat[0](p1, 1) +
180 omat(p1, 3) * cmat[0](p1, 2) - omat(p1, 2) * cmat[0](p1, 3) +
181 omat(p1, 5) * cmat[0](p1, 4) - omat(p1, 4) * cmat[0](p1, 5);
183 omat(p1, 1) * cmat[1](p1, 0) - omat(p1, 0) * cmat[1](p1, 1) +
184 omat(p1, 3) * cmat[1](p1, 2) - omat(p1, 2) * cmat[1](p1, 3) +
185 omat(p1, 5) * cmat[1](p1, 4) - omat(p1, 4) * cmat[1](p1, 5);
187 omat(p2, 1) * cmat[0](p1, 0) - omat(p2, 0) * cmat[0](p1, 1) +
188 omat(p2, 3) * cmat[0](p1, 2) - omat(p2, 2) * cmat[0](p1, 3) +
189 omat(p2, 5) * cmat[0](p1, 4) - omat(p2, 4) * cmat[0](p1, 5);
191 omat(p2, 1) * cmat[1](p1, 0) - omat(p2, 0) * cmat[1](p1, 1) +
192 omat(p2, 3) * cmat[1](p1, 2) - omat(p2, 2) * cmat[1](p1, 3) +
193 omat(p2, 5) * cmat[1](p1, 4) - omat(p2, 4) * cmat[1](p1, 5);
194 double det = a11 * a22 - a12 * a21;
197 double k1 = - (a22 * r1 - a12 * r2) / det;
198 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)
void correct(int plane, TLine::iterator &)
RangeRep getRange(const Attribute &attr)
Get range value.
T det(const AntiSymTenzor< T, 3 > &t)
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.
virtual ThreadBpm * clone(const std::string &name)
Make clone.
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.
ThreadBpm()
Exemplar constructor.
virtual void execute()
Apply the algorithm to the top-level beamline.
bool isMoni[2]
Flag telling wether a monitor exists.
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.
OwnPtr< OrbitTracker > itsTracker
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.
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.
virtual void execute()
Check validity of the table definition.
Inform & endl(Inform &inf)
std::string getString(const Attribute &attr)
Get string value.