17 const std::int8_t g_order[3][3][3][3] = {
64 const unsigned g_size = 15 + 1;
68 const std::int8_t g_order2[3][3] = {
75 const unsigned g_size2 = 6;
94 unsigned power_tx,
unsigned power_ty,
95 unsigned power_omegax,
unsigned power_omegay)
99 if (power_Bx > 2 or power_By > 2
100 or power_tx > 2 or power_ty > 2
101 or power_omegax > 2 or power_omegay > 2) {
102 throw std::out_of_range(
"Power>2: Calculated array index is out of range in T2TrackBSLLPoly::idx");
105 int idx = g_order[power_Bx][power_By][power_tx][power_ty];
106 if (
idx < 0)
throw std::out_of_range(
"idx<0: Calculated array index is out of range in T2TrackBSLLPoly::idx");
108 int idx2 = g_order2[power_omegax][power_omegay];
109 if (idx2 < 0)
throw std::out_of_range(
"idx2<0: Calculated array index is out of range in T2TrackBSLLPoly::idx");
111 return idx*g_size2 + idx2;
124 double var_bd = var_d0 + var_b;
127 coeff[g_size*g_size2] += z_0;
128 coeff[g_size*g_size2+1] += z_0*z_0;
131 coeff[g_size*g_size2+2] += 1;
138 coeff[
idx(0, 0, 0, 0, 0, 0)] += -
pow(d_0, 2)/(2*var_bd);
144 coeff[
idx(0, 0, 0, 1, 0, 0)] += cos_phi*d_0*z_0/var_bd;
145 coeff[
idx(0, 0, 0, 1, 0, 1)] += -
pow(cos_phi, 3)*d_0*z_0/
pow(var_bd, 2);
146 coeff[
idx(0, 0, 0, 1, 0, 2)] +=
pow(cos_phi, 5)*d_0*z_0/
pow(var_bd, 3);
147 coeff[
idx(0, 0, 0, 1, 1, 0)] += -cos_phi*d_0*
pow(sin_phi, 2)*z_0/
pow(var_bd, 2);
148 coeff[
idx(0, 0, 0, 1, 1, 1)] += 2*
pow(cos_phi, 3)*d_0*
pow(sin_phi, 2)*z_0/
pow(var_bd, 3);
149 coeff[
idx(0, 0, 0, 1, 2, 0)] += cos_phi*d_0*
pow(sin_phi, 4)*z_0/
pow(var_bd, 3);
150 coeff[
idx(0, 0, 0, 2, 0, 0)] += -
pow(cos_phi, 2)*
pow(z_0, 2)/(2*var_bd);
155 coeff[
idx(0, 0, 0, 2, 2, 0)] += -
pow(cos_phi, 2)*
pow(sin_phi, 4)*
pow(z_0, 2)/(2*
pow(var_bd, 3));
156 coeff[
idx(0, 0, 1, 0, 0, 0)] += -d_0*sin_phi*z_0/var_bd;
157 coeff[
idx(0, 0, 1, 0, 0, 1)] +=
pow(cos_phi, 2)*d_0*sin_phi*z_0/
pow(var_bd, 2);
158 coeff[
idx(0, 0, 1, 0, 0, 2)] += -
pow(cos_phi, 4)*d_0*sin_phi*z_0/
pow(var_bd, 3);
159 coeff[
idx(0, 0, 1, 0, 1, 0)] += d_0*
pow(sin_phi, 3)*z_0/
pow(var_bd, 2);
160 coeff[
idx(0, 0, 1, 0, 1, 1)] += -2*
pow(cos_phi, 2)*d_0*
pow(sin_phi, 3)*z_0/
pow(var_bd, 3);
161 coeff[
idx(0, 0, 1, 0, 2, 0)] += -d_0*
pow(sin_phi, 5)*z_0/
pow(var_bd, 3);
162 coeff[
idx(0, 0, 1, 1, 0, 0)] += cos_phi*sin_phi*
pow(z_0, 2)/var_bd;
163 coeff[
idx(0, 0, 1, 1, 0, 1)] += -
pow(cos_phi, 3)*sin_phi*
pow(z_0, 2)/
pow(var_bd, 2);
164 coeff[
idx(0, 0, 1, 1, 0, 2)] +=
pow(cos_phi, 5)*sin_phi*
pow(z_0, 2)/
pow(var_bd, 3);
165 coeff[
idx(0, 0, 1, 1, 1, 0)] += -cos_phi*
pow(sin_phi, 3)*
pow(z_0, 2)/
pow(var_bd, 2);
167 coeff[
idx(0, 0, 1, 1, 2, 0)] += cos_phi*
pow(sin_phi, 5)*
pow(z_0, 2)/
pow(var_bd, 3);
168 coeff[
idx(0, 0, 2, 0, 0, 0)] += -
pow(sin_phi, 2)*
pow(z_0, 2)/(2*var_bd);
170 coeff[
idx(0, 0, 2, 0, 0, 2)] += -
pow(cos_phi, 4)*
pow(sin_phi, 2)*
pow(z_0, 2)/(2*
pow(var_bd, 3));
174 coeff[
idx(0, 1, 0, 0, 0, 0)] += cos_phi*d_0/var_bd;
175 coeff[
idx(0, 1, 0, 0, 0, 1)] += -
pow(cos_phi, 3)*d_0/
pow(var_bd, 2);
176 coeff[
idx(0, 1, 0, 0, 0, 2)] +=
pow(cos_phi, 5)*d_0/
pow(var_bd, 3);
177 coeff[
idx(0, 1, 0, 0, 1, 0)] += -cos_phi*d_0*
pow(sin_phi, 2)/
pow(var_bd, 2);
178 coeff[
idx(0, 1, 0, 0, 1, 1)] += 2*
pow(cos_phi, 3)*d_0*
pow(sin_phi, 2)/
pow(var_bd, 3);
179 coeff[
idx(0, 1, 0, 0, 2, 0)] += cos_phi*d_0*
pow(sin_phi, 4)/
pow(var_bd, 3);
180 coeff[
idx(0, 1, 0, 1, 0, 0)] += -
pow(cos_phi, 2)*z_0/var_bd;
181 coeff[
idx(0, 1, 0, 1, 0, 1)] +=
pow(cos_phi, 4)*z_0/
pow(var_bd, 2);
182 coeff[
idx(0, 1, 0, 1, 0, 2)] += -
pow(cos_phi, 6)*z_0/
pow(var_bd, 3);
183 coeff[
idx(0, 1, 0, 1, 1, 0)] +=
pow(cos_phi, 2)*
pow(sin_phi, 2)*z_0/
pow(var_bd, 2);
184 coeff[
idx(0, 1, 0, 1, 1, 1)] += -2*
pow(cos_phi, 4)*
pow(sin_phi, 2)*z_0/
pow(var_bd, 3);
185 coeff[
idx(0, 1, 0, 1, 2, 0)] += -
pow(cos_phi, 2)*
pow(sin_phi, 4)*z_0/
pow(var_bd, 3);
186 coeff[
idx(0, 1, 1, 0, 0, 0)] += cos_phi*sin_phi*z_0/var_bd;
187 coeff[
idx(0, 1, 1, 0, 0, 1)] += -
pow(cos_phi, 3)*sin_phi*z_0/
pow(var_bd, 2);
188 coeff[
idx(0, 1, 1, 0, 0, 2)] +=
pow(cos_phi, 5)*sin_phi*z_0/
pow(var_bd, 3);
189 coeff[
idx(0, 1, 1, 0, 1, 0)] += -cos_phi*
pow(sin_phi, 3)*z_0/
pow(var_bd, 2);
190 coeff[
idx(0, 1, 1, 0, 1, 1)] += 2*
pow(cos_phi, 3)*
pow(sin_phi, 3)*z_0/
pow(var_bd, 3);
191 coeff[
idx(0, 1, 1, 0, 2, 0)] += cos_phi*
pow(sin_phi, 5)*z_0/
pow(var_bd, 3);
192 coeff[
idx(0, 2, 0, 0, 0, 0)] += -
pow(cos_phi, 2)/(2*var_bd);
193 coeff[
idx(0, 2, 0, 0, 0, 1)] +=
pow(cos_phi, 4)/(2*
pow(var_bd, 2));
194 coeff[
idx(0, 2, 0, 0, 0, 2)] += -
pow(cos_phi, 6)/(2*
pow(var_bd, 3));
195 coeff[
idx(0, 2, 0, 0, 1, 0)] +=
pow(cos_phi, 2)*
pow(sin_phi, 2)/(2*
pow(var_bd, 2));
197 coeff[
idx(0, 2, 0, 0, 2, 0)] += -
pow(cos_phi, 2)*
pow(sin_phi, 4)/(2*
pow(var_bd, 3));
198 coeff[
idx(1, 0, 0, 0, 0, 0)] += -d_0*sin_phi/var_bd;
199 coeff[
idx(1, 0, 0, 0, 0, 1)] +=
pow(cos_phi, 2)*d_0*sin_phi/
pow(var_bd, 2);
200 coeff[
idx(1, 0, 0, 0, 0, 2)] += -
pow(cos_phi, 4)*d_0*sin_phi/
pow(var_bd, 3);
201 coeff[
idx(1, 0, 0, 0, 1, 0)] += d_0*
pow(sin_phi, 3)/
pow(var_bd, 2);
202 coeff[
idx(1, 0, 0, 0, 1, 1)] += -2*
pow(cos_phi, 2)*d_0*
pow(sin_phi, 3)/
pow(var_bd, 3);
203 coeff[
idx(1, 0, 0, 0, 2, 0)] += -d_0*
pow(sin_phi, 5)/
pow(var_bd, 3);
204 coeff[
idx(1, 0, 0, 1, 0, 0)] += cos_phi*sin_phi*z_0/var_bd;
205 coeff[
idx(1, 0, 0, 1, 0, 1)] += -
pow(cos_phi, 3)*sin_phi*z_0/
pow(var_bd, 2);
206 coeff[
idx(1, 0, 0, 1, 0, 2)] +=
pow(cos_phi, 5)*sin_phi*z_0/
pow(var_bd, 3);
207 coeff[
idx(1, 0, 0, 1, 1, 0)] += -cos_phi*
pow(sin_phi, 3)*z_0/
pow(var_bd, 2);
208 coeff[
idx(1, 0, 0, 1, 1, 1)] += 2*
pow(cos_phi, 3)*
pow(sin_phi, 3)*z_0/
pow(var_bd, 3);
209 coeff[
idx(1, 0, 0, 1, 2, 0)] += cos_phi*
pow(sin_phi, 5)*z_0/
pow(var_bd, 3);
210 coeff[
idx(1, 0, 1, 0, 0, 0)] += -
pow(sin_phi, 2)*z_0/var_bd;
211 coeff[
idx(1, 0, 1, 0, 0, 1)] +=
pow(cos_phi, 2)*
pow(sin_phi, 2)*z_0/
pow(var_bd, 2);
212 coeff[
idx(1, 0, 1, 0, 0, 2)] += -
pow(cos_phi, 4)*
pow(sin_phi, 2)*z_0/
pow(var_bd, 3);
213 coeff[
idx(1, 0, 1, 0, 1, 0)] +=
pow(sin_phi, 4)*z_0/
pow(var_bd, 2);
214 coeff[
idx(1, 0, 1, 0, 1, 1)] += -2*
pow(cos_phi, 2)*
pow(sin_phi, 4)*z_0/
pow(var_bd, 3);
215 coeff[
idx(1, 0, 1, 0, 2, 0)] += -
pow(sin_phi, 6)*z_0/
pow(var_bd, 3);
216 coeff[
idx(1, 1, 0, 0, 0, 0)] += cos_phi*sin_phi/var_bd;
217 coeff[
idx(1, 1, 0, 0, 0, 1)] += -
pow(cos_phi, 3)*sin_phi/
pow(var_bd, 2);
218 coeff[
idx(1, 1, 0, 0, 0, 2)] +=
pow(cos_phi, 5)*sin_phi/
pow(var_bd, 3);
219 coeff[
idx(1, 1, 0, 0, 1, 0)] += -cos_phi*
pow(sin_phi, 3)/
pow(var_bd, 2);
220 coeff[
idx(1, 1, 0, 0, 1, 1)] += 2*
pow(cos_phi, 3)*
pow(sin_phi, 3)/
pow(var_bd, 3);
221 coeff[
idx(1, 1, 0, 0, 2, 0)] += cos_phi*
pow(sin_phi, 5)/
pow(var_bd, 3);
222 coeff[
idx(2, 0, 0, 0, 0, 0)] += -
pow(sin_phi, 2)/(2*var_bd);
223 coeff[
idx(2, 0, 0, 0, 0, 1)] +=
pow(cos_phi, 2)*
pow(sin_phi, 2)/(2*
pow(var_bd, 2));
224 coeff[
idx(2, 0, 0, 0, 0, 2)] += -
pow(cos_phi, 4)*
pow(sin_phi, 2)/(2*
pow(var_bd, 3));
225 coeff[
idx(2, 0, 0, 0, 1, 0)] +=
pow(sin_phi, 4)/(2*
pow(var_bd, 2));
227 coeff[
idx(2, 0, 0, 0, 2, 0)] += -
pow(sin_phi, 6)/(2*
pow(var_bd, 3));
229 coeff[
idx(0, 0, 0, 0, 0, 1)+90] += -
pow(cos_phi, 2)/(2*var_bd);
230 coeff[
idx(0, 0, 0, 0, 0, 2)+90] +=
pow(cos_phi, 4)/(4*
pow(var_bd, 2));
231 coeff[
idx(0, 0, 0, 0, 1, 0)+90] += -
pow(sin_phi, 2)/(2*var_bd);
232 coeff[
idx(0, 0, 0, 0, 1, 1)+90] +=
pow(cos_phi, 2)*
pow(sin_phi, 2)/(2*
pow(var_bd, 2));
233 coeff[
idx(0, 0, 0, 0, 2, 0)+90] +=
pow(sin_phi, 4)/(4*
pow(var_bd, 2));