21 template <
typename external_spacepo
int_t>
45 float L = std::sqrt(dx * dx + dy * dy);
71 memset(&
m_Cx[0][0], 0,
sizeof(
m_Cx));
72 memset(&
m_Cy[0][0], 0,
sizeof(
m_Cy));
94 std::copy(st.
m_vs.begin(), st.
m_vs.end(), std::back_inserter(
m_vs));
101 std::vector<Acts::TrigFTF_GNN_Edge<external_spacepoint_t>*>
m_vs;
109 #define MAX_EDGE_STATE 2500
111 template <
typename external_spacepo
int_t>
115 const std::vector<Acts::TrigInDetSiLayer>&
g,
164 new_ts.
m_vs.push_back(pS);
166 bool accepted =
update(pS, new_ts);
173 std::list<Acts::TrigFTF_GNN_Edge<external_spacepoint_t>*> lCont;
175 for (
int nIdx = 0; nIdx < pS->
m_nNei;
177 unsigned int nextSegmentIdx = pS->
m_vNei[nIdx];
185 if (pN->
m_level == level - 1) {
199 float best_so_far = (*
m_stateVec.begin())->m_J;
200 if (new_ts.
m_J > best_so_far) {
210 for (
typename std::list<
213 sIt != lCont.end(); ++sIt, nBranches++) {
221 const float sigma_t = 0.0003;
222 const float sigma_w = 0.00009;
224 const float sigmaMS = 0.016;
226 const float sigma_x = 0.25;
227 const float sigma_y = 2.5;
229 const float weight_x = 0.5;
230 const float weight_y = 0.5;
232 const float maxDChi2_x = 60.0;
233 const float maxDChi2_y = 60.0;
235 const float add_hit = 14.0;
237 if (ts.
m_Cx[2][2] < 0.0 || ts.
m_Cx[1][1] < 0.0 || ts.
m_Cx[0][0] < 0.0) {
238 std::cout <<
"Negative cov_x" << std::endl;
241 if (ts.
m_Cy[1][1] < 0.0 || ts.
m_Cy[0][0] < 0.0) {
242 std::cout <<
"Negative cov_y" << std::endl;
247 ts.
m_Cx[2][2] += sigma_w * sigma_w;
248 ts.
m_Cx[1][1] += sigma_t * sigma_t;
252 float t2 = type1 == 0 ? 1.0 + ts.
m_Y[1] * ts.
m_Y[1]
253 : 1.0 + 1.0 / (ts.
m_Y[1] * ts.
m_Y[1]);
254 float s1 = sigmaMS *
t2;
264 float Cx[3][3], Cy[2][2];
266 float refX{}, refY{}, mx{}, my{};
268 float x{},
y{},
z{},
r{};
281 float B = 0.5 * A *
A;
282 float dr = refY - ts.
m_refY;
284 X[0] = ts.
m_X[0] + ts.
m_X[1] * A + ts.
m_X[2] * B;
285 X[1] = ts.
m_X[1] + ts.
m_X[2] *
A;
288 Cx[0][0] = ts.
m_Cx[0][0] + 2 * ts.
m_Cx[0][1] * A + 2 * ts.
m_Cx[0][2] * B +
289 A * A * ts.
m_Cx[1][1] + 2 * A * B * ts.
m_Cx[1][2] +
290 B * B * ts.
m_Cx[2][2];
291 Cx[0][1] = Cx[1][0] = ts.
m_Cx[0][1] + ts.
m_Cx[1][1] * A +
292 ts.
m_Cx[1][2] * B + ts.
m_Cx[0][2] * A +
293 A * A * ts.
m_Cx[1][2] + A * B * ts.
m_Cx[2][2];
294 Cx[0][2] = Cx[2][0] = ts.
m_Cx[0][2] + ts.
m_Cx[1][2] * A + ts.
m_Cx[2][2] * B;
296 Cx[1][1] = ts.
m_Cx[1][1] + 2 * A * ts.
m_Cx[1][2] + A * A * ts.
m_Cx[2][2];
297 Cx[1][2] = Cx[2][1] = ts.
m_Cx[1][2] + ts.
m_Cx[2][2] *
A;
299 Cx[2][2] = ts.
m_Cx[2][2];
301 Y[0] = ts.
m_Y[0] + ts.
m_Y[1] * dr;
304 Cy[0][0] = ts.
m_Cy[0][0] + 2 * ts.
m_Cy[0][1] * dr + dr * dr * ts.
m_Cy[1][1];
305 Cy[0][1] = Cy[1][0] = ts.
m_Cy[0][1] + dr * ts.
m_Cy[1][1];
306 Cy[1][1] = ts.
m_Cy[1][1];
310 float resid_x = mx - X[0];
311 float resid_y = my - Y[0];
313 float CHx[3] = {Cx[0][0], Cx[0][1], Cx[0][2]};
314 float CHy[2] = {Cy[0][0], Cy[0][1]};
316 float sigma_rz = 0.0;
321 sigma_rz = sigma_y * sigma_y;
323 sigma_rz = sigma_y * ts.
m_Y[1];
324 sigma_rz = sigma_rz * sigma_rz;
327 float Dx = 1.0 / (Cx[0][0] + sigma_x * sigma_x);
329 float Dy = 1.0 / (Cy[0][0] + sigma_rz);
331 float dchi2_x = resid_x * resid_x * Dx;
332 float dchi2_y = resid_y * resid_y * Dy;
334 if (dchi2_x > maxDChi2_x || dchi2_y > maxDChi2_y) {
338 ts.
m_J += add_hit - dchi2_x * weight_x - dchi2_y * weight_y;
342 float Kx[3] = {Dx * Cx[0][0], Dx * Cx[0][1], Dx * Cx[0][2]};
343 float Ky[2] = {Dy * Cy[0][0], Dy * Cy[0][1]};
345 for (
int i = 0;
i < 3;
i++) {
346 ts.
m_X[
i] = X[
i] + Kx[
i] * resid_x;
348 for (
int i = 0;
i < 2;
i++) {
349 ts.
m_Y[
i] = Y[
i] + Ky[
i] * resid_y;
352 for (
int i = 0;
i < 3;
i++) {
353 for (
int j = 0;
j < 3;
j++) {
358 for (
int i = 0;
i < 2;
i++) {
359 for (
int j = 0;
j < 2;
j++) {
369 auto iterator = find_if(
m_geo.begin(),
m_geo.end(), [l](
auto n) {
370 return n.m_subdet == l;
374 return m_geo.at(index).m_type;
377 const std::vector<Acts::TrigInDetSiLayer>&
m_geo;
379 std::vector<Acts::TrigFTF_GNN_Edge<external_spacepoint_t>>&
m_segStore;
381 std::vector<TrigFTF_GNN_EdgeState<external_spacepoint_t>*>
m_stateVec;