FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairTrackParH.cxx
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 // Class for the representation of a track as helix (SC system)
9 //
10 // Authors: M. Al-Turany, A. Fontana, L. Lavezzi and A. Rotondi
11 //
12 //
13 // GEANE parameters (q/p, lambda, phi, y_perp, z_perp) of Helix track
14 // The Helix can be constructed using the Helix parameter (1/p, lambda, phi,y_perp,z_perp) in SC reference
15 // and the covariance matrix. Or using position and momentum in LAB referance.
16 
17 #include "FairTrackParH.h"
18 #include <TGenericClassInfo.h> // for TGenericClassInfo
19 #include <TMath.h> // for Sqrt, Sin, Cos, ASin, ATan2, Tan
20 #include <TMathBase.h> // for Abs, Sign
21 #include <cmath> // for pow, fabs, sqrt
22 #include <iomanip> // for operator<<, setprecision
23 #include <iostream> // for operator<<, basic_ostream, endl, cout
24 #include "FairGeaneUtil.h" // for FairGeaneUtil
25 #include "FairTrackParP.h" // for FairTrackParP
26 
27 
28 using std::cout;
29 using std::endl;
30 
32 
34  : FairTrackPar()
35  , fLm(0.)
36  , fPhi(0.)
37  , fDLm(0.)
38  , fDPhi(0.)
39  , fX_sc(0.)
40  , fY_sc(0.)
41  , fZ_sc(0.)
42  , fDX_sc(0.)
43  , fDY_sc(0.)
44  , fDZ_sc(0.)
45  , cLm(0.)
46  , sLm(0.)
47  , cphi(0.)
48  , sphi(0.)
49 {
50  for (Int_t i = 0; i < 15; i++) {
51  fCovMatrix[i] = 0;
52  }
53  for (int i = 0; i < 6; i++)
54  for (int j = 0; j < 6; j++) {
55  fCovMatrix66[i][j] = 0.;
56  }
57 }
58 
59 // constructor in SC
61  Double_t y,
62  Double_t z,
63  Double_t lm,
64  Double_t phi,
65  Double_t qp,
66  Double_t CovMatrix[15])
67  : FairTrackPar()
68  , fLm(lm)
69  , fPhi(phi)
70  , fDLm(0.)
71  , fDPhi(0.)
72  , fX_sc(x)
73  , fY_sc(y)
74  , fZ_sc(z)
75  , fDX_sc(0.)
76  , fDY_sc(0.)
77  , fDZ_sc(0.)
78  , cLm(TMath::Cos(lm))
79  , sLm(TMath::Sin(lm))
80  , cphi(TMath::Cos(phi))
81  , sphi(TMath::Sin(phi))
82 {
83 
84  /*
85  fLm = lm;
86  fPhi = phi;
87  */
88  fQp = qp;
89  Double_t P = TMath::Abs(1 / fQp);
90  // fq= int (P * fQp);
91  fq = static_cast<int>(TMath::Sign(1.0, fQp));
92  for (Int_t i = 0; i < 15; i++) {
93  fCovMatrix[i] = CovMatrix[i];
94  }
95  /*
96  cLm= TMath::Cos(fLm);
97  sLm= TMath::Sin(fLm);
98  cphi= TMath::Cos(fPhi);
99  sphi= TMath::Sin(fPhi);
100  */
101  fPx = P * cLm * cphi;
102  fPy = P * cLm * sphi;
103  fPz = P * sLm;
104 
105  /*
106  fX_sc = x;
107  fY_sc = y;
108  fZ_sc = z;
109  */
110 
111  fX = fX_sc * cLm * cphi - fY_sc * sphi - fZ_sc * cphi * sLm;
112  fY = fX_sc * cLm * sphi + fY_sc * cphi - fZ_sc * sphi * sLm;
113  fZ = fX_sc * sLm + fZ_sc * cLm;
114 
115  fDQp = TMath::Sqrt(fabs(fCovMatrix[0]));
116  fDLm = TMath::Sqrt(fabs(fCovMatrix[5]));
117  fDPhi = TMath::Sqrt(fabs(fCovMatrix[9]));
118  fDX_sc = 0.;
119  fDY_sc = TMath::Sqrt(fabs(fCovMatrix[12]));
120  fDZ_sc = TMath::Sqrt(fabs(fCovMatrix[14]));
121 
122  Double_t PD[3], RD[6][6], H[3], PC[3], RC[15];
123  Int_t CH;
124  PC[0] = fQp;
125  PC[1] = fLm;
126  PC[2] = fPhi;
127 
128  for (Int_t i = 0; i < 15; i++) {
129  RC[i] = fCovMatrix[i];
130  }
131 
132  // retrieve field
133  Double_t pnt[3];
134  pnt[0] = fX;
135  pnt[1] = fY;
136  pnt[2] = fZ;
137 
138  GetFieldValue(pnt, H);
139 
140  CH = fq;
141  FairGeaneUtil util;
142  util.FromSCToMars(PC, RC, H, CH, PD, RD);
143 
144  // test
145  fDPx = sqrt(fabs(RD[0][0]));
146  fDPy = sqrt(fabs(RD[1][1]));
147  fDPz = sqrt(fabs(RD[2][2]));
148  fDX = sqrt(fabs(RD[3][3]));
149  fDY = sqrt(fabs(RD[4][4]));
150  fDZ = sqrt(fabs(RD[5][5]));
151 
152  for (int i = 0; i < 6; i++)
153  for (int j = 0; j < 6; j++) {
154  fCovMatrix66[i][j] = RD[i][j];
155  }
156 }
157 
158 // constructor in LAB
159 FairTrackParH::FairTrackParH(TVector3 pos, TVector3 Mom, TVector3 posErr, TVector3 MomErr, Int_t q)
160  : FairTrackPar(pos.x(), pos.y(), pos.z(), Mom.x(), Mom.y(), Mom.z(), q)
161  , fLm(0.)
162  , fPhi(0.)
163  , fDLm(0.)
164  , fDPhi(0.)
165  , fX_sc(0.)
166  , fY_sc(0.)
167  , fZ_sc(0.)
168  , fDX_sc(0.)
169  , fDY_sc(0.)
170  , fDZ_sc(0.)
171  , cLm(0.)
172  , sLm(0.)
173  , cphi(0.)
174  , sphi(0.)
175 {
176  Reset();
177  SetPx(Mom.x());
178  SetPy(Mom.y());
179  SetPz(Mom.z());
180 
181  SetX(pos.x()); // x (lab)
182  SetY(pos.y()); // y (lab)
183  SetZ(pos.z()); // z (lab)
184 
185  fq = int(q / TMath::Abs(q));
186  Double_t P = TMath::Sqrt(fPx * fPx + fPy * fPy + fPz * fPz);
187  fLm = TMath::ASin(fPz / P);
188 
189  fPhi = TMath::ATan2(fPy, fPx);
190  fQp = fq / P;
191 
192  cLm = TMath::Cos(fLm);
193  sLm = TMath::Sin(fLm);
194  cphi = TMath::Cos(fPhi);
195  sphi = TMath::Sin(fPhi);
196 
197  fDPx = MomErr.x(); // dpx
198  fDPy = MomErr.y(); // dpy
199  fDPz = MomErr.z(); // dpz
200 
201  fX_sc = fX * cphi * cLm + fY * cLm * sphi + fZ * sLm;
202  fY_sc = fY * cphi - fX * sphi;
203  fZ_sc = fZ * cLm - fY * sLm * sphi - fX * sLm * cphi;
204 
205  fDX = posErr.x(); // dx (lab)
206  fDY = posErr.y(); // dy (lab)
207  fDZ = posErr.z(); // dz (lab)
208 
209  Double_t PD[3], RD[6][6], H[3], PC[3], RC[15];
210  Int_t CH;
211  PD[0] = Mom.x();
212  PD[1] = Mom.y();
213  PD[2] = Mom.z();
214  for (Int_t i = 0; i < 6; i++)
215  for (Int_t j = 0; j < 6; j++) {
216  RD[i][j] = 0;
217  }
218  RD[0][0] = fDPx * fDPx;
219  RD[1][1] = fDPy * fDPy;
220  RD[2][2] = fDPz * fDPz;
221  RD[3][3] = fDX * fDX;
222  RD[4][4] = fDY * fDY;
223  RD[5][5] = fDZ * fDZ;
224 
225  // retrieve field
226  Double_t pnt[3];
227  pnt[0] = fX;
228  pnt[1] = fY;
229  pnt[2] = fZ;
230 
231  GetFieldValue(pnt, H);
232 
233  CH = fq;
234  FairGeaneUtil util;
235 
236  util.FromMarsToSC(PD, RD, H, CH, PC, RC);
237 
238  for (Int_t i = 0; i < 15; i++) {
239  fCovMatrix[i] = RC[i];
240  }
241 
242  fDX_sc = 0;
243  fDY_sc = TMath::Sqrt(fabs(fCovMatrix[12]));
244  fDZ_sc = TMath::Sqrt(fabs(fCovMatrix[14]));
245 
246  for (int i = 0; i < 6; i++)
247  for (int j = 0; j < 6; j++) {
248  fCovMatrix66[i][j] = RD[i][j];
249  }
250 }
251 
253  : FairTrackPar()
254  , fLm(0.)
255  , fPhi(0.)
256  , fDLm(0.)
257  , fDPhi(0.)
258  , fX_sc(0.)
259  , fY_sc(0.)
260  , fZ_sc(0.)
261  , fDX_sc(0.)
262  , fDY_sc(0.)
263  , fDZ_sc(0.)
264  , cLm(0.)
265  , sLm(0.)
266  , cphi(0.)
267  , sphi(0.)
268 {
269 
270  // q/p, v', w' --> q/p, lambda, phi
271  Double_t PD[3] = {parab->GetQp(), parab->GetTV(), parab->GetTW()};
272  Double_t RD[15];
273  parab->GetCov(RD);
274  // retrieve field
275  TVector3 xyz(parab->GetX(), parab->GetY(), parab->GetZ());
276  Double_t H[3], pnt[3];
277  pnt[0] = xyz.X();
278  pnt[1] = xyz.Y();
279  pnt[2] = xyz.Z();
280 
281  GetFieldValue(pnt, H);
282 
283  Int_t CH = parab->GetQ();
284 
285  Double_t DJ[3] = {parab->GetJVer().X(), parab->GetJVer().Y(), parab->GetJVer().Z()};
286  Double_t DK[3] = {parab->GetKVer().X(), parab->GetKVer().Y(), parab->GetKVer().Z()};
287 
288  Double_t SPU = parab->GetSPU();
289 
290  Int_t IERR = 0;
291  Double_t PC[3], RC[15];
292 
293  FairGeaneUtil util;
294  util.FromSDToSC(PD, RD, H, CH, SPU, DJ, DK, IERR, PC, RC);
295 
296  ierr = IERR;
297 
298  if (ierr == 0)
299  SetTrackPar(
300  parab->GetX(), parab->GetY(), parab->GetZ(), parab->GetPx(), parab->GetPy(), parab->GetPz(), CH, RC);
301  else {
302  cout << "FairTrackParH(FairTrackParP *) contructor ERROR: CANNOT convert parabola to helix" << endl;
303  }
304 }
305 
306 // track definition in LAB
308  Double_t Y,
309  Double_t Z,
310  Double_t Px,
311  Double_t Py,
312  Double_t Pz,
313  Int_t Q,
314  Double_t CovMatrix[15])
315 {
316  Reset();
317  Double_t P = TMath::Sqrt(Px * Px + Py * Py + Pz * Pz);
318  fLm = TMath::ASin(Pz / P);
319 
320  fPhi = TMath::ATan2(Py, Px);
321  if (Q != 0) {
322  fq = int(TMath::Abs(Q) / Q);
323  }
324  fQp = fq / P;
325 
326  cLm = TMath::Cos(fLm);
327  sLm = TMath::Sin(fLm);
328  cphi = TMath::Cos(fPhi);
329  sphi = TMath::Sin(fPhi);
330 
331  SetX(X);
332  SetY(Y);
333  SetZ(Z);
334 
335  SetPx(Px);
336  SetPy(Py);
337  SetPz(Pz);
338 
339  fX_sc = fX * cphi * cLm + fY * cLm * sphi + fZ * sLm;
340  fY_sc = fY * cphi - fX * sphi;
341  fZ_sc = fZ * cLm - fY * sLm * sphi - fX * sLm * cphi;
342 
343  for (Int_t i = 0; i < 15; i++) {
344  fCovMatrix[i] = CovMatrix[i];
345  }
346 
347  fDQp = TMath::Sqrt(fabs(fCovMatrix[0]));
348  fDLm = TMath::Sqrt(fabs(fCovMatrix[5]));
349  fDPhi = TMath::Sqrt(fabs(fCovMatrix[9]));
350  fDX_sc = 0;
351  fDY_sc = TMath::Sqrt(fabs(fCovMatrix[12]));
352  fDZ_sc = TMath::Sqrt(fabs(fCovMatrix[14]));
353 
354  fDPx = GetDPx();
355  fDPy = GetDPy();
356  fDPz = GetDPz();
357 
358  Double_t PD[3], RD[6][6], H[3], PC[3], RC[15];
359  Int_t CH;
360  PC[0] = fQp;
361  PC[1] = fLm;
362  PC[2] = fPhi;
363 
364  for (Int_t i = 0; i < 15; i++) {
365  RC[i] = fCovMatrix[i];
366  }
367 
368  // retrieve field
369  Double_t pnt[3];
370  pnt[0] = fX;
371  pnt[1] = fY;
372  pnt[2] = fZ;
373 
374  GetFieldValue(pnt, H);
375 
376  CH = fq;
377  FairGeaneUtil util;
378  util.FromSCToMars(PC, RC, H, CH, PD, RD);
379 
380  fDPx = sqrt(fabs(RD[0][0]));
381  fDPy = sqrt(fabs(RD[1][1]));
382  fDPz = sqrt(fabs(RD[2][2]));
383  fDX = sqrt(fabs(RD[3][3]));
384  fDY = sqrt(fabs(RD[4][4]));
385  fDZ = sqrt(fabs(RD[5][5]));
386 
387  for (int i = 0; i < 6; i++)
388  for (int j = 0; j < 6; j++) {
389  fCovMatrix66[i][j] = RD[i][j];
390  }
391 }
392 
393 // track definition in SC
395  Double_t y,
396  Double_t z,
397  Double_t qp,
398  Double_t lm,
399  Double_t phi,
400  Double_t CovMatrix[15])
401 {
402  fLm = lm;
403  fPhi = phi;
404  fQp = qp;
405  Double_t P = TMath::Abs(1 / fQp);
406  // fq= int (P * fQp);
407  fq = static_cast<int>(TMath::Sign(1.0, fQp));
408  for (Int_t i = 0; i < 15; i++) {
409  fCovMatrix[i] = CovMatrix[i];
410  }
411 
412  cLm = TMath::Cos(fLm);
413  sLm = TMath::Sin(fLm);
414  cphi = TMath::Cos(fPhi);
415  sphi = TMath::Sin(fPhi);
416 
417  fPx = P * cLm * cphi;
418  fPy = P * cLm * sphi;
419  fPz = P * sLm;
420 
421  fX_sc = x;
422  fY_sc = y;
423  fZ_sc = z;
424 
425  fX = fX_sc * cLm * cphi - fY_sc * sphi - fZ_sc * cphi * sLm;
426  fY = fX_sc * cLm * sphi + fY_sc * cphi - fZ_sc * sphi * sLm;
427  fZ = fX_sc * sLm + fZ_sc * cLm;
428 
429  fDQp = TMath::Sqrt(fabs(fCovMatrix[0]));
430  fDLm = TMath::Sqrt(fabs(fCovMatrix[5]));
431  fDPhi = TMath::Sqrt(fabs(fCovMatrix[9]));
432  fDX_sc = 0;
433  fDY_sc = TMath::Sqrt(fabs(fCovMatrix[12]));
434  fDZ_sc = TMath::Sqrt(fabs(fCovMatrix[14]));
435 
436  fDPx = GetDPx();
437  fDPy = GetDPy();
438  fDPz = GetDPz();
439 
440  Double_t PD[3], RD[6][6], H[3], PC[3], RC[15];
441  Int_t CH;
442  PC[0] = fQp;
443  PC[1] = fLm;
444  PC[2] = fPhi;
445 
446  for (Int_t i = 0; i < 15; i++) {
447  RC[i] = fCovMatrix[i];
448  }
449 
450  // retrieve field
451  Double_t pnt[3];
452  pnt[0] = fX;
453  pnt[1] = fY;
454  pnt[2] = fZ;
455 
456  GetFieldValue(pnt, H);
457 
458  CH = fq;
459  FairGeaneUtil util;
460  util.FromSCToMars(PC, RC, H, CH, PD, RD);
461 
462  // test
463  fDPx = sqrt(fabs(RD[0][0]));
464  fDPy = sqrt(fabs(RD[1][1]));
465  fDPz = sqrt(fabs(RD[2][2]));
466  fDX = sqrt(fabs(RD[3][3]));
467  fDY = sqrt(fabs(RD[4][4]));
468  fDZ = sqrt(fabs(RD[5][5]));
469 
470  for (int i = 0; i < 6; i++)
471  for (int j = 0; j < 6; j++) {
472  fCovMatrix66[i][j] = RD[i][j];
473  }
474 }
475 
476 void FairTrackParH::CalCov()
477 {
478 
479  fDPx = GetDPx();
480  fDPy = GetDPy();
481  fDPz = GetDPz();
482 
483  Double_t fP = sqrt(fPx * fPx + fPy * fPy + fPz * fPz);
484  Double_t fDP = (2 * fPx * fDPx + 2 * fPy * fDPy + 2 * fPz * fDPz) / (2 * fP); // dp
485  fDQp = -fDP / (fP * fP); // d(1/p)
486 
487  Double_t fDPQDLm = -sLm * cphi / fPx; // d(1/p)/dLambda
488  Double_t fDPQDPhi = -cLm * TMath::Sin(fPhi) / fPx; // d(1/p)/dphi
489 
490  Double_t fDPQDX_sc = (fX_sc * pow(fZ, 3))
491  / (fPz * pow(pow(fX_sc, 2) + pow(fY_sc, 2), 2.5)
492  * pow(1 + pow(fZ_sc, 2) / (pow(fX_sc, 2) + pow(fY_sc, 2)), 1.5))
493  - (fX_sc * fZ_sc)
494  / (fPz * pow(pow(fX_sc, 2) + pow(fY_sc, 2), 1.5)
495  * TMath::Sqrt(1 + pow(fZ_sc, 2) / (pow(fX_sc, 2) + pow(fY_sc, 2)))); // d(1/p)/dx
496 
497  Double_t fDPQDY_sc = (fY_sc * pow(fZ_sc, 3))
498  / (fPz * pow(pow(fX_sc, 2) + pow(fY_sc, 2), 2.5)
499  * pow(1 + pow(fZ_sc, 2) / (pow(fX_sc, 2) + pow(fY_sc, 2)), 1.5))
500  - (fY_sc * fZ_sc)
501  / (fPz * pow(pow(fX_sc, 2) + pow(fY_sc, 2), 1.5)
502  * TMath::Sqrt(1 + pow(fZ_sc, 2) / (pow(fX_sc, 2) + pow(fY_sc, 2)))); // d(1/p)/dy
503 
504  fDLm = (-((fPz * fDP) / pow(fP, 2)) + fDPz / fP) / TMath::Sqrt(1 - pow(fPz, 2) / pow(fP, 2)); // d(Lambda)
505 
506  Double_t fDLmDPhi = -((fPx * TMath::Tan(fPhi) / cphi)
507  / (fP * TMath::Sqrt(1 - (pow(fPx, 2) * pow(1 / cphi, 2)) / pow(fP, 2)))); // dLambda/dPhi
508 
509  Double_t fDLmDX_sc = -((fX_sc * fZ_sc)
510  / (pow(pow(fX_sc, 2) + pow(fY_sc, 2), 1.5)
511  * (1 + pow(fZ_sc, 2) / (pow(fX_sc, 2) + pow(fY_sc, 2))))); // dLambda/dX
512 
513  Double_t fDLmDY_sc = -((fY_sc * fZ_sc)
514  / (pow(pow(fX_sc, 2) + pow(fY_sc, 2), 1.5)
515  * (1 + pow(fZ_sc, 2) / (pow(fX_sc, 2) + pow(fY_sc, 2))))); // dLambda/dY
516 
517  fDPhi = (-((fPy * fDP / cLm) / pow(fP, 2)) + (fDPy / cLm) / fP + (fPy * fDLm * TMath::Tan(fLm) / cLm) / fP)
518  / TMath::Sqrt(1 - (pow(fPy, 2) * pow(1 / cLm, 2)) / pow(fP, 2)); // d(Phi)
519 
520  Double_t fDPhiDx_sc = -(fY_sc / (pow(fX_sc, 2) * (1 + pow(fY_sc, 2) / pow(fX_sc, 2)))); // dPhi/dx
521 
522  Double_t fDPhiDy_sc = 1 / (fX_sc * (1 + pow(fY_sc, 2) / pow(fX_sc, 2))); // dPhi/dy
523 
524  Double_t fDXDY_sc = 1 / TMath::Tan(fPhi); // dX/dY
525 
526  if (fDQp == 0 && fDLm == 0 && fDPhi == 0) {
527  cout << "FairTrackParH::CalCov() No Errors" << endl;
528  } else {
529  fCovMatrix[0] = fDQp * fDQp;
530  fCovMatrix[1] = fDPQDLm;
531  fCovMatrix[2] = fDPQDPhi;
532  fCovMatrix[3] = fDPQDX_sc;
533  fCovMatrix[4] = fDPQDY_sc;
534  fCovMatrix[5] = fDLm * fDLm;
535  fCovMatrix[6] = fDLmDPhi;
536  fCovMatrix[7] = fDLmDX_sc;
537  fCovMatrix[8] = fDLmDY_sc;
538  fCovMatrix[9] = fDPhi * fDPhi;
539  fCovMatrix[10] = fDPhiDx_sc;
540  fCovMatrix[11] = fDPhiDy_sc;
541  fCovMatrix[12] = fDX_sc * fDX_sc;
542  fCovMatrix[13] = fDXDY_sc;
543  fCovMatrix[14] = fDY_sc * fDY_sc;
544  }
545 }
546 
548  : FairTrackPar(Trkbase)
549  , fLm(0.)
550  , fPhi(0.)
551  , fDLm(0.)
552  , fDPhi(0.)
553  , fX_sc(0.)
554  , fY_sc(0.)
555  , fZ_sc(0.)
556  , fDX_sc(0.)
557  , fDY_sc(0.)
558  , fDZ_sc(0.)
559  , cLm(0.)
560  , sLm(0.)
561  , cphi(0.)
562  , sphi(0.)
563 {
564  cout << "FairTrackParH::FairTrackParH(FairTrackPar &Trkbase)" << endl;
565  Reset();
566  fX = Trkbase.GetX();
567  fY = Trkbase.GetY();
568  fZ = Trkbase.GetZ();
569 
570  fPx = Trkbase.GetPx();
571  fPy = Trkbase.GetPy();
572  fPz = Trkbase.GetPz();
573  fq = Trkbase.GetQ();
574  Double_t fP = TMath::Sqrt(fPx * fPx + fPy * fPy + fPz * fPz);
575  if (fP != 0) {
576  fQp = fq / fP;
577  } else {
578  fQp = 0;
579  }
580  fLm = TMath::ASin(fPz / fP);
581  fPhi = TMath::ATan2(fPy, fPx);
582 
583  cLm = TMath::Cos(fLm);
584  sLm = TMath::Sin(fLm);
585  cphi = TMath::Cos(fPhi);
586  sphi = TMath::Sin(fPhi);
587 
588  fDPx = Trkbase.GetDPx();
589  fDPy = Trkbase.GetDPy();
590  fDPz = Trkbase.GetDPz();
591 
592  fDX = Trkbase.GetDX();
593  fDY = Trkbase.GetDY();
594  fDZ = Trkbase.GetDZ();
595 
596  fX_sc = fX * cphi * cLm + fY * cLm * sphi + fZ * sLm;
597  fY_sc = fY * cphi - fX * sphi;
598  fZ_sc = fZ * cLm - fY * sLm * sphi - fX * sLm * cphi;
599 
600  for (Int_t i = 0; i < 15; i++) {
601  fCovMatrix[i] = 0;
602  }
603 
604  Double_t PD[3], RD[6][6], H[3], PC[3], RC[15];
605  Int_t CH;
606  PD[0] = fPx;
607  PD[1] = fPy;
608  PD[2] = fPz;
609  for (Int_t i = 0; i < 6; i++)
610  for (Int_t j = 0; j < 6; j++) {
611  RD[i][j] = 0;
612  }
613  RD[0][0] = fDPx * fDPx;
614  RD[1][1] = fDPy * fDPy;
615  RD[2][2] = fDPz * fDPz;
616  RD[3][3] = fDX * fDX;
617  RD[4][4] = fDY * fDY;
618  RD[5][5] = fDZ * fDZ;
619 
620  // retrieve field
621  Double_t pnt[3];
622  pnt[0] = fX;
623  pnt[1] = fY;
624  pnt[2] = fZ;
625 
626  GetFieldValue(pnt, H);
627 
628  CH = fq;
629  FairGeaneUtil fUtil;
630  fUtil.FromMarsToSC(PD, RD, H, CH, PC, RC);
631  for (Int_t i = 0; i < 15; i++) {
632  fCovMatrix[i] = RC[i];
633  }
634  fDX_sc = 0;
635  fDY_sc = TMath::Sqrt(fabs(fCovMatrix[12]));
636  fDZ_sc = TMath::Sqrt(fabs(fCovMatrix[14]));
637 
638  for (int i = 0; i < 6; i++)
639  for (int j = 0; j < 6; j++) {
640  fCovMatrix66[i][j] = RD[i][j];
641  }
642 }
643 
645 void FairTrackParH::Print(Option_t* /*option*/) const
646 {
647  cout << this << endl;
648  cout << "Position : " << std::setprecision(2) << fX << ", " << fY << ", " << fZ << ")" << endl;
649  cout << std::setprecision(2) << "Angles : Lambda = " << fLm << ", Phi = " << fPhi << endl;
650  cout << "q/p = " << fQp << endl;
651  for (Int_t i = 0; i < 15; i++) {
652  cout << std::setprecision(2) << "fCovMatrix[" << i << "] = " << this << " " << fCovMatrix[i] << endl;
653  }
654 }
655 Double_t FairTrackParH::GetDX_sc() { return fDX_sc; }
656 
657 Double_t FairTrackParH::GetDY_sc() { return fDY_sc; }
658 Double_t FairTrackParH::GetDZ_sc() { return fDZ_sc; }
659 
661 {
662 
663  if (fX == 0) {
664  fX = fX_sc * cLm * cphi - fY_sc * sphi - fZ_sc * cphi * sLm;
665  }
666  return fX;
667 }
669 {
670  if (fY == 0) {
671  fY = fX_sc * cLm * sphi + fY_sc * cphi - fZ_sc * sphi * sLm;
672  }
673  return fY;
674 }
675 
677 {
678  if (fZ == 0) {
679  fZ = fX_sc * sLm + fZ_sc * cLm;
680  }
681  return fZ;
682 }
683 
684 /*Double_t FairTrackParH::GetDPx()
685 {
686  return fDPx;
687 }
688 Double_t FairTrackParH::GetDPy()
689 {
690  return fDPy;
691 }
692 Double_t FairTrackParH::GetDPz()
693 {
694  return fDPz;
695 }
696 
697 Double_t FairTrackParH::GetDQp()
698 {
699  return fDQp;
700 }
701 */
702 Double_t FairTrackParH::GetDLambda() { return fDLm; };
703 Double_t FairTrackParH::GetDPhi() { return fDPhi; };
704 
706 {
707  fLm = 0;
708  fPhi = 0;
709  fDLm = 0;
710  fDPhi = 0;
711  fX_sc = fY_sc = fZ_sc = 0;
712  fDX_sc = fDY_sc = fDZ_sc = 0;
713  cLm = sLm = cphi = sphi = 0;
714  for (Int_t i = 0; i < 15; i++) {
715  fCovMatrix[i] = 0;
716  }
717 
718  // base class members
719 
720  fX = fY = fZ = 0;
721  fDX = fDY = fDZ = 0;
722  fPx = fPy = fPz = 0;
723  fDPx = fDPy = fDPz = 0;
724  fQp = fDQp = fq = 0;
725 }
726 
727 void FairTrackParH::GetCovQ(Double_t* CovQ)
728 {
729  // return error matrix in 1/p instead of q/p
730 
731  for (int i = 0; i < 15; i++) {
732  CovQ[i] = fCovMatrix[i];
733  if (fq != 0) {
734  if (i == 0) {
735  CovQ[i] = CovQ[i] / (fq * fq);
736  }
737  if (i > 0 && i < 5) {
738  CovQ[i] = CovQ[i] / fq;
739  }
740  }
741  }
742 }
virtual Double_t GetDZ() const
Definition: FairTrackPar.h:56
virtual Double_t GetPz() const
Definition: FairTrackPar.h:62
void FromMarsToSC(Double_t PD[3], Double_t RD[6][6], Double_t H[3], Int_t CH, Double_t *PC, Double_t *RC)
void GetCovQ(Double_t *CovQ)
Double_t fQp
Definition: FairTrackPar.h:124
Double_t fPz
Definition: FairTrackPar.h:118
virtual Double_t GetQp() const
Definition: FairTrackPar.h:63
Double_t * GetCov()
virtual void Print(Option_t *option="") const
Double_t GetDPhi()
virtual void GetFieldValue(const Double_t point[3], Double_t *bField)
virtual void SetPy(Double_t py)
Definition: FairTrackPar.h:81
Double_t fY
Definition: FairTrackPar.h:112
Double_t GetY()
Double_t fDPx
Definition: FairTrackPar.h:121
ClassImp(FairEventBuilder)
virtual Double_t GetDPx() const
Definition: FairTrackPar.h:65
virtual void SetY(Double_t y)
Definition: FairTrackPar.h:73
Double_t fDPz
Definition: FairTrackPar.h:121
Double_t fZ
Definition: FairTrackPar.h:112
virtual Double_t GetDPy() const
Definition: FairTrackPar.h:66
virtual Double_t GetZ()
Definition: FairTrackPar.h:51
Double_t fX
Definition: FairTrackPar.h:112
Double_t fPx
Definition: FairTrackPar.h:118
virtual ~FairTrackParH()
Double_t fDX
Definition: FairTrackPar.h:115
Double_t GetTW()
Double_t GetX()
virtual void SetZ(Double_t z)
Definition: FairTrackPar.h:74
virtual Double_t GetPx() const
Definition: FairTrackPar.h:60
TVector3 GetJVer()
Double_t GetDZ_sc()
Double_t GetZ()
Double_t GetDX_sc()
virtual void SetPz(Double_t pz)
Definition: FairTrackPar.h:82
virtual void SetPx(Double_t px)
Definition: FairTrackPar.h:80
Double_t GetSPU()
Double_t GetDY_sc()
void FromSDToSC(Double_t PD[3], Double_t RD[15], Double_t H[3], Int_t CH, Double_t SPU, Double_t DJ[3], Double_t DK[3], Int_t &IERR, Double_t *PC, Double_t *RC)
void FromSCToMars(Double_t PC[3], Double_t RC[15], Double_t H[3], Int_t CH, Double_t *PD, sixMat &RD)
Int_t GetQ() const
Definition: FairTrackPar.h:52
Double_t fPy
Definition: FairTrackPar.h:118
virtual Double_t GetPy() const
Definition: FairTrackPar.h:61
Double_t GetDLambda()
Double_t fDZ
Definition: FairTrackPar.h:115
virtual void SetX(Double_t x)
Definition: FairTrackPar.h:72
Double_t fDPy
Definition: FairTrackPar.h:121
virtual Double_t GetY()
Definition: FairTrackPar.h:50
virtual Double_t GetDY() const
Definition: FairTrackPar.h:55
Double_t GetTV()
virtual Double_t GetDPz() const
Definition: FairTrackPar.h:67
virtual Double_t GetX()
Definition: FairTrackPar.h:49
void SetTrackPar(Double_t x, Double_t y, Double_t z, Double_t Px, Double_t Py, Double_t Pz, Int_t Q, Double_t CovMatrix[15])
virtual Double_t GetDX() const
Definition: FairTrackPar.h:54
Double_t fDY
Definition: FairTrackPar.h:115
TVector3 GetKVer()
Double_t fDQp
Definition: FairTrackPar.h:127