CbmRoot
CbmKFSecondaryVertexFinder.cxx
Go to the documentation of this file.
1 
10 
11 #include "CbmKF.h"
12 #include "CbmKFTrack.h"
13 
14 #include <cmath>
15 
16 using std::fabs;
17 using std::vector;
18 
20 
21  void CbmKFSecondaryVertexFinder::Clear(Option_t* /*opt*/) {
22  vTracks.clear();
23  VGuess = 0;
24  VParent = 0;
25  MassConstraint = -1;
26 }
27 
29 
31  vTracks.push_back(Track);
32 }
33 
34 void CbmKFSecondaryVertexFinder::SetTracks(vector<CbmKFTrackInterface*>& vTr) {
35  vTracks = vTr;
36 }
37 
39  VGuess = Guess;
40 }
41 
43  MassConstraint = MotherMass;
44 }
45 
47  VParent = VP;
48 }
49 
51  const Int_t MaxIter = 3;
52 
53  if (VGuess) {
54  r[0] = VGuess->GetRefX();
55  r[1] = VGuess->GetRefY();
56  r[2] = VGuess->GetRefZ();
57  } else {
58  if (CbmKF::Instance()->vTargets.empty()) {
59  r[0] = r[1] = r[2] = 0.;
60  } else {
62  r[0] = r[1] = 0.;
63  r[2] = t.z;
64  }
65  }
66 
67  r[3] = 0;
68  r[4] = 0;
69  r[5] = 0;
70  r[6] = 0;
71  r[7] = 0;
72 
73  for (Int_t iteration = 0; iteration < MaxIter; ++iteration) {
74 
75  for (int i = 0; i < 8; i++)
76  r0[i] = r[i];
77 
78  r[3] = 0;
79  r[4] = 0;
80  r[5] = 0;
81  r[6] = 0;
82 
83  for (Int_t i = 0; i < 36; ++i)
84  C[i] = 0.0;
85 
86  C[0] = C[2] = C[5] = 100.0;
87  C[35] = 1.E4;
88  NDF = -3;
89  Chi2 = 0.;
90 
91  for (vector<CbmKFTrackInterface*>::iterator tr = vTracks.begin();
92  tr != vTracks.end();
93  ++tr) {
94  CbmKFTrack T(**tr);
95 
96  T.Extrapolate(r0[2]);
97 
98  Double_t* m = T.GetTrack();
99  Double_t* V = T.GetCovMatrix();
100 
101  //* Fit of vertex track slopes and momentum (a,b,qp) to r0 vertex
102 
103  Double_t a = m[2], b = m[3], qp = m[4];
104  {
105  Double_t s = V[0] * V[2] - V[1] * V[1];
106  s = (s > 1.E-20) ? 1. / s : 0;
107  Double_t zetas[2] = {(r0[0] - m[0]) * s, (r0[1] - m[1]) * s};
108  a += (V[3] * V[2] - V[4] * V[1]) * zetas[0]
109  + (-V[3] * V[1] + V[4] * V[0]) * zetas[1];
110  b += (V[6] * V[2] - V[7] * V[1]) * zetas[0]
111  + (-V[6] * V[1] + V[7] * V[0]) * zetas[1];
112  qp += (V[10] * V[2] - V[11] * V[1]) * zetas[0]
113  + (-V[10] * V[1] + V[11] * V[0]) * zetas[1];
114  }
115 
116  //* convert the track to (x,y,px,py,pz,e) parameterization
117  double mm[6], VV[21];
118  {
119  double c2 = 1. / (1. + a * a + b * b);
120  double p = 1. / qp;
121  double p2 = p * p;
122  double pz = sqrt(p2 * c2);
123  double px = a * pz;
124  double py = b * pz;
125  double E = sqrt(T.GetMass() * T.GetMass() + p2);
126 
127  double da = (m[2] - a);
128  double db = (m[3] - b);
129  double dq = (m[4] - qp);
130 
131  double H[3] = {-px * c2, -py * c2, -pz * p};
132  double HE = -p * p2 / E;
133 
134  double dpz = H[0] * da + H[1] * db + H[2] * dq;
135 
136  mm[0] = m[0];
137  mm[1] = m[1];
138  mm[2] = px + da + a * dpz;
139  mm[3] = py + db + b * dpz;
140  mm[4] = pz + dpz;
141  mm[5] = E + HE * dq;
142 
143  double cxpz = H[0] * V[3] + H[1] * V[6] + H[2] * V[10];
144  double cypz = H[0] * V[4] + H[1] * V[7] + H[2] * V[11];
145  double capz = H[0] * V[5] + H[1] * V[8] + H[2] * V[12];
146  double cbpz = H[0] * V[8] + H[1] * V[9] + H[2] * V[13];
147  double cqpz = H[0] * V[12] + H[1] * V[13] + H[2] * V[14];
148  double cpzpz = H[0] * H[0] * V[5] + H[1] * H[1] * V[9]
149  + H[2] * H[2] * V[14]
150  + 2
151  * (H[0] * H[1] * V[8] + H[0] * H[2] * V[12]
152  + H[1] * H[2] * V[13]);
153 
154  VV[0] = V[0];
155  VV[1] = V[1];
156  VV[2] = V[2];
157  VV[3] = V[3] * pz + a * cxpz;
158  VV[4] = V[4] * pz + a * cypz;
159  VV[5] = V[5] * pz * pz + 2 * a * pz * capz + a * a * cpzpz;
160  VV[6] = V[6] * pz + b * cxpz;
161  VV[7] = V[7] * pz + b * cypz;
162  VV[8] = V[8] * pz * pz + a * pz * cbpz + b * pz * capz + a * b * cpzpz;
163  VV[9] = V[9] * pz * pz + 2 * b * pz * cbpz + b * b * cpzpz;
164  VV[10] = cxpz;
165  VV[11] = cypz;
166  VV[12] = capz * pz + a * cpzpz;
167  VV[13] = cbpz * pz + b * cpzpz;
168  VV[14] = cpzpz;
169  VV[15] = HE * V[10];
170  VV[16] = HE * V[11];
171  VV[17] = HE * (V[12] * pz + a * cqpz);
172  VV[18] = HE * (V[13] * pz + b * cqpz);
173  VV[19] = HE * cqpz;
174  VV[20] = HE * HE * V[14];
175  }
176 
177 
178  //* Measure the state vector with the track estimate
179 
180  Chi2 += T.GetRefChi2();
181  NDF += T.GetRefNDF() - 3;
182 
183  //* Update the state vector with the momentum part of the track estimate
184 
185  r[3] += mm[2];
186  r[4] += mm[3];
187  r[5] += mm[4];
188  r[6] += mm[5];
189 
190  C[9] += VV[5];
191  C[13] += VV[8];
192  C[14] += VV[9];
193  C[18] += VV[12];
194  C[19] += VV[13];
195  C[20] += VV[14];
196  C[24] += VV[17];
197  C[25] += VV[18];
198  C[26] += VV[19];
199  C[27] += VV[20];
200 
201  NDF += 3;
202  Chi2 += 0.;
203 
204  //* Update the state vector with the coordinate part of the track estimate
205 
206  //* Residual (measured - estimated)
207 
208  Double_t zeta[2] = {mm[0] - (r[0] - a * (r[2] - r0[2])),
209  mm[1] - (r[1] - b * (r[2] - r0[2]))};
210 
211  //* Measurement matrix H= { { 1, 0, -a, 0..0}, { 0, 1, -b,0..0} };
212 
213  //* S = (H*C*H' + V )^{-1}
214 
215  Double_t S[3] = {VV[0] + C[0] - 2 * a * C[3] + a * a * C[5],
216  VV[1] + C[1] - b * C[3] - a * C[4] + a * b * C[5],
217  VV[2] + C[2] - 2 * b * C[4] + b * b * C[5]};
218 
219  //* Invert S
220  {
221  Double_t s = S[0] * S[2] - S[1] * S[1];
222 
223  if (s < 1.E-20) continue;
224  s = 1. / s;
225  Double_t S0 = S[0];
226  S[0] = s * S[2];
227  S[1] = -s * S[1];
228  S[2] = s * S0;
229  }
230 
231  //* CHt = CH' - D'
232 
233  Double_t CHt0[7], CHt1[7];
234 
235  CHt0[0] = C[0] - a * C[3];
236  CHt1[0] = C[1] - b * C[3];
237  CHt0[1] = C[1] - a * C[4];
238  CHt1[1] = C[2] - b * C[4];
239  CHt0[2] = C[3] - a * C[5];
240  CHt1[2] = C[4] - b * C[5];
241  CHt0[3] = C[6] - a * C[8] - VV[3];
242  CHt1[3] = C[7] - b * C[8] - VV[4];
243  CHt0[4] = C[10] - a * C[12] - VV[6];
244  CHt1[4] = C[11] - b * C[12] - VV[7];
245  CHt0[5] = C[15] - a * C[17] - VV[10];
246  CHt1[5] = C[16] - b * C[17] - VV[11];
247  CHt0[6] = C[21] - a * C[23] - VV[15];
248  CHt1[6] = C[22] - b * C[23] - VV[16];
249 
250  //* Kalman gain K = CH'*S
251 
252  Double_t K0[7], K1[7];
253 
254  for (Int_t i = 0; i < 7; ++i) {
255  K0[i] = CHt0[i] * S[0] + CHt1[i] * S[1];
256  K1[i] = CHt0[i] * S[1] + CHt1[i] * S[2];
257  }
258 
259  //* New estimation of the vertex position r += K*zeta
260 
261  for (Int_t i = 0; i < 7; ++i)
262  r[i] += K0[i] * zeta[0] + K1[i] * zeta[1];
263 
264  //* New covariance matrix C -= K*(CH')'
265 
266  for (Int_t i = 0, k = 0; i < 7; ++i) {
267  for (Int_t j = 0; j <= i; ++j, ++k)
268  C[k] -= K0[i] * CHt0[j] + K1[i] * CHt1[j];
269  }
270 
271  //* Calculate Chi^2 & NDF
272 
273  NDF += 2;
274  Chi2 += zeta[0] * zeta[0] * S[0] + 2 * zeta[0] * zeta[1] * S[1]
275  + zeta[1] * zeta[1] * S[2];
276 
277  } // add tracks
278 
279  // Put constraints if they exist
280 
283 
284  } // iterations
285 }
286 
287 
289  vtx.GetRefX() = r[0];
290  vtx.GetRefY() = r[1];
291  vtx.GetRefZ() = r[2];
292  for (int i = 0; i < 6; i++)
293  vtx.GetCovMatrix()[i] = C[i];
294  vtx.GetRefChi2() = Chi2;
295  vtx.GetRefNDF() = NDF;
296 }
297 
300  GetVertex(vi);
301  vi.GetVertex(vtx);
302 }
303 
304 
306  Double_t Cov[]) {
307 
308  if (!Par) return;
309 
310  Double_t px = r[3], py = r[4], pz = r[5];
311 
312  Double_t p = sqrt(px * px + py * py + pz * pz);
313  double pzi = 1 / pz;
314  double qp = 1 / p;
315  Par[0] = r[0];
316  Par[1] = r[1];
317  Par[2] = px * pzi;
318  Par[3] = py * pzi;
319  Par[4] = qp;
320  Par[5] = r[2];
321 
322  if (!Cov) return;
323 
324  double qp3 = qp * qp * qp;
325  Double_t J[5][6];
326 
327  for (Int_t i = 0; i < 5; i++)
328  for (Int_t j = 0; j < 6; ++j)
329  J[i][j] = 0.0;
330 
331 
332  J[0][0] = 1;
333  J[0][2] = -Par[2];
334  J[1][1] = 1;
335  J[1][2] = -Par[3];
336  J[2][3] = pzi;
337  J[2][5] = -Par[2] * pzi;
338  J[3][4] = pzi;
339  J[3][5] = -Par[3] * pzi;
340  J[4][3] = -qp3 * px;
341  J[4][4] = -qp3 * py;
342  J[4][4] = -qp3 * pz;
343 
344  Double_t JC[5][6];
345 
346  for (Int_t i = 0; i < 5; i++)
347  for (Int_t j = 0; j < 6; j++) {
348  JC[i][j] = 0;
349  for (Int_t k = 0; k < 6; k++)
350  JC[i][j] += J[i][k] * Cij(k, j);
351  }
352 
353  Int_t ii = 0;
354  for (Int_t i = 0; i < 5; i++)
355  for (Int_t j = i; j < 5; j++, ii++) {
356  Cov[ii] = 0;
357  for (Int_t k = 0; k < 6; k++)
358  Cov[ii] += JC[i][k] * J[j][k];
359  }
360 }
361 
362 
363 void CbmKFSecondaryVertexFinder::GetMass(Double_t* M, Double_t* Error_) {
364  // S = sigma^2 of m2/2
365 
366  Double_t S =
367  (r[3] * r[3] * C[9] + r[4] * r[4] * C[14] + r[5] * r[5] * C[20]
368  + r[6] * r[6] * C[27]
369  + 2
370  * (+r[3] * r[4] * C[13] + r[5] * (r[3] * C[18] + r[4] * C[19])
371  - r[6] * (r[3] * C[24] + r[4] * C[25] + r[5] * C[26])));
372  Double_t m2 = r[6] * r[6] - r[3] * r[3] - r[4] * r[4] - r[5] * r[5];
373 
374  if (M) *M = (m2 > 1.e-20) ? sqrt(m2) : 0.;
375  if (Error_) *Error_ = (S >= 0 && m2 > 1.e-20) ? sqrt(S / m2) : 1.e4;
376 }
377 
378 
380  if (MassConstraint < 0) return;
381  double H[8];
382  H[0] = H[1] = H[2] = 0.;
383  H[3] = -2 * r0[3];
384  H[4] = -2 * r0[4];
385  H[5] = -2 * r0[5];
386  H[6] = 2 * r0[6];
387  H[7] = 0;
388  double m2 = r0[6] * r0[6] - r0[3] * r0[3] - r0[4] * r0[4] - r0[5] * r0[5];
389 
390  double zeta = MassConstraint * MassConstraint - m2;
391  for (Int_t i = 0; i < 8; ++i)
392  zeta -= H[i] * (r[i] - r0[i]);
393 
394  Double_t S = 0.;
395  Double_t CHt[8];
396  for (Int_t i = 0; i < 8; ++i) {
397  CHt[i] = 0.0;
398  for (Int_t j = 0; j < 8; ++j)
399  CHt[i] += Cij(i, j) * H[j];
400  S += H[i] * CHt[i];
401  }
402 
403  if (S < 1.e-20) return;
404  S = 1. / S;
405  Chi2 += zeta * zeta * S;
406  NDF += 1;
407  for (Int_t i = 0, ii = 0; i < 8; ++i) {
408  Double_t Ki = CHt[i] * S;
409  r[i] += Ki * zeta;
410  for (Int_t j = 0; j <= i; ++j)
411  C[ii++] -= Ki * CHt[j];
412  }
413 }
414 
415 
417 
418  r0[0] += T * r0[3];
419  r0[1] += T * r0[4];
420  r0[2] += T * r0[5];
421 
422  r[0] += T * r[3];
423  r[1] += T * r[4];
424  r[2] += T * r[5];
425 
426  double C30 = C[6] + T * C[9];
427  double C41 = C[11] + T * C[14];
428  double C52 = C[17] + T * C[20];
429  double T54 = T * C[19];
430 
431  C[0] += T * (C[6] + C30);
432  C[1] += T * (C[7] + C[10]);
433  C[2] += T * (C[11] + C41);
434  C[10] += T * C[13];
435  C[6] = C30;
436  C[11] = C41;
437 
438  C[15] += T * C[18];
439  C[16] += T54;
440  C[3] += T * (C[8] + C[15]);
441  C[4] += T * (C[12] + C[16]);
442  C[5] += T * (C[17] + C52);
443  C[17] = C52;
444  C[12] += T54;
445 
446  C[7] += T * C[13];
447  C[8] += T * C[18];
448 
449  C[21] += T * C[24];
450  C[22] += T * C[25];
451  C[23] += T * C[26];
452  C[28] += T * C[31];
453  C[29] += T * C[32];
454  C[30] += T * C[33];
455 }
456 
458  if (!VParent) return;
459 
460  double m[3], *V;
461  {
462  m[0] = VParent->GetRefX();
463  m[1] = VParent->GetRefY();
464  m[2] = VParent->GetRefZ();
465  V = VParent->GetCovMatrix();
466  }
467 
468  Extrapolate(-r0[7]);
469 
470  {
471  double inf = 1.e8;
472  double xinf = r0[0] * inf;
473  double yinf = r0[1] * inf;
474  double zinf = r0[2] * inf;
475  C[0] += r0[0] * xinf;
476  C[1] += r0[0] * yinf;
477  C[2] += r0[1] * yinf;
478  C[3] += r0[0] * zinf;
479  C[4] += r0[1] * zinf;
480  C[5] += r0[2] * zinf;
481  C[28] = -2 * xinf;
482  C[29] = -2 * yinf;
483  C[30] = -2 * zinf;
484  C[31] = 0;
485  C[32] = 0;
486  C[33] = 0;
487  C[34] = 0;
488  C[35] = inf;
489  }
490  r[7] = r0[7];
491 
492  double Ai[6];
493  Ai[0] = C[4] * C[4] - C[2] * C[5];
494  Ai[1] = C[1] * C[5] - C[3] * C[4];
495  Ai[3] = C[2] * C[3] - C[1] * C[4];
496  double det = (C[0] * Ai[0] + C[1] * Ai[1] + C[3] * Ai[3]);
497  det = (det > 1.e-8) ? 1. / det : 0;
498  Ai[0] *= det;
499  Ai[1] *= det;
500  Ai[3] *= det;
501  Ai[2] = (C[3] * C[3] - C[0] * C[5]) * det;
502  Ai[4] = (C[0] * C[4] - C[1] * C[3]) * det;
503  Ai[5] = (C[1] * C[1] - C[0] * C[2]) * det;
504 
505  double B[5][3];
506  B[0][0] = C[6] * Ai[0] + C[7] * Ai[1] + C[8] * Ai[3];
507  B[0][1] = C[6] * Ai[1] + C[7] * Ai[2] + C[8] * Ai[4];
508  B[0][2] = C[6] * Ai[3] + C[7] * Ai[4] + C[8] * Ai[5];
509 
510  B[1][0] = C[10] * Ai[0] + C[11] * Ai[1] + C[12] * Ai[3];
511  B[1][1] = C[10] * Ai[1] + C[11] * Ai[2] + C[12] * Ai[4];
512  B[1][2] = C[10] * Ai[3] + C[11] * Ai[4] + C[12] * Ai[5];
513 
514  B[2][0] = C[15] * Ai[0] + C[16] * Ai[1] + C[17] * Ai[3];
515  B[2][1] = C[15] * Ai[1] + C[16] * Ai[2] + C[17] * Ai[4];
516  B[2][2] = C[15] * Ai[3] + C[16] * Ai[4] + C[17] * Ai[5];
517 
518  B[3][0] = C[21] * Ai[0] + C[22] * Ai[1] + C[23] * Ai[3];
519  B[3][1] = C[21] * Ai[1] + C[22] * Ai[2] + C[23] * Ai[4];
520  B[3][2] = C[21] * Ai[3] + C[22] * Ai[4] + C[23] * Ai[5];
521 
522  B[4][0] = C[28] * Ai[0] + C[29] * Ai[1] + C[30] * Ai[3];
523  B[4][1] = C[28] * Ai[1] + C[29] * Ai[2] + C[30] * Ai[4];
524  B[4][2] = C[28] * Ai[3] + C[29] * Ai[4] + C[30] * Ai[5];
525 
526  double z[3] = {m[0] - r[0], m[1] - r[1], m[2] - r[2]};
527  r[0] = m[0];
528  r[1] = m[1];
529  r[2] = m[2];
530  r[3] += B[0][0] * z[0] + B[0][1] * z[1] + B[0][2] * z[2];
531  r[4] += B[1][0] * z[0] + B[1][1] * z[1] + B[1][2] * z[2];
532  r[5] += B[2][0] * z[0] + B[2][1] * z[1] + B[2][2] * z[2];
533  r[6] += B[3][0] * z[0] + B[3][1] * z[1] + B[3][2] * z[2];
534  r[7] += B[4][0] * z[0] + B[4][1] * z[1] + B[4][2] * z[2];
535 
536  {
537  double AV[6] = {C[0] - V[0],
538  C[1] - V[1],
539  C[2] - V[2],
540  C[3] - V[3],
541  C[4] - V[4],
542  C[5] - V[5]};
543  double AVi[6];
544  AVi[0] = AV[4] * AV[4] - AV[2] * AV[5];
545  AVi[1] = AV[1] * AV[5] - AV[3] * AV[4];
546  AVi[2] = AV[3] * AV[3] - AV[0] * AV[5];
547  AVi[3] = AV[2] * AV[3] - AV[1] * AV[4];
548  AVi[4] = AV[0] * AV[4] - AV[1] * AV[3];
549  AVi[5] = -123; // FIXME assing correct value
550  det = (AV[0] * AVi[0] + AV[1] * AVi[1] + AV[3] * AVi[3]);
551  det = (det > 1.e-8) ? 1. / det : 0;
552  NDF += 2;
553  Chi2 += (+(AVi[0] * z[0] + AVi[1] * z[1] + AVi[3] * z[2]) * z[0]
554  + (AVi[1] * z[0] + AVi[2] * z[1] + AVi[4] * z[2]) * z[1]
555  + (AVi[3] * z[0] + AVi[4] * z[1] + AVi[5] * z[2]) * z[2])
556  * det;
557  }
558 
559  double d0, d1, d2;
560  C[0] = V[0];
561  C[1] = V[1];
562  C[2] = V[2];
563  C[3] = V[3];
564  C[4] = V[4];
565  C[5] = V[5];
566 
567  d0 = B[0][0] * V[0] + B[0][1] * V[1] + B[0][2] * V[3] - C[6];
568  d1 = B[0][0] * V[1] + B[0][1] * V[2] + B[0][2] * V[4] - C[7];
569  d2 = B[0][0] * V[3] + B[0][1] * V[4] + B[0][2] * V[5] - C[8];
570 
571  C[6] += d0;
572  C[7] += d1;
573  C[8] += d2;
574  C[9] += d0 * B[0][0] + d1 * B[0][1] + d2 * B[0][2];
575 
576  d0 = B[1][0] * V[0] + B[1][1] * V[1] + B[1][2] * V[3] - C[10];
577  d1 = B[1][0] * V[1] + B[1][1] * V[2] + B[1][2] * V[4] - C[11];
578  d2 = B[1][0] * V[3] + B[1][1] * V[4] + B[1][2] * V[5] - C[12];
579 
580  C[10] += d0;
581  C[11] += d1;
582  C[12] += d2;
583  C[13] += d0 * B[0][0] + d1 * B[0][1] + d2 * B[0][2];
584  C[14] += d0 * B[1][0] + d1 * B[1][1] + d2 * B[1][2];
585 
586  d0 = B[2][0] * V[0] + B[2][1] * V[1] + B[2][2] * V[3] - C[15];
587  d1 = B[2][0] * V[1] + B[2][1] * V[2] + B[2][2] * V[4] - C[16];
588  d2 = B[2][0] * V[3] + B[2][1] * V[4] + B[2][2] * V[5] - C[17];
589 
590  C[15] += d0;
591  C[16] += d1;
592  C[17] += d2;
593  C[18] += d0 * B[0][0] + d1 * B[0][1] + d2 * B[0][2];
594  C[19] += d0 * B[1][0] + d1 * B[1][1] + d2 * B[1][2];
595  C[20] += d0 * B[2][0] + d1 * B[2][1] + d2 * B[2][2];
596 
597  d0 = B[3][0] * V[0] + B[3][1] * V[1] + B[3][2] * V[3] - C[21];
598  d1 = B[3][0] * V[1] + B[3][1] * V[2] + B[3][2] * V[4] - C[22];
599  d2 = B[3][0] * V[3] + B[3][1] * V[4] + B[3][2] * V[5] - C[23];
600 
601  C[21] += d0;
602  C[22] += d1;
603  C[23] += d2;
604  C[24] += d0 * B[0][0] + d1 * B[0][1] + d2 * B[0][2];
605  C[25] += d0 * B[1][0] + d1 * B[1][1] + d2 * B[1][2];
606  C[26] += d0 * B[2][0] + d1 * B[2][1] + d2 * B[2][2];
607  C[27] += d0 * B[3][0] + d1 * B[3][1] + d2 * B[3][2];
608 
609  d0 = B[4][0] * V[0] + B[4][1] * V[1] + B[4][2] * V[3] - C[28];
610  d1 = B[4][0] * V[1] + B[4][1] * V[2] + B[4][2] * V[4] - C[29];
611  d2 = B[4][0] * V[3] + B[4][1] * V[4] + B[4][2] * V[5] - C[30];
612 
613  C[28] += d0;
614  C[29] += d1;
615  C[30] += d2;
616  C[31] += d0 * B[0][0] + d1 * B[0][1] + d2 * B[0][2];
617  C[32] += d0 * B[1][0] + d1 * B[1][1] + d2 * B[1][2];
618  C[33] += d0 * B[2][0] + d1 * B[2][1] + d2 * B[2][2];
619  C[34] += d0 * B[3][0] + d1 * B[3][1] + d2 * B[3][2];
620  C[35] += d0 * B[4][0] + d1 * B[4][1] + d2 * B[4][2];
621 
622  {
623  Extrapolate(r[7]);
624 
625  double CH00 = C[0] + r0[0] * C[28];
626  double CH10 = C[1] + r0[0] * C[29];
627  double CH11 = C[2] + r0[1] * C[29];
628  double CH20 = C[3] + r0[0] * C[30];
629  double CH21 = C[4] + r0[1] * C[30];
630  double CH22 = C[5] + r0[2] * C[30];
631 
632  C[28] += r0[0] * C[35];
633  C[29] += r0[1] * C[35];
634  C[30] += r0[2] * C[35];
635 
636  C[0] = CH00 + r0[0] * C[28];
637  C[1] = CH10 + r0[1] * C[28];
638  C[2] = CH11 + r0[1] * C[29];
639  C[3] = CH20 + r0[2] * C[28];
640  C[4] = CH21 + r0[2] * C[29];
641  C[5] = CH22 + r0[2] * C[30];
642 
643  C[6] += r0[0] * C[31];
644  C[7] += r0[1] * C[31];
645  C[8] += r0[2] * C[31];
646  C[10] += r0[0] * C[32];
647  C[11] += r0[1] * C[32];
648  C[12] += r0[2] * C[32];
649  C[15] += r0[0] * C[33];
650  C[16] += r0[1] * C[33];
651  C[17] += r0[2] * C[33];
652  C[21] += r0[0] * C[34];
653  C[22] += r0[1] * C[34];
654  C[23] += r0[2] * C[34];
655  }
656 }
CbmKFSecondaryVertexFinder::GetVertex
void GetVertex(CbmKFVertexInterface &vtx)
Definition: CbmKFSecondaryVertexFinder.cxx:288
CbmKFSecondaryVertexFinder::VGuess
CbmKFVertexInterface * VGuess
Definition: CbmKFSecondaryVertexFinder.h:24
CbmKFSecondaryVertexFinder::Chi2
Double_t Chi2
Definition: CbmKFSecondaryVertexFinder.h:22
CbmKFTube::z
Double_t z
Definition: CbmKFMaterial.h:92
CbmKFSecondaryVertexFinder::r0
Double_t r0[8]
Definition: CbmKFSecondaryVertexFinder.h:23
CbmKF.h
ClassImp
ClassImp(CbmKFSecondaryVertexFinder) void CbmKFSecondaryVertexFinder
Definition: CbmKFSecondaryVertexFinder.cxx:19
CbmKFSecondaryVertexFinder::Clear
virtual void Clear(Option_t *opt="")
sqrt
friend F32vec4 sqrt(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:41
CbmKFSecondaryVertexFinder::GetMotherTrack
void GetMotherTrack(Double_t T[], Double_t C[])
Definition: CbmKFSecondaryVertexFinder.cxx:305
CbmKFSecondaryVertexFinder::C
Double_t C[36]
Definition: CbmKFSecondaryVertexFinder.h:23
CbmKFSecondaryVertexFinder::SetTopoConstraint
void SetTopoConstraint(CbmKFVertexInterface *Parent=0)
Definition: CbmKFSecondaryVertexFinder.cxx:46
CbmKFSecondaryVertexFinder::GetMass
void GetMass(Double_t *M, Double_t *Error)
Definition: CbmKFSecondaryVertexFinder.cxx:363
CbmKFTrack::GetTrack
Double_t * GetTrack()
Is it electron.
Definition: CbmKFTrack.h:58
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmKFSecondaryVertexFinder::Fit
void Fit()
Definition: CbmKFSecondaryVertexFinder.cxx:50
CbmKF::vTargets
std::vector< CbmKFTube > vTargets
Definition: CbmKF.h:79
CbmKFTrack::GetMass
Double_t GetMass()
Definition: CbmKFTrack.h:62
CbmKFSecondaryVertexFinder::SetTracks
void SetTracks(std::vector< CbmKFTrackInterface * > &vTracks)
Definition: CbmKFSecondaryVertexFinder.cxx:34
CbmKFSecondaryVertexFinder::AddTrack
void AddTrack(CbmKFTrackInterface *Track)
Definition: CbmKFSecondaryVertexFinder.cxx:30
CbmKFVertexInterface::GetRefChi2
virtual Double_t & GetRefChi2()
Array[6] of covariance matrix.
Definition: CbmKFVertexInterface.cxx:32
CbmKFSecondaryVertexFinder::AddMassConstraint
void AddMassConstraint()
Definition: CbmKFSecondaryVertexFinder.cxx:379
CbmKFTrack::GetRefChi2
Double_t & GetRefChi2()
array[15] of covariance matrix
Definition: CbmKFTrack.h:60
CbmKFVertexInterface::GetVertex
void GetVertex(CbmVertex &v)
Definition: CbmKFVertexInterface.cxx:50
CbmKF::Instance
static CbmKF * Instance()
Definition: CbmKF.h:39
CbmKFTrack::GetRefNDF
Int_t & GetRefNDF()
Chi^2 after fit.
Definition: CbmKFTrack.h:61
CbmKFVertexInterface::GetRefZ
virtual Double_t & GetRefZ()
Definition: CbmKFVertexInterface.cxx:30
CbmKFSecondaryVertexFinder::VParent
CbmKFVertexInterface * VParent
Definition: CbmKFSecondaryVertexFinder.h:24
CbmKFSecondaryVertexFinder
Definition: CbmKFSecondaryVertexFinder.h:18
CbmKFTrack::GetCovMatrix
Double_t * GetCovMatrix()
array[6] of track parameters(x,y,tx,ty,qp,z)
Definition: CbmKFTrack.h:59
CbmVertex
Definition: CbmVertex.h:26
CbmKFVertexInterface
Definition: CbmKFVertexInterface.h:24
CbmKFSecondaryVertexFinder::NDF
Int_t NDF
Definition: CbmKFSecondaryVertexFinder.h:21
CbmKFSecondaryVertexFinder::AddTopoConstraint
void AddTopoConstraint()
Definition: CbmKFSecondaryVertexFinder.cxx:457
CbmKFTrack.h
CbmKFVertexInterface::GetRefX
virtual Double_t & GetRefX()
Definition: CbmKFVertexInterface.cxx:28
CbmKFSecondaryVertexFinder::SetMassConstraint
void SetMassConstraint(Double_t MotherMass=-1)
Definition: CbmKFSecondaryVertexFinder.cxx:42
CbmKFTrackInterface
Definition: CbmKFTrackInterface.h:26
CbmKFSecondaryVertexFinder::r
Double_t r[8]
Definition: CbmKFSecondaryVertexFinder.h:23
CbmKFVertexInterface::GetRefY
virtual Double_t & GetRefY()
Definition: CbmKFVertexInterface.cxx:29
CbmKFSecondaryVertexFinder::Extrapolate
void Extrapolate(double T)
Definition: CbmKFSecondaryVertexFinder.cxx:416
CbmKFSecondaryVertexFinder::MassConstraint
Double_t MassConstraint
Definition: CbmKFSecondaryVertexFinder.h:22
CbmKFSecondaryVertexFinder::Cij
Double_t & Cij(Int_t i, Int_t j)
Definition: CbmKFSecondaryVertexFinder.h:28
CbmKFSecondaryVertexFinder.h
CbmKFSecondaryVertexFinder::vTracks
std::vector< CbmKFTrackInterface * > vTracks
Definition: CbmKFSecondaryVertexFinder.h:20
CbmKFTube
Definition: CbmKFMaterial.h:77
CbmKFSecondaryVertexFinder::ClearTracks
void ClearTracks()
Definition: CbmKFSecondaryVertexFinder.cxx:28
fabs
friend F32vec4 fabs(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:60
CbmKFSecondaryVertexFinder::SetApproximation
void SetApproximation(CbmKFVertexInterface *Guess=0)
Definition: CbmKFSecondaryVertexFinder.cxx:38
m
__m128 m
Definition: L1/vectors/P4_F32vec4.h:26
CbmKFTrack
Definition: CbmKFTrack.h:21
CbmKFVertexInterface::GetRefNDF
virtual Int_t & GetRefNDF()
Chi^2 after fit.
Definition: CbmKFVertexInterface.cxx:33
CbmKFVertexInterface::GetCovMatrix
virtual Double_t * GetCovMatrix()
Definition: CbmKFVertexInterface.cxx:31
CbmKFTrackInterface::Extrapolate
Int_t Extrapolate(Double_t z, Double_t *QP0=0)
Access to i-th hit.
Definition: CbmKFTrackInterface.cxx:39