32 void DeterminantRadius::assignFromQuadrupole(
double ixx,
double iyy,
double ixy, Distortion& distortion) {
33 _value =
std::pow(ixx * iyy - ixy * ixy, 0.25);
34 distortion.setE1((ixx - iyy) / (ixx + iyy));
35 distortion.setE2(2.0 * ixy / (ixx + iyy));
38 BaseCore::Jacobian DeterminantRadius::dAssignFromQuadrupole(
double ixx,
double iyy,
double ixy,
39 Distortion& distortion) {
40 double xx_yy = ixx + iyy;
42 _value =
std::pow(ixx * iyy - ixy * ixy, 0.25);
43 distortion.setE1((ixx - iyy) / xx_yy);
44 distortion.setE2(2.0 * ixy / xx_yy);
45 result.block<2, 2>(0, 0).setConstant(2.0 / (xx_yy * xx_yy));
50 result(1, 2) = 2.0 / xx_yy;
51 result.row(2).setConstant(1.0 / (4.0 * _value * _value * _value));
54 result(2, 2) *= -2.0 * ixy;
58 void DeterminantRadius::assignToQuadrupole(Distortion
const& distortion,
double& ixx,
double& iyy,
61 double r2 = _value * _value;
62 ixx = r2 * (1.0 + distortion.getE1()) / den;
63 iyy = r2 * (1.0 - distortion.getE1()) / den;
64 ixy = r2 * distortion.getE2() / den;
67 BaseCore::Jacobian DeterminantRadius::dAssignToQuadrupole(Distortion
const& distortion,
double& ixx,
68 double& iyy,
double& ixy)
const {
71 result.col(2).setConstant(2.0 * _value / den);
72 double r2 = _value * _value;
73 ixx = r2 * (1.0 + distortion.getE1()) / den;
74 iyy = r2 * (1.0 - distortion.getE1()) / den;
75 ixy = r2 * distortion.getE2() / den;
76 result.block<3, 2>(0, 0).setConstant(r2 / (den * den * den));
77 result(0, 0) *= (distortion.getE1() + 1.0 - distortion.getE2() * distortion.getE2());
78 result(1, 0) *= (distortion.getE1() - 1.0 + distortion.getE2() * distortion.getE2());
79 result(2, 0) *= distortion.getE1() * distortion.getE2();
80 result(0, 1) *= distortion.getE2() * (1.0 + distortion.getE1());
81 result(1, 1) *= distortion.getE2() * (1.0 - distortion.getE1());
82 result(2, 1) *= (1.0 - distortion.getE1() * distortion.getE1());
83 result(0, 2) *= (1.0 + distortion.getE1());
84 result(1, 2) *= (1.0 - distortion.getE1());
85 result(2, 2) *= distortion.getE2();
89 void TraceRadius::assignFromQuadrupole(
double ixx,
double iyy,
double ixy, Distortion& distortion) {
91 distortion.setE1((ixx - iyy) / (ixx + iyy));
92 distortion.setE2(2.0 * ixy / (ixx + iyy));
95 BaseCore::Jacobian TraceRadius::dAssignFromQuadrupole(
double ixx,
double iyy,
double ixy,
96 Distortion& distortion) {
97 double xx_yy = ixx + iyy;
100 distortion.setE1((ixx - iyy) / xx_yy);
101 distortion.setE2(2.0 * ixy / xx_yy);
102 result.block<2, 2>(0, 0).setConstant(2.0 / (xx_yy * xx_yy));
107 result(1, 2) = 2.0 / xx_yy;
108 result(2, 0) = 0.25 / _value;
109 result(2, 1) = 0.25 / _value;
113 void TraceRadius::assignToQuadrupole(Distortion
const& distortion,
double& ixx,
double& iyy,
115 double r2 = _value * _value;
116 ixx = r2 * (1.0 + distortion.getE1());
117 iyy = r2 * (1.0 - distortion.getE1());
118 ixy = r2 * distortion.getE2();
121 BaseCore::Jacobian TraceRadius::dAssignToQuadrupole(Distortion
const& distortion,
double& ixx,
double& iyy,
124 result.col(2).setConstant(2.0 * _value);
125 result(0, 2) *= (1.0 + distortion.getE1());
126 result(1, 2) *= (1.0 - distortion.getE1());
127 result(2, 2) *= distortion.getE2();
128 double r2 = _value * _value;
129 ixx = r2 * (1.0 + distortion.getE1());
130 iyy = r2 * (1.0 - distortion.getE1());
131 ixy = r2 * distortion.getE2();
138 void LogDeterminantRadius::assignFromQuadrupole(
double ixx,
double iyy,
double ixy, Distortion& distortion) {
139 _value = 0.25 *
std::log(ixx * iyy - ixy * ixy);
140 distortion.setE1((ixx - iyy) / (ixx + iyy));
141 distortion.setE2(2.0 * ixy / (ixx + iyy));
144 BaseCore::Jacobian LogDeterminantRadius::dAssignFromQuadrupole(
double ixx,
double iyy,
double ixy,
145 Distortion& distortion) {
146 double xx_yy = ixx + iyy;
148 double det = ixx * iyy - ixy * ixy;
150 distortion.setE1((ixx - iyy) / xx_yy);
151 distortion.setE2(2.0 * ixy / xx_yy);
152 result.block<2, 2>(0, 0).setConstant(2.0 / (xx_yy * xx_yy));
157 result(1, 2) = 2.0 / xx_yy;
164 void LogDeterminantRadius::assignToQuadrupole(Distortion
const& distortion,
double& ixx,
double& iyy,
168 ixx = r2 * (1.0 + distortion.getE1()) / den;
169 iyy = r2 * (1.0 - distortion.getE1()) / den;
170 ixy = r2 * distortion.getE2() / den;
173 BaseCore::Jacobian LogDeterminantRadius::dAssignToQuadrupole(Distortion
const& distortion,
double& ixx,
174 double& iyy,
double& ixy)
const {
177 result.col(2).setConstant(2.0 * _value / den);
179 ixx = r2 * (1.0 + distortion.getE1()) / den;
180 iyy = r2 * (1.0 - distortion.getE1()) / den;
181 ixy = r2 * distortion.getE2() / den;
182 result.block<3, 2>(0, 0).setConstant(r2 / (den * den * den));
183 result(0, 0) *= distortion.getE1() + 1.0 - distortion.getE2() * distortion.getE2();
184 result(1, 0) *= distortion.getE1() - 1.0 + distortion.getE2() * distortion.getE2();
185 result(2, 0) *= distortion.getE1() * distortion.getE2();
186 result(0, 1) *= distortion.getE2() * (1.0 + distortion.getE1());
187 result(1, 1) *= distortion.getE2() * (1.0 - distortion.getE1());
188 result(2, 1) *= 1.0 - distortion.getE1() * distortion.getE1();
195 void LogTraceRadius::assignFromQuadrupole(
double ixx,
double iyy,
double ixy, Distortion& distortion) {
196 _value = 0.5 *
std::log(0.5 * (ixx + iyy));
197 distortion.setE1((ixx - iyy) / (ixx + iyy));
198 distortion.setE2(2.0 * ixy / (ixx + iyy));
201 BaseCore::Jacobian LogTraceRadius::dAssignFromQuadrupole(
double ixx,
double iyy,
double ixy,
202 Distortion& distortion) {
203 double xx_yy = ixx + iyy;
205 _value = 0.5 *
std::log(0.5 * xx_yy);
206 distortion.setE1((ixx - iyy) / xx_yy);
207 distortion.setE2(2.0 * ixy / xx_yy);
208 result.block<2, 2>(0, 0).setConstant(2.0 / (xx_yy * xx_yy));
213 result(1, 2) = 2.0 / xx_yy;
214 result(2, 0) = 0.5 / xx_yy;
215 result(2, 1) = 0.5 / xx_yy;
219 void LogTraceRadius::assignToQuadrupole(Distortion
const& distortion,
double& ixx,
double& iyy,
222 ixx = r2 * (1.0 + distortion.getE1());
223 iyy = r2 * (1.0 - distortion.getE1());
224 ixy = r2 * distortion.getE2();
227 BaseCore::Jacobian LogTraceRadius::dAssignToQuadrupole(Distortion
const& distortion,
double& ixx,
double& iyy,
231 ixx = r2 * (1.0 + distortion.getE1());
232 iyy = r2 * (1.0 - distortion.getE1());
233 ixy = r2 * distortion.getE2();