42 const Double_t CutChi2 = 3.5 * 3.5;
43 const Int_t MaxIter = 3;
51 for (Int_t i = 0; i < 6; i++) {
56 r[0] = r[1] = r[2] = 0.;
64 C[0] = C[2] = t.
RR / 3.5 / 3.5;
65 C[5] = (t.
dz / 2 / 3.5) * (t.
dz / 2 / 3.5);
68 int fitIterSuccess = 0;
70 for (Int_t iteration = 0; iteration < MaxIter; ++iteration) {
74 Double_t r0[3], C0[6];
76 for (Int_t i = 0; i < 3; i++) {
79 for (Int_t i = 0; i < 6; i++) {
97 auto itr = std::get<0>(trk);
98 std::get<2>(trk) =
true;
101 Bool_t err = T.Extrapolate(r0[2]);
103 std::get<2>(trk) =
false;
107 Double_t* m = T.GetTrack();
108 Double_t* V = T.GetCovMatrix();
109 Double_t a = 0, b = 0;
111 Double_t zeta[2] = {r0[0] - m[0], r0[1] - m[1]};
115 Double_t S[3] = {(C0[2] + V[2]), -(C0[1] + V[1]), (C0[0] + V[0])};
116 Double_t s = S[2] * S[0] - S[1] * S[1];
117 Double_t chi2 = zeta[0] * zeta[0] * S[0] + 2 * zeta[0] * zeta[1] * S[1] + zeta[1] * zeta[1] * S[2];
118 if (chi2 > s * CutChi2) {
119 std::get<2>(trk) =
false;
124 s = V[0] * V[2] - V[1] * V[1];
126 std::get<2>(trk) =
false;
130 a = m[2] + s * ((V[3] * V[2] - V[4] * V[1]) * zeta[0] + (-V[3] * V[1] + V[4] * V[0]) * zeta[1]);
131 b = m[3] + s * ((V[6] * V[2] - V[7] * V[1]) * zeta[0] + (-V[6] * V[1] + V[7] * V[0]) * zeta[1]);
140 Double_t zeta[2] = {m[0] - (r[0] - a * (r[2] - r0[2])), m[1] - (r[1] - b * (r[2] - r0[2]))};
144 Double_t CHt[3][2] = {{C[0] - a * C[3], C[1] - b * C[3]},
145 {C[1] - a * C[4], C[2] - b * C[4]},
146 {C[3] - a * C[5], C[4] - b * C[5]}};
150 Double_t S[3] = {V[0] + CHt[0][0] - a * CHt[2][0], V[1] + CHt[1][0] - b * CHt[2][0],
151 V[2] + CHt[1][1] - b * CHt[2][1]};
155 Double_t w = S[0] * S[2] - S[1] * S[1];
157 std::get<2>(trk) =
false;
170 zeta[0] * zeta[0] * S[0] + 2 * zeta[0] * zeta[1] * S[1] + zeta[1] * zeta[1] * S[2] + T.GetRefChi2();
178 for (Int_t i = 0; i < 3; ++i) {
179 K[i][0] = CHt[i][0] * S[0] + CHt[i][1] * S[1];
180 K[i][1] = CHt[i][0] * S[1] + CHt[i][1] * S[2];
185 for (Int_t i = 0; i < 3; ++i) {
186 r[i] += K[i][0] * zeta[0] + K[i][1] * zeta[1];
191 C[0] -= K[0][0] * CHt[0][0] + K[0][1] * CHt[0][1];
192 C[1] -= K[1][0] * CHt[0][0] + K[1][1] * CHt[0][1];
193 C[2] -= K[1][0] * CHt[1][0] + K[1][1] * CHt[1][1];
194 C[3] -= K[2][0] * CHt[0][0] + K[2][1] * CHt[0][1];
195 C[4] -= K[2][0] * CHt[1][0] + K[2][1] * CHt[1][1];
196 C[5] -= K[2][0] * CHt[2][0] + K[2][1] * CHt[2][1];
202 if (fitIterSuccess) {