Commit 4b7951a9 authored by adelmann's avatar adelmann 🎗
Browse files

more on the corrector

parent d4b4e2d5
......@@ -301,7 +301,6 @@ void OpalBeamline::visit(const T &element, Tracker &, PartBunch *bunch) {
double endField;
elptr->initialise(bunch, startField, endField, 1.0);
elements_m.push_back(OpalField(elptr, startField, endField));
msg << element.getType() << " ELEMEDGE=" << startField << endl;
}
template<> inline
......
......@@ -86,6 +86,8 @@ void OpalHKicker::update() {
corr->setElementLength(length);
corr->setBy(- kick * factor);
corr->SetKickX(Attributes::getReal(itsAttr[KICK]));
// Transmit "unknown" attributes.
OpalElement::updateUnknown(corr);
}
......@@ -63,6 +63,8 @@ OpalKicker *OpalKicker::clone(const string &name) {
void OpalKicker::
fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) {
Inform m("fillRegisteredAttributes ");
OpalElement::fillRegisteredAttributes(base, flag);
const CorrectorWrapper *corr =
dynamic_cast<const CorrectorWrapper *>(base.removeAlignWrapper());
......@@ -79,6 +81,10 @@ fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) {
double scale = Physics::c / OpalData::getInstance()->getP0();
attributeRegistry["HKICK"]->setReal(- field.getBy() * scale);
attributeRegistry["VKICK"]->setReal(+ field.getBx() * scale);
m << "P= " << OpalData::getInstance()->getP0()
<< " Bx= " << field.getBx()
<< " By= " << field.getBy() << endl;
}
......@@ -93,6 +99,9 @@ void OpalKicker::update() {
corr->setBy(- hKick * factor);
corr->setBx(vKick * factor);
corr->SetKickX(Attributes::getReal(itsAttr[HKICK]));
corr->SetKickY(Attributes::getReal(itsAttr[VKICK]));
// Transmit "unknown" attributes.
OpalElement::updateUnknown(corr);
}
......@@ -58,9 +58,11 @@ OpalVKicker *OpalVKicker::clone(const string &name) {
void OpalVKicker::
fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) {
Inform m("fillRegisteredAttributes ");
OpalElement::fillRegisteredAttributes(base, flag);
const CorrectorWrapper *corr =
dynamic_cast<const CorrectorWrapper *>(base.removeAlignWrapper());
dynamic_cast<const CorrectorWrapper *>(base.removeAlignWrapper());
BDipoleField field;
if(flag == ERROR_FLAG) {
......@@ -74,17 +76,24 @@ fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) {
double scale = Physics::c / OpalData::getInstance()->getP0();
attributeRegistry["HKICK"]->setReal(- field.getBy() * scale);
attributeRegistry["VKICK"]->setReal(+ field.getBx() * scale);
m << "P= " << OpalData::getInstance()->getP0()
<< " Bx= " << field.getBx()
<< " By= " << field.getBy() << endl;
}
void OpalVKicker::update() {
YCorrectorRep *corr =
dynamic_cast<YCorrectorRep *>(getElement()->removeWrappers());
YCorrectorRep *corr = dynamic_cast<YCorrectorRep *>(getElement()->removeWrappers());
double length = Attributes::getReal(itsAttr[LENGTH]);
double factor = OpalData::getInstance()->getP0() / Physics::c;
double kick = Attributes::getReal(itsAttr[KICK]);
corr->setElementLength(length);
corr->setBx(kick * factor);
corr->SetKickY(Attributes::getReal(itsAttr[KICK]));
// Transmit "unknown" attributes.
OpalElement::updateUnknown(corr);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment