13 #include <TGenericClassInfo.h>
15 #include <TMathBase.h>
17 #include <TMatrixTBase.h>
18 #include <TMatrixTUtils.h>
61 Double_t
A[5][5], S[15], COSL, SINL;
65 memset(RD, 0,
sizeof(*RD));
69 if (TMath::Abs(COSL) < 1.e-7) {
80 for (Int_t I = 0; I < 5; I++) {
81 for (Int_t K = 0; K < 5; K++) {
87 for (Int_t I = 0; I < 15; I++) {
97 A[0][1] = -PC[0] * SINL;
104 for (Int_t I = 0; I < 15; I++) {
155 Double_t
A[5][5], S[15], TN[3], COSL, SINL, COSL1;
157 Double_t PM, HM, UN[3], VN[3], DI[3], TVW[3];
158 Double_t VJ, VK, HA, HAM, Q, SINZ ;
160 Double_t CFACT8 = 2.997925e-04;
167 TVW[0] = 1. / TMath::Sqrt(1. + PD[1] * PD[1] + PD[2] * PD[2]);
171 TVW[1] = PD[1] * TVW[0];
172 TVW[2] = PD[2] * TVW[0];
174 DI[0] = DJ[1] * DK[2] - DJ[2] * DK[1];
175 DI[1] = DJ[2] * DK[0] - DJ[0] * DK[2];
176 DI[2] = DJ[0] * DK[1] - DJ[1] * DK[0];
178 for (Int_t I = 0; I < 3; I++) {
179 TN[I] = TVW[0] * DI[I] + TVW[1] * DJ[I] + TVW[2] * DK[I];
182 COSL = TMath::Sqrt(TMath::Abs(1. - TN[2] * TN[2]));
189 PC[0] = PD[0] * COSL;
194 if (TMath::Abs(TN[0]) < 1.E-30) {
198 UN[0] = -TN[1] * COSL1;
199 UN[1] = TN[0] * COSL1;
202 VN[0] = -TN[2] * UN[1];
203 VN[1] = TN[2] * UN[0];
208 VJ = VN[0] * DJ[0] + VN[1] * DJ[1] + VN[2] * DJ[2];
209 VK = VN[0] * DK[0] + VN[1] * DK[1] + VN[2] * DK[2];
211 for (Int_t I = 0; I < 5; I++) {
212 for (Int_t K = 0; K < 5; K++) {
218 for (Int_t I = 0; I < 15; I++) {
223 HA = TMath::Sqrt(H[0] * H[0] + H[1] * H[1] + H[2] * H[2]);
230 SINZ = -(H[0] * UN[0] + H[1] * UN[1] + H[2] * UN[2]) * HM;
232 A[0][3] = Q * TVW[1] * SINZ * (SINL * PD[0]);
233 A[0][4] = Q * TVW[2] * SINZ * (SINL * PD[0]);
243 A[0][1] = -TVW[0] * VJ * (SINL * PD[0]);
244 A[0][2] = -TVW[0] * VK * (SINL * PD[0]);
251 for (Int_t I = 0; I < 15; I++) {
285 Double_t
A[5][5], S[15], COSL, COSL1;
290 memset(RD, 0,
sizeof(*RD));
293 if (TMath::Abs(COSL) < 1.e-7) {
300 PD[0] = PC[0] * COSL1;
304 for (Int_t I = 0; I < 5; I++) {
305 for (Int_t K = 0; K < 5; K++) {
311 for (Int_t I = 0; I < 15; I++) {
321 A[0][1] = PD[0] * TANL;
328 for (Int_t I = 0; I < 15; I++) {
377 Double_t
A[5][5], S[15], TN[3], COSL, COSP;
378 Double_t UN[3], VN[3], DI[3], TVW[3];
381 Double_t CFACT8 = 2.997925e-04;
382 Double_t T1R, T2R, T3R, SINP, SINZ, COSZ, HA, HM, HAM;
383 Double_t Q, UI, VI, UJ, UK, VJ, VK;
386 memset(RD, 0,
sizeof(*RD));
387 memset(PD, 0,
sizeof(*PD));
389 COSL = TMath::Cos(PC[1]);
390 SINP = TMath::Sin(PC[2]);
391 COSP = TMath::Cos(PC[2]);
395 TN[2] = TMath::Sin(PC[1]);
398 DI[0] = DJ[1] * DK[2] - DJ[2] * DK[1];
399 DI[1] = DJ[2] * DK[0] - DJ[0] * DK[2];
400 DI[2] = DJ[0] * DK[1] - DJ[1] * DK[0];
402 TVW[0] = TN[0] * DI[0] + TN[1] * DI[1] + TN[2] * DI[2];
407 TVW[1] = TN[0] * DJ[0] + TN[1] * DJ[1] + TN[2] * DJ[2];
408 TVW[2] = TN[0] * DK[0] + TN[1] * DK[1] + TN[2] * DK[2];
411 if (TMath::Abs(TVW[0]) < 1.e-7) {
418 PD[1] = TVW[1] * T1R;
419 PD[2] = TVW[2] * T1R;
425 VN[0] = -TN[2] * UN[1];
426 VN[1] = TN[2] * UN[0];
429 UJ = UN[0] * DJ[0] + UN[1] * DJ[1] + UN[2] * DJ[2];
430 UK = UN[0] * DK[0] + UN[1] * DK[1] + UN[2] * DK[2];
431 VJ = VN[0] * DJ[0] + VN[1] * DJ[1] + VN[2] * DJ[2];
432 VK = VN[0] * DK[0] + VN[1] * DK[1] + VN[2] * DK[2];
434 for (Int_t I = 0; I < 5; I++) {
435 for (Int_t K = 0; K < 5; K++) {
441 for (Int_t I = 0; I < 15; I++) {
447 HA = TMath::Sqrt(H[0] * H[0] + H[1] * H[1] + H[2] * H[2]);
453 SINZ = -(H[0] * UN[0] + H[1] * UN[1] + H[2] * UN[2]) * HM;
454 COSZ = (H[0] * VN[0] + H[1] * VN[1] + H[2] * VN[2]) * HM;
455 T3R = Q * pow(T1R, 3);
456 UI = UN[0] * DI[0] + UN[1] * DI[1] + UN[2] * DI[2];
457 VI = VN[0] * DI[0] + VN[1] * DI[1] + VN[2] * DI[2];
458 A[1][3] = -UI * (VK * COSZ - UK * SINZ) * T3R;
459 A[1][4] = -VI * (VK * COSZ - UK * SINZ) * T3R;
460 A[2][3] = UI * (VJ * COSZ - UJ * SINZ) * T3R;
461 A[2][4] = VI * (VJ * COSZ - UJ * SINZ) * T3R;
471 A[1][2] = VK * COSL * T2R;
473 A[2][2] = -VJ * COSL * T2R;
484 for (Int_t I = 0; I < 15; I++) {
543 Double_t
A[5][5], S[15], TN[3], COSL, COSL1;
544 Double_t SINZ, COSZ, UN[3], VN[3];
547 Double_t PM, TR, TS, TT, HA, HM, HAM, Q;
548 Double_t UJ1, UK1, UJ2, UK2, VJ1, VJ2, VK1, VK2;
549 Double_t SJ1I2, SK1I2, SK2U, SK2V, SJ2U, SJ2V;
550 Double_t DI1[3], DI2[3], TVW1[3], TVW2[3];
551 Double_t CFACT8 = 2.997925e-04;
554 memset(PD2, 0,
sizeof(*PD2));
555 memset(RD2, 0,
sizeof(*RD2));
558 TVW1[0] = 1. / sqrt(1. + PD1[1] * PD1[1] + PD1[2] * PD1[2]);
562 TVW1[1] = PD1[1] * TVW1[0];
563 TVW1[2] = PD1[2] * TVW1[0];
565 DI1[0] = DJ1[1] * DK1[2] - DJ1[2] * DK1[1];
566 DI1[1] = DJ1[2] * DK1[0] - DJ1[0] * DK1[2];
567 DI1[2] = DJ1[0] * DK1[1] - DJ1[1] * DK1[0];
569 for (Int_t I = 0; I < 3; I++) {
570 TN[I] = TVW1[0] * DI1[I] + TVW1[1] * DJ1[I] + TVW1[2] * DK1[I];
573 DI2[0] = DJ2[1] * DK2[2] - DJ2[2] * DK2[1];
574 DI2[1] = DJ2[2] * DK2[0] - DJ2[0] * DK2[2];
575 DI2[2] = DJ2[0] * DK2[1] - DJ2[1] * DK2[0];
577 TVW2[0] = TN[0] * DI2[0] + TN[1] * DI2[1] + TN[2] * DI2[2];
578 TVW2[1] = TN[0] * DJ2[0] + TN[1] * DJ2[1] + TN[2] * DJ2[2];
579 TVW2[2] = TN[0] * DK2[0] + TN[1] * DK2[1] + TN[2] * DK2[2];
581 if (TMath::Abs(TVW2[0]) < 1.e-7) {
592 PD2[1] = TVW2[1] * TR;
593 PD2[2] = TVW2[2] * TR;
595 COSL = sqrt(TMath::Abs(1. - TN[2] * TN[2]));
596 if (TMath::Abs(COSL) < 1.e-7) {
602 UN[0] = -TN[1] * COSL1;
603 UN[1] = TN[0] * COSL1;
606 VN[0] = -TN[2] * UN[1];
607 VN[1] = TN[2] * UN[0];
610 UJ1 = UN[0] * DJ1[0] + UN[1] * DJ1[1] + UN[2] * DJ1[2];
611 UK1 = UN[0] * DK1[0] + UN[1] * DK1[1] + UN[2] * DK1[2];
612 VJ1 = VN[0] * DJ1[0] + VN[1] * DJ1[1] + VN[2] * DJ1[2];
613 VK1 = VN[0] * DK1[0] + VN[1] * DK1[1] + VN[2] * DK1[2];
615 UJ2 = UN[0] * DJ2[0] + UN[1] * DJ2[1] + UN[2] * DJ2[2];
616 UK2 = UN[0] * DK2[0] + UN[1] * DK2[1] + UN[2] * DK2[2];
617 VJ2 = VN[0] * DJ2[0] + VN[1] * DJ2[1] + VN[2] * DJ2[2];
618 VK2 = VN[0] * DK2[0] + VN[1] * DK2[1] + VN[2] * DK2[2];
621 for (Int_t I = 0; I < 5; I++) {
622 for (Int_t K = 0; K < 5; K++) {
626 for (Int_t J = 0; J < 15; J++) {
632 HA = sqrt(H[0] * H[0] + H[1] * H[1] + H[2] * H[2]);
638 TT = -Q * pow(TR, 3);
639 SJ1I2 = DJ1[0] * DI2[0] + DJ1[1] * DI2[1] + DJ1[2] * DI2[2];
640 SK1I2 = DK1[0] * DI2[0] + DK1[1] * DI2[1] + DK1[2] * DI2[2];
641 SK2U = DK2[0] * UN[0] + DK2[1] * UN[1] + DK2[2] * UN[2];
642 SK2V = DK2[0] * VN[0] + DK2[1] * VN[1] + DK2[2] * VN[2];
643 SJ2U = DJ2[0] * UN[0] + DJ2[1] * UN[1] + DJ2[2] * UN[2];
644 SJ2V = DJ2[0] * VN[0] + DJ2[1] * VN[1] + DJ2[2] * VN[2];
646 SINZ = -(H[0] * UN[0] + H[1] * UN[1] + H[2] * UN[2]) * HM;
647 COSZ = (H[0] * VN[0] + H[1] * VN[1] + H[2] * VN[2]) * HM;
648 A[1][3] = -TT * SJ1I2 * (SK2U * SINZ - SK2V * COSZ);
649 A[1][4] = -TT * SK1I2 * (SK2U * SINZ - SK2V * COSZ);
650 A[2][3] = TT * SJ1I2 * (SJ2U * SINZ - SJ2V * COSZ);
651 A[2][4] = TT * SK1I2 * (SJ2U * SINZ - SJ2V * COSZ);
655 A[3][3] = TR * (UJ1 * VK2 - VJ1 * UK2);
656 A[3][4] = TR * (UK1 * VK2 - VK1 * UK2);
657 A[4][3] = TR * (VJ1 * UJ2 - UJ1 * VJ2);
658 A[4][4] = TR * (VK1 * UJ2 - UK1 * VJ2);
661 A[1][1] = A[3][3] * TS;
662 A[1][2] = A[3][4] * TS;
663 A[2][1] = A[4][3] * TS;
664 A[2][2] = A[4][4] * TS;
674 for (Int_t J = 0; J < 15; J++) {
728 Double_t
A[5][5], S[15], TN[3], TANL, COSL, COSL1;
730 Double_t PM, HM, UN[3], VN[3], DI[3], TVW[3];
732 Double_t CFACT8 = 2.997925e-04;
734 Double_t VJ, VK, HA, HAM, Q, SINZ ;
742 TVW[0] = 1. / TMath::Sqrt(1. + PD[1] * PD[1] + PD[2] * PD[2]);
746 TVW[1] = PD[1] * TVW[0];
747 TVW[2] = PD[2] * TVW[0];
749 DI[0] = DJ[1] * DK[2] - DJ[2] * DK[1];
750 DI[1] = DJ[2] * DK[0] - DJ[0] * DK[2];
751 DI[2] = DJ[0] * DK[1] - DJ[1] * DK[0];
753 for (Int_t I = 0; I < 3; I++) {
754 TN[I] = TVW[0] * DI[I] + TVW[1] * DJ[I] + TVW[2] * DK[I];
757 COSL = TMath::Sqrt(TMath::Abs(1. - TN[2] * TN[2]));
762 TANL = TN[2] * COSL1;
764 PC[0] = PD[0] * COSL1;
768 if (TMath::Abs(TN[0]) < 1.e-30) {
772 UN[0] = -TN[1] * COSL1;
773 UN[1] = TN[0] * COSL1;
776 VN[0] = -TN[2] * UN[1];
777 VN[1] = TN[2] * UN[0];
782 VJ = VN[0] * DJ[0] + VN[1] * DJ[1] + VN[2] * DJ[2];
783 VK = VN[0] * DK[0] + VN[1] * DK[1] + VN[2] * DK[2];
785 for (Int_t I = 0; I < 5; I++) {
786 for (Int_t K = 0; K < 5; K++) {
792 for (Int_t I = 0; I < 15; I++) {
797 HA = TMath::Sqrt(H[0] * H[0] + H[1] * H[1] + H[2] * H[2]);
804 SINZ = -(H[0] * UN[0] + H[1] * UN[1] + H[2] * UN[2]) * HM;
806 A[0][3] = -Q * TVW[1] * SINZ * (TANL * PC[0]);
807 A[0][4] = -Q * TVW[2] * SINZ * (TANL * PC[0]);
817 A[0][1] = TVW[0] * VJ * (TANL * PC[0]);
818 A[0][2] = TVW[0] * VK * (TANL * PC[0]);
825 for (Int_t I = 0; I < 15; I++) {
876 Double_t
A[5][5], S[15], TN[3];
877 Double_t SINZ, COSZ, COSL, COSL1;
878 Double_t UN[3], VN[3], DI[3], TVW[3];
881 Double_t CFACT8 = 2.997925e-04;
882 Double_t HA, HM, HAM, Q, UJ, UK, VJ, VK;
887 memset(RC, 0,
sizeof(*RC));
888 memset(PC, 0,
sizeof(*PC));
891 TVW[0] = 1. / TMath::Sqrt(1. + PD[1] * PD[1] + PD[2] * PD[2]);
896 TVW[1] = PD[1] * TVW[0];
897 TVW[2] = PD[2] * TVW[0];
899 DI[0] = DJ[1] * DK[2] - DJ[2] * DK[1];
900 DI[1] = DJ[2] * DK[0] - DJ[0] * DK[2];
901 DI[2] = DJ[0] * DK[1] - DJ[1] * DK[0];
903 for (Int_t I = 0; I < 3; I++) {
904 TN[I] = TVW[0] * DI[I] + TVW[1] * DJ[I] + TVW[2] * DK[I];
908 PC[1] = TMath::ASin(TN[2]);
909 if (TMath::Abs(TN[0]) < 1.e-30) {
913 PC[2] = TMath::ATan2(TN[1], TN[0]);
915 COSL = TMath::Sqrt(TMath::Abs(1. - TN[2] * TN[2]));
920 UN[0] = -TN[1] * COSL1;
921 UN[1] = TN[0] * COSL1;
924 VN[0] = -TN[2] * UN[1];
925 VN[1] = TN[2] * UN[0];
928 UJ = UN[0] * DJ[0] + UN[1] * DJ[1] + UN[2] * DJ[2];
929 UK = UN[0] * DK[0] + UN[1] * DK[1] + UN[2] * DK[2];
930 VJ = VN[0] * DJ[0] + VN[1] * DJ[1] + VN[2] * DJ[2];
931 VK = VN[0] * DK[0] + VN[1] * DK[1] + VN[2] * DK[2];
935 for (Int_t I = 0; I < 5; I++) {
936 for (Int_t K = 0; K < 5; K++) {
940 for (Int_t J = 0; J < 15; J++) {
946 HA = TMath::Sqrt(H[0] * H[0] + H[1] * H[1] + H[2] * H[2]);
952 SINZ = -(H[0] * UN[0] + H[1] * UN[1] + H[2] * UN[2]) * HM;
953 COSZ = (H[0] * VN[0] + H[1] * VN[1] + H[2] * VN[2]) * HM;
954 A[1][3] = -Q * TVW[1] * SINZ;
955 A[1][4] = -Q * TVW[2] * SINZ;
956 A[2][3] = -Q * TVW[1] * COSZ * COSL1;
957 A[2][4] = -Q * TVW[2] * COSZ * COSL1;
961 A[1][1] = TVW[0] * VJ;
962 A[1][2] = TVW[0] * VK;
963 A[2][1] = TVW[0] * UJ * COSL1;
964 A[2][2] = TVW[0] * UK * COSL1;
975 for (Int_t I = 0; I < 15; I++) {
1011 for (Int_t I = 0; I < 5; I++) {
1012 for (Int_t k = I; k < 5; k++) {
1104 Double_t SPU, DJ[3], DK[3], PM ;
1106 Double_t clam, slam, cphi, sphi, PC1[3], RC1[15];
1112 memset(RC, 0,
sizeof(*RC));
1113 memset(PC, 0,
sizeof(*PC));
1115 PM = TMath::Sqrt(PD[0] * PD[0] + PD[1] * PD[1] + PD[2] * PD[2]);
1123 clam = TMath::Sqrt(1. - slam * slam);
1125 if (TMath::Abs(clam) < 1.e-10) {
1131 cphi = PD[0] / (clam * PM);
1132 sphi = PD[1] / (clam * PM);
1139 DK[0] = -slam * cphi;
1140 DK[1] = -slam * sphi;
1143 FromMarsToSD(PD, RD, H, CH, DJ, DK, IERR, SPU, PC1, RC1);
1147 FromSDToSC(PC1, RC1, H, CH, SPU, DJ, DK, IERR, PC, RC);
1189 Double_t DJ[3], DK[3];
1190 Double_t PDD[3], RDD[15];
1195 Double_t clam, slam, cphi, sphi;
1199 memset(PD, 0,
sizeof(*PD));
1202 for (Int_t I = 0; I < 6; I++) {
1203 for (Int_t K = 0; K < 6; K++) {
1212 clam = TMath::Cos(PC[1]);
1213 slam = TMath::Sin(PC[1]);
1214 cphi = TMath::Cos(PC[2]);
1215 sphi = TMath::Sin(PC[2]);
1218 if (TMath::Abs(clam) < 1.e-15) {
1231 DK[0] = -slam * cphi;
1232 DK[1] = -slam * sphi;
1235 FromSCToSD(PC, RC, H, CH, DJ, DK, IERR, SPU, PDD, RDD);
1297 Double_t M56[5][6], M56T[6][5], AJ[5][5], AJT[6][5];
1298 Double_t R6[6][6], RLC[6][6];
1301 Double_t Rot[3][3], Rmat[6][6], Rtra[6][6];
1307 memset(RC, 0,
sizeof(*RC));
1308 memset(PC, 0,
sizeof(*PC));
1310 for (Int_t I = 0; I < 5; I++) {
1311 for (Int_t K = 0; K < 6; K++) {
1321 for (Int_t i = 0; i < 6; i++) {
1322 for (Int_t k = 0; k < 6; k++) {
1332 TVector3 MI(1., 0., 0.);
1333 TVector3 MJ(0., 1., 0.);
1334 TVector3 MK(0., 0., 1.);
1336 TVector3 DI(DJ1[0], DJ1[1], DJ1[2]);
1337 TVector3 DJ(DK1[0], DK1[1], DK1[2]);
1338 TVector3 DK = DI.Cross(DJ);
1343 Rot[0][0] = DI.Dot(MI);
1344 Rot[0][1] = DI.Dot(MJ);
1345 Rot[0][2] = DI.Dot(MK);
1346 Rot[1][0] = DJ.Dot(MI);
1347 Rot[1][1] = DJ.Dot(MJ);
1348 Rot[1][2] = DJ.Dot(MK);
1349 Rot[2][0] = DK.Dot(MI);
1350 Rot[2][1] = DK.Dot(MJ);
1351 Rot[2][2] = DK.Dot(MK);
1353 TMatrixT<double> PD1(3, 1);
1358 TMatrixT<double> Rot1(3, 3);
1359 for (
int i = 0; i < 3; i++)
1360 for (
int j = 0; j < 3; j++) {
1361 Rot1[i][j] = Rot[i][j];
1367 TMatrixT<double> Rot1xPD1(Rot1, TMatrixT<double>::kMult, PD1);
1368 PDD[0] = Rot1xPD1[0][0];
1369 PDD[1] = Rot1xPD1[1][0];
1370 PDD[2] = Rot1xPD1[2][0];
1374 Rmat[0][0] = Rot[0][0];
1375 Rmat[0][1] = Rot[0][1];
1376 Rmat[0][2] = Rot[0][2];
1377 Rmat[1][0] = Rot[1][0];
1378 Rmat[1][1] = Rot[1][1];
1379 Rmat[1][2] = Rot[1][2];
1380 Rmat[2][0] = Rot[2][0];
1381 Rmat[2][1] = Rot[2][1];
1382 Rmat[2][2] = Rot[2][2];
1384 Rmat[3][3] = Rot[0][0];
1385 Rmat[3][4] = Rot[0][1];
1386 Rmat[3][5] = Rot[0][2];
1387 Rmat[4][3] = Rot[1][0];
1388 Rmat[4][4] = Rot[1][1];
1389 Rmat[4][5] = Rot[1][2];
1390 Rmat[5][3] = Rot[2][0];
1391 Rmat[5][4] = Rot[2][1];
1392 Rmat[5][5] = Rot[2][2];
1396 for (Int_t I = 0; I < 6; I++) {
1397 for (Int_t K = 0; K < 6; K++) {
1398 Rtra[K][I] = Rmat[I][K];
1404 for (Int_t i = 0; i < 6; i++) {
1405 for (Int_t k = 0; k < 6; k++) {
1406 for (Int_t l = 0; l < 6; l++) {
1407 R6[i][k] += RD[i][l] * Rtra[l][k];
1412 for (Int_t i = 0; i < 6; i++) {
1413 for (Int_t k = 0; k < 6; k++) {
1414 for (Int_t l = 0; l < 6; l++) {
1415 RLC[i][k] += Rmat[i][l] * R6[l][k];
1424 PM = TMath::Sqrt(PDD[0] * PDD[0] + PDD[1] * PDD[1] + PDD[2] * PDD[2]);
1425 PM3 = TMath::Power(PM, 3);
1433 if (TMath::Abs(PDD[2]) < 1.e-08) {
1442 PC[1] = PDD[0] / PDD[2];
1443 PC[2] = PDD[1] / PDD[2];
1449 M56[0][0] = -CH * PDD[0] / PM3;
1450 M56[0][1] = -CH * PDD[1] / PM3;
1451 M56[0][2] = -CH * PDD[2] / PM3;
1453 M56[1][0] = 1. / PDD[2];
1455 M56[1][2] = -PDD[0] / (PDD[2] * PDD[2]);
1458 M56[2][1] = 1. / PDD[2];
1459 M56[2][2] = -PDD[1] / (PDD[2] * PDD[2]);
1466 for (Int_t k = 0; k < 5; k++) {
1467 for (Int_t l = 0; l < 6; l++) {
1468 M56T[l][k] = M56[k][l];
1472 for (Int_t i = 0; i < 6; i++) {
1473 for (Int_t k = 0; k < 5; k++) {
1474 for (Int_t l = 0; l < 6; l++) {
1475 AJT[i][k] += RLC[i][l] * M56T[l][k];
1480 for (Int_t i = 0; i < 5; i++) {
1481 for (Int_t k = 0; k < 5; k++) {
1482 for (Int_t l = 0; l < 6; l++) {
1483 AJ[i][k] += M56[i][l] * AJT[l][k];
1491 SP1 = TMath::Sign(1.,
1492 PD[0] * (DJ1[1] * DK1[2] - DJ1[2] * DK1[1]) + PD[1] * (DJ1[2] * DK1[0] - DJ1[0] * DK1[2])
1493 + PD[2] * (DJ1[0] * DK1[1] - DJ1[1] * DK1[0]));
1542 Double_t M65[6][5], M65T[5][6], AJ[5][6];
1550 Double_t RD1[6][6], Rmat[6][6], AJJ[6][6], Rtra[6][6];
1552 Double_t SPU, PM, PM2, PVW, PVW3;
1556 memset(PD, 0,
sizeof(*PD));
1559 for (Int_t I = 0; I < 5; I++) {
1560 for (Int_t K = 0; K < 6; K++) {
1573 for (Int_t I = 0; I < 6; I++) {
1590 PVW = TMath::Sqrt(1. + PC[1] * PC[1] + PC[2] * PC[2]);
1591 PVW3 = TMath::Power(PVW, 3);
1595 PDD[0] = SPU * PM * PC[1] / PVW;
1596 PDD[1] = SPU * PM * PC[2] / PVW;
1597 PDD[2] = SPU * PM / PVW;
1602 M65[0][0] = -SPU * PM2 * PC[1] / (CH * PVW);
1603 M65[1][0] = -SPU * PM2 * PC[2] / (CH * PVW);
1604 M65[2][0] = -SPU * PM2 / (CH * PVW);
1606 M65[0][1] = SPU * PM * (1. + PC[2] * PC[2]) / PVW3;
1607 M65[1][1] = -SPU * PM * PC[1] * PC[2] / PVW3;
1608 M65[2][1] = -SPU * PM * PC[1] / PVW3;
1610 M65[0][2] = -SPU * PM * PC[1] * PC[2] / PVW3;
1611 M65[1][2] = SPU * PM * (1. + PC[1] * PC[1]) / PVW3;
1612 M65[2][2] = -SPU * PM * PC[2] / PVW3;
1621 for (Int_t I = 0; I < 6; I++) {
1622 for (Int_t K = 0; K < 5; K++) {
1623 M65T[K][I] = M65[I][K];
1629 for (Int_t i = 0; i < 5; i++) {
1630 for (Int_t k = 0; k < 6; k++) {
1631 for (Int_t l = 0; l < 5; l++) {
1632 AJ[i][k] += RCM[i][l] * M65T[l][k];
1637 for (Int_t i = 0; i < 6; i++) {
1638 for (Int_t k = 0; k < 6; k++) {
1639 for (Int_t l = 0; l < 5; l++) {
1640 RD1[i][k] += M65[i][l] * AJ[l][k];
1648 TVector3 MI(1., 0., 0.);
1649 TVector3 MJ(0., 1., 0.);
1650 TVector3 MK(0., 0., 1.);
1652 TVector3 DI(DJ1[0], DJ1[1], DJ1[2]);
1653 TVector3 DJ(DK1[0], DK1[1], DK1[2]);
1654 TVector3 DK = DI.Cross(DJ);
1659 Rot[0][0] = MI.Dot(DI);
1660 Rot[0][1] = MI.Dot(DJ);
1661 Rot[0][2] = MI.Dot(DK);
1662 Rot[1][0] = MJ.Dot(DI);
1663 Rot[1][1] = MJ.Dot(DJ);
1664 Rot[1][2] = MJ.Dot(DK);
1665 Rot[2][0] = MK.Dot(DI);
1666 Rot[2][1] = MK.Dot(DJ);
1667 Rot[2][2] = MK.Dot(DK);
1669 TMatrixT<double> PD1(3, 1);
1674 TMatrixT<double> Rot1(3, 3);
1675 for (
int i = 0; i < 3; i++)
1676 for (
int j = 0; j < 3; j++) {
1677 Rot1[i][j] = Rot[i][j];
1680 TMatrixT<double> Rot1xPD1(Rot1, TMatrixT<double>::kMult, PD1);
1681 PD[0] = Rot1xPD1[0][0];
1682 PD[1] = Rot1xPD1[1][0];
1683 PD[2] = Rot1xPD1[2][0];
1687 Rmat[0][0] = Rot[0][0];
1688 Rmat[0][1] = Rot[0][1];
1689 Rmat[0][2] = Rot[0][2];
1690 Rmat[1][0] = Rot[1][0];
1691 Rmat[1][1] = Rot[1][1];
1692 Rmat[1][2] = Rot[1][2];
1693 Rmat[2][0] = Rot[2][0];
1694 Rmat[2][1] = Rot[2][1];
1695 Rmat[2][2] = Rot[2][2];
1697 Rmat[3][3] = Rot[0][0];
1698 Rmat[3][4] = Rot[0][1];
1699 Rmat[3][5] = Rot[0][2];
1700 Rmat[4][3] = Rot[1][0];
1701 Rmat[4][4] = Rot[1][1];
1702 Rmat[4][5] = Rot[1][2];
1703 Rmat[5][3] = Rot[2][0];
1704 Rmat[5][4] = Rot[2][1];
1705 Rmat[5][5] = Rot[2][2];
1709 for (Int_t I = 0; I < 6; I++) {
1710 for (Int_t K = 0; K < 6; K++) {
1711 Rtra[K][I] = Rmat[I][K];
1715 for (Int_t i = 0; i < 6; i++) {
1716 for (Int_t k = 0; k < 6; k++) {
1717 for (Int_t l = 0; l < 6; l++) {
1718 AJJ[i][k] += RD1[i][l] * Rtra[l][k];
1723 for (Int_t i = 0; i < 6; i++) {
1724 for (Int_t k = 0; k < 6; k++) {
1725 for (Int_t l = 0; l < 6; l++) {
1726 RD[i][k] += Rmat[i][l] * AJJ[l][k];
1831 Double_t Q[15], T1, T2, T3, T4, T5;
1833 for (Int_t i = 0; i < 15; i++) {
1838 for (Int_t J = 0; J < 5; J++) {
1844 for (Int_t I = J; I < 5; I++) {
1845 R[K] = A[I] * (Q[0] * T1 + Q[1] * T2 + Q[2] * T3 + Q[3] * T4 + Q[4] * T5)
1846 + A[I + 5] * (Q[1] * T1 + Q[5] * T2 + Q[6] * T3 + Q[7] * T4 + Q[8] * T5)
1847 + A[I + 10] * (Q[2] * T1 + Q[6] * T2 + Q[9] * T3 + Q[10] * T4 + Q[11] * T5)
1848 + A[I + 15] * (Q[3] * T1 + Q[7] * T2 + Q[10] * T3 + Q[12] * T4 + Q[13] * T5)
1849 + A[I + 20] * (Q[4] * T1 + Q[8] * T2 + Q[11] * T3 + Q[13] * T4 + Q[14] * T5);
1860 TMatrixT<double> matrix(3, 3);
1862 matrix[0][0] = di[0];
1863 matrix[0][1] = di[1];
1864 matrix[0][2] = di[2];
1865 matrix[1][0] = dj[0];
1866 matrix[1][1] = dj[1];
1867 matrix[1][2] = dj[2];
1868 matrix[2][0] = dk[0];
1869 matrix[2][1] = dk[1];
1870 matrix[2][2] = dk[2];
1872 TMatrixT<double> xyzvec(3, 1);
1873 xyzvec[0][0] = xyz.X();
1874 xyzvec[1][0] = xyz.Y();
1875 xyzvec[2][0] = xyz.Z();
1877 TMatrixT<double> origin(3, 1);
1878 origin[0][0] = o.X();
1879 origin[1][0] = o.Y();
1880 origin[2][0] = o.Z();
1884 TMatrixT<double> uvwvec(matrix, TMatrixT<double>::kMult, xyzvec);
1886 TVector3 uvw = TVector3(uvwvec[0][0], uvwvec[1][0], uvwvec[2][0]);
1892 TMatrixT<double> matrix(3, 3);
1893 matrix[0][0] = di[0];
1894 matrix[0][1] = di[1];
1895 matrix[0][2] = di[2];
1896 matrix[1][0] = dj[0];
1897 matrix[1][1] = dj[1];
1898 matrix[1][2] = dj[2];
1899 matrix[2][0] = dk[0];
1900 matrix[2][1] = dk[1];
1901 matrix[2][2] = dk[2];
1903 TMatrixT<double> uvwvec(3, 1);
1904 uvwvec[0][0] = uvw.X();
1905 uvwvec[1][0] = uvw.Y();
1906 uvwvec[2][0] = uvw.Z();
1908 TMatrixT<double> uvwrot(matrix, TMatrixT<double>::kTransposeMult, uvwvec);
1910 TMatrixT<double> origin(3, 1);
1911 origin[0][0] = o.X();
1912 origin[1][0] = o.Y();
1913 origin[2][0] = o.Z();
1915 TMatrixT<double> xyzvec(3, 1);
1916 xyzvec = uvwrot + origin;
1918 TVector3 xyz = TVector3(xyzvec[0][0], xyzvec[1][0], xyzvec[2][0]);
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 FromSDToPt(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 FromMarsToSD(Double_t PD[3], Double_t RD[6][6], Double_t H[3], Int_t CH, Double_t DJ1[3], Double_t DK1[3], Int_t &IERR, Double_t &SP1, Double_t *PC, Double_t *RC)
void FromSDToMars(Double_t PC[3], Double_t RC[15], Double_t H[3], Int_t CH, Double_t SP1, Double_t DJ1[3], Double_t DK1[3], Double_t *PD, sixMat &RD)
void FromPtToSC(Double_t PC[3], Double_t RC[15], Double_t *PD, Double_t *RD, Int_t &IERR)
void FromSCToPt(Double_t PC[3], Double_t RC[15], Double_t *PD, Double_t *RD, Int_t &IERR)
void FromVec15ToMat25(Double_t V[15], fiveMat &A)
void SymmProd(Double_t A[25], Double_t S[15], Double_t *R)
ClassImp(FairEventBuilder)
void FromSD1ToSD2(Double_t PD1[3], Double_t RD1[15], Double_t H[3], Int_t CH, Double_t SP1, Double_t DJ1[3], Double_t DK1[3], Double_t DJ2[3], Double_t DK2[3], Int_t &IERR, Double_t &SP2, Double_t *PD2, Double_t *RD2)
void FromMat25ToVec15(Double_t A[5][5], Double_t *V)
TVector3 FromMARSToSDCoord(TVector3 xyz, TVector3 o, TVector3 di, TVector3 dj, TVector3 dk)
TVector3 FromSDToMARSCoord(TVector3 uvw, TVector3 o, TVector3 di, TVector3 dj, TVector3 dk)
void FromMatToVec(Double_t A[5][5], Double_t *V)
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)
void FromVecToMat(fiveMat &A, Double_t V[25])
void FromSCToSD(Double_t PC[3], Double_t RC[15], Double_t H[3], Int_t CH, Double_t DJ[3], Double_t DK[3], Int_t &IERR, Double_t &SPU, Double_t *PD, Double_t *RD)
void FromPtToSD(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)