62 fNumberIterations = 1;
67 fStatisticType = kFitOptimChiCounts;
68 fAlphaOptim = kFitAlphaHalving;
70 fFitTaylor = kFitTaylorOrderFirst;
183 if (numberPeaks <= 0){
184 Error (
"TSpectrum2Fit",
"Invalid number of peaks, must be > than 0");
336 Double_t da1 = 0.1740121, da2 = -0.0479399, da3 = 0.3739278, dap =
349 c = c * t * (da1 + t * (da2 + t * da3));
366 Double_t da1 = 0.1740121, da2 = -0.0479399, da3 = 0.3739278, dap =
378 c = (-1.) * dap * c * t * t * (da1 + t * (2. * da2 + t * 3. * da3)) -
396 if (pw > 10) c *= a2;
397 if (pw > 12) c *= a2;
417 Double_t sk = 0, b, lambdak, normk, normk_old = 0;
423 for (i = 0; i < size; i++) {
424 a[i][size + 2] = -a[i][size];
425 for (j = 0; j < size; j++) {
426 a[i][size + 2] += a[i][j] * a[j][size + 1];
428 normk += a[i][size + 2] * a[i][size + 2];
433 sk = normk / normk_old;
437 for (i = 0; i < size; i++) {
438 a[i][size + 3] = -a[i][size + 2] + sk * a[i][size + 3];
443 for (i = 0; i < size; i++) {
444 for (j = 0, b = 0; j < size; j++) {
445 b += a[i][j] * a[j][size + 3];
447 lambdak += b * a[i][size + 3];
450 lambdak = normk / lambdak;
454 for (i = 0; i < size; i++)
455 a[i][size + 1] += lambdak * a[i][size + 3];
458 }
while (k < size &&
TMath::Abs(normk) > 1e-50);
489 Double_t r, p,
r1, e,
ex,
ey, vx, s2, px, py, rx, ry, erx, ery;
492 for (j = 0; j < numOfFittedPeaks; j++) {
493 p = (x - parameter[7 * j + 1]) / sigmax;
494 r = (y - parameter[7 * j + 2]) / sigmay;
496 e = (p * p - 2 * ro * p * r + r *
r) / (2 * (1 - ro * ro));
505 erx =
Erfc(p / s2 + 1 / (2 * bx)), ery =
506 Erfc(r / s2 + 1 / (2 * by));
507 ex = p / (s2 * bx), ey = r / (s2 * by);
509 px =
exp(ex) * erx, py =
exp(ey) * ery;
511 r1 += 0.5 * txy * px * py;
514 rx =
Erfc(p / s2), ry =
Erfc(r / s2);
515 r1 += 0.5 * sxy * rx * ry;
517 vx = vx + parameter[7 * j] *
r1;
519 p = (x - parameter[7 * j + 5]) / sigmax;
530 erx =
Erfc(p / s2 + 1 / (2 * bx));
541 vx = vx + parameter[7 * j + 3] *
r1;
543 r = (y - parameter[7 * j + 6]) / sigmay;
554 ery =
Erfc(r / s2 + 1 / (2 * by));
565 vx = vx + parameter[7 * j + 4] *
r1;
568 vx = vx + a0 + ax * x + ay *
y;
595 Double_t p,
r,
r1 = 0, e,
ex,
ey, px, py, rx, ry, erx, ery, s2;
596 p = (x - x0) / sigmax;
597 r = (y - y0) / sigmay;
600 e = (p * p - 2 * ro * p * r + r *
r) / (2 * (1 - ro * ro));
609 erx =
Erfc(p / s2 + 1 / (2 * bx)), ery =
610 Erfc(r / s2 + 1 / (2 * by));
611 ex = p / (s2 * bx), ey = r / (s2 * by);
613 px =
exp(ex) * erx, py =
exp(ey) * ery;
615 r1 += 0.5 * txy * px * py;
618 rx =
Erfc(p / s2), ry =
Erfc(r / s2);
619 r1 += 0.5 * sxy * rx * ry;
646 p = (x - x0) / sigmax;
658 erx =
Erfc(p / s2 + 1 / (2 * bx));
698 Double_t p,
r,
r1 = 0, e,
ex,
ey, px, py, rx, ry, erx, ery, s2;
699 p = (x - x0) / sigmax;
700 r = (y - y0) / sigmay;
703 e = (p * p - 2 * ro * p * r + r *
r) / (2 * (1 - ro * ro));
710 e = -(ro * r - p) / sigmax;
711 e = e / (1 - ro * ro);
716 (-
Erfc(p / s2 + 1 / (2 * bx)) / (s2 * bx * sigmax) -
717 Derfc(p / s2 + 1 / (2 * bx)) / (s2 * sigmax)), ery =
718 Erfc(r / s2 + 1 / (2 * by));
719 ex = p / (s2 * bx), ey = r / (s2 * by);
721 px =
exp(ex) * erx, py =
exp(ey) * ery;
723 r1 += 0.5 * txy * px * py;
726 rx = -
Derfc(p / s2) / (s2 * sigmax), ry =
Erfc(r / s2);
727 r1 += 0.5 * sxy * rx * ry;
757 p = (x - x0) / sigmax;
758 r = (y - y0) / sigmay;
760 e = (p * p - 2 * ro * p * r + r *
r) / (2 * (1 - ro * ro));
767 e = -(ro * r - p) / sigmax;
768 e = e / (1 - ro * ro);
769 r1 = r1 * (e * e - 1 / ((1 - ro * ro) * sigmax * sigmax));
797 Double_t p,
r,
r1 = 0, e,
ex,
ey, px, py, rx, ry, erx, ery, s2;
798 p = (x - x0) / sigmax;
799 r = (y - y0) / sigmay;
802 e = (p * p - 2 * ro * p * r + r *
r) / (2 * (1 - ro * ro));
809 e = -(ro * p -
r) / sigmay;
810 e = e / (1 - ro * ro);
815 (-
Erfc(r / s2 + 1 / (2 * by)) / (s2 * by * sigmay) -
816 Derfc(r / s2 + 1 / (2 * by)) / (s2 * sigmay)), erx =
817 Erfc(p / s2 + 1 / (2 * bx));
818 ex = p / (s2 * bx), ey = r / (s2 * by);
820 px =
exp(ex) * erx, py =
exp(ey) * ery;
822 r1 += 0.5 * txy * px * py;
825 ry = -
Derfc(r / s2) / (s2 * sigmay), rx =
Erfc(p / s2);
826 r1 += 0.5 * sxy * rx * ry;
856 p = (x - x0) / sigmax;
857 r = (y - y0) / sigmay;
859 e = (p * p - 2 * ro * p * r + r *
r) / (2 * (1 - ro * ro));
866 e = -(ro * p -
r) / sigmay;
867 e = e / (1 - ro * ro);
868 r1 = r1 * (e * e - 1 / ((1 - ro * ro) * sigmay * sigmay));
895 p = (x - x0) / sigmax;
905 r1 = r1 * p / sigmax;
909 (-
Erfc(p / s2 + 1 / (2 * bx)) / (s2 * bx * sigmax) -
910 Derfc(p / s2 + 1 / (2 * bx)) / (s2 * sigmax));
917 rx = -
Derfc(p / s2) / (s2 * sigmax);
943 p = (x - x0) / sigmax;
952 r1 = r1 * (p * p / (sigmax * sigmax) - 1 / (sigmax * sigmax));
983 0, e,
a, b, x0, y0, s2, px, py, rx, ry, erx, ery,
ex,
ey;
986 for (j = 0; j < numOfFittedPeaks; j++) {
987 a = parameter[7 * j];
988 x0 = parameter[7 * j + 1];
989 y0 = parameter[7 * j + 2];
990 p = (x - x0) / sigmax;
991 r = (y - y0) / sigmay;
993 e = (p * p - 2 * ro * p * r + r *
r) / (2 * (1 - ro * ro));
1000 b = -(ro * p * r - p * p) / sigmax;
1001 e = e * b / (1 - ro * ro);
1005 -
Erfc(p / s2 + 1 / (2 * bx)) * p / (s2 * bx * sigmax) -
1006 Derfc(p / s2 + 1 / (2 * bx)) * p / (s2 * sigmax), ery =
1007 Erfc(r / s2 + 1 / (2 * by));
1008 ex = p / (s2 * bx), ey = r / (s2 * by);
1010 px =
exp(ex) * erx, py =
exp(ey) * ery;
1012 e += 0.5 * txy * px * py;
1015 rx = -
Derfc(p / s2) * p / (s2 * sigmax), ry =
Erfc(r / s2);
1016 e += 0.5 * sxy * rx * ry;
1021 x0 = parameter[7 * j + 5];
1022 p = (x - x0) / sigmax;
1030 e = 2 * b * e / sigmax;
1034 (-
Erfc(p / s2 + 1 / (2 * bx)) * p / (s2 * bx * sigmax) -
1035 Derfc(p / s2 + 1 / (2 * bx)) * p / (s2 * sigmax));
1042 rx = -
Derfc(p / s2) * p / (s2 * sigmax);
1045 r1 += parameter[7 * j + 3] * e;
1074 for (j = 0; j < numOfFittedPeaks; j++) {
1075 a = parameter[7 * j];
1076 x0 = parameter[7 * j + 1];
1077 y0 = parameter[7 * j + 2];
1078 p = (x - x0) / sigmax;
1079 r = (y - y0) / sigmay;
1081 e = (p * p - 2 * ro * p * r + r *
r) / (2 * (1 - ro * ro));
1088 b = -(ro * p * r - p * p) / sigmax;
1089 e = e * (b * b / (1 - ro * ro) -
1090 (3 * p * p - 2 * ro * p * r) / (sigmax * sigmax)) / (1 -
1097 x0 = parameter[7 * j + 5];
1098 p = (x - x0) / sigmax;
1106 e = e * (4 * b * b - 6 * b) / (sigmax * sigmax);
1107 r1 += parameter[7 * j + 3] * e;
1138 0, e,
a, b, x0, y0, s2, px, py, rx, ry, erx, ery,
ex,
ey;
1141 for (j = 0; j < numOfFittedPeaks; j++) {
1142 a = parameter[7 * j];
1143 x0 = parameter[7 * j + 1];
1144 y0 = parameter[7 * j + 2];
1145 p = (x - x0) / sigmax;
1146 r = (y - y0) / sigmay;
1148 e = (p * p - 2 * ro * p * r + r *
r) / (2 * (1 - ro * ro));
1155 b = -(ro * p * r - r *
r) / sigmay;
1156 e = e * b / (1 - ro * ro);
1160 -
Erfc(r / s2 + 1 / (2 * by)) * r / (s2 * by * sigmay) -
1161 Derfc(r / s2 + 1 / (2 * by)) * r / (s2 * sigmay), erx =
1162 Erfc(p / s2 + 1 / (2 * bx));
1163 ex = p / (s2 * bx), ey = r / (s2 * by);
1165 px =
exp(ex) * erx, py =
exp(ey) * ery;
1167 e += 0.5 * txy * px * py;
1170 ry = -
Derfc(r / s2) * r / (s2 * sigmay), rx =
Erfc(p / s2);
1171 e += 0.5 * sxy * rx * ry;
1176 y0 = parameter[7 * j + 6];
1177 r = (y - y0) / sigmay;
1185 e = 2 * b * e / sigmay;
1189 (-
Erfc(r / s2 + 1 / (2 * by)) * r / (s2 * by * sigmay) -
1190 Derfc(r / s2 + 1 / (2 * by)) * r / (s2 * sigmay));
1197 ry = -
Derfc(r / s2) * r / (s2 * sigmay);
1200 r1 += parameter[7 * j + 4] * e;
1229 for (j = 0; j < numOfFittedPeaks; j++) {
1230 a = parameter[7 * j];
1231 x0 = parameter[7 * j + 1];
1232 y0 = parameter[7 * j + 2];
1233 p = (x - x0) / sigmax;
1234 r = (y - y0) / sigmay;
1236 e = (p * p - 2 * ro * p * r + r *
r) / (2 * (1 - ro * ro));
1243 b = -(ro * p * r - r *
r) / sigmay;
1244 e = e * (b * b / (1 - ro * ro) -
1245 (3 * r * r - 2 * ro * r * p) / (sigmay * sigmay)) / (1 -
1252 y0 = parameter[7 * j + 6];
1253 r = (y - y0) / sigmay;
1261 e = e * (4 * b * b - 6 * b) / (sigmay * sigmay);
1262 r1 += parameter[7 * j + 4] * e;
1291 for (j = 0; j < numOfFittedPeaks; j++) {
1292 a = parameter[7 * j];
1293 x0 = parameter[7 * j + 1];
1294 y0 = parameter[7 * j + 2];
1298 rx = (px * px - 2 * r * px * qx + qx * qx);
1299 ex = rx / (2 * (1 - r *
r));
1306 tx = px * qx / (1 - r *
r);
1307 tx = tx - r * rx / ((1 - r *
r) * (1 - r * r));
1308 vx = vx + a * ex * tx;
1334 Double_t p,
r,
r1 = 0,
ex,
ey, px, py, erx, ery, s2, x0, y0,
a;
1337 for (j = 0; j < numOfFittedPeaks; j++) {
1338 a = parameter[7 * j];
1339 x0 = parameter[7 * j + 1];
1340 y0 = parameter[7 * j + 2];
1341 p = (x - x0) / sigmax;
1342 r = (y - y0) / sigmay;
1344 erx =
Erfc(p / s2 + 1 / (2 * bx)), ery =
1345 Erfc(r / s2 + 1 / (2 * by));
1346 ex = p / (s2 * bx), ey = r / (s2 * by);
1348 px =
exp(
ex) * erx, py =
exp(ey) * ery;
1350 r1 += 0.5 * a * px * py;
1377 for (j = 0; j < numOfFittedPeaks; j++) {
1378 a = parameter[7 * j];
1379 x0 = parameter[7 * j + 1];
1380 y0 = parameter[7 * j + 2];
1381 p = (x - x0) / sigmax;
1382 r = (y - y0) / sigmay;
1383 rx =
Erfc(p / s2), ry =
Erfc(r / s2);
1384 r1 += 0.5 * a * rx * ry;
1411 for (j = 0; j < numOfFittedPeaks; j++) {
1412 ax = parameter[7 * j + 3];
1413 x0 = parameter[7 * j + 5];
1414 p = (x - x0) / sigmax;
1416 erx =
Erfc(p / s2 + 1 / (2 * bx));
1421 r1 += 0.5 * ax * px;
1448 for (j = 0; j < numOfFittedPeaks; j++) {
1449 ax = parameter[7 * j + 4];
1450 x0 = parameter[7 * j + 6];
1451 p = (x - x0) / sigmax;
1453 erx =
Erfc(p / s2 + 1 / (2 * bx));
1458 r1 += 0.5 * ax * px;
1483 for (j = 0; j < numOfFittedPeaks; j++) {
1484 ax = parameter[7 * j + 3];
1485 x0 = parameter[7 * j + 5];
1486 p = (x - x0) / sigmax;
1489 r1 += 0.5 * ax * rx;
1514 for (j = 0; j < numOfFittedPeaks; j++) {
1515 ax = parameter[7 * j + 4];
1516 x0 = parameter[7 * j + 6];
1517 p = (x - x0) / sigmax;
1520 r1 += 0.5 * ax * rx;
1547 Double_t p,
r,
r1 = 0,
a, x0, y0, s2, px, py, erx, ery,
ex,
ey;
1550 for (j = 0; j < numOfFittedPeaks; j++) {
1551 a = parameter[7 * j];
1552 x0 = parameter[7 * j + 1];
1553 y0 = parameter[7 * j + 2];
1554 p = (x - x0) / sigmax;
1555 r = (y - y0) / sigmay;
1559 -
Erfc(p / s2 + 1 / (2 * bx)) * p / (s2 * bx * bx) -
1560 Derfc(p / s2 + 1 / (2 * bx)) / (s2 * bx * bx), ery =
1561 Erfc(r / s2 + 1 / (2 * by));
1562 ex = p / (s2 * bx), ey = r / (s2 * by);
1564 px =
exp(ex) * erx, py =
exp(ey) * ery;
1566 r1 += 0.5 *
a * txy * px * py;
1568 a = parameter[7 * j + 3];
1569 x0 = parameter[7 * j + 5];
1570 p = (x - x0) / sigmax;
1574 (-
Erfc(p / s2 + 1 / (2 * bx)) * p / (s2 * bx * bx) -
1575 Derfc(p / s2 + 1 / (2 * bx)) / (s2 * bx * bx));
1579 r1 += 0.5 *
a * tx * px;
1607 Double_t p,
r,
r1 = 0,
a, x0, y0, s2, px, py, erx, ery,
ex,
ey;
1610 for (j = 0; j < numOfFittedPeaks; j++) {
1611 a = parameter[7 * j];
1612 x0 = parameter[7 * j + 1];
1613 y0 = parameter[7 * j + 2];
1614 p = (x - x0) / sigmax;
1615 r = (y - y0) / sigmay;
1619 -
Erfc(r / s2 + 1 / (2 * by)) * r / (s2 * by * by) -
1620 Derfc(r / s2 + 1 / (2 * by)) / (s2 * by * by), erx =
1621 Erfc(p / s2 + 1 / (2 * bx));
1622 ex = p / (s2 * bx), ey = r / (s2 * by);
1624 px =
exp(ex) * erx, py =
exp(ey) * ery;
1626 r1 += 0.5 *
a * txy * px * py;
1628 a = parameter[7 * j + 4];
1629 y0 = parameter[7 * j + 6];
1630 r = (y - y0) / sigmay;
1634 (-
Erfc(r / s2 + 1 / (2 * by)) * r / (s2 * by * by) -
1635 Derfc(r / s2 + 1 / (2 * by)) / (s2 * by * by));
1639 r1 += 0.5 *
a * ty * py;
1667 r = 2 * a * pi * sx * sy *
r;
1693 r = 2 * pi * sx * sy *
r;
1720 r = a * 2 * pi * sy *
r;
1747 r = a * 2 * pi * sx *
r;
1774 r = -a * 2 * pi * sx * sy * ro /
r;
2692 Int_t i, i1, i2, j, k, shift =
2695 Double_t a, b,
c, d = 0, alpha, chi_opt, yw, ywm,
f, chi2, chi_min, chi =
2696 0,
pi, pmin = 0, chi_cel = 0, chi_er;
2698 for (i = 0, j = 0; i <
fNPeaks; i++) {
2699 working_space[7 * i] =
fAmpInit[i];
2701 working_space[shift + j] =
fAmpInit[i];
2746 working_space[7 * i + 2] =
fRoInit;
2748 working_space[shift + j] =
fRoInit;
2751 working_space[7 * i + 3] =
fA0Init;
2753 working_space[shift + j] =
fA0Init;
2756 working_space[7 * i + 4] =
fAxInit;
2758 working_space[shift + j] =
fAxInit;
2761 working_space[7 * i + 5] =
fAyInit;
2763 working_space[shift + j] =
fAyInit;
2766 working_space[7 * i + 6] =
fTxyInit;
2768 working_space[shift + j] =
fTxyInit;
2771 working_space[7 * i + 7] =
fSxyInit;
2773 working_space[shift + j] =
fSxyInit;
2776 working_space[7 * i + 8] =
fTxInit;
2778 working_space[shift + j] =
fTxInit;
2781 working_space[7 * i + 9] =
fTyInit;
2783 working_space[shift + j] =
fTyInit;
2786 working_space[7 * i + 10] =
fSxyInit;
2788 working_space[shift + j] =
fSxInit;
2791 working_space[7 * i + 11] =
fSyInit;
2793 working_space[shift + j] =
fSyInit;
2796 working_space[7 * i + 12] =
fBxInit;
2798 working_space[shift + j] =
fBxInit;
2801 working_space[7 * i + 13] =
fByInit;
2803 working_space[shift + j] =
fByInit;
2808 for (j = 0; j < size; j++) {
2809 working_space[2 * shift + j] = 0, working_space[3 * shift + j] = 0;
2814 chi_opt = 0, pw =
fPower - 2;
2817 yw = source[i1][i2];
2819 f =
Shape2(fNPeaks, i1, i2,
2820 working_space, working_space[peak_vel],
2821 working_space[peak_vel + 1],
2822 working_space[peak_vel + 2],
2823 working_space[peak_vel + 3],
2824 working_space[peak_vel + 4],
2825 working_space[peak_vel + 5],
2826 working_space[peak_vel + 6],
2827 working_space[peak_vel + 7],
2828 working_space[peak_vel + 8],
2829 working_space[peak_vel + 9],
2830 working_space[peak_vel + 10],
2831 working_space[peak_vel + 11],
2832 working_space[peak_vel + 12],
2833 working_space[peak_vel + 13]);
2841 chi_opt += (yw -
f) * (yw - f) / ywm;
2861 for (j = 0, k = 0; j <
fNPeaks; j++) {
2864 working_space[7 * j + 1],
2865 working_space[7 * j + 2],
2866 working_space[peak_vel],
2867 working_space[peak_vel + 1],
2868 working_space[peak_vel + 2],
2869 working_space[peak_vel + 6],
2870 working_space[peak_vel + 7],
2871 working_space[peak_vel + 12],
2872 working_space[peak_vel + 13]);
2876 b = a * (yw * yw - f *
f) / (ywm * ywm);
2877 working_space[2 * shift + k] += b *
c;
2878 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
2879 working_space[3 * shift + k] += b *
c;
2883 b = a * (yw -
f) / ywm;
2884 working_space[2 * shift + k] += b *
c;
2886 working_space[3 * shift + k] += b *
c;
2893 working_space[7 * j],
2894 working_space[7 * j + 1],
2895 working_space[7 * j + 2],
2896 working_space[peak_vel],
2897 working_space[peak_vel + 1],
2898 working_space[peak_vel + 2],
2899 working_space[peak_vel + 6],
2900 working_space[peak_vel + 7],
2901 working_space[peak_vel + 12],
2902 working_space[peak_vel + 13]);
2905 working_space[7 * j],
2906 working_space[7 * j + 1],
2907 working_space[7 * j + 2],
2908 working_space[peak_vel],
2909 working_space[peak_vel + 1],
2910 working_space[peak_vel + 2]);
2916 if (((a + d) <= 0 && a >= 0) || ((a + d) >= 0
2925 b = a * (yw * yw - f *
f) / (ywm * ywm);
2926 working_space[2 * shift + k] += b *
c;
2927 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
2928 working_space[3 * shift + k] += b *
c;
2932 b = a * (yw -
f) / ywm;
2933 working_space[2 * shift + k] += b *
c;
2935 working_space[3 * shift + k] += b *
c;
2942 working_space[7 * j],
2943 working_space[7 * j + 1],
2944 working_space[7 * j + 2],
2945 working_space[peak_vel],
2946 working_space[peak_vel + 1],
2947 working_space[peak_vel + 2],
2948 working_space[peak_vel + 6],
2949 working_space[peak_vel + 7],
2950 working_space[peak_vel + 12],
2951 working_space[peak_vel + 13]);
2954 working_space[7 * j],
2955 working_space[7 * j + 1],
2956 working_space[7 * j + 2],
2957 working_space[peak_vel],
2958 working_space[peak_vel + 1],
2959 working_space[peak_vel + 2]);
2965 if (((a + d) <= 0 && a >= 0) || ((a + d) >= 0
2974 b = a * (yw * yw - f *
f) / (ywm * ywm);
2975 working_space[2 * shift + k] += b *
c;
2976 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
2977 working_space[3 * shift + k] += b *
c;
2981 b = a * (yw -
f) / ywm;
2982 working_space[2 * shift + k] += b *
c;
2984 working_space[3 * shift + k] += b *
c;
2990 a =
Derampx(i1, working_space[7 * j + 5],
2991 working_space[peak_vel],
2992 working_space[peak_vel + 8],
2993 working_space[peak_vel + 10],
2994 working_space[peak_vel + 12]);
2998 b = a * (yw * yw - f *
f) / (ywm * ywm);
2999 working_space[2 * shift + k] += b *
c;
3000 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3001 working_space[3 * shift + k] += b *
c;
3005 b = a * (yw -
f) / ywm;
3006 working_space[2 * shift + k] += b *
c;
3008 working_space[3 * shift + k] += b *
c;
3014 a =
Derampx(i2, working_space[7 * j + 6],
3015 working_space[peak_vel + 1],
3016 working_space[peak_vel + 9],
3017 working_space[peak_vel + 11],
3018 working_space[peak_vel + 13]);
3022 b = a * (yw * yw - f *
f) / (ywm * ywm);
3023 working_space[2 * shift + k] += b *
c;
3024 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3025 working_space[3 * shift + k] += b *
c;
3029 b = a * (yw -
f) / ywm;
3030 working_space[2 * shift + k] += b *
c;
3032 working_space[3 * shift + k] += b *
c;
3038 a =
Deri01(i1, working_space[7 * j + 3],
3039 working_space[7 * j + 5],
3040 working_space[peak_vel],
3041 working_space[peak_vel + 8],
3042 working_space[peak_vel + 10],
3043 working_space[peak_vel + 12]);
3045 d =
Derderi01(i1, working_space[7 * j + 3],
3046 working_space[7 * j + 5],
3047 working_space[peak_vel]);
3053 if (((a + d) <= 0 && a >= 0) || ((a + d) >= 0
3062 b = a * (yw * yw - f *
f) / (ywm * ywm);
3063 working_space[2 * shift + k] += b *
c;
3064 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3065 working_space[3 * shift + k] += b *
c;
3069 b = a * (yw -
f) / ywm;
3070 working_space[2 * shift + k] += b *
c;
3072 working_space[3 * shift + k] += b *
c;
3078 a =
Deri01(i2, working_space[7 * j + 4],
3079 working_space[7 * j + 6],
3080 working_space[peak_vel + 1],
3081 working_space[peak_vel + 9],
3082 working_space[peak_vel + 11],
3083 working_space[peak_vel + 13]);
3085 d =
Derderi01(i2, working_space[7 * j + 4],
3086 working_space[7 * j + 6],
3087 working_space[peak_vel + 1]);
3093 if (((a + d) <= 0 && a >= 0) || ((a + d) >= 0
3102 b = a * (yw * yw - f *
f) / (ywm * ywm);
3103 working_space[2 * shift + k] += b *
c;
3104 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3105 working_space[3 * shift + k] += b *
c;
3109 b = a * (yw -
f) / ywm;
3110 working_space[2 * shift + k] += b *
c;
3112 working_space[3 * shift + k] += b *
c;
3120 working_space, working_space[peak_vel],
3121 working_space[peak_vel + 1],
3122 working_space[peak_vel + 2],
3123 working_space[peak_vel + 6],
3124 working_space[peak_vel + 7],
3125 working_space[peak_vel + 8],
3126 working_space[peak_vel + 10],
3127 working_space[peak_vel + 12],
3128 working_space[peak_vel + 13]);
3132 working_space[peak_vel],
3133 working_space[peak_vel + 1],
3134 working_space[peak_vel + 2]);
3140 if (((a + d) <= 0 && a >= 0) || ((a + d) >= 0 && a <= 0))
3148 b = a * (yw * yw - f *
f) / (ywm * ywm);
3149 working_space[2 * shift + k] += b *
c;
3150 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3151 working_space[3 * shift + k] += b *
c;
3155 b = a * (yw -
f) / ywm;
3156 working_space[2 * shift + k] += b *
c;
3158 working_space[3 * shift + k] += b *
c;
3165 working_space, working_space[peak_vel],
3166 working_space[peak_vel + 1],
3167 working_space[peak_vel + 2],
3168 working_space[peak_vel + 6],
3169 working_space[peak_vel + 7],
3170 working_space[peak_vel + 9],
3171 working_space[peak_vel + 11],
3172 working_space[peak_vel + 12],
3173 working_space[peak_vel + 13]);
3177 working_space[peak_vel],
3178 working_space[peak_vel + 1],
3179 working_space[peak_vel + 2]);
3185 if (((a + d) <= 0 && a >= 0) || ((a + d) >= 0 && a <= 0))
3193 b = a * (yw * yw - f *
f) / (ywm * ywm);
3194 working_space[2 * shift + k] += b *
c;
3195 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3196 working_space[3 * shift + k] += b *
c;
3200 b = a * (yw -
f) / ywm;
3201 working_space[2 * shift + k] += b *
c;
3203 working_space[3 * shift + k] += b *
c;
3209 a =
Derro(fNPeaks, i1, i2,
3210 working_space, working_space[peak_vel],
3211 working_space[peak_vel + 1],
3212 working_space[peak_vel + 2]);
3218 if (((a + d) <= 0 && a >= 0) || ((a + d) >= 0 && a <= 0))
3226 b = a * (yw * yw - f *
f) / (ywm * ywm);
3227 working_space[2 * shift + k] += b *
c;
3228 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3229 working_space[3 * shift + k] += b *
c;
3233 b = a * (yw -
f) / ywm;
3234 working_space[2 * shift + k] += b *
c;
3236 working_space[3 * shift + k] += b *
c;
3246 b = a * (yw * yw - f *
f) / (ywm * ywm);
3247 working_space[2 * shift + k] += b *
c;
3248 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3249 working_space[3 * shift + k] += b *
c;
3253 b = a * (yw -
f) / ywm;
3254 working_space[2 * shift + k] += b *
c;
3256 working_space[3 * shift + k] += b *
c;
3266 b = a * (yw * yw - f *
f) / (ywm * ywm);
3267 working_space[2 * shift + k] += b *
c;
3268 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3269 working_space[3 * shift + k] += b *
c;
3273 b = a * (yw -
f) / ywm;
3274 working_space[2 * shift + k] += b *
c;
3276 working_space[3 * shift + k] += b *
c;
3286 b = a * (yw * yw - f *
f) / (ywm * ywm);
3287 working_space[2 * shift + k] += b *
c;
3288 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3289 working_space[3 * shift + k] += b *
c;
3293 b = a * (yw -
f) / ywm;
3294 working_space[2 * shift + k] += b *
c;
3296 working_space[3 * shift + k] += b *
c;
3302 a =
Dertxy(fNPeaks, i1, i2,
3303 working_space, working_space[peak_vel],
3304 working_space[peak_vel + 1],
3305 working_space[peak_vel + 12],
3306 working_space[peak_vel + 13]);
3310 b = a * (yw * yw - f *
f) / (ywm * ywm);
3311 working_space[2 * shift + k] += b *
c;
3312 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3313 working_space[3 * shift + k] += b *
c;
3317 b = a * (yw -
f) / ywm;
3318 working_space[2 * shift + k] += b *
c;
3320 working_space[3 * shift + k] += b *
c;
3326 a =
Dersxy(fNPeaks, i1, i2,
3327 working_space, working_space[peak_vel],
3328 working_space[peak_vel + 1]);
3332 b = a * (yw * yw - f *
f) / (ywm * ywm);
3333 working_space[2 * shift + k] += b *
c;
3334 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3335 working_space[3 * shift + k] += b *
c;
3339 b = a * (yw -
f) / ywm;
3340 working_space[2 * shift + k] += b *
c;
3342 working_space[3 * shift + k] += b *
c;
3348 a =
Dertx(fNPeaks, i1, working_space,
3349 working_space[peak_vel],
3350 working_space[peak_vel + 12]);
3354 b = a * (yw * yw - f *
f) / (ywm * ywm);
3355 working_space[2 * shift + k] += b *
c;
3356 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3357 working_space[3 * shift + k] += b *
c;
3361 b = a * (yw -
f) / ywm;
3362 working_space[2 * shift + k] += b *
c;
3364 working_space[3 * shift + k] += b *
c;
3370 a =
Derty(fNPeaks, i2, working_space,
3371 working_space[peak_vel + 1],
3372 working_space[peak_vel + 13]);
3376 b = a * (yw * yw - f *
f) / (ywm * ywm);
3377 working_space[2 * shift + k] += b *
c;
3378 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3379 working_space[3 * shift + k] += b *
c;
3383 b = a * (yw -
f) / ywm;
3384 working_space[2 * shift + k] += b *
c;
3386 working_space[3 * shift + k] += b *
c;
3392 a =
Dersx(fNPeaks, i1, working_space,
3393 working_space[peak_vel]);
3397 b = a * (yw * yw - f *
f) / (ywm * ywm);
3398 working_space[2 * shift + k] += b *
c;
3399 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3400 working_space[3 * shift + k] += b *
c;
3404 b = a * (yw -
f) / ywm;
3405 working_space[2 * shift + k] += b *
c;
3407 working_space[3 * shift + k] += b *
c;
3413 a =
Dersy(fNPeaks, i2, working_space,
3414 working_space[peak_vel + 1]);
3418 b = a * (yw * yw - f *
f) / (ywm * ywm);
3419 working_space[2 * shift + k] += b *
c;
3420 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3421 working_space[3 * shift + k] += b *
c;
3425 b = a * (yw -
f) / ywm;
3426 working_space[2 * shift + k] += b *
c;
3428 working_space[3 * shift + k] += b *
c;
3434 a =
Derbx(fNPeaks, i1, i2,
3435 working_space, working_space[peak_vel],
3436 working_space[peak_vel + 1],
3437 working_space[peak_vel + 6],
3438 working_space[peak_vel + 8],
3439 working_space[peak_vel + 12],
3440 working_space[peak_vel + 13]);
3444 b = a * (yw * yw - f *
f) / (ywm * ywm);
3445 working_space[2 * shift + k] += b *
c;
3446 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3447 working_space[3 * shift + k] += b *
c;
3451 b = a * (yw -
f) / ywm;
3452 working_space[2 * shift + k] += b *
c;
3454 working_space[3 * shift + k] += b *
c;
3460 a =
Derby(fNPeaks, i1, i2,
3461 working_space, working_space[peak_vel],
3462 working_space[peak_vel + 1],
3463 working_space[peak_vel + 6],
3464 working_space[peak_vel + 8],
3465 working_space[peak_vel + 12],
3466 working_space[peak_vel + 13]);
3470 b = a * (yw * yw - f *
f) / (ywm * ywm);
3471 working_space[2 * shift + k] += b *
c;
3472 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3473 working_space[3 * shift + k] += b *
c;
3477 b = a * (yw -
f) / ywm;
3478 working_space[2 * shift + k] += b *
c;
3480 working_space[3 * shift + k] += b *
c;
3487 for (j = 0; j < size; j++) {
3488 if (
TMath::Abs(working_space[3 * shift + j]) > 0.000001)
3489 working_space[2 * shift + j] = working_space[2 * shift + j] /
TMath::Abs(working_space[3 * shift + j]);
3491 working_space[2 * shift + j] = 0;
3500 for (j = 0; j < size; j++) {
3501 working_space[4 * shift + j] = working_space[shift + j];
3507 chi_min = 10000 * chi2;
3510 chi_min = 0.1 * chi2;
3512 for (
pi = 0.1; flag == 0 &&
pi <= 100;
pi += 0.1) {
3513 for (j = 0; j < size; j++) {
3514 working_space[shift + j] = working_space[4 * shift + j] +
pi * alpha * working_space[2 * shift + j];
3516 for (i = 0, j = 0; i <
fNPeaks; i++) {
3518 if (working_space[shift + j] < 0)
3519 working_space[shift + j] = 0;
3520 working_space[7 * i] = working_space[shift + j];
3524 if (working_space[shift + j] <
fXmin)
3525 working_space[shift + j] =
fXmin;
3526 if (working_space[shift + j] >
fXmax)
3527 working_space[shift + j] =
fXmax;
3528 working_space[7 * i + 1] = working_space[shift + j];
3532 if (working_space[shift + j] <
fYmin)
3533 working_space[shift + j] =
fYmin;
3534 if (working_space[shift + j] >
fYmax)
3535 working_space[shift + j] =
fYmax;
3536 working_space[7 * i + 2] = working_space[shift + j];
3540 if (working_space[shift + j] < 0)
3541 working_space[shift + j] = 0;
3542 working_space[7 * i + 3] = working_space[shift + j];
3546 if (working_space[shift + j] < 0)
3547 working_space[shift + j] = 0;
3548 working_space[7 * i + 4] = working_space[shift + j];
3552 if (working_space[shift + j] <
fXmin)
3553 working_space[shift + j] =
fXmin;
3554 if (working_space[shift + j] >
fXmax)
3555 working_space[shift + j] =
fXmax;
3556 working_space[7 * i + 5] = working_space[shift + j];
3560 if (working_space[shift + j] <
fYmin)
3561 working_space[shift + j] =
fYmin;
3562 if (working_space[shift + j] >
fYmax)
3563 working_space[shift + j] =
fYmax;
3564 working_space[7 * i + 6] = working_space[shift + j];
3569 if (working_space[shift + j] < 0.001) {
3570 working_space[shift + j] = 0.001;
3572 working_space[peak_vel] = working_space[shift + j];
3576 if (working_space[shift + j] < 0.001) {
3577 working_space[shift + j] = 0.001;
3579 working_space[peak_vel + 1] = working_space[shift + j];
3583 if (working_space[shift + j] < -1) {
3584 working_space[shift + j] = -1;
3586 if (working_space[shift + j] > 1) {
3587 working_space[shift + j] = 1;
3589 working_space[peak_vel + 2] = working_space[shift + j];
3593 working_space[peak_vel + 3] = working_space[shift + j];
3597 working_space[peak_vel + 4] = working_space[shift + j];
3601 working_space[peak_vel + 5] = working_space[shift + j];
3605 working_space[peak_vel + 6] = working_space[shift + j];
3609 working_space[peak_vel + 7] = working_space[shift + j];
3613 working_space[peak_vel + 8] = working_space[shift + j];
3617 working_space[peak_vel + 9] = working_space[shift + j];
3621 working_space[peak_vel + 10] = working_space[shift + j];
3625 working_space[peak_vel + 11] = working_space[shift + j];
3629 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
3630 if (working_space[shift + j] < 0)
3631 working_space[shift + j] = -0.001;
3633 working_space[shift + j] = 0.001;
3635 working_space[peak_vel + 12] = working_space[shift + j];
3639 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
3640 if (working_space[shift + j] < 0)
3641 working_space[shift + j] = -0.001;
3643 working_space[shift + j] = 0.001;
3645 working_space[peak_vel + 13] = working_space[shift + j];
3651 yw = source[i1][i2];
3655 working_space[peak_vel],
3656 working_space[peak_vel + 1],
3657 working_space[peak_vel + 2],
3658 working_space[peak_vel + 3],
3659 working_space[peak_vel + 4],
3660 working_space[peak_vel + 5],
3661 working_space[peak_vel + 6],
3662 working_space[peak_vel + 7],
3663 working_space[peak_vel + 8],
3664 working_space[peak_vel + 9],
3665 working_space[peak_vel + 10],
3666 working_space[peak_vel + 11],
3667 working_space[peak_vel + 12],
3668 working_space[peak_vel + 13]);
3681 chi2 += (yw -
f) * (yw - f) / ywm;
3689 pmin =
pi, chi_min = chi2;
3699 for (j = 0; j < size; j++) {
3700 working_space[shift + j] = working_space[4 * shift + j] + pmin * alpha * working_space[2 * shift + j];
3702 for (i = 0, j = 0; i <
fNPeaks; i++) {
3704 if (working_space[shift + j] < 0)
3705 working_space[shift + j] = 0;
3706 working_space[7 * i] = working_space[shift + j];
3710 if (working_space[shift + j] <
fXmin)
3711 working_space[shift + j] =
fXmin;
3712 if (working_space[shift + j] >
fXmax)
3713 working_space[shift + j] =
fXmax;
3714 working_space[7 * i + 1] = working_space[shift + j];
3718 if (working_space[shift + j] <
fYmin)
3719 working_space[shift + j] =
fYmin;
3720 if (working_space[shift + j] >
fYmax)
3721 working_space[shift + j] =
fYmax;
3722 working_space[7 * i + 2] = working_space[shift + j];
3726 if (working_space[shift + j] < 0)
3727 working_space[shift + j] = 0;
3728 working_space[7 * i + 3] = working_space[shift + j];
3732 if (working_space[shift + j] < 0)
3733 working_space[shift + j] = 0;
3734 working_space[7 * i + 4] = working_space[shift + j];
3738 if (working_space[shift + j] <
fXmin)
3739 working_space[shift + j] =
fXmin;
3740 if (working_space[shift + j] >
fXmax)
3741 working_space[shift + j] =
fXmax;
3742 working_space[7 * i + 5] = working_space[shift + j];
3746 if (working_space[shift + j] <
fYmin)
3747 working_space[shift + j] =
fYmin;
3748 if (working_space[shift + j] >
fYmax)
3749 working_space[shift + j] =
fYmax;
3750 working_space[7 * i + 6] = working_space[shift + j];
3755 if (working_space[shift + j] < 0.001) {
3756 working_space[shift + j] = 0.001;
3758 working_space[peak_vel] = working_space[shift + j];
3762 if (working_space[shift + j] < 0.001) {
3763 working_space[shift + j] = 0.001;
3765 working_space[peak_vel + 1] = working_space[shift + j];
3769 if (working_space[shift + j] < -1) {
3770 working_space[shift + j] = -1;
3772 if (working_space[shift + j] > 1) {
3773 working_space[shift + j] = 1;
3775 working_space[peak_vel + 2] = working_space[shift + j];
3779 working_space[peak_vel + 3] = working_space[shift + j];
3783 working_space[peak_vel + 4] = working_space[shift + j];
3787 working_space[peak_vel + 5] = working_space[shift + j];
3791 working_space[peak_vel + 6] = working_space[shift + j];
3795 working_space[peak_vel + 7] = working_space[shift + j];
3799 working_space[peak_vel + 8] = working_space[shift + j];
3803 working_space[peak_vel + 9] = working_space[shift + j];
3807 working_space[peak_vel + 10] = working_space[shift + j];
3811 working_space[peak_vel + 11] = working_space[shift + j];
3815 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
3816 if (working_space[shift + j] < 0)
3817 working_space[shift + j] = -0.001;
3819 working_space[shift + j] = 0.001;
3821 working_space[peak_vel + 12] = working_space[shift + j];
3825 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
3826 if (working_space[shift + j] < 0)
3827 working_space[shift + j] = -0.001;
3829 working_space[shift + j] = 0.001;
3831 working_space[peak_vel + 13] = working_space[shift + j];
3839 for (j = 0; j < size; j++) {
3840 working_space[shift + j] = working_space[4 * shift + j] + alpha * working_space[2 * shift + j];
3842 for (i = 0, j = 0; i <
fNPeaks; i++) {
3844 if (working_space[shift + j] < 0)
3845 working_space[shift + j] = 0;
3846 working_space[7 * i] = working_space[shift + j];
3850 if (working_space[shift + j] <
fXmin)
3851 working_space[shift + j] =
fXmin;
3852 if (working_space[shift + j] >
fXmax)
3853 working_space[shift + j] =
fXmax;
3854 working_space[7 * i + 1] = working_space[shift + j];
3858 if (working_space[shift + j] <
fYmin)
3859 working_space[shift + j] =
fYmin;
3860 if (working_space[shift + j] >
fYmax)
3861 working_space[shift + j] =
fYmax;
3862 working_space[7 * i + 2] = working_space[shift + j];
3866 if (working_space[shift + j] < 0)
3867 working_space[shift + j] = 0;
3868 working_space[7 * i + 3] = working_space[shift + j];
3872 if (working_space[shift + j] < 0)
3873 working_space[shift + j] = 0;
3874 working_space[7 * i + 4] = working_space[shift + j];
3878 if (working_space[shift + j] <
fXmin)
3879 working_space[shift + j] =
fXmin;
3880 if (working_space[shift + j] >
fXmax)
3881 working_space[shift + j] =
fXmax;
3882 working_space[7 * i + 5] = working_space[shift + j];
3886 if (working_space[shift + j] <
fYmin)
3887 working_space[shift + j] =
fYmin;
3888 if (working_space[shift + j] >
fYmax)
3889 working_space[shift + j] =
fYmax;
3890 working_space[7 * i + 6] = working_space[shift + j];
3895 if (working_space[shift + j] < 0.001) {
3896 working_space[shift + j] = 0.001;
3898 working_space[peak_vel] = working_space[shift + j];
3902 if (working_space[shift + j] < 0.001) {
3903 working_space[shift + j] = 0.001;
3905 working_space[peak_vel + 1] = working_space[shift + j];
3909 if (working_space[shift + j] < -1) {
3910 working_space[shift + j] = -1;
3912 if (working_space[shift + j] > 1) {
3913 working_space[shift + j] = 1;
3915 working_space[peak_vel + 2] = working_space[shift + j];
3919 working_space[peak_vel + 3] = working_space[shift + j];
3923 working_space[peak_vel + 4] = working_space[shift + j];
3927 working_space[peak_vel + 5] = working_space[shift + j];
3931 working_space[peak_vel + 6] = working_space[shift + j];
3935 working_space[peak_vel + 7] = working_space[shift + j];
3939 working_space[peak_vel + 8] = working_space[shift + j];
3943 working_space[peak_vel + 9] = working_space[shift + j];
3947 working_space[peak_vel + 10] = working_space[shift + j];
3951 working_space[peak_vel + 11] = working_space[shift + j];
3955 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
3956 if (working_space[shift + j] < 0)
3957 working_space[shift + j] = -0.001;
3959 working_space[shift + j] = 0.001;
3961 working_space[peak_vel + 12] = working_space[shift + j];
3965 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
3966 if (working_space[shift + j] < 0)
3967 working_space[shift + j] = -0.001;
3969 working_space[shift + j] = 0.001;
3971 working_space[peak_vel + 13] = working_space[shift + j];
3977 yw = source[i1][i2];
3979 f =
Shape2(fNPeaks, i1, i2,
3980 working_space, working_space[peak_vel],
3981 working_space[peak_vel + 1],
3982 working_space[peak_vel + 2],
3983 working_space[peak_vel + 3],
3984 working_space[peak_vel + 4],
3985 working_space[peak_vel + 5],
3986 working_space[peak_vel + 6],
3987 working_space[peak_vel + 7],
3988 working_space[peak_vel + 8],
3989 working_space[peak_vel + 9],
3990 working_space[peak_vel + 10],
3991 working_space[peak_vel + 11],
3992 working_space[peak_vel + 12],
3993 working_space[peak_vel + 13]);
4006 chi += (yw -
f) * (yw - f) / ywm;
4014 alpha = alpha * chi_opt / (2 * chi);
4017 alpha = alpha / 10.0;
4020 }
while (((chi > chi_opt
4025 for (j = 0; j < size; j++) {
4026 working_space[4 * shift + j] = 0;
4027 working_space[2 * shift + j] = 0;
4029 for (i1 =
fXmin, chi_cel = 0; i1 <=
fXmax; i1++) {
4031 yw = source[i1][i2];
4034 f =
Shape2(fNPeaks, i1, i2,
4035 working_space, working_space[peak_vel],
4036 working_space[peak_vel + 1],
4037 working_space[peak_vel + 2],
4038 working_space[peak_vel + 3],
4039 working_space[peak_vel + 4],
4040 working_space[peak_vel + 5],
4041 working_space[peak_vel + 6],
4042 working_space[peak_vel + 7],
4043 working_space[peak_vel + 8],
4044 working_space[peak_vel + 9],
4045 working_space[peak_vel + 10],
4046 working_space[peak_vel + 11],
4047 working_space[peak_vel + 12],
4048 working_space[peak_vel + 13]);
4049 chi_opt = (yw -
f) * (yw - f) / yw;
4050 chi_cel += (yw -
f) * (yw - f) / yw;
4053 for (j = 0, k = 0; j <
fNPeaks; j++) {
4056 working_space[7 * j + 1],
4057 working_space[7 * j + 2],
4058 working_space[peak_vel],
4059 working_space[peak_vel + 1],
4060 working_space[peak_vel + 2],
4061 working_space[peak_vel + 6],
4062 working_space[peak_vel + 7],
4063 working_space[peak_vel + 12],
4064 working_space[peak_vel + 13]);
4067 working_space[2 * shift + k] += chi_opt *
c;
4069 working_space[4 * shift + k] += b *
c;
4075 working_space[7 * j],
4076 working_space[7 * j + 1],
4077 working_space[7 * j + 2],
4078 working_space[peak_vel],
4079 working_space[peak_vel + 1],
4080 working_space[peak_vel + 2],
4081 working_space[peak_vel + 6],
4082 working_space[peak_vel + 7],
4083 working_space[peak_vel + 12],
4084 working_space[peak_vel + 13]);
4087 working_space[2 * shift + k] += chi_opt *
c;
4089 working_space[4 * shift + k] += b *
c;
4095 working_space[7 * j],
4096 working_space[7 * j + 1],
4097 working_space[7 * j + 2],
4098 working_space[peak_vel],
4099 working_space[peak_vel + 1],
4100 working_space[peak_vel + 2],
4101 working_space[peak_vel + 6],
4102 working_space[peak_vel + 7],
4103 working_space[peak_vel + 12],
4104 working_space[peak_vel + 13]);
4107 working_space[2 * shift + k] += chi_opt *
c;
4109 working_space[4 * shift + k] += b *
c;
4114 a =
Derampx(i1, working_space[7 * j + 5],
4115 working_space[peak_vel],
4116 working_space[peak_vel + 8],
4117 working_space[peak_vel + 10],
4118 working_space[peak_vel + 12]);
4121 working_space[2 * shift + k] += chi_opt *
c;
4123 working_space[4 * shift + k] += b *
c;
4128 a =
Derampx(i2, working_space[7 * j + 6],
4129 working_space[peak_vel + 1],
4130 working_space[peak_vel + 9],
4131 working_space[peak_vel + 11],
4132 working_space[peak_vel + 13]);
4135 working_space[2 * shift + k] += chi_opt *
c;
4137 working_space[4 * shift + k] += b *
c;
4142 a =
Deri01(i1, working_space[7 * j + 3],
4143 working_space[7 * j + 5],
4144 working_space[peak_vel],
4145 working_space[peak_vel + 8],
4146 working_space[peak_vel + 10],
4147 working_space[peak_vel + 12]);
4150 working_space[2 * shift + k] += chi_opt *
c;
4152 working_space[4 * shift + k] += b *
c;
4157 a =
Deri01(i2, working_space[7 * j + 4],
4158 working_space[7 * j + 6],
4159 working_space[peak_vel + 1],
4160 working_space[peak_vel + 9],
4161 working_space[peak_vel + 11],
4162 working_space[peak_vel + 13]);
4165 working_space[2 * shift + k] += chi_opt *
c;
4167 working_space[4 * shift + k] += b *
c;
4174 working_space, working_space[peak_vel],
4175 working_space[peak_vel + 1],
4176 working_space[peak_vel + 2],
4177 working_space[peak_vel + 6],
4178 working_space[peak_vel + 7],
4179 working_space[peak_vel + 8],
4180 working_space[peak_vel + 10],
4181 working_space[peak_vel + 12],
4182 working_space[peak_vel + 13]);
4185 working_space[2 * shift + k] += chi_opt *
c;
4187 working_space[4 * shift + k] += b *
c;
4193 working_space, working_space[peak_vel],
4194 working_space[peak_vel + 1],
4195 working_space[peak_vel + 2],
4196 working_space[peak_vel + 6],
4197 working_space[peak_vel + 7],
4198 working_space[peak_vel + 9],
4199 working_space[peak_vel + 11],
4200 working_space[peak_vel + 12],
4201 working_space[peak_vel + 13]);
4204 working_space[2 * shift + k] += chi_opt *
c;
4206 working_space[4 * shift + k] += b *
c;
4211 a =
Derro(fNPeaks, i1, i2,
4212 working_space, working_space[peak_vel],
4213 working_space[peak_vel + 1],
4214 working_space[peak_vel + 2]);
4217 working_space[2 * shift + k] += chi_opt *
c;
4219 working_space[4 * shift + k] += b *
c;
4227 working_space[2 * shift + k] += chi_opt *
c;
4229 working_space[4 * shift + k] += b *
c;
4237 working_space[2 * shift + k] += chi_opt *
c;
4239 working_space[4 * shift + k] += b *
c;
4247 working_space[2 * shift + k] += chi_opt *
c;
4249 working_space[4 * shift + k] += b *
c;
4254 a =
Dertxy(fNPeaks, i1, i2,
4255 working_space, working_space[peak_vel],
4256 working_space[peak_vel + 1],
4257 working_space[peak_vel + 12],
4258 working_space[peak_vel + 13]);
4261 working_space[2 * shift + k] += chi_opt *
c;
4263 working_space[4 * shift + k] += b *
c;
4268 a =
Dersxy(fNPeaks, i1, i2,
4269 working_space, working_space[peak_vel],
4270 working_space[peak_vel + 1]);
4273 working_space[2 * shift + k] += chi_opt *
c;
4275 working_space[4 * shift + k] += b *
c;
4280 a =
Dertx(fNPeaks, i1, working_space,
4281 working_space[peak_vel],
4282 working_space[peak_vel + 12]);
4285 working_space[2 * shift + k] += chi_opt *
c;
4287 working_space[4 * shift + k] += b *
c;
4292 a =
Derty(fNPeaks, i2, working_space,
4293 working_space[peak_vel + 1],
4294 working_space[peak_vel + 13]);
4297 working_space[2 * shift + k] += chi_opt *
c;
4299 working_space[4 * shift + k] += b *
c;
4304 a =
Dersx(fNPeaks, i1, working_space,
4305 working_space[peak_vel]);
4308 working_space[2 * shift + k] += chi_opt *
c;
4310 working_space[4 * shift + k] += b *
c;
4315 a =
Dersy(fNPeaks, i2, working_space,
4316 working_space[peak_vel + 1]);
4319 working_space[2 * shift + k] += chi_opt *
c;
4321 working_space[4 * shift + k] += b *
c;
4326 a =
Derbx(fNPeaks, i1, i2,
4327 working_space, working_space[peak_vel],
4328 working_space[peak_vel + 1],
4329 working_space[peak_vel + 6],
4330 working_space[peak_vel + 8],
4331 working_space[peak_vel + 12],
4332 working_space[peak_vel + 13]);
4335 working_space[2 * shift + k] += chi_opt *
c;
4337 working_space[4 * shift + k] += b *
c;
4342 a =
Derby(fNPeaks, i1, i2,
4343 working_space, working_space[peak_vel],
4344 working_space[peak_vel + 1],
4345 working_space[peak_vel + 6],
4346 working_space[peak_vel + 8],
4347 working_space[peak_vel + 12],
4348 working_space[peak_vel + 13]);
4351 working_space[2 * shift + k] += chi_opt *
c;
4353 working_space[4 * shift + k] += b *
c;
4361 chi_er = chi_cel / b;
4362 for (i = 0, j = 0; i <
fNPeaks; i++) {
4364 Volume(working_space[7 * i], working_space[peak_vel],
4365 working_space[peak_vel + 1], working_space[peak_vel + 2]);
4369 a =
Derpa2(working_space[peak_vel],
4370 working_space[peak_vel + 1],
4371 working_space[peak_vel + 2]);
4372 b = working_space[4 * shift + j];
4382 working_space[peak_vel + 1],
4383 working_space[peak_vel + 2]);
4384 b = working_space[4 * shift + peak_vel];
4394 working_space[peak_vel],
4395 working_space[peak_vel + 2]);
4396 b = working_space[4 * shift + peak_vel + 1];
4405 a =
Derpro(working_space[shift + j], working_space[peak_vel],
4406 working_space[peak_vel + 1],
4407 working_space[peak_vel + 2]);
4408 b = working_space[4 * shift + peak_vel + 2];
4423 fAmpCalc[i] = working_space[shift + j];
4424 if (working_space[3 * shift + j] != 0)
4435 if (working_space[3 * shift + j] != 0)
4446 if (working_space[3 * shift + j] != 0)
4457 if (working_space[3 * shift + j] != 0)
4468 if (working_space[3 * shift + j] != 0)
4479 if (working_space[3 * shift + j] != 0)
4490 if (working_space[3 * shift + j] != 0)
4502 if (working_space[3 * shift + j] != 0)
4513 if (working_space[3 * shift + j] != 0)
4523 fRoCalc = working_space[shift + j];
4524 if (working_space[3 * shift + j] != 0)
4534 fA0Calc = working_space[shift + j];
4535 if (working_space[3 * shift + j] != 0)
4545 fAxCalc = working_space[shift + j];
4546 if (working_space[3 * shift + j] != 0)
4556 fAyCalc = working_space[shift + j];
4557 if (working_space[3 * shift + j] != 0)
4567 fTxyCalc = working_space[shift + j];
4568 if (working_space[3 * shift + j] != 0)
4578 fSxyCalc = working_space[shift + j];
4579 if (working_space[3 * shift + j] != 0)
4589 fTxCalc = working_space[shift + j];
4590 if (working_space[3 * shift + j] != 0)
4600 fTyCalc = working_space[shift + j];
4601 if (working_space[3 * shift + j] != 0)
4611 fSxCalc = working_space[shift + j];
4612 if (working_space[3 * shift + j] != 0)
4622 fSyCalc = working_space[shift + j];
4623 if (working_space[3 * shift + j] != 0)
4633 fBxCalc = working_space[shift + j];
4634 if (working_space[3 * shift + j] != 0)
4644 fByCalc = working_space[shift + j];
4645 if (working_space[3 * shift + j] != 0)
4658 f =
Shape2(fNPeaks, i1, i2,
4659 working_space, working_space[peak_vel],
4660 working_space[peak_vel + 1],
4661 working_space[peak_vel + 2],
4662 working_space[peak_vel + 3],
4663 working_space[peak_vel + 4],
4664 working_space[peak_vel + 5],
4665 working_space[peak_vel + 6],
4666 working_space[peak_vel + 7],
4667 working_space[peak_vel + 8],
4668 working_space[peak_vel + 9],
4669 working_space[peak_vel + 10],
4670 working_space[peak_vel + 11],
4671 working_space[peak_vel + 12],
4672 working_space[peak_vel + 13]);
4676 delete [] working_space;
4934 Int_t i, i1, i2, j, k, shift =
4935 7 *
fNPeaks + 14, peak_vel, size,
iter, regul_cycle,
4937 Double_t a, b,
c, alpha, chi_opt, yw, ywm,
f, chi2, chi_min, chi = 0
4938 ,
pi, pmin = 0, chi_cel = 0, chi_er;
4940 for (i = 0, j = 0; i <
fNPeaks; i++) {
4941 working_space[7 * i] =
fAmpInit[i];
4943 working_space[shift + j] =
fAmpInit[i];
4988 working_space[7 * i + 2] =
fRoInit;
4990 working_space[shift + j] =
fRoInit;
4993 working_space[7 * i + 3] =
fA0Init;
4995 working_space[shift + j] =
fA0Init;
4998 working_space[7 * i + 4] =
fAxInit;
5000 working_space[shift + j] =
fAxInit;
5003 working_space[7 * i + 5] =
fAyInit;
5005 working_space[shift + j] =
fAyInit;
5008 working_space[7 * i + 6] =
fTxyInit;
5010 working_space[shift + j] =
fTxyInit;
5013 working_space[7 * i + 7] =
fSxyInit;
5015 working_space[shift + j] =
fSxyInit;
5018 working_space[7 * i + 8] =
fTxInit;
5020 working_space[shift + j] =
fTxInit;
5023 working_space[7 * i + 9] =
fTyInit;
5025 working_space[shift + j] =
fTyInit;
5028 working_space[7 * i + 10] =
fSxyInit;
5030 working_space[shift + j] =
fSxInit;
5033 working_space[7 * i + 11] =
fSyInit;
5035 working_space[shift + j] =
fSyInit;
5038 working_space[7 * i + 12] =
fBxInit;
5040 working_space[shift + j] =
fBxInit;
5043 working_space[7 * i + 13] =
fByInit;
5045 working_space[shift + j] =
fByInit;
5050 for (i = 0; i < size; i++)
5051 working_matrix[i] =
new Double_t[size + 4];
5053 for (j = 0; j < size; j++) {
5054 working_space[3 * shift + j] = 0;
5055 for (k = 0; k <= size; k++) {
5056 working_matrix[j][k] = 0;
5066 for (j = 0, k = 0; j <
fNPeaks; j++) {
5068 working_space[2 * shift + k] =
5070 working_space[7 * j + 1],
5071 working_space[7 * j + 2],
5072 working_space[peak_vel],
5073 working_space[peak_vel + 1],
5074 working_space[peak_vel + 2],
5075 working_space[peak_vel + 6],
5076 working_space[peak_vel + 7],
5077 working_space[peak_vel + 12],
5078 working_space[peak_vel + 13]);
5082 working_space[2 * shift + k] =
5084 working_space[7 * j],
5085 working_space[7 * j + 1],
5086 working_space[7 * j + 2],
5087 working_space[peak_vel],
5088 working_space[peak_vel + 1],
5089 working_space[peak_vel + 2],
5090 working_space[peak_vel + 6],
5091 working_space[peak_vel + 7],
5092 working_space[peak_vel + 12],
5093 working_space[peak_vel + 13]);
5097 working_space[2 * shift + k] =
5099 working_space[7 * j],
5100 working_space[7 * j + 1],
5101 working_space[7 * j + 2],
5102 working_space[peak_vel],
5103 working_space[peak_vel + 1],
5104 working_space[peak_vel + 2],
5105 working_space[peak_vel + 6],
5106 working_space[peak_vel + 7],
5107 working_space[peak_vel + 12],
5108 working_space[peak_vel + 13]);
5112 working_space[2 * shift + k] =
5113 Derampx(i1, working_space[7 * j + 5],
5114 working_space[peak_vel],
5115 working_space[peak_vel + 8],
5116 working_space[peak_vel + 10],
5117 working_space[peak_vel + 12]);
5121 working_space[2 * shift + k] =
5122 Derampx(i2, working_space[7 * j + 6],
5123 working_space[peak_vel + 1],
5124 working_space[peak_vel + 9],
5125 working_space[peak_vel + 11],
5126 working_space[peak_vel + 13]);
5130 working_space[2 * shift + k] =
5131 Deri01(i1, working_space[7 * j + 3],
5132 working_space[7 * j + 5],
5133 working_space[peak_vel],
5134 working_space[peak_vel + 8],
5135 working_space[peak_vel + 10],
5136 working_space[peak_vel + 12]);
5140 working_space[2 * shift + k] =
5141 Deri01(i2, working_space[7 * j + 4],
5142 working_space[7 * j + 6],
5143 working_space[peak_vel + 1],
5144 working_space[peak_vel + 9],
5145 working_space[peak_vel + 11],
5146 working_space[peak_vel + 13]);
5150 working_space[2 * shift + k] =
5152 working_space, working_space[peak_vel],
5153 working_space[peak_vel + 1],
5154 working_space[peak_vel + 2],
5155 working_space[peak_vel + 6],
5156 working_space[peak_vel + 7],
5157 working_space[peak_vel + 8],
5158 working_space[peak_vel + 10],
5159 working_space[peak_vel + 12],
5160 working_space[peak_vel + 13]);
5164 working_space[2 * shift + k] =
5166 working_space, working_space[peak_vel],
5167 working_space[peak_vel + 1],
5168 working_space[peak_vel + 2],
5169 working_space[peak_vel + 6],
5170 working_space[peak_vel + 7],
5171 working_space[peak_vel + 9],
5172 working_space[peak_vel + 11],
5173 working_space[peak_vel + 12],
5174 working_space[peak_vel + 13]);
5178 working_space[2 * shift + k] =
5179 Derro(fNPeaks, i1, i2,
5180 working_space, working_space[peak_vel],
5181 working_space[peak_vel + 1],
5182 working_space[peak_vel + 2]);
5186 working_space[2 * shift + k] = 1.;
5190 working_space[2 * shift + k] = i1;
5194 working_space[2 * shift + k] = i2;
5198 working_space[2 * shift + k] =
5200 working_space, working_space[peak_vel],
5201 working_space[peak_vel + 1],
5202 working_space[peak_vel + 12],
5203 working_space[peak_vel + 13]);
5207 working_space[2 * shift + k] =
5209 working_space, working_space[peak_vel],
5210 working_space[peak_vel + 1]);
5214 working_space[2 * shift + k] =
5215 Dertx(fNPeaks, i1, working_space,
5216 working_space[peak_vel],
5217 working_space[peak_vel + 12]);
5221 working_space[2 * shift + k] =
5222 Derty(fNPeaks, i2, working_space,
5223 working_space[peak_vel + 1],
5224 working_space[peak_vel + 13]);
5228 working_space[2 * shift + k] =
5229 Dersx(fNPeaks, i1, working_space,
5230 working_space[peak_vel]);
5234 working_space[2 * shift + k] =
5235 Dersy(fNPeaks, i2, working_space,
5236 working_space[peak_vel + 1]);
5240 working_space[2 * shift + k] =
5241 Derbx(fNPeaks, i1, i2,
5242 working_space, working_space[peak_vel],
5243 working_space[peak_vel + 1],
5244 working_space[peak_vel + 6],
5245 working_space[peak_vel + 8],
5246 working_space[peak_vel + 12],
5247 working_space[peak_vel + 13]);
5251 working_space[2 * shift + k] =
5252 Derby(fNPeaks, i1, i2,
5253 working_space, working_space[peak_vel],
5254 working_space[peak_vel + 1],
5255 working_space[peak_vel + 6],
5256 working_space[peak_vel + 8],
5257 working_space[peak_vel + 12],
5258 working_space[peak_vel + 13]);
5261 yw = source[i1][i2];
5263 f =
Shape2(fNPeaks, i1, i2,
5264 working_space, working_space[peak_vel],
5265 working_space[peak_vel + 1],
5266 working_space[peak_vel + 2],
5267 working_space[peak_vel + 3],
5268 working_space[peak_vel + 4],
5269 working_space[peak_vel + 5],
5270 working_space[peak_vel + 6],
5271 working_space[peak_vel + 7],
5272 working_space[peak_vel + 8],
5273 working_space[peak_vel + 9],
5274 working_space[peak_vel + 10],
5275 working_space[peak_vel + 11],
5276 working_space[peak_vel + 12],
5277 working_space[peak_vel + 13]);
5285 chi_opt += (yw -
f) * (yw - f) / ywm;
5303 for (j = 0; j < size; j++) {
5304 for (k = 0; k < size; k++) {
5305 b = working_space[2 * shift +
5306 j] * working_space[2 * shift +
5309 b = b * (4 * yw - 2 *
f) / ywm;
5310 working_matrix[j][k] += b;
5312 working_space[3 * shift + j] += b;
5316 b = (f * f - yw * yw) / (ywm * ywm);
5320 for (j = 0; j < size; j++) {
5321 working_matrix[j][size] -=
5322 b * working_space[2 * shift + j];
5326 for (i = 0; i < size; i++) {
5327 working_matrix[i][size + 1] = 0;
5330 for (i = 0; i < size; i++) {
5331 working_space[2 * shift + i] = working_matrix[i][size + 1];
5340 for (j = 0; j < size; j++) {
5341 working_space[4 * shift + j] = working_space[shift + j];
5347 chi_min = 10000 * chi2;
5350 chi_min = 0.1 * chi2;
5352 for (
pi = 0.1; flag == 0 &&
pi <= 100;
pi += 0.1) {
5353 for (j = 0; j < size; j++) {
5354 working_space[shift + j] = working_space[4 * shift + j] +
pi * alpha * working_space[2 * shift + j];
5356 for (i = 0, j = 0; i <
fNPeaks; i++) {
5358 if (working_space[shift + j] < 0)
5359 working_space[shift + j] = 0;
5360 working_space[7 * i] = working_space[shift + j];
5364 if (working_space[shift + j] <
fXmin)
5365 working_space[shift + j] =
fXmin;
5366 if (working_space[shift + j] >
fXmax)
5367 working_space[shift + j] =
fXmax;
5368 working_space[7 * i + 1] = working_space[shift + j];
5372 if (working_space[shift + j] <
fYmin)
5373 working_space[shift + j] =
fYmin;
5374 if (working_space[shift + j] >
fYmax)
5375 working_space[shift + j] =
fYmax;
5376 working_space[7 * i + 2] = working_space[shift + j];
5380 if (working_space[shift + j] < 0)
5381 working_space[shift + j] = 0;
5382 working_space[7 * i + 3] = working_space[shift + j];
5386 if (working_space[shift + j] < 0)
5387 working_space[shift + j] = 0;
5388 working_space[7 * i + 4] = working_space[shift + j];
5392 if (working_space[shift + j] <
fXmin)
5393 working_space[shift + j] =
fXmin;
5394 if (working_space[shift + j] >
fXmax)
5395 working_space[shift + j] =
fXmax;
5396 working_space[7 * i + 5] = working_space[shift + j];
5400 if (working_space[shift + j] <
fYmin)
5401 working_space[shift + j] =
fYmin;
5402 if (working_space[shift + j] >
fYmax)
5403 working_space[shift + j] =
fYmax;
5404 working_space[7 * i + 6] = working_space[shift + j];
5409 if (working_space[shift + j] < 0.001) {
5410 working_space[shift + j] = 0.001;
5412 working_space[peak_vel] = working_space[shift + j];
5416 if (working_space[shift + j] < 0.001) {
5417 working_space[shift + j] = 0.001;
5419 working_space[peak_vel + 1] = working_space[shift + j];
5423 if (working_space[shift + j] < -1) {
5424 working_space[shift + j] = -1;
5426 if (working_space[shift + j] > 1) {
5427 working_space[shift + j] = 1;
5429 working_space[peak_vel + 2] = working_space[shift + j];
5433 working_space[peak_vel + 3] = working_space[shift + j];
5437 working_space[peak_vel + 4] = working_space[shift + j];
5441 working_space[peak_vel + 5] = working_space[shift + j];
5445 working_space[peak_vel + 6] = working_space[shift + j];
5449 working_space[peak_vel + 7] = working_space[shift + j];
5453 working_space[peak_vel + 8] = working_space[shift + j];
5457 working_space[peak_vel + 9] = working_space[shift + j];
5461 working_space[peak_vel + 10] = working_space[shift + j];
5465 working_space[peak_vel + 11] = working_space[shift + j];
5469 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
5470 if (working_space[shift + j] < 0)
5471 working_space[shift + j] = -0.001;
5473 working_space[shift + j] = 0.001;
5475 working_space[peak_vel + 12] = working_space[shift + j];
5479 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
5480 if (working_space[shift + j] < 0)
5481 working_space[shift + j] = -0.001;
5483 working_space[shift + j] = 0.001;
5485 working_space[peak_vel + 13] = working_space[shift + j];
5491 yw = source[i1][i2];
5495 working_space[peak_vel],
5496 working_space[peak_vel + 1],
5497 working_space[peak_vel + 2],
5498 working_space[peak_vel + 3],
5499 working_space[peak_vel + 4],
5500 working_space[peak_vel + 5],
5501 working_space[peak_vel + 6],
5502 working_space[peak_vel + 7],
5503 working_space[peak_vel + 8],
5504 working_space[peak_vel + 9],
5505 working_space[peak_vel + 10],
5506 working_space[peak_vel + 11],
5507 working_space[peak_vel + 12],
5508 working_space[peak_vel + 13]);
5521 chi2 += (yw -
f) * (yw - f) / ywm;
5529 pmin =
pi, chi_min = chi2;
5539 for (j = 0; j < size; j++) {
5540 working_space[shift + j] = working_space[4 * shift + j] + pmin * alpha * working_space[2 * shift + j];
5542 for (i = 0, j = 0; i <
fNPeaks; i++) {
5544 if (working_space[shift + j] < 0)
5545 working_space[shift + j] = 0;
5546 working_space[7 * i] = working_space[shift + j];
5550 if (working_space[shift + j] <
fXmin)
5551 working_space[shift + j] =
fXmin;
5552 if (working_space[shift + j] >
fXmax)
5553 working_space[shift + j] =
fXmax;
5554 working_space[7 * i + 1] = working_space[shift + j];
5558 if (working_space[shift + j] <
fYmin)
5559 working_space[shift + j] =
fYmin;
5560 if (working_space[shift + j] >
fYmax)
5561 working_space[shift + j] =
fYmax;
5562 working_space[7 * i + 2] = working_space[shift + j];
5566 if (working_space[shift + j] < 0)
5567 working_space[shift + j] = 0;
5568 working_space[7 * i + 3] = working_space[shift + j];
5572 if (working_space[shift + j] < 0)
5573 working_space[shift + j] = 0;
5574 working_space[7 * i + 4] = working_space[shift + j];
5578 if (working_space[shift + j] <
fXmin)
5579 working_space[shift + j] =
fXmin;
5580 if (working_space[shift + j] >
fXmax)
5581 working_space[shift + j] =
fXmax;
5582 working_space[7 * i + 5] = working_space[shift + j];
5586 if (working_space[shift + j] <
fYmin)
5587 working_space[shift + j] =
fYmin;
5588 if (working_space[shift + j] >
fYmax)
5589 working_space[shift + j] =
fYmax;
5590 working_space[7 * i + 6] = working_space[shift + j];
5595 if (working_space[shift + j] < 0.001) {
5596 working_space[shift + j] = 0.001;
5598 working_space[peak_vel] = working_space[shift + j];
5602 if (working_space[shift + j] < 0.001) {
5603 working_space[shift + j] = 0.001;
5605 working_space[peak_vel + 1] = working_space[shift + j];
5609 if (working_space[shift + j] < -1) {
5610 working_space[shift + j] = -1;
5612 if (working_space[shift + j] > 1) {
5613 working_space[shift + j] = 1;
5615 working_space[peak_vel + 2] = working_space[shift + j];
5619 working_space[peak_vel + 3] = working_space[shift + j];
5623 working_space[peak_vel + 4] = working_space[shift + j];
5627 working_space[peak_vel + 5] = working_space[shift + j];
5631 working_space[peak_vel + 6] = working_space[shift + j];
5635 working_space[peak_vel + 7] = working_space[shift + j];
5639 working_space[peak_vel + 8] = working_space[shift + j];
5643 working_space[peak_vel + 9] = working_space[shift + j];
5647 working_space[peak_vel + 10] = working_space[shift + j];
5651 working_space[peak_vel + 11] = working_space[shift + j];
5655 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
5656 if (working_space[shift + j] < 0)
5657 working_space[shift + j] = -0.001;
5659 working_space[shift + j] = 0.001;
5661 working_space[peak_vel + 12] = working_space[shift + j];
5665 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
5666 if (working_space[shift + j] < 0)
5667 working_space[shift + j] = -0.001;
5669 working_space[shift + j] = 0.001;
5671 working_space[peak_vel + 13] = working_space[shift + j];
5679 for (j = 0; j < size; j++) {
5680 working_space[shift + j] = working_space[4 * shift + j] + alpha * working_space[2 * shift + j];
5682 for (i = 0, j = 0; i <
fNPeaks; i++) {
5684 if (working_space[shift + j] < 0)
5685 working_space[shift + j] = 0;
5686 working_space[7 * i] = working_space[shift + j];
5690 if (working_space[shift + j] <
fXmin)
5691 working_space[shift + j] =
fXmin;
5692 if (working_space[shift + j] >
fXmax)
5693 working_space[shift + j] =
fXmax;
5694 working_space[7 * i + 1] = working_space[shift + j];
5698 if (working_space[shift + j] <
fYmin)
5699 working_space[shift + j] =
fYmin;
5700 if (working_space[shift + j] >
fYmax)
5701 working_space[shift + j] =
fYmax;
5702 working_space[7 * i + 2] = working_space[shift + j];
5706 if (working_space[shift + j] < 0)
5707 working_space[shift + j] = 0;
5708 working_space[7 * i + 3] = working_space[shift + j];
5712 if (working_space[shift + j] < 0)
5713 working_space[shift + j] = 0;
5714 working_space[7 * i + 4] = working_space[shift + j];
5718 if (working_space[shift + j] <
fXmin)
5719 working_space[shift + j] =
fXmin;
5720 if (working_space[shift + j] >
fXmax)
5721 working_space[shift + j] =
fXmax;
5722 working_space[7 * i + 5] = working_space[shift + j];
5726 if (working_space[shift + j] <
fYmin)
5727 working_space[shift + j] =
fYmin;
5728 if (working_space[shift + j] >
fYmax)
5729 working_space[shift + j] =
fYmax;
5730 working_space[7 * i + 6] = working_space[shift + j];
5735 if (working_space[shift + j] < 0.001) {
5736 working_space[shift + j] = 0.001;
5738 working_space[peak_vel] = working_space[shift + j];
5742 if (working_space[shift + j] < 0.001) {
5743 working_space[shift + j] = 0.001;
5745 working_space[peak_vel + 1] = working_space[shift + j];
5749 if (working_space[shift + j] < -1) {
5750 working_space[shift + j] = -1;
5752 if (working_space[shift + j] > 1) {
5753 working_space[shift + j] = 1;
5755 working_space[peak_vel + 2] = working_space[shift + j];
5759 working_space[peak_vel + 3] = working_space[shift + j];
5763 working_space[peak_vel + 4] = working_space[shift + j];
5767 working_space[peak_vel + 5] = working_space[shift + j];
5771 working_space[peak_vel + 6] = working_space[shift + j];
5775 working_space[peak_vel + 7] = working_space[shift + j];
5779 working_space[peak_vel + 8] = working_space[shift + j];
5783 working_space[peak_vel + 9] = working_space[shift + j];
5787 working_space[peak_vel + 10] = working_space[shift + j];
5791 working_space[peak_vel + 11] = working_space[shift + j];
5795 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
5796 if (working_space[shift + j] < 0)
5797 working_space[shift + j] = -0.001;
5799 working_space[shift + j] = 0.001;
5801 working_space[peak_vel + 12] = working_space[shift + j];
5805 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
5806 if (working_space[shift + j] < 0)
5807 working_space[shift + j] = -0.001;
5809 working_space[shift + j] = 0.001;
5811 working_space[peak_vel + 13] = working_space[shift + j];
5817 yw = source[i1][i2];
5819 f =
Shape2(fNPeaks, i1, i2,
5820 working_space, working_space[peak_vel],
5821 working_space[peak_vel + 1],
5822 working_space[peak_vel + 2],
5823 working_space[peak_vel + 3],
5824 working_space[peak_vel + 4],
5825 working_space[peak_vel + 5],
5826 working_space[peak_vel + 6],
5827 working_space[peak_vel + 7],
5828 working_space[peak_vel + 8],
5829 working_space[peak_vel + 9],
5830 working_space[peak_vel + 10],
5831 working_space[peak_vel + 11],
5832 working_space[peak_vel + 12],
5833 working_space[peak_vel + 13]);
5846 chi += (yw -
f) * (yw - f) / ywm;
5854 alpha = alpha * chi_opt / (2 * chi);
5857 alpha = alpha / 10.0;
5860 }
while (((chi > chi_opt
5865 for (j = 0; j < size; j++) {
5866 working_space[4 * shift + j] = 0;
5867 working_space[2 * shift + j] = 0;
5869 for (i1 =
fXmin, chi_cel = 0; i1 <=
fXmax; i1++) {
5871 yw = source[i1][i2];
5874 f =
Shape2(fNPeaks, i1, i2,
5875 working_space, working_space[peak_vel],
5876 working_space[peak_vel + 1],
5877 working_space[peak_vel + 2],
5878 working_space[peak_vel + 3],
5879 working_space[peak_vel + 4],
5880 working_space[peak_vel + 5],
5881 working_space[peak_vel + 6],
5882 working_space[peak_vel + 7],
5883 working_space[peak_vel + 8],
5884 working_space[peak_vel + 9],
5885 working_space[peak_vel + 10],
5886 working_space[peak_vel + 11],
5887 working_space[peak_vel + 12],
5888 working_space[peak_vel + 13]);
5889 chi_opt = (yw -
f) * (yw - f) / yw;
5890 chi_cel += (yw -
f) * (yw - f) / yw;
5893 for (j = 0, k = 0; j <
fNPeaks; j++) {
5896 working_space[7 * j + 1],
5897 working_space[7 * j + 2],
5898 working_space[peak_vel],
5899 working_space[peak_vel + 1],
5900 working_space[peak_vel + 2],
5901 working_space[peak_vel + 6],
5902 working_space[peak_vel + 7],
5903 working_space[peak_vel + 12],
5904 working_space[peak_vel + 13]);
5906 working_space[2 * shift + k] += chi_opt;
5908 working_space[4 * shift + k] += b;
5914 working_space[7 * j],
5915 working_space[7 * j + 1],
5916 working_space[7 * j + 2],
5917 working_space[peak_vel],
5918 working_space[peak_vel + 1],
5919 working_space[peak_vel + 2],
5920 working_space[peak_vel + 6],
5921 working_space[peak_vel + 7],
5922 working_space[peak_vel + 12],
5923 working_space[peak_vel + 13]);
5925 working_space[2 * shift + k] += chi_opt;
5927 working_space[4 * shift + k] += b;
5933 working_space[7 * j],
5934 working_space[7 * j + 1],
5935 working_space[7 * j + 2],
5936 working_space[peak_vel],
5937 working_space[peak_vel + 1],
5938 working_space[peak_vel + 2],
5939 working_space[peak_vel + 6],
5940 working_space[peak_vel + 7],
5941 working_space[peak_vel + 12],
5942 working_space[peak_vel + 13]);
5944 working_space[2 * shift + k] += chi_opt;
5946 working_space[4 * shift + k] += b;
5951 a =
Derampx(i1, working_space[7 * j + 5],
5952 working_space[peak_vel],
5953 working_space[peak_vel + 8],
5954 working_space[peak_vel + 10],
5955 working_space[peak_vel + 12]);
5957 working_space[2 * shift + k] += chi_opt;
5959 working_space[4 * shift + k] += b;
5964 a =
Derampx(i2, working_space[7 * j + 6],
5965 working_space[peak_vel + 1],
5966 working_space[peak_vel + 9],
5967 working_space[peak_vel + 11],
5968 working_space[peak_vel + 13]);
5970 working_space[2 * shift + k] += chi_opt;
5972 working_space[4 * shift + k] += b;
5977 a =
Deri01(i1, working_space[7 * j + 3],
5978 working_space[7 * j + 5],
5979 working_space[peak_vel],
5980 working_space[peak_vel + 8],
5981 working_space[peak_vel + 10],
5982 working_space[peak_vel + 12]);
5984 working_space[2 * shift + k] += chi_opt;
5986 working_space[4 * shift + k] += b;
5991 a =
Deri01(i2, working_space[7 * j + 4],
5992 working_space[7 * j + 6],
5993 working_space[peak_vel + 1],
5994 working_space[peak_vel + 9],
5995 working_space[peak_vel + 11],
5996 working_space[peak_vel + 13]);
5998 working_space[2 * shift + k] += chi_opt;
6000 working_space[4 * shift + k] += b;
6007 working_space, working_space[peak_vel],
6008 working_space[peak_vel + 1],
6009 working_space[peak_vel + 2],
6010 working_space[peak_vel + 6],
6011 working_space[peak_vel + 7],
6012 working_space[peak_vel + 8],
6013 working_space[peak_vel + 10],
6014 working_space[peak_vel + 12],
6015 working_space[peak_vel + 13]);
6017 working_space[2 * shift + k] += chi_opt;
6019 working_space[4 * shift + k] += b;
6025 working_space, working_space[peak_vel],
6026 working_space[peak_vel + 1],
6027 working_space[peak_vel + 2],
6028 working_space[peak_vel + 6],
6029 working_space[peak_vel + 7],
6030 working_space[peak_vel + 9],
6031 working_space[peak_vel + 11],
6032 working_space[peak_vel + 12],
6033 working_space[peak_vel + 13]);
6035 working_space[2 * shift + k] += chi_opt;
6037 working_space[4 * shift + k] += b;
6042 a =
Derro(fNPeaks, i1, i2,
6043 working_space, working_space[peak_vel],
6044 working_space[peak_vel + 1],
6045 working_space[peak_vel + 2]);
6047 working_space[2 * shift + k] += chi_opt;
6049 working_space[4 * shift + k] += b;
6056 working_space[2 * shift + k] += chi_opt;
6058 working_space[4 * shift + k] += b;
6065 working_space[2 * shift + k] += chi_opt;
6067 working_space[4 * shift + k] += b;
6074 working_space[2 * shift + k] += chi_opt;
6076 working_space[4 * shift + k] += b;
6081 a =
Dertxy(fNPeaks, i1, i2,
6082 working_space, working_space[peak_vel],
6083 working_space[peak_vel + 1],
6084 working_space[peak_vel + 12],
6085 working_space[peak_vel + 13]);
6087 working_space[2 * shift + k] += chi_opt;
6089 working_space[4 * shift + k] += b;
6094 a =
Dersxy(fNPeaks, i1, i2,
6095 working_space, working_space[peak_vel],
6096 working_space[peak_vel + 1]);
6098 working_space[2 * shift + k] += chi_opt;
6100 working_space[4 * shift + k] += b;
6105 a =
Dertx(fNPeaks, i1, working_space,
6106 working_space[peak_vel],
6107 working_space[peak_vel + 12]);
6109 working_space[2 * shift + k] += chi_opt;
6111 working_space[4 * shift + k] += b;
6116 a =
Derty(fNPeaks, i2, working_space,
6117 working_space[peak_vel + 1],
6118 working_space[peak_vel + 13]);
6120 working_space[2 * shift + k] += chi_opt;
6122 working_space[4 * shift + k] += b;
6127 a =
Dersx(fNPeaks, i1, working_space,
6128 working_space[peak_vel]);
6130 working_space[2 * shift + k] += chi_opt;
6132 working_space[4 * shift + k] += b;
6137 a =
Dersy(fNPeaks, i2, working_space,
6138 working_space[peak_vel + 1]);
6140 working_space[2 * shift + k] += chi_opt;
6142 working_space[4 * shift + k] += b;
6147 a =
Derbx(fNPeaks, i1, i2,
6148 working_space, working_space[peak_vel],
6149 working_space[peak_vel + 1],
6150 working_space[peak_vel + 6],
6151 working_space[peak_vel + 8],
6152 working_space[peak_vel + 12],
6153 working_space[peak_vel + 13]);
6155 working_space[2 * shift + k] += chi_opt;
6157 working_space[4 * shift + k] += b;
6162 a =
Derby(fNPeaks, i1, i2,
6163 working_space, working_space[peak_vel],
6164 working_space[peak_vel + 1],
6165 working_space[peak_vel + 6],
6166 working_space[peak_vel + 8],
6167 working_space[peak_vel + 12],
6168 working_space[peak_vel + 13]);
6170 working_space[2 * shift + k] += chi_opt;
6172 working_space[4 * shift + k] += b;
6180 chi_er = chi_cel / b;
6181 for (i = 0, j = 0; i <
fNPeaks; i++) {
6183 Volume(working_space[7 * i], working_space[peak_vel],
6184 working_space[peak_vel + 1], working_space[peak_vel + 2]);
6188 a =
Derpa2(working_space[peak_vel],
6189 working_space[peak_vel + 1],
6190 working_space[peak_vel + 2]);
6191 b = working_space[4 * shift + j];
6201 working_space[peak_vel + 1],
6202 working_space[peak_vel + 2]);
6203 b = working_space[4 * shift + peak_vel];
6213 working_space[peak_vel],
6214 working_space[peak_vel + 2]);
6215 b = working_space[4 * shift + peak_vel + 1];
6224 a =
Derpro(working_space[shift + j], working_space[peak_vel],
6225 working_space[peak_vel + 1],
6226 working_space[peak_vel + 2]);
6227 b = working_space[4 * shift + peak_vel + 2];
6242 fAmpCalc[i] = working_space[shift + j];
6243 if (working_space[3 * shift + j] != 0)
6254 if (working_space[3 * shift + j] != 0)
6265 if (working_space[3 * shift + j] != 0)
6276 if (working_space[3 * shift + j] != 0)
6287 if (working_space[3 * shift + j] != 0)
6298 if (working_space[3 * shift + j] != 0)
6309 if (working_space[3 * shift + j] != 0)
6321 if (working_space[3 * shift + j] != 0)
6332 if (working_space[3 * shift + j] != 0)
6342 fRoCalc = working_space[shift + j];
6343 if (working_space[3 * shift + j] != 0)
6353 fA0Calc = working_space[shift + j];
6354 if (working_space[3 * shift + j] != 0)
6364 fAxCalc = working_space[shift + j];
6365 if (working_space[3 * shift + j] != 0)
6375 fAyCalc = working_space[shift + j];
6376 if (working_space[3 * shift + j] != 0)
6386 fTxyCalc = working_space[shift + j];
6387 if (working_space[3 * shift + j] != 0)
6397 fSxyCalc = working_space[shift + j];
6398 if (working_space[3 * shift + j] != 0)
6408 fTxCalc = working_space[shift + j];
6409 if (working_space[3 * shift + j] != 0)
6419 fTyCalc = working_space[shift + j];
6420 if (working_space[3 * shift + j] != 0)
6430 fSxCalc = working_space[shift + j];
6431 if (working_space[3 * shift + j] != 0)
6441 fSyCalc = working_space[shift + j];
6442 if (working_space[3 * shift + j] != 0)
6452 fBxCalc = working_space[shift + j];
6453 if (working_space[3 * shift + j] != 0)
6463 fByCalc = working_space[shift + j];
6464 if (working_space[3 * shift + j] != 0)
6477 f =
Shape2(fNPeaks, i1, i2,
6478 working_space, working_space[peak_vel],
6479 working_space[peak_vel + 1],
6480 working_space[peak_vel + 2],
6481 working_space[peak_vel + 3],
6482 working_space[peak_vel + 4],
6483 working_space[peak_vel + 5],
6484 working_space[peak_vel + 6],
6485 working_space[peak_vel + 7],
6486 working_space[peak_vel + 8],
6487 working_space[peak_vel + 9],
6488 working_space[peak_vel + 10],
6489 working_space[peak_vel + 11],
6490 working_space[peak_vel + 12],
6491 working_space[peak_vel + 13]);
6496 for (i = 0; i < size; i++)
delete [] working_matrix[i];
6497 delete [] working_matrix;
6498 delete [] working_space;
6517 if(xmin<0 || xmax <= xmin || ymin<0 || ymax <= ymin){
6518 Error(
"SetFitParameters",
"Wrong range");
6521 if (numberIterations <= 0){
6522 Error(
"SetFitParameters",
"Invalid number of iterations, must be positive");
6525 if (alpha <= 0 || alpha > 1){
6526 Error (
"SetFitParameters",
"Invalid step coefficient alpha, must be > than 0 and <=1");
6532 Error(
"SetFitParameters",
"Wrong type of statistic");
6537 Error(
"SetFitParameters",
"Wrong optimization algorithm");
6543 Error(
"SetFitParameters",
"Wrong power");
6548 Error(
"SetFitParameters",
"Wrong order of Taylor development");
6577 void TSpectrum2Fit::SetPeakParameters(
Double_t sigmaX,
Bool_t fixSigmaX,
Double_t sigmaY,
Bool_t fixSigmaY,
Double_t ro,
Bool_t fixRo,
const Double_t *positionInitX,
const Bool_t *fixPositionX,
const Double_t *positionInitY,
const Bool_t *fixPositionY,
const Double_t *positionInitX1,
const Bool_t *fixPositionX1,
const Double_t *positionInitY1,
const Bool_t *fixPositionY1,
const Double_t *ampInit,
const Bool_t *fixAmp,
const Double_t *ampInitX1,
const Bool_t *fixAmpX1,
const Double_t *ampInitY1,
const Bool_t *fixAmpY1)
6579 if (sigmaX <= 0 || sigmaY <= 0){
6580 Error (
"SetPeakParameters",
"Invalid sigma, must be > than 0");
6583 if (ro < -1 || ro > 1){
6584 Error (
"SetPeakParameters",
"Invalid ro, must be from region <-1,1>");
6589 if(positionInitX[i] <
fXmin || positionInitX[i] >
fXmax){
6590 Error (
"SetPeakParameters",
"Invalid peak position, must be in the range fXmin, fXmax");
6593 if(positionInitY[i] <
fYmin || positionInitY[i] >
fYmax){
6594 Error (
"SetPeakParameters",
"Invalid peak position, must be in the range fYmin, fYmax");
6597 if(positionInitX1[i] <
fXmin || positionInitX1[i] >
fXmax){
6598 Error (
"SetPeakParameters",
"Invalid ridge position, must be in the range fXmin, fXmax");
6601 if(positionInitY1[i] <
fYmin || positionInitY1[i] >
fYmax){
6602 Error (
"SetPeakParameters",
"Invalid ridge position, must be in the range fYmin, fYmax");
6606 Error (
"SetPeakParameters",
"Invalid peak amplitude, must be > than 0");
6609 if(ampInitX1[i] < 0){
6610 Error (
"SetPeakParameters",
"Invalid x ridge amplitude, must be > than 0");
6613 if(ampInitY1[i] < 0){
6614 Error (
"SetPeakParameters",
"Invalid y ridge amplitude, must be > than 0");
6683 void TSpectrum2Fit::SetTailParameters(
Double_t tInitXY,
Bool_t fixTxy,
Double_t tInitX,
Bool_t fixTx,
Double_t tInitY,
Bool_t fixTy,
Double_t bInitX,
Bool_t fixBx,
Double_t bInitY,
Bool_t fixBy,
Double_t sInitXY,
Bool_t fixSxy,
Double_t sInitX,
Bool_t fixSx,
Double_t sInitY,
Bool_t fixSy)
6777 amplitudeErrors[i] =
fAmpErr[i];
6904 void TSpectrum2Fit::GetTailParameters(
Double_t &txy,
Double_t &txyErr,
Double_t &tx,
Double_t &txErr,
Double_t &ty,
Double_t &tyErr,
Double_t &bx,
Double_t &bxErr,
Double_t &by,
Double_t &byErr,
Double_t &sxy,
Double_t &sxyErr,
Double_t &sx,
Double_t &sxErr,
Double_t &sy,
Double_t &syErr)
Double_t Derpsigmay(Double_t a, Double_t sx, Double_t ro)
AUXILIARY FUNCTION // // This function calculates derivative of the volume of a peak // according to ...
Double_t Derpa2(Double_t sx, Double_t sy, Double_t ro)
AUXILIARY FUNCTION // // This function calculates derivative of the volume of a peak // according to ...
Double_t Derampx(Double_t x, Double_t x0, Double_t sigmax, Double_t tx, Double_t sx, Double_t bx)
AUXILIARY FUNCTION // // This function calculates derivative of 2D peaks shape function (see manual) ...
Double_t Dersigmay(Int_t numOfFittedPeaks, Double_t x, Double_t y, const Double_t *parameter, Double_t sigmax, Double_t sigmay, Double_t ro, Double_t txy, Double_t sxy, Double_t ty, Double_t sy, Double_t bx, Double_t by)
AUXILIARY FUNCTION // // This function calculates derivative of peaks shape function (see manual) // ...
Double_t Dertx(Int_t numOfFittedPeaks, Double_t x, const Double_t *parameter, Double_t sigmax, Double_t bx)
AUXILIARY FUNCTION // // This function calculates derivative of peaks shape function (see manual) // ...
Double_t * fPositionErrY1
Double_t Deri01(Double_t x, Double_t ax, Double_t x0, Double_t sigmax, Double_t tx, Double_t sx, Double_t bx)
AUXILIARY FUNCTION // // This function calculates derivative of 2D peaks shape function (see manual) ...
Advanced 2-dimentional spectra fitting functions.
Double_t * fPositionCalcX1
Double_t * fPositionInitY
void GetBackgroundParameters(Double_t &a0, Double_t &a0Err, Double_t &ax, Double_t &axErr, Double_t &ay, Double_t &ayErr)
GETTER FUNCTION.
Double_t Derpsigmax(Double_t a, Double_t sy, Double_t ro)
AUXILIARY FUNCTION // // This function calculates derivative of the volume of a peak // according to ...
void GetTailParameters(Double_t &txy, Double_t &txyErr, Double_t &tx, Double_t &txErr, Double_t &ty, Double_t &tyErr, Double_t &bx, Double_t &bxErr, Double_t &by, Double_t &byErr, Double_t &sxy, Double_t &sxyErr, Double_t &sx, Double_t &sxErr, Double_t &sy, Double_t &syErr)
GETTER FUNCTION.
Double_t Derfc(Double_t x)
AUXILIARY FUNCTION // // This function calculates derivative of error function of x...
Double_t Derpro(Double_t a, Double_t sx, Double_t sy, Double_t ro)
AUXILIARY FUNCTION // // This function calculates derivative of the volume of a peak // according to ...
Double_t Deri02(Double_t x, Double_t y, Double_t a, Double_t x0, Double_t y0, Double_t sigmax, Double_t sigmay, Double_t ro, Double_t txy, Double_t sxy, Double_t bx, Double_t by)
AUXILIARY FUNCTION // // This function calculates derivative of 2D peaks shape function (see manual) ...
Double_t * fPositionCalcY1
Double_t * fPositionInitY1
void GetAmplitudes(Double_t *amplitudes, Double_t *amplitudesX1, Double_t *amplitudesY1)
GETTER FUNCTION.
Double_t Derty(Int_t numOfFittedPeaks, Double_t x, const Double_t *parameter, Double_t sigmax, Double_t bx)
AUXILIARY FUNCTION // // This function calculates derivative of peaks shape function (see manual) // ...
Double_t * fPositionInitX
void FitStiefel(Double_t **source)
void GetPositions(Double_t *positionsX, Double_t *positionsY, Double_t *positionsX1, Double_t *positionsY1)
GETTER FUNCTION.
Double_t Derdersigmay(Int_t numOfFittedPeaks, Double_t x, Double_t y, const Double_t *parameter, Double_t sigmax, Double_t sigmay, Double_t ro)
AUXILIARY FUNCTION // // This function calculates second derivative of peaks shape function // (see m...
Double_t Derby(Int_t numOfFittedPeaks, Double_t x, Double_t y, const Double_t *parameter, Double_t sigmax, Double_t sigmay, Double_t txy, Double_t ty, Double_t bx, Double_t by)
AUXILIARY FUNCTION // // This function calculates derivative of peaks shape function (see manual) // ...
Double_t Derderi01(Double_t x, Double_t ax, Double_t x0, Double_t sigmax)
AUXILIARY FUNCTION // // This function calculates second derivative of 2D peaks shape function // (se...
Double_t Dersx(Int_t numOfFittedPeaks, Double_t x, const Double_t *parameter, Double_t sigmax)
AUXILIARY FUNCTION // // This function calculates derivative of peaks shape function (see manual) // ...
Double_t Shape2(Int_t numOfFittedPeaks, Double_t x, Double_t y, const Double_t *parameter, Double_t sigmax, Double_t sigmay, Double_t ro, Double_t a0, Double_t ax, Double_t ay, Double_t txy, Double_t sxy, Double_t tx, Double_t ty, Double_t sx, Double_t sy, Double_t bx, Double_t by)
AUXILIARY FUNCTION // // This function calculates 2D peaks shape function (see manual) // Function pa...
Double_t * fPositionErrX1
void FitAwmi(Double_t **source)
TWO-DIMENSIONAL FIT FUNCTION ALGORITHM WITHOUT MATRIX INVERSION This function fits the source spectru...
The TNamed class is the base class for all named ROOT classes.
Double_t Deramp2(Double_t x, Double_t y, Double_t x0, Double_t y0, Double_t sigmax, Double_t sigmay, Double_t ro, Double_t txy, Double_t sxy, Double_t bx, Double_t by)
AUXILIARY FUNCTION // // This function calculates derivative of 2D peaks shape function (see manual) ...
Double_t Ourpowl(Double_t a, Int_t pw)
power function
std::map< std::string, std::string >::const_iterator iter
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
void GetSigmaX(Double_t &sigmaX, Double_t &sigmaErrX)
GETTER FUNCTION.
void SetBackgroundParameters(Double_t a0Init, Bool_t fixA0, Double_t axInit, Bool_t fixAx, Double_t ayInit, Bool_t fixAy)
SETTER FUNCTION.
void GetVolumes(Double_t *volumes)
GETTER FUNCTION.
Double_t * fPositionCalcY
void SetPeakParameters(Double_t sigmaX, Bool_t fixSigmaX, Double_t sigmaY, Bool_t fixSigmaY, Double_t ro, Bool_t fixRo, const Double_t *positionInitX, const Bool_t *fixPositionX, const Double_t *positionInitY, const Bool_t *fixPositionY, const Double_t *positionInitX1, const Bool_t *fixPositionX1, const Double_t *positionInitY1, const Bool_t *fixPositionY1, const Double_t *ampInit, const Bool_t *fixAmp, const Double_t *ampInitX1, const Bool_t *fixAmpX1, const Double_t *ampInitY1, const Bool_t *fixAmpY1)
SETTER FUNCTION.
void GetPositionErrors(Double_t *positionErrorsX, Double_t *positionErrorsY, Double_t *positionErrorsX1, Double_t *positionErrorsY1)
GETTER FUNCTION.
unsigned int r1[N_CITIES]
Double_t Derj02(Double_t x, Double_t y, Double_t a, Double_t x0, Double_t y0, Double_t sigmax, Double_t sigmay, Double_t ro, Double_t txy, Double_t sxy, Double_t bx, Double_t by)
void GetAmplitudeErrors(Double_t *amplitudeErrors, Double_t *amplitudeErrorsX1, Double_t *amplitudeErrorsY1)
GETTER FUNCTION.
void SetTailParameters(Double_t tInitXY, Bool_t fixTxy, Double_t tInitX, Bool_t fixTx, Double_t tInitY, Bool_t fixTy, Double_t bInitX, Bool_t fixBx, Double_t bInitY, Bool_t fixBy, Double_t sInitXY, Bool_t fixSxy, Double_t sInitX, Bool_t fixSx, Double_t sInitY, Bool_t fixSy)
SETTER FUNCTION.
void GetSigmaY(Double_t &sigmaY, Double_t &sigmaErrY)
GETTER FUNCTION.
void GetRo(Double_t &ro, Double_t &roErr)
GETTER FUNCTION.
Double_t Derdersigmax(Int_t numOfFittedPeaks, Double_t x, Double_t y, const Double_t *parameter, Double_t sigmax, Double_t sigmay, Double_t ro)
AUXILIARY FUNCTION // // This function calculates second derivative of peaks shape function // (see m...
Double_t Dertxy(Int_t numOfFittedPeaks, Double_t x, Double_t y, const Double_t *parameter, Double_t sigmax, Double_t sigmay, Double_t bx, Double_t by)
AUXILIARY FUNCTION // // This function calculates derivative of peaks shape function (see manual) // ...
Double_t Derderi02(Double_t x, Double_t y, Double_t a, Double_t x0, Double_t y0, Double_t sigmax, Double_t sigmay, Double_t ro)
AUXILIARY FUNCTION // // This function calculates second derivative of 2D peaks shape function // (se...
void GetVolumeErrors(Double_t *volumeErrors)
GETTER FUNCTION.
Double_t Derro(Int_t numOfFittedPeaks, Double_t x, Double_t y, const Double_t *parameter, Double_t sx, Double_t sy, Double_t r)
AUXILIARY FUNCTION // // This function calculates derivative of peaks shape function (see manual) // ...
Double_t Dersxy(Int_t numOfFittedPeaks, Double_t x, Double_t y, const Double_t *parameter, Double_t sigmax, Double_t sigmay)
AUXILIARY FUNCTION // // This function calculates derivative of peaks shape function (see manual) // ...
Double_t Erfc(Double_t x)
AUXILIARY FUNCTION // // This function calculates error function of x.
Double_t Derderj02(Double_t x, Double_t y, Double_t a, Double_t x0, Double_t y0, Double_t sigmax, Double_t sigmay, Double_t ro)
AUXILIARY FUNCTION // // This function calculates second derivative of 2D peaks shape function // (se...
void StiefelInversion(Double_t **a, Int_t size)
Double_t * fPositionCalcX
void SetFitParameters(Int_t xmin, Int_t xmax, Int_t ymin, Int_t ymax, Int_t numberIterations, Double_t alpha, Int_t statisticType, Int_t alphaOptim, Int_t power, Int_t fitTaylor)
ClassImp(TSpectrum2Fit) TSpectrum2Fit
default constructor
Double_t Volume(Double_t a, Double_t sx, Double_t sy, Double_t ro)
AUXILIARY FUNCTION // // This function calculates volume of a peak // Function parameters: // -a-ampl...
Double_t * fPositionInitX1
Double_t Sqrt(Double_t x)
virtual ~TSpectrum2Fit()
destructor
Double_t Dersigmax(Int_t numOfFittedPeaks, Double_t x, Double_t y, const Double_t *parameter, Double_t sigmax, Double_t sigmay, Double_t ro, Double_t txy, Double_t sxy, Double_t tx, Double_t sx, Double_t bx, Double_t by)
AUXILIARY FUNCTION // // This function calculates derivative of peaks shape function (see manual) // ...
Double_t Derbx(Int_t numOfFittedPeaks, Double_t x, Double_t y, const Double_t *parameter, Double_t sigmax, Double_t sigmay, Double_t txy, Double_t tx, Double_t bx, Double_t by)
AUXILIARY FUNCTION // // This function calculates derivative of peaks shape function (see manual) // ...
Double_t Dersy(Int_t numOfFittedPeaks, Double_t x, const Double_t *parameter, Double_t sigmax)
AUXILIARY FUNCTION // // This function calculates derivative of peaks shape function (see manual) // ...