CbmRoot
CbmHelix.cxx
Go to the documentation of this file.
1 /*
2  * CbmHelix.cxx
3  *
4  * Created on: 27 sie 2019
5  * Author: Daniel Wielanek
6  * E-mail: daniel.wielanek@gmail.com
7  * Warsaw University of Technology, Faculty of Physics
8  */
9 #include "CbmHelix.h"
10 #include <TMath.h>
11 #include <vector>
12 // matrix x, y, tx,ty, qp, z
13 FairField* CbmHelix::fgField = NULL;
15 
17  const FairTrackParam* parameters = tr->GetParamVertex();
18  SetParameters(parameters);
19 }
20 
21 void CbmHelix::Build(const CbmStsTrack* tr, Bool_t firstPoint) {
22  if (firstPoint) {
24  } else {
26  }
27 }
28 
29 TVector3 CbmHelix::Eval(Double_t z) {
30  Propagate(z);
31  return TVector3(GetTrack()[0], GetTrack()[1], GetTrack()[5]);
32 }
33 
34 TVector3 CbmHelix::Eval(Double_t z, TVector3& mom) {
35  Propagate(z);
36  Double_t p = (TMath::Abs(Qp()) > 1.e-4) ? 1. / TMath::Abs(Qp()) : 1.e4;
37  Double_t pz = TMath::Sqrt(p * p / (Tx() * Tx() + Ty() * Ty() + 1));
38  Double_t px = Tx() * pz;
39  Double_t py = Ty() * pz;
40  mom.SetXYZ(px, py, pz);
41  return TVector3(GetTrack()[0], GetTrack()[1], GetTrack()[5]);
42 }
43 
44 void CbmHelix::SetParameters(const FairTrackParam* param) {
45  fT[0] = param->GetX();
46  fT[1] = param->GetY();
47  fT[2] = param->GetTx();
48  fT[3] = param->GetTy();
49  fT[4] = param->GetQp();
50  fT[5] = param->GetZ();
51  for (Int_t i = 0, iCov = 0; i < 5; i++)
52  for (Int_t j = 0; j <= i; j++, iCov++)
53  fC[iCov] = param->GetCovariance(i, j);
54 }
55 
57  // TODO Auto-generated destructor stub
58 }
59 
60 CbmHelix::CbmHelix(const CbmHelix& other) : TObject() {
61  for (int i = 0; i < 6; i++)
62  fT[i] = other.fT[i];
63  for (int i = 0; i < 15; i++)
64  fC[i] = other.fC[i];
65 }
66 
68  if (&other == this) return *this;
69  for (int i = 0; i < 6; i++)
70  fT[i] = other.fT[i];
71  for (int i = 0; i < 15; i++)
72  fC[i] = other.fC[i];
73  return *this;
74 }
75 
76 Int_t CbmHelix::Propagate(Double_t z) {
77  Int_t fMethod = 1;
78  Bool_t err = 0;
79  if (fabs(fT[5] - z) < 1.e-5) return 0;
80 
81  if (!fgField || (300 <= z && 300 <= fT[5])) {
82  // ExtrapolateLine(Z );
83  // return 0;
84  }
85  Double_t zz = z;
86  if (z < 300. && 300 <= fT[5]) ExtrapolateLine(300.);
87 
88  if (fT[5] < 300. && 300. < z) { zz = 300.; }
89  Bool_t repeat = 1;
90  while (!err && repeat) {
91  const Double_t max_step = 5.;
92  Double_t zzz;
93  if (fabs(fT[5] - zz) > max_step)
94  zzz = fT[5] + ((zz > fT[5]) ? max_step : -max_step);
95  else {
96  zzz = zz;
97  repeat = 0;
98  }
99  switch (fMethod) {
100  case 0: {
101  ExtrapolateLine(zzz);
102  break;
103  }
104  case 1: {
105  err = err || ExtrapolateALight(zzz);
106  break;
107  }
108  case 2: {
109  err = err || ExtrapolateRK4(zzz);
110  break;
111  }
112  }
113  }
114  if (fT[5] != z) ExtrapolateLine(z);
115  return err;
116 }
117 
118 void CbmHelix::ExtrapolateLine(Double_t z_out) {
119  Double_t dz = z_out - fT[5];
120 
121  fT[0] += dz * fT[2];
122  fT[1] += dz * fT[3];
123  fT[5] = z_out;
124 
125  const Double_t dzC_in8 = dz * fC[8];
126 
127  fC[4] = fC[4] + dzC_in8;
128  fC[1] = fC[1] + dz * (fC[4] + fC[6]);
129 
130  const Double_t C_in3 = fC[3];
131 
132  fC[3] = C_in3 + dz * fC[5];
133  fC[0] = fC[0] + dz * (fC[3] + C_in3);
134 
135  const Double_t C_in7 = fC[7];
136 
137  fC[7] = C_in7 + dz * fC[9];
138  fC[2] = fC[2] + dz * (fC[7] + C_in7);
139  fC[6] = fC[6] + dzC_in8;
140 }
141 
142 Int_t CbmHelix::ExtrapolateRK4(Double_t z_out) {
143  const Double_t c_light = 0.000299792458;
144 
145  static Double_t a[4] = {0.0, 0.5, 0.5, 1.0};
146  static Double_t c[4] = {1.0 / 6.0, 1.0 / 3.0, 1.0 / 3.0, 1.0 / 6.0};
147  static Double_t b[4] = {0.0, 0.5, 0.5, 1.0};
148 
149  Int_t step4;
150  Double_t k[16], x0[4], x[4], k1[16];
151  Double_t Ax[4], Ay[4], Ax_tx[4], Ay_tx[4], Ax_ty[4], Ay_ty[4];
152 
153  //----------------------------------------------------------------
154 
155  Double_t qp_in = fT[4];
156  Double_t z_in = fT[5];
157  Double_t h = z_out - z_in;
158  Double_t hC = h * c_light;
159  x0[0] = fT[0];
160  x0[1] = fT[1];
161  x0[2] = fT[2];
162  x0[3] = fT[3];
163  //
164  // Runge-Kutta step
165  //
166 
167  Int_t step;
168  Int_t i;
169 
170  for (step = 0; step < 4; ++step) {
171  for (i = 0; i < 4; ++i) {
172  if (step == 0) {
173  x[i] = x0[i];
174  } else {
175  x[i] = x0[i] + b[step] * k[step * 4 - 4 + i];
176  }
177  }
178 
179  Double_t point[3] = {x[0], x[1], z_in + a[step] * h};
180  Double_t B[3];
181  if (fgField)
182  fgField->GetFieldValue(point, B);
183  else {
184  B[0] = B[1] = B[2] = 0.;
185  }
186 
187  Double_t tx = x[2];
188  Double_t ty = x[3];
189  Double_t tx2 = tx * tx;
190  Double_t ty2 = ty * ty;
191  Double_t txty = tx * ty;
192  Double_t tx2ty21 = 1.0 + tx2 + ty2;
193  if (tx2ty21 > 1.e4) return 1;
194  Double_t I_tx2ty21 = 1.0 / tx2ty21 * Qp();
195  Double_t tx2ty2 = sqrt(tx2ty21);
196  // Double_t I_tx2ty2 = qp0 * hC / tx2ty2 ; unsused ???
197  tx2ty2 *= hC;
198  Double_t tx2ty2qp = tx2ty2 * Qp();
199  Ax[step] = (txty * B[0] + ty * B[2] - (1.0 + tx2) * B[1]) * tx2ty2;
200  Ay[step] = (-txty * B[1] - tx * B[2] + (1.0 + ty2) * B[0]) * tx2ty2;
201 
202  Ax_tx[step] =
203  Ax[step] * tx * I_tx2ty21 + (ty * B[0] - 2.0 * tx * B[1]) * tx2ty2qp;
204  Ax_ty[step] = Ax[step] * ty * I_tx2ty21 + (tx * B[0] + B[2]) * tx2ty2qp;
205  Ay_tx[step] = Ay[step] * tx * I_tx2ty21 + (-ty * B[1] - B[2]) * tx2ty2qp;
206  Ay_ty[step] =
207  Ay[step] * ty * I_tx2ty21 + (-tx * B[1] + 2.0 * ty * B[0]) * tx2ty2qp;
208 
209  step4 = step * 4;
210  k[step4] = tx * h;
211  k[step4 + 1] = ty * h;
212  k[step4 + 2] = Ax[step] * Qp();
213  k[step4 + 3] = Ay[step] * Qp();
214 
215  } // end of Runge-Kutta steps
216 
217  for (i = 0; i < 4; ++i) {
218  fT[i] = x0[i] + c[0] * k[i] + c[1] * k[4 + i] + c[2] * k[8 + i]
219  + c[3] * k[12 + i];
220  }
221  fT[5] = z_out;
222  //
223  // Derivatives dx/dqp
224  //
225 
226  x0[0] = 0.0;
227  x0[1] = 0.0;
228  x0[2] = 0.0;
229  x0[3] = 0.0;
230 
231  //
232  // Runge-Kutta step for derivatives dx/dqp
233 
234  for (step = 0; step < 4; ++step) {
235  for (i = 0; i < 4; ++i) {
236  if (step == 0) {
237  x[i] = x0[i];
238  } else {
239  x[i] = x0[i] + b[step] * k1[step * 4 - 4 + i];
240  }
241  }
242  step4 = step * 4;
243  k1[step4] = x[2] * h;
244  k1[step4 + 1] = x[3] * h;
245  k1[step4 + 2] = Ax[step] + Ax_tx[step] * x[2] + Ax_ty[step] * x[3];
246  k1[step4 + 3] = Ay[step] + Ay_tx[step] * x[2] + Ay_ty[step] * x[3];
247 
248  } // end of Runge-Kutta steps for derivatives dx/dqp
249 
250  Double_t J[25];
251 
252  for (i = 0; i < 4; ++i) {
253  J[20 + i] = x0[i] + c[0] * k1[i] + c[1] * k1[4 + i] + c[2] * k1[8 + i]
254  + c[3] * k1[12 + i];
255  }
256  J[24] = 1.;
257  //
258  // end of derivatives dx/dqp
259  //
260 
261  // Derivatives dx/tx
262  //
263 
264  x0[0] = 0.0;
265  x0[1] = 0.0;
266  x0[2] = 1.0;
267  x0[3] = 0.0;
268 
269  //
270  // Runge-Kutta step for derivatives dx/dtx
271  //
272 
273  for (step = 0; step < 4; ++step) {
274  for (i = 0; i < 4; ++i) {
275  if (step == 0) {
276  x[i] = x0[i];
277  } else if (i != 2) {
278  x[i] = x0[i] + b[step] * k1[step * 4 - 4 + i];
279  }
280  }
281  step4 = step * 4;
282  k1[step4] = x[2] * h;
283  k1[step4 + 1] = x[3] * h;
284  // k1[step4+2] = Ax_tx[step] * x[2] + Ax_ty[step] * x[3];
285  k1[step4 + 3] = Ay_tx[step] * x[2] + Ay_ty[step] * x[3];
286 
287  } // end of Runge-Kutta steps for derivatives dx/dtx
288 
289  for (i = 0; i < 4; ++i) {
290  if (i != 2) {
291  J[10 + i] = x0[i] + c[0] * k1[i] + c[1] * k1[4 + i] + c[2] * k1[8 + i]
292  + c[3] * k1[12 + i];
293  }
294  }
295  // end of derivatives dx/dtx
296  J[12] = 1.0;
297  J[14] = 0.0;
298 
299  // Derivatives dx/ty
300  //
301 
302  x0[0] = 0.0;
303  x0[1] = 0.0;
304  x0[2] = 0.0;
305  x0[3] = 1.0;
306 
307  //
308  // Runge-Kutta step for derivatives dx/dty
309  //
310 
311  for (step = 0; step < 4; ++step) {
312  for (i = 0; i < 4; ++i) {
313  if (step == 0) {
314  x[i] = x0[i]; // ty fixed
315  } else if (i != 3) {
316  x[i] = x0[i] + b[step] * k1[step * 4 - 4 + i];
317  }
318  }
319  step4 = step * 4;
320  k1[step4] = x[2] * h;
321  k1[step4 + 1] = x[3] * h;
322  k1[step4 + 2] = Ax_tx[step] * x[2] + Ax_ty[step] * x[3];
323  // k1[step4+3] = Ay_tx[step] * x[2] + Ay_ty[step] * x[3];
324 
325  } // end of Runge-Kutta steps for derivatives dx/dty
326 
327  for (i = 0; i < 3; ++i) {
328  J[15 + i] = x0[i] + c[0] * k1[i] + c[1] * k1[4 + i] + c[2] * k1[8 + i]
329  + c[3] * k1[12 + i];
330  }
331  // end of derivatives dx/dty
332  J[18] = 1.;
333  J[19] = 0.;
334 
335  //
336  // derivatives dx/dx and dx/dy
337 
338  for (i = 0; i < 10; ++i) {
339  J[i] = 0.;
340  }
341  J[0] = 1.;
342  J[6] = 1.;
343 
344  // extrapolate inverse momentum
345 
346  fT[4] = qp_in;
347 
348  Double_t dqp = qp_in - Qp();
349 
350  {
351  for (Int_t ip = 0; ip < 4; ip++) {
352  fT[ip] += J[5 * 4 + ip] * dqp;
353  }
354  }
355 
356  // covariance matrix transport
357 
358  multQtSQ(5, J);
359  return 0;
360 }
361 
362 Int_t CbmHelix::ExtrapolateALight(Double_t z_out) {
363  //
364  // Part of the analytic extrapolation formula with error (c_light*B*dz)^4/4!
365  //
366  {
367  bool ok = 1;
368  for (int i = 0; i < 6; i++)
369  ok = ok && !TMath::IsNaN(fT[i]) && (fT[i] < 1.e5);
370  for (int i = 0; i < 15; i++)
371  ok = ok && !TMath::IsNaN(fC[i]);
372  if (!ok) {
373  for (int i = 0; i < 15; i++)
374  fC[i] = 0;
375  fC[0] = fC[2] = fC[5] = fC[9] = fC[14] = 100.;
376  return 1;
377  }
378  }
379  const Double_t c_light = 0.000299792458;
380 
381  //Double_t qp_in = fT[4];
382  Double_t z_in = fT[5];
383  Double_t dz = z_out - z_in;
384 
385  // construct coefficients
386 
387  Double_t x = fT[2], // tx !!
388  y = fT[3], // ty !!
389 
390  xx = x * x, xy = x * y, yy = y * y, x2 = x * 2, x4 = x * 4,
391  xx31 = xx * 3 + 1, xx159 = xx * 15 + 9, y2 = y * 2;
392 
393  Double_t Ax = xy, Ay = -xx - 1, Az = y, Ayy = x * (xx * 3 + 3), Ayz = -2 * xy,
394  Ayyy = -(15 * xx * xx + 18 * xx + 3),
395 
396  Ax_x = y, Ay_x = -x2, Az_x = 0, Ayy_x = 3 * xx31, Ayz_x = -y2,
397  Ayyy_x = -x4 * xx159,
398 
399  Ax_y = x, Ay_y = 0, Az_y = 1, Ayy_y = 0, Ayz_y = -x2, Ayyy_y = 0,
400 
401  Bx = yy + 1, By = -xy, Bz = -x, Byy = y * xx31, Byz = 2 * xx + 1,
402  Byyy = -xy * xx159,
403 
404  Bx_x = 0, By_x = -y, Bz_x = -1, Byy_x = 6 * xy, Byz_x = x4,
405  Byyy_x = -y * (45 * xx + 9),
406 
407  Bx_y = y2, By_y = -x, Bz_y = 0, Byy_y = xx31, Byz_y = 0,
408  Byyy_y = -x * xx159;
409 
410  // end of coefficients calculation
411 
412  Double_t t2 = 1. + xx + yy;
413  if (t2 > 1.e4) return 1;
414  Double_t t = sqrt(t2), h = Qp() * c_light, ht = h * t;
415 
416  Double_t sx = 0, sy = 0, sz = 0, syy = 0, syz = 0, syyy = 0, Sx = 0, Sy = 0,
417  Sz = 0, Syy = 0, Syz = 0, Syyy = 0;
418 
419  { // get field integrals
420 
421  Double_t B[3][3];
422  Double_t r0[3], r1[3], r2[3];
423 
424  // first order track approximation
425 
426  r0[0] = fT[0];
427  r0[1] = fT[1];
428  r0[2] = fT[5];
429 
430  r2[0] = fT[0] + fT[2] * dz;
431  r2[1] = fT[1] + fT[3] * dz;
432  r2[2] = z_out;
433 
434  r1[0] = 0.5 * (r0[0] + r2[0]);
435  r1[1] = 0.5 * (r0[1] + r2[1]);
436  r1[2] = 0.5 * (r0[2] + r2[2]);
437 
438  fgField->GetFieldValue(r0, B[0]);
439  fgField->GetFieldValue(r1, B[1]);
440  fgField->GetFieldValue(r2, B[2]);
441 
442  Sy = (7 * B[0][1] + 6 * B[1][1] - B[2][1]) * dz * dz / 96.;
443  r1[0] = fT[0] + x * dz / 2 + ht * Sy * Ay;
444  r1[1] = fT[1] + y * dz / 2 + ht * Sy * By;
445 
446  Sy = (B[0][1] + 2 * B[1][1]) * dz * dz / 6.;
447  r2[0] = fT[0] + x * dz + ht * Sy * Ay;
448  r2[1] = fT[1] + y * dz + ht * Sy * By;
449 
450  Sy = 0;
451 
452  // integrals
453 
454  fgField->GetFieldValue(r0, B[0]);
455  fgField->GetFieldValue(r1, B[1]);
456  fgField->GetFieldValue(r2, B[2]);
457 
458  sx = (B[0][0] + 4 * B[1][0] + B[2][0]) * dz / 6.;
459  sy = (B[0][1] + 4 * B[1][1] + B[2][1]) * dz / 6.;
460  sz = (B[0][2] + 4 * B[1][2] + B[2][2]) * dz / 6.;
461 
462  Sx = (B[0][0] + 2 * B[1][0]) * dz * dz / 6.;
463  Sy = (B[0][1] + 2 * B[1][1]) * dz * dz / 6.;
464  Sz = (B[0][2] + 2 * B[1][2]) * dz * dz / 6.;
465 
466  Double_t c2[3][3] = {{5, -4, -1}, {44, 80, -4}, {11, 44, 5}}; // /=360.
467  Double_t C2[3][3] = {{38, 8, -4}, {148, 208, -20}, {3, 36, 3}}; // /=2520.
468  for (Int_t n = 0; n < 3; n++)
469  for (Int_t m = 0; m < 3; m++) {
470  syz += c2[n][m] * B[n][1] * B[m][2];
471  Syz += C2[n][m] * B[n][1] * B[m][2];
472  }
473 
474  syz *= dz * dz / 360.;
475  Syz *= dz * dz * dz / 2520.;
476 
477  syy = (B[0][1] + 4 * B[1][1] + B[2][1]) * dz;
478  syyy = syy * syy * syy / 1296;
479  syy = syy * syy / 72;
480 
481  Syy = (B[0][1] * (38 * B[0][1] + 156 * B[1][1] - B[2][1])
482  + B[1][1] * (208 * B[1][1] + 16 * B[2][1]) + B[2][1] * (3 * B[2][1]))
483  * dz * dz * dz / 2520.;
484  Syyy = (B[0][1]
485  * (B[0][1] * (85 * B[0][1] + 526 * B[1][1] - 7 * B[2][1])
486  + B[1][1] * (1376 * B[1][1] + 84 * B[2][1])
487  + B[2][1] * (19 * B[2][1]))
488  + B[1][1]
489  * (B[1][1] * (1376 * B[1][1] + 256 * B[2][1])
490  + B[2][1] * (62 * B[2][1]))
491  + B[2][1] * B[2][1] * (3 * B[2][1]))
492  * dz * dz * dz * dz / 90720.;
493  }
494 
495  Double_t
496 
497  sA1 = sx * Ax + sy * Ay + sz * Az,
498  sA1_x = sx * Ax_x + sy * Ay_x + sz * Az_x,
499  sA1_y = sx * Ax_y + sy * Ay_y + sz * Az_y,
500 
501  sB1 = sx * Bx + sy * By + sz * Bz,
502  sB1_x = sx * Bx_x + sy * By_x + sz * Bz_x,
503  sB1_y = sx * Bx_y + sy * By_y + sz * Bz_y,
504 
505  SA1 = Sx * Ax + Sy * Ay + Sz * Az,
506  SA1_x = Sx * Ax_x + Sy * Ay_x + Sz * Az_x,
507  SA1_y = Sx * Ax_y + Sy * Ay_y + Sz * Az_y,
508 
509  SB1 = Sx * Bx + Sy * By + Sz * Bz,
510  SB1_x = Sx * Bx_x + Sy * By_x + Sz * Bz_x,
511  SB1_y = Sx * Bx_y + Sy * By_y + Sz * Bz_y,
512 
513  sA2 = syy * Ayy + syz * Ayz, sA2_x = syy * Ayy_x + syz * Ayz_x,
514  sA2_y = syy * Ayy_y + syz * Ayz_y, sB2 = syy * Byy + syz * Byz,
515  sB2_x = syy * Byy_x + syz * Byz_x, sB2_y = syy * Byy_y + syz * Byz_y,
516 
517  SA2 = Syy * Ayy + Syz * Ayz, SA2_x = Syy * Ayy_x + Syz * Ayz_x,
518  SA2_y = Syy * Ayy_y + Syz * Ayz_y, SB2 = Syy * Byy + Syz * Byz,
519  SB2_x = Syy * Byy_x + Syz * Byz_x, SB2_y = Syy * Byy_y + Syz * Byz_y,
520 
521  sA3 = syyy * Ayyy, sA3_x = syyy * Ayyy_x, sA3_y = syyy * Ayyy_y,
522  sB3 = syyy * Byyy, sB3_x = syyy * Byyy_x, sB3_y = syyy * Byyy_y,
523 
524  SA3 = Syyy * Ayyy, SA3_x = Syyy * Ayyy_x, SA3_y = Syyy * Ayyy_y,
525  SB3 = Syyy * Byyy, SB3_x = Syyy * Byyy_x, SB3_y = Syyy * Byyy_y;
526 #ifdef SKIP_LOSSES
527  fT[0] = fT[0] + x * dz + ht * (SA1 + ht * (SA2 + ht * SA3));
528  fT[1] = fT[1] + y * dz + ht * (SB1 + ht * (SB2 + ht * SB3));
529  fT[2] = fT[2] + ht * (sA1 + ht * (sA2 + ht * sA3));
530  fT[3] = fT[3] + ht * (sB1 + ht * (sB2 + ht * sB3));
531  fT[5] = z_out;
532 #else
533  T_out[0] = fT[0] + x * dz + ht * (SA1 + ht * (SA2 + ht * SA3));
534  T_out[1] = fT[1] + y * dz + ht * (SB1 + ht * (SB2 + ht * SB3));
535  T_out[2] = fT[2] + ht * (sA1 + ht * (sA2 + ht * sA3));
536  T_out[3] = fT[3] + ht * (sB1 + ht * (sB2 + ht * sB3));
537  T_out[4] = fT[4];
538  T_out[5] = z_out;
539 #endif
540  Double_t J[25];
541 
542  // derivatives '_x
543 
544  J[0] = 1;
545  J[1] = 0;
546  J[2] = 0;
547  J[3] = 0;
548  J[4] = 0;
549 
550  // derivatives '_y
551 
552  J[5] = 0;
553  J[6] = 1;
554  J[7] = 0;
555  J[8] = 0;
556  J[9] = 0;
557 
558  // derivatives '_tx
559 
560  J[10] = dz + h * x * (1. / t * SA1 + h * (2 * SA2 + 3 * ht * SA3))
561  + ht * (SA1_x + ht * (SA2_x + ht * SA3_x));
562  J[11] = h * x * (1. / t * SB1 + h * (2 * SB2 + 3 * ht * SB3))
563  + ht * (SB1_x + ht * (SB2_x + ht * SB3_x));
564  J[12] = 1 + h * x * (1. / t * sA1 + h * (2 * sA2 + 3 * ht * sA3))
565  + ht * (sA1_x + ht * (sA2_x + ht * sA3_x));
566  J[13] = h * x * (1. / t * sB1 + h * (2 * sB2 + 3 * ht * sB3))
567  + ht * (sB1_x + ht * (sB2_x + ht * sB3_x));
568  J[14] = 0;
569 
570  // derivatives '_ty
571 
572  J[15] = h * y * (1. / t * SA1 + h * (2 * SA2 + 3 * ht * SA3))
573  + ht * (SA1_y + ht * (SA2_y + ht * SA3_y));
574  J[16] = dz + h * y * (1. / t * SB1 + h * (2 * SB2 + 3 * ht * SB3))
575  + ht * (SB1_y + ht * (SB2_y + ht * SB3_y));
576  J[17] = h * y * (1. / t * sA1 + h * (2 * sA2 + 3 * ht * sA3))
577  + ht * (sA1_y + ht * (sA2_y + ht * sA3_y));
578  J[18] = 1 + h * y * (1. / t * sB1 + h * (2 * sB2 + 3 * ht * sB3))
579  + ht * (sB1_y + ht * (sB2_y + ht * sB3_y));
580  J[19] = 0;
581 
582  // derivatives '_qp
583 
584  J[20] = c_light * t * (SA1 + ht * (2 * SA2 + 3 * ht * SA3));
585  J[21] = c_light * t * (SB1 + ht * (2 * SB2 + 3 * ht * SB3));
586  J[22] = c_light * t * (sA1 + ht * (2 * sA2 + 3 * ht * sA3));
587  J[23] = c_light * t * (sB1 + ht * (2 * sB2 + 3 * ht * sB3));
588  J[24] = 1;
589 
590  // extrapolate inverse momentum
591 #ifdef SKIP_LOSSES
592 #else
593  T_out[4] = qp_in;
594 
595  Double_t dqp = qp_in - Qp();
596 
597 
598  for (Int_t i = 0; i < 4; i++) {
599  fT[i] = T_out[i] + J[5 * 4 + i] * dqp;
600  }
601  fT[4] = T_out[4];
602  fT[5] = T_out[5];
603 #endif
604  // covariance matrix transport
605 
606  multQtSQ(5, J);
607  return 0;
608 }
609 
610 void CbmHelix::multQtSQ(const Int_t N, Double_t Q[]) {
611  Double_t A[N * N];
612 
613  for (Int_t i = 0, n = 0; i < N; i++) {
614  for (Int_t j = 0; j < N; j++, ++n) {
615  A[n] = 0;
616  for (Int_t k = 0; k < N; ++k)
617  A[n] += fC[indexS(i, k)] * Q[k * N + j];
618  }
619  }
620 
621  for (Int_t i = 0; i < N; i++) {
622  for (Int_t j = 0; j <= i; j++) {
623  Int_t n = indexS(i, j);
624  fC[n] = 0;
625  for (Int_t k = 0; k < N; k++)
626  fC[n] += Q[k * N + i] * A[k * N + j];
627  }
628  }
629 }
CbmTrack::GetParamLast
const FairTrackParam * GetParamLast() const
Definition: CbmTrack.h:62
CbmHelix::Ty
Double_t Ty() const
Definition: CbmHelix.h:32
sqrt
friend F32vec4 sqrt(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:41
CbmHelix.h
CbmHelix::GetTrack
Double_t * GetTrack()
Definition: CbmHelix.h:62
CbmHelix::Tx
Double_t Tx() const
Definition: CbmHelix.h:31
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmHelix::CbmHelix
CbmHelix()
Definition: CbmHelix.cxx:14
CbmHelix::Build
void Build(const FairTrackParam *params)
Definition: CbmHelix.h:49
CbmGlobalTrack::GetParamVertex
const CbmTrackParam * GetParamVertex() const
Definition: CbmGlobalTrack.h:45
CbmHelix::multQtSQ
void multQtSQ(const Int_t N, Double_t Q[])
Definition: CbmHelix.cxx:610
CbmHelix::Propagate
Int_t Propagate(Double_t Z)
Definition: CbmHelix.cxx:76
CbmHelix::fgField
static FairField * fgField
Definition: CbmHelix.h:33
h
Data class with information on a STS local track.
CbmHelix::fC
Double_t fC[15]
Definition: CbmHelix.h:25
CbmHelix::indexS
Int_t indexS(Int_t i, Int_t j)
Definition: CbmHelix.h:34
CbmHelix::ExtrapolateALight
Int_t ExtrapolateALight(Double_t z_out)
Definition: CbmHelix.cxx:362
CbmHelix::Eval
TVector3 Eval(Double_t z)
Definition: CbmHelix.cxx:29
CbmHelix::Qp
Double_t Qp() const
Definition: CbmHelix.h:26
CbmHelix::fT
Double_t fT[6]
Definition: CbmHelix.h:25
CbmTrack::GetParamFirst
const FairTrackParam * GetParamFirst() const
Definition: CbmTrack.h:61
CbmHelix::ExtrapolateLine
void ExtrapolateLine(Double_t z_out)
Definition: CbmHelix.cxx:118
CbmHelix
Definition: CbmHelix.h:23
CbmHelix::operator=
CbmHelix & operator=(const CbmHelix &other)
Definition: CbmHelix.cxx:67
CbmGlobalTrack
Definition: CbmGlobalTrack.h:26
x
Double_t x
Definition: CbmMvdSensorDigiToHitTask.cxx:68
fabs
friend F32vec4 fabs(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:60
CbmHelix::SetParameters
void SetParameters(const FairTrackParam *param)
Definition: CbmHelix.cxx:44
m
__m128 m
Definition: L1/vectors/P4_F32vec4.h:26
y
Double_t y
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmStsTrack
Definition: CbmStsTrack.h:37
CbmHelix::ExtrapolateRK4
Int_t ExtrapolateRK4(Double_t z_out)
Definition: CbmHelix.cxx:142
CbmHelix::~CbmHelix
virtual ~CbmHelix()
Definition: CbmHelix.cxx:56
NS_L1TrackFitter::c_light
const fvec c_light
Definition: L1TrackFitter.cxx:31