258 Double_t XX, YY, ZZ, X, Y, Z, FX, FY, FZ, pfScale;
259 Float_t fHemiX = 1., fHemiY = 1., fHemiZ = 1;
261 X = Point[0] -
fPosX;
262 Y = Point[1] -
fPosY;
263 Z = Point[2] -
fPosZ;
271 PALC0(XX * 0.01, YY * 0.01, ZZ * 0.01, &FX, &FY,
281 if (X < 0.) fHemiX = -1.;
282 if (Y < 0.) fHemiY = -1.;
284 FX = FX * fHemiX * fHemiY;
286 if ((fType == 3) && (Z < 0.))
289 FZ = FZ * fHemiY * fHemiZ;
333 const char* BsFortranAsciiFileName3)
338 TString fileNam1 = BsFortranAsciiFileName1;
339 ifstream fBsFortranAscii1(fileNam1);
340 if (!fBsFortranAscii1.is_open()) { cerr <<
"ERROR: File " << BsFortranAsciiFileName1 <<
" not opened!" << endl; }
344 fX =
new TArrayF(
LL1);
345 UX1 =
fX->GetArray();
346 for (i = 0; i <
LL1; i++) {
347 fBsFortranAscii1 >> val;
353 for (i = 0; i <
NDIM; i++) {
354 fBsFortranAscii1 >> val;
355 fBsBx->AddAt(val, i);
358 fBsFortranAscii1.close();
361 TString fileNam2 = BsFortranAsciiFileName2;
362 ifstream fBsFortranAscii2(fileNam2);
363 if (!fBsFortranAscii2.is_open()) { cerr <<
"ERROR: File " << BsFortranAsciiFileName2 <<
" not opened!" << endl; }
366 fY =
new TArrayF(
LL2);
367 UX2 =
fY->GetArray();
368 for (i = 0; i <
LL2; i++) {
369 fBsFortranAscii2 >> val;
374 for (i = 0; i <
NDIM; i++) {
375 fBsFortranAscii2 >> val;
376 fBsBy->AddAt(val, i);
378 fBsFortranAscii2.close();
381 TString fileNam3 = BsFortranAsciiFileName3;
382 ifstream fBsFortranAscii3(fileNam3);
383 if (!fBsFortranAscii3.is_open()) { cerr <<
"ERROR: File " << BsFortranAsciiFileName3 <<
" not opened!" << endl; }
386 fZ =
new TArrayF(
LL3);
387 UX3 =
fZ->GetArray();
388 for (i = 0; i <
LL3; i++) {
389 fBsFortranAscii3 >> val;
394 for (i = 0; i <
NDIM; i++) {
395 fBsFortranAscii3 >> val;
396 fBsBz->AddAt(val, i);
398 fBsFortranAscii3.close();
402void CbmBsField::PALC0(Double_t X, Double_t Y, Double_t Z, Double_t* BX, Double_t* BY, Double_t* BZ)
404 Double_t UX[4], UY[4], UZ[4], X0, X1, X2, X3, X4, X5, X6, X7, Y0, Y1, Y2, Y3, Y4, Y5, Y6, Y7, VX0, VX1, VX2, VX3, VX4,
406 Long64_t INT1[4], INT2[4], INT3[4], KK, K1, K2, K3, KK1, KK2, KK3, NN0, I1, JJ0, I2, JJ1, I3, JJ2;
407 Double_t EPS = 1.0e-7, XRZYX, YRZYX, ZRZYX, XRZY, YRZY, ZRZY, XRZ, YRZ, ZRZ, SS3, SS2, SS1;
408 Int_t izero4 = 3, izero5 = 4;
409 if (X < (
UX1[izero4] - EPS))
goto m100;
410 for (KK = izero5; KK <
LL1; KK++) {
411 if (X <=
UX1[KK])
goto m52;
416 if (Y < (
UX2[izero4] - EPS))
goto m100;
417 for (KK = izero5; KK <
LL2; KK++) {
418 if (Y <=
UX2[KK])
goto m54;
423 if (Z < (
UX3[izero4] - EPS))
goto m100;
425 for (KK = izero5; KK <
LL3; KK++) {
426 if (Z <=
UX3[KK])
goto m56;
439 UX[1 - 1] =
SPL0(X, X0, X1, X2, X3, X4);
440 UX[2 - 1] =
SPL0(X, X1, X2, X3, X4, X5);
441 UX[3 - 1] =
SPL0(X, X2, X3, X4, X5, X6);
442 UX[4 - 1] =
SPL0(X, X3, X4, X5, X6, X7);
452 UY[1 - 1] =
SPL0(Y, Y0, Y1, Y2, Y3, Y4);
453 UY[2 - 1] =
SPL0(Y, Y1, Y2, Y3, Y4, Y5);
454 UY[3 - 1] =
SPL0(Y, Y2, Y3, Y4, Y5, Y6);
455 UY[4 - 1] =
SPL0(Y, Y3, Y4, Y5, Y6, Y7);
465 UZ[1 - 1] =
SPL0(Z, VX0, VX1, VX2, VX3, VX4);
466 UZ[2 - 1] =
SPL0(Z, VX1, VX2, VX3, VX4, VX5);
467 UZ[3 - 1] =
SPL0(Z, VX2, VX3, VX4, VX5, VX6);
468 UZ[4 - 1] =
SPL0(Z, VX3, VX4, VX5, VX6, VX7);
471 if (KK2 < 0) KK2 = 0;
473 if (KK3 < 0) KK3 = 0;
474 NN0 = KK1 +
II1 * (KK2 +
II2 * (KK3));
476 INT1[2 - 1] = NN0 + 1;
477 INT1[3 - 1] = NN0 + 2;
478 INT1[4 - 1] = NN0 + 3;
481 INT2[2 - 1] = (1) *
II1;
482 INT2[3 - 1] = (2) *
II1;
483 INT2[4 - 1] = (3) *
II1;
487 INT3[2 - 1] = (1) *
II1 *
II2;
488 INT3[3 - 1] = (2) *
II1 *
II2;
489 INT3[4 - 1] = (3) *
II1 *
II2;
495 for (I1 = 1; I1 <= 4; I1++) {
501 for (I2 = 1; I2 <= 4; I2++) {
502 JJ1 = JJ0 + INT2[I2 - 1];
506 for (I3 = 1; I3 <= 4; I3++) {
507 JJ2 = JJ1 + INT3[I3 - 1];
509 XRZ = XRZ +
F0[JJ2] * SS3;
510 YRZ = YRZ +
G0[JJ2] * SS3;
511 ZRZ = ZRZ +
U0[JJ2] * SS3;
514 XRZY = XRZY + XRZ * SS2;
515 YRZY = YRZY + YRZ * SS2;
516 ZRZY = ZRZY + ZRZ * SS2;
519 XRZYX = XRZYX + XRZY * SS1;
520 YRZYX = YRZYX + YRZY * SS1;
521 ZRZYX = ZRZYX + ZRZY * SS1;
537Float_t
CbmBsField::SPL0(Double_t T, Double_t X0, Double_t X1, Double_t X2, Double_t X3, Double_t X4)
539 Double_t W0, C0,
TT, RR, TPL, W1, W2, W3, value_SPL0;
540 if (T < X0)
goto n100;
541 if (T < X1)
goto n200;
542 if (T < X2)
goto n300;
543 if (T < X3)
goto n400;
544 if (T > X4)
goto n100;
546 W0 = (X1 - X0) * (X2 - X0) * (X3 - X0) * (X4 - X0);
549 TPL = RR * (
TT *
TT *
TT);
550 W1 = (X0 - X1) * (X2 - X1) * (X3 - X1) * (X4 - X1);
553 TPL = RR * (
TT *
TT *
TT) + TPL;
554 W2 = (X0 - X2) * (X1 - X2) * (X3 - X2) * (X4 - X2);
557 TPL = RR * (
TT *
TT *
TT) + TPL;
558 W3 = (X0 - X3) * (X1 - X3) * (X2 - X3) * (X4 - X3);
561 value_SPL0 = RR * (
TT *
TT *
TT) + TPL;
562 return ((Float_t) value_SPL0);
565 W0 = (X1 - X0) * (X2 - X0) * (X3 - X0) * (X4 - X0);
568 value_SPL0 = RR * (
TT *
TT *
TT);
569 return ((Float_t) value_SPL0);
572 W0 = (X1 - X0) * (X2 - X0) * (X3 - X0) * (X4 - X0);
575 TPL = RR * (
TT *
TT *
TT);
576 W1 = (X0 - X1) * (X2 - X1) * (X3 - X1) * (X4 - X1);
579 value_SPL0 = RR * (
TT *
TT *
TT) + TPL;
580 return ((Float_t) value_SPL0);
583 W0 = (X1 - X0) * (X2 - X0) * (X3 - X0) * (X4 - X0);
586 TPL = RR * (
TT *
TT *
TT);
587 W1 = (X0 - X1) * (X2 - X1) * (X3 - X1) * (X4 - X1);
590 TPL = RR * (
TT *
TT *
TT) + TPL;
591 W2 = (X0 - X2) * (X1 - X2) * (X3 - X2) * (X4 - X2);
594 value_SPL0 = RR * (
TT *
TT *
TT) + TPL;
595 return ((Float_t) value_SPL0);
598 return ((Float_t) value_SPL0);