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) { ...@@ -301,7 +301,6 @@ void OpalBeamline::visit(const T &element, Tracker &, PartBunch *bunch) {
double endField; double endField;
elptr->initialise(bunch, startField, endField, 1.0); elptr->initialise(bunch, startField, endField, 1.0);
elements_m.push_back(OpalField(elptr, startField, endField)); elements_m.push_back(OpalField(elptr, startField, endField));
msg << element.getType() << " ELEMEDGE=" << startField << endl;
} }
template<> inline template<> inline
......
...@@ -86,6 +86,8 @@ void OpalHKicker::update() { ...@@ -86,6 +86,8 @@ void OpalHKicker::update() {
corr->setElementLength(length); corr->setElementLength(length);
corr->setBy(- kick * factor); corr->setBy(- kick * factor);
corr->SetKickX(Attributes::getReal(itsAttr[KICK]));
// Transmit "unknown" attributes. // Transmit "unknown" attributes.
OpalElement::updateUnknown(corr); OpalElement::updateUnknown(corr);
} }
...@@ -63,6 +63,8 @@ OpalKicker *OpalKicker::clone(const string &name) { ...@@ -63,6 +63,8 @@ OpalKicker *OpalKicker::clone(const string &name) {
void OpalKicker:: void OpalKicker::
fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) {
Inform m("fillRegisteredAttributes ");
OpalElement::fillRegisteredAttributes(base, flag); OpalElement::fillRegisteredAttributes(base, flag);
const CorrectorWrapper *corr = const CorrectorWrapper *corr =
dynamic_cast<const CorrectorWrapper *>(base.removeAlignWrapper()); dynamic_cast<const CorrectorWrapper *>(base.removeAlignWrapper());
...@@ -79,6 +81,10 @@ fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { ...@@ -79,6 +81,10 @@ fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) {
double scale = Physics::c / OpalData::getInstance()->getP0(); double scale = Physics::c / OpalData::getInstance()->getP0();
attributeRegistry["HKICK"]->setReal(- field.getBy() * scale); attributeRegistry["HKICK"]->setReal(- field.getBy() * scale);
attributeRegistry["VKICK"]->setReal(+ field.getBx() * 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() { ...@@ -93,6 +99,9 @@ void OpalKicker::update() {
corr->setBy(- hKick * factor); corr->setBy(- hKick * factor);
corr->setBx(vKick * factor); corr->setBx(vKick * factor);
corr->SetKickX(Attributes::getReal(itsAttr[HKICK]));
corr->SetKickY(Attributes::getReal(itsAttr[VKICK]));
// Transmit "unknown" attributes. // Transmit "unknown" attributes.
OpalElement::updateUnknown(corr); OpalElement::updateUnknown(corr);
} }
...@@ -58,9 +58,11 @@ OpalVKicker *OpalVKicker::clone(const string &name) { ...@@ -58,9 +58,11 @@ OpalVKicker *OpalVKicker::clone(const string &name) {
void OpalVKicker:: void OpalVKicker::
fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) {
Inform m("fillRegisteredAttributes ");
OpalElement::fillRegisteredAttributes(base, flag); OpalElement::fillRegisteredAttributes(base, flag);
const CorrectorWrapper *corr = const CorrectorWrapper *corr =
dynamic_cast<const CorrectorWrapper *>(base.removeAlignWrapper()); dynamic_cast<const CorrectorWrapper *>(base.removeAlignWrapper());
BDipoleField field; BDipoleField field;
if(flag == ERROR_FLAG) { if(flag == ERROR_FLAG) {
...@@ -74,17 +76,24 @@ fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { ...@@ -74,17 +76,24 @@ fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) {
double scale = Physics::c / OpalData::getInstance()->getP0(); double scale = Physics::c / OpalData::getInstance()->getP0();
attributeRegistry["HKICK"]->setReal(- field.getBy() * scale); attributeRegistry["HKICK"]->setReal(- field.getBy() * scale);
attributeRegistry["VKICK"]->setReal(+ field.getBx() * scale); attributeRegistry["VKICK"]->setReal(+ field.getBx() * scale);
m << "P= " << OpalData::getInstance()->getP0()
<< " Bx= " << field.getBx()
<< " By= " << field.getBy() << endl;
} }
void OpalVKicker::update() { void OpalVKicker::update() {
YCorrectorRep *corr = YCorrectorRep *corr = dynamic_cast<YCorrectorRep *>(getElement()->removeWrappers());
dynamic_cast<YCorrectorRep *>(getElement()->removeWrappers());
double length = Attributes::getReal(itsAttr[LENGTH]); double length = Attributes::getReal(itsAttr[LENGTH]);
double factor = OpalData::getInstance()->getP0() / Physics::c; double factor = OpalData::getInstance()->getP0() / Physics::c;
double kick = Attributes::getReal(itsAttr[KICK]); double kick = Attributes::getReal(itsAttr[KICK]);
corr->setElementLength(length); corr->setElementLength(length);
corr->setBx(kick * factor); corr->setBx(kick * factor);
corr->SetKickY(Attributes::getReal(itsAttr[KICK]));
// Transmit "unknown" attributes. // Transmit "unknown" attributes.
OpalElement::updateUnknown(corr); 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