18 #include <TGenericClassInfo.h>
20 #include <TMathBase.h>
50 for (Int_t i = 0; i < 15; i++) {
53 for (
int i = 0; i < 6; i++)
54 for (
int j = 0; j < 6; j++) {
55 fCovMatrix66[i][j] = 0.;
66 Double_t CovMatrix[15])
80 , cphi(TMath::Cos(phi))
81 , sphi(TMath::Sin(phi))
89 Double_t P = TMath::Abs(1 /
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];
101 fPx = P * cLm * cphi;
102 fPy = P * cLm * sphi;
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;
115 fDQp = TMath::Sqrt(fabs(fCovMatrix[0]));
116 fDLm = TMath::Sqrt(fabs(fCovMatrix[5]));
117 fDPhi = TMath::Sqrt(fabs(fCovMatrix[9]));
119 fDY_sc = TMath::Sqrt(fabs(fCovMatrix[12]));
120 fDZ_sc = TMath::Sqrt(fabs(fCovMatrix[14]));
122 Double_t PD[3], RD[6][6], H[3], PC[3], RC[15];
128 for (Int_t i = 0; i < 15; i++) {
129 RC[i] = fCovMatrix[i];
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]));
152 for (
int i = 0; i < 6; i++)
153 for (
int j = 0; j < 6; j++) {
154 fCovMatrix66[i][j] = RD[i][j];
160 :
FairTrackPar(pos.x(), pos.y(), pos.z(), Mom.x(), Mom.y(), Mom.z(), q)
185 fq = int(q / TMath::Abs(q));
187 fLm = TMath::ASin(fPz / P);
189 fPhi = TMath::ATan2(
fPy,
fPx);
192 cLm = TMath::Cos(fLm);
193 sLm = TMath::Sin(fLm);
194 cphi = TMath::Cos(fPhi);
195 sphi = TMath::Sin(fPhi);
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;
209 Double_t PD[3], RD[6][6], H[3], PC[3], RC[15];
214 for (Int_t i = 0; i < 6; i++)
215 for (Int_t j = 0; j < 6; j++) {
238 for (Int_t i = 0; i < 15; i++) {
239 fCovMatrix[i] = RC[i];
243 fDY_sc = TMath::Sqrt(fabs(fCovMatrix[12]));
244 fDZ_sc = TMath::Sqrt(fabs(fCovMatrix[14]));
246 for (
int i = 0; i < 6; i++)
247 for (
int j = 0; j < 6; j++) {
248 fCovMatrix66[i][j] = RD[i][j];
275 TVector3 xyz(parab->
GetX(), parab->
GetY(), parab->
GetZ());
276 Double_t H[3], pnt[3];
283 Int_t CH = parab->
GetQ();
288 Double_t SPU = parab->
GetSPU();
291 Double_t PC[3], RC[15];
294 util.
FromSDToSC(PD, RD, H, CH, SPU, DJ, DK, IERR, PC, RC);
302 cout <<
"FairTrackParH(FairTrackParP *) contructor ERROR: CANNOT convert parabola to helix" << endl;
314 Double_t CovMatrix[15])
317 Double_t P = TMath::Sqrt(Px * Px + Py * Py + Pz * Pz);
318 fLm = TMath::ASin(Pz / P);
320 fPhi = TMath::ATan2(Py, Px);
322 fq = int(TMath::Abs(Q) / Q);
326 cLm = TMath::Cos(fLm);
327 sLm = TMath::Sin(fLm);
328 cphi = TMath::Cos(fPhi);
329 sphi = TMath::Sin(fPhi);
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;
343 for (Int_t i = 0; i < 15; i++) {
344 fCovMatrix[i] = CovMatrix[i];
347 fDQp = TMath::Sqrt(fabs(fCovMatrix[0]));
348 fDLm = TMath::Sqrt(fabs(fCovMatrix[5]));
349 fDPhi = TMath::Sqrt(fabs(fCovMatrix[9]));
351 fDY_sc = TMath::Sqrt(fabs(fCovMatrix[12]));
352 fDZ_sc = TMath::Sqrt(fabs(fCovMatrix[14]));
358 Double_t PD[3], RD[6][6], H[3], PC[3], RC[15];
364 for (Int_t i = 0; i < 15; i++) {
365 RC[i] = fCovMatrix[i];
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]));
387 for (
int i = 0; i < 6; i++)
388 for (
int j = 0; j < 6; j++) {
389 fCovMatrix66[i][j] = RD[i][j];
400 Double_t CovMatrix[15])
405 Double_t P = TMath::Abs(1 /
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];
412 cLm = TMath::Cos(fLm);
413 sLm = TMath::Sin(fLm);
414 cphi = TMath::Cos(fPhi);
415 sphi = TMath::Sin(fPhi);
417 fPx = P * cLm * cphi;
418 fPy = P * cLm * sphi;
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;
429 fDQp = TMath::Sqrt(fabs(fCovMatrix[0]));
430 fDLm = TMath::Sqrt(fabs(fCovMatrix[5]));
431 fDPhi = TMath::Sqrt(fabs(fCovMatrix[9]));
433 fDY_sc = TMath::Sqrt(fabs(fCovMatrix[12]));
434 fDZ_sc = TMath::Sqrt(fabs(fCovMatrix[14]));
440 Double_t PD[3], RD[6][6], H[3], PC[3], RC[15];
446 for (Int_t i = 0; i < 15; i++) {
447 RC[i] = fCovMatrix[i];
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]));
470 for (
int i = 0; i < 6; i++)
471 for (
int j = 0; j < 6; j++) {
472 fCovMatrix66[i][j] = RD[i][j];
476 void FairTrackParH::CalCov()
485 fDQp = -fDP / (fP * fP);
487 Double_t fDPQDLm = -sLm * cphi /
fPx;
488 Double_t fDPQDPhi = -cLm * TMath::Sin(fPhi) /
fPx;
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))
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))));
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))
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))));
504 fDLm = (-((
fPz * fDP) / pow(fP, 2)) +
fDPz / fP) / TMath::Sqrt(1 - pow(
fPz, 2) / pow(fP, 2));
506 Double_t fDLmDPhi = -((
fPx * TMath::Tan(fPhi) / cphi)
507 / (fP * TMath::Sqrt(1 - (pow(
fPx, 2) * pow(1 / cphi, 2)) / pow(fP, 2))));
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)))));
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)))));
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));
520 Double_t fDPhiDx_sc = -(fY_sc / (pow(fX_sc, 2) * (1 + pow(fY_sc, 2) / pow(fX_sc, 2))));
522 Double_t fDPhiDy_sc = 1 / (fX_sc * (1 + pow(fY_sc, 2) / pow(fX_sc, 2)));
524 Double_t fDXDY_sc = 1 / TMath::Tan(fPhi);
526 if (
fDQp == 0 && fDLm == 0 && fDPhi == 0) {
527 cout <<
"FairTrackParH::CalCov() No Errors" << endl;
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;
564 cout <<
"FairTrackParH::FairTrackParH(FairTrackPar &Trkbase)" << endl;
580 fLm = TMath::ASin(fPz / fP);
581 fPhi = TMath::ATan2(
fPy,
fPx);
583 cLm = TMath::Cos(fLm);
584 sLm = TMath::Sin(fLm);
585 cphi = TMath::Cos(fPhi);
586 sphi = TMath::Sin(fPhi);
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;
600 for (Int_t i = 0; i < 15; i++) {
604 Double_t PD[3], RD[6][6], H[3], PC[3], RC[15];
609 for (Int_t i = 0; i < 6; i++)
610 for (Int_t j = 0; j < 6; j++) {
631 for (Int_t i = 0; i < 15; i++) {
632 fCovMatrix[i] = RC[i];
635 fDY_sc = TMath::Sqrt(fabs(fCovMatrix[12]));
636 fDZ_sc = TMath::Sqrt(fabs(fCovMatrix[14]));
638 for (
int i = 0; i < 6; i++)
639 for (
int j = 0; j < 6; j++) {
640 fCovMatrix66[i][j] = RD[i][j];
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;
664 fX = fX_sc * cLm * cphi - fY_sc * sphi - fZ_sc * cphi * sLm;
671 fY = fX_sc * cLm * sphi + fY_sc * cphi - fZ_sc * sphi * sLm;
679 fZ = fX_sc * sLm + fZ_sc * cLm;
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++) {
731 for (
int i = 0; i < 15; i++) {
732 CovQ[i] = fCovMatrix[i];
735 CovQ[i] = CovQ[i] / (
fq *
fq);
737 if (i > 0 && i < 5) {
738 CovQ[i] = CovQ[i] /
fq;
virtual Double_t GetDZ() const
virtual Double_t GetPz() const
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)
virtual Double_t GetQp() const
virtual void Print(Option_t *option="") const
virtual void GetFieldValue(const Double_t point[3], Double_t *bField)
virtual void SetPy(Double_t py)
ClassImp(FairEventBuilder)
virtual Double_t GetDPx() const
virtual void SetY(Double_t y)
virtual Double_t GetDPy() const
virtual void SetZ(Double_t z)
virtual Double_t GetPx() const
virtual void SetPz(Double_t pz)
virtual void SetPx(Double_t px)
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)
virtual Double_t GetPy() const
virtual void SetX(Double_t x)
virtual Double_t GetDY() const
virtual Double_t GetDPz() const
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