62 fNumberIterations = 1;
67 fStatisticType = kFitOptimChiCounts;
68 fAlphaOptim = kFitAlphaHalving;
70 fFitTaylor = kFitTaylorOrderFirst;
181 if (numberPeaks <= 0){
182 Error (
"TSpectrum2Fit",
"Invalid number of peaks, must be > than 0");
334 Double_t da1 = 0.1740121, da2 = -0.0479399, da3 = 0.3739278, dap =
347 c = c * t * (da1 + t * (da2 + t * da3));
364 Double_t da1 = 0.1740121, da2 = -0.0479399, da3 = 0.3739278, dap =
376 c = (-1.) * dap * c * t * t * (da1 + t * (2. * da2 + t * 3. * da3)) -
394 if (pw > 10) c *= a2;
395 if (pw > 12) c *= a2;
415 Double_t sk = 0, b, lambdak, normk, normk_old = 0;
421 for (i = 0; i < size; i++) {
422 a[i][size + 2] = -a[i][size];
423 for (j = 0; j < size; j++) {
424 a[i][size + 2] += a[i][j] * a[j][size + 1];
426 normk += a[i][size + 2] * a[i][size + 2];
431 sk = normk / normk_old;
435 for (i = 0; i < size; i++) {
436 a[i][size + 3] = -a[i][size + 2] + sk * a[i][size + 3];
441 for (i = 0; i < size; i++) {
442 for (j = 0, b = 0; j < size; j++) {
443 b += a[i][j] * a[j][size + 3];
445 lambdak += b * a[i][size + 3];
448 lambdak = normk / lambdak;
452 for (i = 0; i < size; i++)
453 a[i][size + 1] += lambdak * a[i][size + 3];
456 }
while (k < size &&
TMath::Abs(normk) > 1e-50);
487 Double_t r, p,
r1, e,
ex,
ey, vx, s2, px, py, rx, ry, erx, ery;
490 for (j = 0; j < numOfFittedPeaks; j++) {
491 p = (x - parameter[7 * j + 1]) / sigmax;
492 r = (y - parameter[7 * j + 2]) / sigmay;
494 e = (p * p - 2 * ro * p * r + r *
r) / (2 * (1 - ro * ro));
503 erx =
Erfc(p / s2 + 1 / (2 * bx)), ery =
504 Erfc(r / s2 + 1 / (2 * by));
505 ex = p / (s2 * bx), ey = r / (s2 * by);
507 px =
exp(ex) * erx, py =
exp(ey) * ery;
509 r1 += 0.5 * txy * px * py;
512 rx =
Erfc(p / s2), ry =
Erfc(r / s2);
513 r1 += 0.5 * sxy * rx * ry;
515 vx = vx + parameter[7 * j] *
r1;
517 p = (x - parameter[7 * j + 5]) / sigmax;
528 erx =
Erfc(p / s2 + 1 / (2 * bx));
539 vx = vx + parameter[7 * j + 3] *
r1;
541 r = (y - parameter[7 * j + 6]) / sigmay;
552 ery =
Erfc(r / s2 + 1 / (2 * by));
563 vx = vx + parameter[7 * j + 4] *
r1;
566 vx = vx + a0 + ax * x + ay *
y;
593 Double_t p,
r,
r1 = 0, e,
ex,
ey, px, py, rx, ry, erx, ery, s2;
594 p = (x - x0) / sigmax;
595 r = (y - y0) / sigmay;
598 e = (p * p - 2 * ro * p * r + r *
r) / (2 * (1 - ro * ro));
607 erx =
Erfc(p / s2 + 1 / (2 * bx)), ery =
608 Erfc(r / s2 + 1 / (2 * by));
609 ex = p / (s2 * bx), ey = r / (s2 * by);
611 px =
exp(ex) * erx, py =
exp(ey) * ery;
613 r1 += 0.5 * txy * px * py;
616 rx =
Erfc(p / s2), ry =
Erfc(r / s2);
617 r1 += 0.5 * sxy * rx * ry;
644 p = (x - x0) / sigmax;
656 erx =
Erfc(p / s2 + 1 / (2 * bx));
696 Double_t p,
r,
r1 = 0, e,
ex,
ey, px, py, rx, ry, erx, ery, s2;
697 p = (x - x0) / sigmax;
698 r = (y - y0) / sigmay;
701 e = (p * p - 2 * ro * p * r + r *
r) / (2 * (1 - ro * ro));
708 e = -(ro * r - p) / sigmax;
709 e = e / (1 - ro * ro);
714 (-
Erfc(p / s2 + 1 / (2 * bx)) / (s2 * bx * sigmax) -
715 Derfc(p / s2 + 1 / (2 * bx)) / (s2 * sigmax)), ery =
716 Erfc(r / s2 + 1 / (2 * by));
717 ex = p / (s2 * bx), ey = r / (s2 * by);
719 px =
exp(ex) * erx, py =
exp(ey) * ery;
721 r1 += 0.5 * txy * px * py;
724 rx = -
Derfc(p / s2) / (s2 * sigmax), ry =
Erfc(r / s2);
725 r1 += 0.5 * sxy * rx * ry;
755 p = (x - x0) / sigmax;
756 r = (y - y0) / sigmay;
758 e = (p * p - 2 * ro * p * r + r *
r) / (2 * (1 - ro * ro));
765 e = -(ro * r - p) / sigmax;
766 e = e / (1 - ro * ro);
767 r1 = r1 * (e * e - 1 / ((1 - ro * ro) * sigmax * sigmax));
795 Double_t p,
r,
r1 = 0, e,
ex,
ey, px, py, rx, ry, erx, ery, s2;
796 p = (x - x0) / sigmax;
797 r = (y - y0) / sigmay;
800 e = (p * p - 2 * ro * p * r + r *
r) / (2 * (1 - ro * ro));
807 e = -(ro * p -
r) / sigmay;
808 e = e / (1 - ro * ro);
813 (-
Erfc(r / s2 + 1 / (2 * by)) / (s2 * by * sigmay) -
814 Derfc(r / s2 + 1 / (2 * by)) / (s2 * sigmay)), erx =
815 Erfc(p / s2 + 1 / (2 * bx));
816 ex = p / (s2 * bx), ey = r / (s2 * by);
818 px =
exp(ex) * erx, py =
exp(ey) * ery;
820 r1 += 0.5 * txy * px * py;
823 ry = -
Derfc(r / s2) / (s2 * sigmay), rx =
Erfc(p / s2);
824 r1 += 0.5 * sxy * rx * ry;
854 p = (x - x0) / sigmax;
855 r = (y - y0) / sigmay;
857 e = (p * p - 2 * ro * p * r + r *
r) / (2 * (1 - ro * ro));
864 e = -(ro * p -
r) / sigmay;
865 e = e / (1 - ro * ro);
866 r1 = r1 * (e * e - 1 / ((1 - ro * ro) * sigmay * sigmay));
893 p = (x - x0) / sigmax;
903 r1 = r1 * p / sigmax;
907 (-
Erfc(p / s2 + 1 / (2 * bx)) / (s2 * bx * sigmax) -
908 Derfc(p / s2 + 1 / (2 * bx)) / (s2 * sigmax));
915 rx = -
Derfc(p / s2) / (s2 * sigmax);
941 p = (x - x0) / sigmax;
950 r1 = r1 * (p * p / (sigmax * sigmax) - 1 / (sigmax * sigmax));
981 0, e,
a, b, x0, y0, s2, px, py, rx, ry, erx, ery,
ex,
ey;
984 for (j = 0; j < numOfFittedPeaks; j++) {
985 a = parameter[7 * j];
986 x0 = parameter[7 * j + 1];
987 y0 = parameter[7 * j + 2];
988 p = (x - x0) / sigmax;
989 r = (y - y0) / sigmay;
991 e = (p * p - 2 * ro * p * r + r *
r) / (2 * (1 - ro * ro));
998 b = -(ro * p * r - p * p) / sigmax;
999 e = e * b / (1 - ro * ro);
1003 -
Erfc(p / s2 + 1 / (2 * bx)) * p / (s2 * bx * sigmax) -
1004 Derfc(p / s2 + 1 / (2 * bx)) * p / (s2 * sigmax), ery =
1005 Erfc(r / s2 + 1 / (2 * by));
1006 ex = p / (s2 * bx), ey = r / (s2 * by);
1008 px =
exp(ex) * erx, py =
exp(ey) * ery;
1010 e += 0.5 * txy * px * py;
1013 rx = -
Derfc(p / s2) * p / (s2 * sigmax), ry =
Erfc(r / s2);
1014 e += 0.5 * sxy * rx * ry;
1019 x0 = parameter[7 * j + 5];
1020 p = (x - x0) / sigmax;
1028 e = 2 * b * e / sigmax;
1032 (-
Erfc(p / s2 + 1 / (2 * bx)) * p / (s2 * bx * sigmax) -
1033 Derfc(p / s2 + 1 / (2 * bx)) * p / (s2 * sigmax));
1040 rx = -
Derfc(p / s2) * p / (s2 * sigmax);
1043 r1 += parameter[7 * j + 3] * e;
1072 for (j = 0; j < numOfFittedPeaks; j++) {
1073 a = parameter[7 * j];
1074 x0 = parameter[7 * j + 1];
1075 y0 = parameter[7 * j + 2];
1076 p = (x - x0) / sigmax;
1077 r = (y - y0) / sigmay;
1079 e = (p * p - 2 * ro * p * r + r *
r) / (2 * (1 - ro * ro));
1086 b = -(ro * p * r - p * p) / sigmax;
1087 e = e * (b * b / (1 - ro * ro) -
1088 (3 * p * p - 2 * ro * p * r) / (sigmax * sigmax)) / (1 -
1095 x0 = parameter[7 * j + 5];
1096 p = (x - x0) / sigmax;
1104 e = e * (4 * b * b - 6 * b) / (sigmax * sigmax);
1105 r1 += parameter[7 * j + 3] * e;
1136 0, e,
a, b, x0, y0, s2, px, py, rx, ry, erx, ery,
ex,
ey;
1139 for (j = 0; j < numOfFittedPeaks; j++) {
1140 a = parameter[7 * j];
1141 x0 = parameter[7 * j + 1];
1142 y0 = parameter[7 * j + 2];
1143 p = (x - x0) / sigmax;
1144 r = (y - y0) / sigmay;
1146 e = (p * p - 2 * ro * p * r + r *
r) / (2 * (1 - ro * ro));
1153 b = -(ro * p * r - r *
r) / sigmay;
1154 e = e * b / (1 - ro * ro);
1158 -
Erfc(r / s2 + 1 / (2 * by)) * r / (s2 * by * sigmay) -
1159 Derfc(r / s2 + 1 / (2 * by)) * r / (s2 * sigmay), erx =
1160 Erfc(p / s2 + 1 / (2 * bx));
1161 ex = p / (s2 * bx), ey = r / (s2 * by);
1163 px =
exp(ex) * erx, py =
exp(ey) * ery;
1165 e += 0.5 * txy * px * py;
1168 ry = -
Derfc(r / s2) * r / (s2 * sigmay), rx =
Erfc(p / s2);
1169 e += 0.5 * sxy * rx * ry;
1174 y0 = parameter[7 * j + 6];
1175 r = (y - y0) / sigmay;
1183 e = 2 * b * e / sigmay;
1187 (-
Erfc(r / s2 + 1 / (2 * by)) * r / (s2 * by * sigmay) -
1188 Derfc(r / s2 + 1 / (2 * by)) * r / (s2 * sigmay));
1195 ry = -
Derfc(r / s2) * r / (s2 * sigmay);
1198 r1 += parameter[7 * j + 4] * e;
1227 for (j = 0; j < numOfFittedPeaks; j++) {
1228 a = parameter[7 * j];
1229 x0 = parameter[7 * j + 1];
1230 y0 = parameter[7 * j + 2];
1231 p = (x - x0) / sigmax;
1232 r = (y - y0) / sigmay;
1234 e = (p * p - 2 * ro * p * r + r *
r) / (2 * (1 - ro * ro));
1241 b = -(ro * p * r - r *
r) / sigmay;
1242 e = e * (b * b / (1 - ro * ro) -
1243 (3 * r * r - 2 * ro * r * p) / (sigmay * sigmay)) / (1 -
1250 y0 = parameter[7 * j + 6];
1251 r = (y - y0) / sigmay;
1259 e = e * (4 * b * b - 6 * b) / (sigmay * sigmay);
1260 r1 += parameter[7 * j + 4] * e;
1289 for (j = 0; j < numOfFittedPeaks; j++) {
1290 a = parameter[7 * j];
1291 x0 = parameter[7 * j + 1];
1292 y0 = parameter[7 * j + 2];
1296 rx = (px * px - 2 * r * px * qx + qx * qx);
1297 ex = rx / (2 * (1 - r *
r));
1304 tx = px * qx / (1 - r *
r);
1305 tx = tx - r * rx / ((1 - r *
r) * (1 - r * r));
1306 vx = vx + a * ex * tx;
1332 Double_t p,
r,
r1 = 0,
ex,
ey, px, py, erx, ery, s2, x0, y0,
a;
1335 for (j = 0; j < numOfFittedPeaks; j++) {
1336 a = parameter[7 * j];
1337 x0 = parameter[7 * j + 1];
1338 y0 = parameter[7 * j + 2];
1339 p = (x - x0) / sigmax;
1340 r = (y - y0) / sigmay;
1342 erx =
Erfc(p / s2 + 1 / (2 * bx)), ery =
1343 Erfc(r / s2 + 1 / (2 * by));
1344 ex = p / (s2 * bx), ey = r / (s2 * by);
1346 px =
exp(
ex) * erx, py =
exp(ey) * ery;
1348 r1 += 0.5 * a * px * py;
1375 for (j = 0; j < numOfFittedPeaks; j++) {
1376 a = parameter[7 * j];
1377 x0 = parameter[7 * j + 1];
1378 y0 = parameter[7 * j + 2];
1379 p = (x - x0) / sigmax;
1380 r = (y - y0) / sigmay;
1381 rx =
Erfc(p / s2), ry =
Erfc(r / s2);
1382 r1 += 0.5 * a * rx * ry;
1409 for (j = 0; j < numOfFittedPeaks; j++) {
1410 ax = parameter[7 * j + 3];
1411 x0 = parameter[7 * j + 5];
1412 p = (x - x0) / sigmax;
1414 erx =
Erfc(p / s2 + 1 / (2 * bx));
1419 r1 += 0.5 * ax * px;
1446 for (j = 0; j < numOfFittedPeaks; j++) {
1447 ax = parameter[7 * j + 4];
1448 x0 = parameter[7 * j + 6];
1449 p = (x - x0) / sigmax;
1451 erx =
Erfc(p / s2 + 1 / (2 * bx));
1456 r1 += 0.5 * ax * px;
1481 for (j = 0; j < numOfFittedPeaks; j++) {
1482 ax = parameter[7 * j + 3];
1483 x0 = parameter[7 * j + 5];
1484 p = (x - x0) / sigmax;
1487 r1 += 0.5 * ax * rx;
1512 for (j = 0; j < numOfFittedPeaks; j++) {
1513 ax = parameter[7 * j + 4];
1514 x0 = parameter[7 * j + 6];
1515 p = (x - x0) / sigmax;
1518 r1 += 0.5 * ax * rx;
1545 Double_t p,
r,
r1 = 0,
a, x0, y0, s2, px, py, erx, ery,
ex,
ey;
1548 for (j = 0; j < numOfFittedPeaks; j++) {
1549 a = parameter[7 * j];
1550 x0 = parameter[7 * j + 1];
1551 y0 = parameter[7 * j + 2];
1552 p = (x - x0) / sigmax;
1553 r = (y - y0) / sigmay;
1557 -
Erfc(p / s2 + 1 / (2 * bx)) * p / (s2 * bx * bx) -
1558 Derfc(p / s2 + 1 / (2 * bx)) / (s2 * bx * bx), ery =
1559 Erfc(r / s2 + 1 / (2 * by));
1560 ex = p / (s2 * bx), ey = r / (s2 * by);
1562 px =
exp(ex) * erx, py =
exp(ey) * ery;
1564 r1 += 0.5 *
a * txy * px * py;
1566 a = parameter[7 * j + 3];
1567 x0 = parameter[7 * j + 5];
1568 p = (x - x0) / sigmax;
1572 (-
Erfc(p / s2 + 1 / (2 * bx)) * p / (s2 * bx * bx) -
1573 Derfc(p / s2 + 1 / (2 * bx)) / (s2 * bx * bx));
1577 r1 += 0.5 *
a * tx * px;
1605 Double_t p,
r,
r1 = 0,
a, x0, y0, s2, px, py, erx, ery,
ex,
ey;
1608 for (j = 0; j < numOfFittedPeaks; j++) {
1609 a = parameter[7 * j];
1610 x0 = parameter[7 * j + 1];
1611 y0 = parameter[7 * j + 2];
1612 p = (x - x0) / sigmax;
1613 r = (y - y0) / sigmay;
1617 -
Erfc(r / s2 + 1 / (2 * by)) * r / (s2 * by * by) -
1618 Derfc(r / s2 + 1 / (2 * by)) / (s2 * by * by), erx =
1619 Erfc(p / s2 + 1 / (2 * bx));
1620 ex = p / (s2 * bx), ey = r / (s2 * by);
1622 px =
exp(ex) * erx, py =
exp(ey) * ery;
1624 r1 += 0.5 *
a * txy * px * py;
1626 a = parameter[7 * j + 4];
1627 y0 = parameter[7 * j + 6];
1628 r = (y - y0) / sigmay;
1632 (-
Erfc(r / s2 + 1 / (2 * by)) * r / (s2 * by * by) -
1633 Derfc(r / s2 + 1 / (2 * by)) / (s2 * by * by));
1637 r1 += 0.5 *
a * ty * py;
1665 r = 2 * a * pi * sx * sy *
r;
1691 r = 2 * pi * sx * sy *
r;
1718 r = a * 2 * pi * sy *
r;
1745 r = a * 2 * pi * sx *
r;
1772 r = -a * 2 * pi * sx * sy * ro /
r;
2688 Int_t i, i1, i2, j, k, shift =
2689 7 *
fNPeaks + 14, peak_vel, size, iter, pw,
2691 Double_t a, b,
c, d = 0, alpha, chi_opt, yw, ywm,
f, chi2, chi_min, chi =
2692 0,
pi, pmin = 0, chi_cel = 0, chi_er;
2694 for (i = 0, j = 0; i <
fNPeaks; i++) {
2695 working_space[7 * i] =
fAmpInit[i];
2697 working_space[shift + j] =
fAmpInit[i];
2742 working_space[7 * i + 2] =
fRoInit;
2744 working_space[shift + j] =
fRoInit;
2747 working_space[7 * i + 3] =
fA0Init;
2749 working_space[shift + j] =
fA0Init;
2752 working_space[7 * i + 4] =
fAxInit;
2754 working_space[shift + j] =
fAxInit;
2757 working_space[7 * i + 5] =
fAyInit;
2759 working_space[shift + j] =
fAyInit;
2762 working_space[7 * i + 6] =
fTxyInit;
2764 working_space[shift + j] =
fTxyInit;
2767 working_space[7 * i + 7] =
fSxyInit;
2769 working_space[shift + j] =
fSxyInit;
2772 working_space[7 * i + 8] =
fTxInit;
2774 working_space[shift + j] =
fTxInit;
2777 working_space[7 * i + 9] =
fTyInit;
2779 working_space[shift + j] =
fTyInit;
2782 working_space[7 * i + 10] =
fSxyInit;
2784 working_space[shift + j] =
fSxInit;
2787 working_space[7 * i + 11] =
fSyInit;
2789 working_space[shift + j] =
fSyInit;
2792 working_space[7 * i + 12] =
fBxInit;
2794 working_space[shift + j] =
fBxInit;
2797 working_space[7 * i + 13] =
fByInit;
2799 working_space[shift + j] =
fByInit;
2804 for (j = 0; j < size; j++) {
2805 working_space[2 * shift + j] = 0, working_space[3 * shift + j] = 0;
2810 chi_opt = 0, pw =
fPower - 2;
2813 yw = source[i1][i2];
2815 f =
Shape2(fNPeaks, i1, i2,
2816 working_space, working_space[peak_vel],
2817 working_space[peak_vel + 1],
2818 working_space[peak_vel + 2],
2819 working_space[peak_vel + 3],
2820 working_space[peak_vel + 4],
2821 working_space[peak_vel + 5],
2822 working_space[peak_vel + 6],
2823 working_space[peak_vel + 7],
2824 working_space[peak_vel + 8],
2825 working_space[peak_vel + 9],
2826 working_space[peak_vel + 10],
2827 working_space[peak_vel + 11],
2828 working_space[peak_vel + 12],
2829 working_space[peak_vel + 13]);
2837 chi_opt += (yw -
f) * (yw - f) / ywm;
2857 for (j = 0, k = 0; j <
fNPeaks; j++) {
2860 working_space[7 * j + 1],
2861 working_space[7 * j + 2],
2862 working_space[peak_vel],
2863 working_space[peak_vel + 1],
2864 working_space[peak_vel + 2],
2865 working_space[peak_vel + 6],
2866 working_space[peak_vel + 7],
2867 working_space[peak_vel + 12],
2868 working_space[peak_vel + 13]);
2872 b = a * (yw * yw - f *
f) / (ywm * ywm);
2873 working_space[2 * shift + k] += b *
c;
2874 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
2875 working_space[3 * shift + k] += b *
c;
2879 b = a * (yw -
f) / ywm;
2880 working_space[2 * shift + k] += b *
c;
2882 working_space[3 * shift + k] += b *
c;
2889 working_space[7 * j],
2890 working_space[7 * j + 1],
2891 working_space[7 * j + 2],
2892 working_space[peak_vel],
2893 working_space[peak_vel + 1],
2894 working_space[peak_vel + 2],
2895 working_space[peak_vel + 6],
2896 working_space[peak_vel + 7],
2897 working_space[peak_vel + 12],
2898 working_space[peak_vel + 13]);
2901 working_space[7 * j],
2902 working_space[7 * j + 1],
2903 working_space[7 * j + 2],
2904 working_space[peak_vel],
2905 working_space[peak_vel + 1],
2906 working_space[peak_vel + 2]);
2912 if (((a + d) <= 0 && a >= 0) || ((a + d) >= 0
2921 b = a * (yw * yw - f *
f) / (ywm * ywm);
2922 working_space[2 * shift + k] += b *
c;
2923 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
2924 working_space[3 * shift + k] += b *
c;
2928 b = a * (yw -
f) / ywm;
2929 working_space[2 * shift + k] += b *
c;
2931 working_space[3 * shift + k] += b *
c;
2938 working_space[7 * j],
2939 working_space[7 * j + 1],
2940 working_space[7 * j + 2],
2941 working_space[peak_vel],
2942 working_space[peak_vel + 1],
2943 working_space[peak_vel + 2],
2944 working_space[peak_vel + 6],
2945 working_space[peak_vel + 7],
2946 working_space[peak_vel + 12],
2947 working_space[peak_vel + 13]);
2950 working_space[7 * j],
2951 working_space[7 * j + 1],
2952 working_space[7 * j + 2],
2953 working_space[peak_vel],
2954 working_space[peak_vel + 1],
2955 working_space[peak_vel + 2]);
2961 if (((a + d) <= 0 && a >= 0) || ((a + d) >= 0
2970 b = a * (yw * yw - f *
f) / (ywm * ywm);
2971 working_space[2 * shift + k] += b *
c;
2972 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
2973 working_space[3 * shift + k] += b *
c;
2977 b = a * (yw -
f) / ywm;
2978 working_space[2 * shift + k] += b *
c;
2980 working_space[3 * shift + k] += b *
c;
2986 a =
Derampx(i1, working_space[7 * j + 5],
2987 working_space[peak_vel],
2988 working_space[peak_vel + 8],
2989 working_space[peak_vel + 10],
2990 working_space[peak_vel + 12]);
2994 b = a * (yw * yw - f *
f) / (ywm * ywm);
2995 working_space[2 * shift + k] += b *
c;
2996 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
2997 working_space[3 * shift + k] += b *
c;
3001 b = a * (yw -
f) / ywm;
3002 working_space[2 * shift + k] += b *
c;
3004 working_space[3 * shift + k] += b *
c;
3010 a =
Derampx(i2, working_space[7 * j + 6],
3011 working_space[peak_vel + 1],
3012 working_space[peak_vel + 9],
3013 working_space[peak_vel + 11],
3014 working_space[peak_vel + 13]);
3018 b = a * (yw * yw - f *
f) / (ywm * ywm);
3019 working_space[2 * shift + k] += b *
c;
3020 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3021 working_space[3 * shift + k] += b *
c;
3025 b = a * (yw -
f) / ywm;
3026 working_space[2 * shift + k] += b *
c;
3028 working_space[3 * shift + k] += b *
c;
3034 a =
Deri01(i1, working_space[7 * j + 3],
3035 working_space[7 * j + 5],
3036 working_space[peak_vel],
3037 working_space[peak_vel + 8],
3038 working_space[peak_vel + 10],
3039 working_space[peak_vel + 12]);
3041 d =
Derderi01(i1, working_space[7 * j + 3],
3042 working_space[7 * j + 5],
3043 working_space[peak_vel]);
3049 if (((a + d) <= 0 && a >= 0) || ((a + d) >= 0
3058 b = a * (yw * yw - f *
f) / (ywm * ywm);
3059 working_space[2 * shift + k] += b *
c;
3060 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3061 working_space[3 * shift + k] += b *
c;
3065 b = a * (yw -
f) / ywm;
3066 working_space[2 * shift + k] += b *
c;
3068 working_space[3 * shift + k] += b *
c;
3074 a =
Deri01(i2, working_space[7 * j + 4],
3075 working_space[7 * j + 6],
3076 working_space[peak_vel + 1],
3077 working_space[peak_vel + 9],
3078 working_space[peak_vel + 11],
3079 working_space[peak_vel + 13]);
3081 d =
Derderi01(i2, working_space[7 * j + 4],
3082 working_space[7 * j + 6],
3083 working_space[peak_vel + 1]);
3089 if (((a + d) <= 0 && a >= 0) || ((a + d) >= 0
3098 b = a * (yw * yw - f *
f) / (ywm * ywm);
3099 working_space[2 * shift + k] += b *
c;
3100 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3101 working_space[3 * shift + k] += b *
c;
3105 b = a * (yw -
f) / ywm;
3106 working_space[2 * shift + k] += b *
c;
3108 working_space[3 * shift + k] += b *
c;
3116 working_space, working_space[peak_vel],
3117 working_space[peak_vel + 1],
3118 working_space[peak_vel + 2],
3119 working_space[peak_vel + 6],
3120 working_space[peak_vel + 7],
3121 working_space[peak_vel + 8],
3122 working_space[peak_vel + 10],
3123 working_space[peak_vel + 12],
3124 working_space[peak_vel + 13]);
3128 working_space[peak_vel],
3129 working_space[peak_vel + 1],
3130 working_space[peak_vel + 2]);
3136 if (((a + d) <= 0 && a >= 0) || ((a + d) >= 0 && a <= 0))
3144 b = a * (yw * yw - f *
f) / (ywm * ywm);
3145 working_space[2 * shift + k] += b *
c;
3146 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3147 working_space[3 * shift + k] += b *
c;
3151 b = a * (yw -
f) / ywm;
3152 working_space[2 * shift + k] += b *
c;
3154 working_space[3 * shift + k] += b *
c;
3161 working_space, working_space[peak_vel],
3162 working_space[peak_vel + 1],
3163 working_space[peak_vel + 2],
3164 working_space[peak_vel + 6],
3165 working_space[peak_vel + 7],
3166 working_space[peak_vel + 9],
3167 working_space[peak_vel + 11],
3168 working_space[peak_vel + 12],
3169 working_space[peak_vel + 13]);
3173 working_space[peak_vel],
3174 working_space[peak_vel + 1],
3175 working_space[peak_vel + 2]);
3181 if (((a + d) <= 0 && a >= 0) || ((a + d) >= 0 && a <= 0))
3189 b = a * (yw * yw - f *
f) / (ywm * ywm);
3190 working_space[2 * shift + k] += b *
c;
3191 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3192 working_space[3 * shift + k] += b *
c;
3196 b = a * (yw -
f) / ywm;
3197 working_space[2 * shift + k] += b *
c;
3199 working_space[3 * shift + k] += b *
c;
3205 a =
Derro(fNPeaks, i1, i2,
3206 working_space, working_space[peak_vel],
3207 working_space[peak_vel + 1],
3208 working_space[peak_vel + 2]);
3214 if (((a + d) <= 0 && a >= 0) || ((a + d) >= 0 && a <= 0))
3222 b = a * (yw * yw - f *
f) / (ywm * ywm);
3223 working_space[2 * shift + k] += b *
c;
3224 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3225 working_space[3 * shift + k] += b *
c;
3229 b = a * (yw -
f) / ywm;
3230 working_space[2 * shift + k] += b *
c;
3232 working_space[3 * shift + k] += b *
c;
3242 b = a * (yw * yw - f *
f) / (ywm * ywm);
3243 working_space[2 * shift + k] += b *
c;
3244 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3245 working_space[3 * shift + k] += b *
c;
3249 b = a * (yw -
f) / ywm;
3250 working_space[2 * shift + k] += b *
c;
3252 working_space[3 * shift + k] += b *
c;
3262 b = a * (yw * yw - f *
f) / (ywm * ywm);
3263 working_space[2 * shift + k] += b *
c;
3264 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3265 working_space[3 * shift + k] += b *
c;
3269 b = a * (yw -
f) / ywm;
3270 working_space[2 * shift + k] += b *
c;
3272 working_space[3 * shift + k] += b *
c;
3282 b = a * (yw * yw - f *
f) / (ywm * ywm);
3283 working_space[2 * shift + k] += b *
c;
3284 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3285 working_space[3 * shift + k] += b *
c;
3289 b = a * (yw -
f) / ywm;
3290 working_space[2 * shift + k] += b *
c;
3292 working_space[3 * shift + k] += b *
c;
3298 a =
Dertxy(fNPeaks, i1, i2,
3299 working_space, working_space[peak_vel],
3300 working_space[peak_vel + 1],
3301 working_space[peak_vel + 12],
3302 working_space[peak_vel + 13]);
3306 b = a * (yw * yw - f *
f) / (ywm * ywm);
3307 working_space[2 * shift + k] += b *
c;
3308 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3309 working_space[3 * shift + k] += b *
c;
3313 b = a * (yw -
f) / ywm;
3314 working_space[2 * shift + k] += b *
c;
3316 working_space[3 * shift + k] += b *
c;
3322 a =
Dersxy(fNPeaks, i1, i2,
3323 working_space, working_space[peak_vel],
3324 working_space[peak_vel + 1]);
3328 b = a * (yw * yw - f *
f) / (ywm * ywm);
3329 working_space[2 * shift + k] += b *
c;
3330 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3331 working_space[3 * shift + k] += b *
c;
3335 b = a * (yw -
f) / ywm;
3336 working_space[2 * shift + k] += b *
c;
3338 working_space[3 * shift + k] += b *
c;
3344 a =
Dertx(fNPeaks, i1, working_space,
3345 working_space[peak_vel],
3346 working_space[peak_vel + 12]);
3350 b = a * (yw * yw - f *
f) / (ywm * ywm);
3351 working_space[2 * shift + k] += b *
c;
3352 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3353 working_space[3 * shift + k] += b *
c;
3357 b = a * (yw -
f) / ywm;
3358 working_space[2 * shift + k] += b *
c;
3360 working_space[3 * shift + k] += b *
c;
3366 a =
Derty(fNPeaks, i2, working_space,
3367 working_space[peak_vel + 1],
3368 working_space[peak_vel + 13]);
3372 b = a * (yw * yw - f *
f) / (ywm * ywm);
3373 working_space[2 * shift + k] += b *
c;
3374 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3375 working_space[3 * shift + k] += b *
c;
3379 b = a * (yw -
f) / ywm;
3380 working_space[2 * shift + k] += b *
c;
3382 working_space[3 * shift + k] += b *
c;
3388 a =
Dersx(fNPeaks, i1, working_space,
3389 working_space[peak_vel]);
3393 b = a * (yw * yw - f *
f) / (ywm * ywm);
3394 working_space[2 * shift + k] += b *
c;
3395 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3396 working_space[3 * shift + k] += b *
c;
3400 b = a * (yw -
f) / ywm;
3401 working_space[2 * shift + k] += b *
c;
3403 working_space[3 * shift + k] += b *
c;
3409 a =
Dersy(fNPeaks, i2, working_space,
3410 working_space[peak_vel + 1]);
3414 b = a * (yw * yw - f *
f) / (ywm * ywm);
3415 working_space[2 * shift + k] += b *
c;
3416 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3417 working_space[3 * shift + k] += b *
c;
3421 b = a * (yw -
f) / ywm;
3422 working_space[2 * shift + k] += b *
c;
3424 working_space[3 * shift + k] += b *
c;
3430 a =
Derbx(fNPeaks, i1, i2,
3431 working_space, working_space[peak_vel],
3432 working_space[peak_vel + 1],
3433 working_space[peak_vel + 6],
3434 working_space[peak_vel + 8],
3435 working_space[peak_vel + 12],
3436 working_space[peak_vel + 13]);
3440 b = a * (yw * yw - f *
f) / (ywm * ywm);
3441 working_space[2 * shift + k] += b *
c;
3442 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3443 working_space[3 * shift + k] += b *
c;
3447 b = a * (yw -
f) / ywm;
3448 working_space[2 * shift + k] += b *
c;
3450 working_space[3 * shift + k] += b *
c;
3456 a =
Derby(fNPeaks, i1, i2,
3457 working_space, working_space[peak_vel],
3458 working_space[peak_vel + 1],
3459 working_space[peak_vel + 6],
3460 working_space[peak_vel + 8],
3461 working_space[peak_vel + 12],
3462 working_space[peak_vel + 13]);
3466 b = a * (yw * yw - f *
f) / (ywm * ywm);
3467 working_space[2 * shift + k] += b *
c;
3468 b = a * a * (4 * yw - 2 *
f) / (ywm * ywm);
3469 working_space[3 * shift + k] += b *
c;
3473 b = a * (yw -
f) / ywm;
3474 working_space[2 * shift + k] += b *
c;
3476 working_space[3 * shift + k] += b *
c;
3483 for (j = 0; j < size; j++) {
3484 if (
TMath::Abs(working_space[3 * shift + j]) > 0.000001)
3485 working_space[2 * shift + j] = working_space[2 * shift + j] /
TMath::Abs(working_space[3 * shift + j]);
3487 working_space[2 * shift + j] = 0;
3496 for (j = 0; j < size; j++) {
3497 working_space[4 * shift + j] = working_space[shift + j];
3503 chi_min = 10000 * chi2;
3506 chi_min = 0.1 * chi2;
3508 for (
pi = 0.1; flag == 0 &&
pi <= 100;
pi += 0.1) {
3509 for (j = 0; j < size; j++) {
3510 working_space[shift + j] = working_space[4 * shift + j] +
pi * alpha * working_space[2 * shift + j];
3512 for (i = 0, j = 0; i <
fNPeaks; i++) {
3514 if (working_space[shift + j] < 0)
3515 working_space[shift + j] = 0;
3516 working_space[7 * i] = working_space[shift + j];
3520 if (working_space[shift + j] <
fXmin)
3521 working_space[shift + j] =
fXmin;
3522 if (working_space[shift + j] >
fXmax)
3523 working_space[shift + j] =
fXmax;
3524 working_space[7 * i + 1] = working_space[shift + j];
3528 if (working_space[shift + j] <
fYmin)
3529 working_space[shift + j] =
fYmin;
3530 if (working_space[shift + j] >
fYmax)
3531 working_space[shift + j] =
fYmax;
3532 working_space[7 * i + 2] = working_space[shift + j];
3536 if (working_space[shift + j] < 0)
3537 working_space[shift + j] = 0;
3538 working_space[7 * i + 3] = working_space[shift + j];
3542 if (working_space[shift + j] < 0)
3543 working_space[shift + j] = 0;
3544 working_space[7 * i + 4] = working_space[shift + j];
3548 if (working_space[shift + j] <
fXmin)
3549 working_space[shift + j] =
fXmin;
3550 if (working_space[shift + j] >
fXmax)
3551 working_space[shift + j] =
fXmax;
3552 working_space[7 * i + 5] = working_space[shift + j];
3556 if (working_space[shift + j] <
fYmin)
3557 working_space[shift + j] =
fYmin;
3558 if (working_space[shift + j] >
fYmax)
3559 working_space[shift + j] =
fYmax;
3560 working_space[7 * i + 6] = working_space[shift + j];
3565 if (working_space[shift + j] < 0.001) {
3566 working_space[shift + j] = 0.001;
3568 working_space[peak_vel] = working_space[shift + j];
3572 if (working_space[shift + j] < 0.001) {
3573 working_space[shift + j] = 0.001;
3575 working_space[peak_vel + 1] = working_space[shift + j];
3579 if (working_space[shift + j] < -1) {
3580 working_space[shift + j] = -1;
3582 if (working_space[shift + j] > 1) {
3583 working_space[shift + j] = 1;
3585 working_space[peak_vel + 2] = working_space[shift + j];
3589 working_space[peak_vel + 3] = working_space[shift + j];
3593 working_space[peak_vel + 4] = working_space[shift + j];
3597 working_space[peak_vel + 5] = working_space[shift + j];
3601 working_space[peak_vel + 6] = working_space[shift + j];
3605 working_space[peak_vel + 7] = working_space[shift + j];
3609 working_space[peak_vel + 8] = working_space[shift + j];
3613 working_space[peak_vel + 9] = working_space[shift + j];
3617 working_space[peak_vel + 10] = working_space[shift + j];
3621 working_space[peak_vel + 11] = working_space[shift + j];
3625 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
3626 if (working_space[shift + j] < 0)
3627 working_space[shift + j] = -0.001;
3629 working_space[shift + j] = 0.001;
3631 working_space[peak_vel + 12] = working_space[shift + j];
3635 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
3636 if (working_space[shift + j] < 0)
3637 working_space[shift + j] = -0.001;
3639 working_space[shift + j] = 0.001;
3641 working_space[peak_vel + 13] = working_space[shift + j];
3647 yw = source[i1][i2];
3651 working_space[peak_vel],
3652 working_space[peak_vel + 1],
3653 working_space[peak_vel + 2],
3654 working_space[peak_vel + 3],
3655 working_space[peak_vel + 4],
3656 working_space[peak_vel + 5],
3657 working_space[peak_vel + 6],
3658 working_space[peak_vel + 7],
3659 working_space[peak_vel + 8],
3660 working_space[peak_vel + 9],
3661 working_space[peak_vel + 10],
3662 working_space[peak_vel + 11],
3663 working_space[peak_vel + 12],
3664 working_space[peak_vel + 13]);
3677 chi2 += (yw -
f) * (yw - f) / ywm;
3685 pmin =
pi, chi_min = chi2;
3695 for (j = 0; j < size; j++) {
3696 working_space[shift + j] = working_space[4 * shift + j] + pmin * alpha * working_space[2 * shift + j];
3698 for (i = 0, j = 0; i <
fNPeaks; i++) {
3700 if (working_space[shift + j] < 0)
3701 working_space[shift + j] = 0;
3702 working_space[7 * i] = working_space[shift + j];
3706 if (working_space[shift + j] <
fXmin)
3707 working_space[shift + j] =
fXmin;
3708 if (working_space[shift + j] >
fXmax)
3709 working_space[shift + j] =
fXmax;
3710 working_space[7 * i + 1] = working_space[shift + j];
3714 if (working_space[shift + j] <
fYmin)
3715 working_space[shift + j] =
fYmin;
3716 if (working_space[shift + j] >
fYmax)
3717 working_space[shift + j] =
fYmax;
3718 working_space[7 * i + 2] = working_space[shift + j];
3722 if (working_space[shift + j] < 0)
3723 working_space[shift + j] = 0;
3724 working_space[7 * i + 3] = working_space[shift + j];
3728 if (working_space[shift + j] < 0)
3729 working_space[shift + j] = 0;
3730 working_space[7 * i + 4] = working_space[shift + j];
3734 if (working_space[shift + j] <
fXmin)
3735 working_space[shift + j] =
fXmin;
3736 if (working_space[shift + j] >
fXmax)
3737 working_space[shift + j] =
fXmax;
3738 working_space[7 * i + 5] = working_space[shift + j];
3742 if (working_space[shift + j] <
fYmin)
3743 working_space[shift + j] =
fYmin;
3744 if (working_space[shift + j] >
fYmax)
3745 working_space[shift + j] =
fYmax;
3746 working_space[7 * i + 6] = working_space[shift + j];
3751 if (working_space[shift + j] < 0.001) {
3752 working_space[shift + j] = 0.001;
3754 working_space[peak_vel] = working_space[shift + j];
3758 if (working_space[shift + j] < 0.001) {
3759 working_space[shift + j] = 0.001;
3761 working_space[peak_vel + 1] = working_space[shift + j];
3765 if (working_space[shift + j] < -1) {
3766 working_space[shift + j] = -1;
3768 if (working_space[shift + j] > 1) {
3769 working_space[shift + j] = 1;
3771 working_space[peak_vel + 2] = working_space[shift + j];
3775 working_space[peak_vel + 3] = working_space[shift + j];
3779 working_space[peak_vel + 4] = working_space[shift + j];
3783 working_space[peak_vel + 5] = working_space[shift + j];
3787 working_space[peak_vel + 6] = working_space[shift + j];
3791 working_space[peak_vel + 7] = working_space[shift + j];
3795 working_space[peak_vel + 8] = working_space[shift + j];
3799 working_space[peak_vel + 9] = working_space[shift + j];
3803 working_space[peak_vel + 10] = working_space[shift + j];
3807 working_space[peak_vel + 11] = working_space[shift + j];
3811 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
3812 if (working_space[shift + j] < 0)
3813 working_space[shift + j] = -0.001;
3815 working_space[shift + j] = 0.001;
3817 working_space[peak_vel + 12] = working_space[shift + j];
3821 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
3822 if (working_space[shift + j] < 0)
3823 working_space[shift + j] = -0.001;
3825 working_space[shift + j] = 0.001;
3827 working_space[peak_vel + 13] = working_space[shift + j];
3835 for (j = 0; j < size; j++) {
3836 working_space[shift + j] = working_space[4 * shift + j] + alpha * working_space[2 * shift + j];
3838 for (i = 0, j = 0; i <
fNPeaks; i++) {
3840 if (working_space[shift + j] < 0)
3841 working_space[shift + j] = 0;
3842 working_space[7 * i] = working_space[shift + j];
3846 if (working_space[shift + j] <
fXmin)
3847 working_space[shift + j] =
fXmin;
3848 if (working_space[shift + j] >
fXmax)
3849 working_space[shift + j] =
fXmax;
3850 working_space[7 * i + 1] = working_space[shift + j];
3854 if (working_space[shift + j] <
fYmin)
3855 working_space[shift + j] =
fYmin;
3856 if (working_space[shift + j] >
fYmax)
3857 working_space[shift + j] =
fYmax;
3858 working_space[7 * i + 2] = working_space[shift + j];
3862 if (working_space[shift + j] < 0)
3863 working_space[shift + j] = 0;
3864 working_space[7 * i + 3] = working_space[shift + j];
3868 if (working_space[shift + j] < 0)
3869 working_space[shift + j] = 0;
3870 working_space[7 * i + 4] = working_space[shift + j];
3874 if (working_space[shift + j] <
fXmin)
3875 working_space[shift + j] =
fXmin;
3876 if (working_space[shift + j] >
fXmax)
3877 working_space[shift + j] =
fXmax;
3878 working_space[7 * i + 5] = working_space[shift + j];
3882 if (working_space[shift + j] <
fYmin)
3883 working_space[shift + j] =
fYmin;
3884 if (working_space[shift + j] >
fYmax)
3885 working_space[shift + j] =
fYmax;
3886 working_space[7 * i + 6] = working_space[shift + j];
3891 if (working_space[shift + j] < 0.001) {
3892 working_space[shift + j] = 0.001;
3894 working_space[peak_vel] = working_space[shift + j];
3898 if (working_space[shift + j] < 0.001) {
3899 working_space[shift + j] = 0.001;
3901 working_space[peak_vel + 1] = working_space[shift + j];
3905 if (working_space[shift + j] < -1) {
3906 working_space[shift + j] = -1;
3908 if (working_space[shift + j] > 1) {
3909 working_space[shift + j] = 1;
3911 working_space[peak_vel + 2] = working_space[shift + j];
3915 working_space[peak_vel + 3] = working_space[shift + j];
3919 working_space[peak_vel + 4] = working_space[shift + j];
3923 working_space[peak_vel + 5] = working_space[shift + j];
3927 working_space[peak_vel + 6] = working_space[shift + j];
3931 working_space[peak_vel + 7] = working_space[shift + j];
3935 working_space[peak_vel + 8] = working_space[shift + j];
3939 working_space[peak_vel + 9] = working_space[shift + j];
3943 working_space[peak_vel + 10] = working_space[shift + j];
3947 working_space[peak_vel + 11] = working_space[shift + j];
3951 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
3952 if (working_space[shift + j] < 0)
3953 working_space[shift + j] = -0.001;
3955 working_space[shift + j] = 0.001;
3957 working_space[peak_vel + 12] = working_space[shift + j];
3961 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
3962 if (working_space[shift + j] < 0)
3963 working_space[shift + j] = -0.001;
3965 working_space[shift + j] = 0.001;
3967 working_space[peak_vel + 13] = working_space[shift + j];
3973 yw = source[i1][i2];
3975 f =
Shape2(fNPeaks, i1, i2,
3976 working_space, working_space[peak_vel],
3977 working_space[peak_vel + 1],
3978 working_space[peak_vel + 2],
3979 working_space[peak_vel + 3],
3980 working_space[peak_vel + 4],
3981 working_space[peak_vel + 5],
3982 working_space[peak_vel + 6],
3983 working_space[peak_vel + 7],
3984 working_space[peak_vel + 8],
3985 working_space[peak_vel + 9],
3986 working_space[peak_vel + 10],
3987 working_space[peak_vel + 11],
3988 working_space[peak_vel + 12],
3989 working_space[peak_vel + 13]);
4002 chi += (yw -
f) * (yw - f) / ywm;
4010 alpha = alpha * chi_opt / (2 * chi);
4013 alpha = alpha / 10.0;
4016 }
while (((chi > chi_opt
4021 for (j = 0; j < size; j++) {
4022 working_space[4 * shift + j] = 0;
4023 working_space[2 * shift + j] = 0;
4025 for (i1 =
fXmin, chi_cel = 0; i1 <=
fXmax; i1++) {
4027 yw = source[i1][i2];
4030 f =
Shape2(fNPeaks, i1, i2,
4031 working_space, working_space[peak_vel],
4032 working_space[peak_vel + 1],
4033 working_space[peak_vel + 2],
4034 working_space[peak_vel + 3],
4035 working_space[peak_vel + 4],
4036 working_space[peak_vel + 5],
4037 working_space[peak_vel + 6],
4038 working_space[peak_vel + 7],
4039 working_space[peak_vel + 8],
4040 working_space[peak_vel + 9],
4041 working_space[peak_vel + 10],
4042 working_space[peak_vel + 11],
4043 working_space[peak_vel + 12],
4044 working_space[peak_vel + 13]);
4045 chi_opt = (yw -
f) * (yw - f) / yw;
4046 chi_cel += (yw -
f) * (yw - f) / yw;
4049 for (j = 0, k = 0; j <
fNPeaks; j++) {
4052 working_space[7 * j + 1],
4053 working_space[7 * j + 2],
4054 working_space[peak_vel],
4055 working_space[peak_vel + 1],
4056 working_space[peak_vel + 2],
4057 working_space[peak_vel + 6],
4058 working_space[peak_vel + 7],
4059 working_space[peak_vel + 12],
4060 working_space[peak_vel + 13]);
4063 working_space[2 * shift + k] += chi_opt *
c;
4065 working_space[4 * shift + k] += b *
c;
4071 working_space[7 * j],
4072 working_space[7 * j + 1],
4073 working_space[7 * j + 2],
4074 working_space[peak_vel],
4075 working_space[peak_vel + 1],
4076 working_space[peak_vel + 2],
4077 working_space[peak_vel + 6],
4078 working_space[peak_vel + 7],
4079 working_space[peak_vel + 12],
4080 working_space[peak_vel + 13]);
4083 working_space[2 * shift + k] += chi_opt *
c;
4085 working_space[4 * shift + k] += b *
c;
4091 working_space[7 * j],
4092 working_space[7 * j + 1],
4093 working_space[7 * j + 2],
4094 working_space[peak_vel],
4095 working_space[peak_vel + 1],
4096 working_space[peak_vel + 2],
4097 working_space[peak_vel + 6],
4098 working_space[peak_vel + 7],
4099 working_space[peak_vel + 12],
4100 working_space[peak_vel + 13]);
4103 working_space[2 * shift + k] += chi_opt *
c;
4105 working_space[4 * shift + k] += b *
c;
4110 a =
Derampx(i1, working_space[7 * j + 5],
4111 working_space[peak_vel],
4112 working_space[peak_vel + 8],
4113 working_space[peak_vel + 10],
4114 working_space[peak_vel + 12]);
4117 working_space[2 * shift + k] += chi_opt *
c;
4119 working_space[4 * shift + k] += b *
c;
4124 a =
Derampx(i2, working_space[7 * j + 6],
4125 working_space[peak_vel + 1],
4126 working_space[peak_vel + 9],
4127 working_space[peak_vel + 11],
4128 working_space[peak_vel + 13]);
4131 working_space[2 * shift + k] += chi_opt *
c;
4133 working_space[4 * shift + k] += b *
c;
4138 a =
Deri01(i1, working_space[7 * j + 3],
4139 working_space[7 * j + 5],
4140 working_space[peak_vel],
4141 working_space[peak_vel + 8],
4142 working_space[peak_vel + 10],
4143 working_space[peak_vel + 12]);
4146 working_space[2 * shift + k] += chi_opt *
c;
4148 working_space[4 * shift + k] += b *
c;
4153 a =
Deri01(i2, working_space[7 * j + 4],
4154 working_space[7 * j + 6],
4155 working_space[peak_vel + 1],
4156 working_space[peak_vel + 9],
4157 working_space[peak_vel + 11],
4158 working_space[peak_vel + 13]);
4161 working_space[2 * shift + k] += chi_opt *
c;
4163 working_space[4 * shift + k] += b *
c;
4170 working_space, working_space[peak_vel],
4171 working_space[peak_vel + 1],
4172 working_space[peak_vel + 2],
4173 working_space[peak_vel + 6],
4174 working_space[peak_vel + 7],
4175 working_space[peak_vel + 8],
4176 working_space[peak_vel + 10],
4177 working_space[peak_vel + 12],
4178 working_space[peak_vel + 13]);
4181 working_space[2 * shift + k] += chi_opt *
c;
4183 working_space[4 * shift + k] += b *
c;
4189 working_space, working_space[peak_vel],
4190 working_space[peak_vel + 1],
4191 working_space[peak_vel + 2],
4192 working_space[peak_vel + 6],
4193 working_space[peak_vel + 7],
4194 working_space[peak_vel + 9],
4195 working_space[peak_vel + 11],
4196 working_space[peak_vel + 12],
4197 working_space[peak_vel + 13]);
4200 working_space[2 * shift + k] += chi_opt *
c;
4202 working_space[4 * shift + k] += b *
c;
4207 a =
Derro(fNPeaks, i1, i2,
4208 working_space, working_space[peak_vel],
4209 working_space[peak_vel + 1],
4210 working_space[peak_vel + 2]);
4213 working_space[2 * shift + k] += chi_opt *
c;
4215 working_space[4 * shift + k] += b *
c;
4223 working_space[2 * shift + k] += chi_opt *
c;
4225 working_space[4 * shift + k] += b *
c;
4233 working_space[2 * shift + k] += chi_opt *
c;
4235 working_space[4 * shift + k] += b *
c;
4243 working_space[2 * shift + k] += chi_opt *
c;
4245 working_space[4 * shift + k] += b *
c;
4250 a =
Dertxy(fNPeaks, i1, i2,
4251 working_space, working_space[peak_vel],
4252 working_space[peak_vel + 1],
4253 working_space[peak_vel + 12],
4254 working_space[peak_vel + 13]);
4257 working_space[2 * shift + k] += chi_opt *
c;
4259 working_space[4 * shift + k] += b *
c;
4264 a =
Dersxy(fNPeaks, i1, i2,
4265 working_space, working_space[peak_vel],
4266 working_space[peak_vel + 1]);
4269 working_space[2 * shift + k] += chi_opt *
c;
4271 working_space[4 * shift + k] += b *
c;
4276 a =
Dertx(fNPeaks, i1, working_space,
4277 working_space[peak_vel],
4278 working_space[peak_vel + 12]);
4281 working_space[2 * shift + k] += chi_opt *
c;
4283 working_space[4 * shift + k] += b *
c;
4288 a =
Derty(fNPeaks, i2, working_space,
4289 working_space[peak_vel + 1],
4290 working_space[peak_vel + 13]);
4293 working_space[2 * shift + k] += chi_opt *
c;
4295 working_space[4 * shift + k] += b *
c;
4300 a =
Dersx(fNPeaks, i1, working_space,
4301 working_space[peak_vel]);
4304 working_space[2 * shift + k] += chi_opt *
c;
4306 working_space[4 * shift + k] += b *
c;
4311 a =
Dersy(fNPeaks, i2, working_space,
4312 working_space[peak_vel + 1]);
4315 working_space[2 * shift + k] += chi_opt *
c;
4317 working_space[4 * shift + k] += b *
c;
4322 a =
Derbx(fNPeaks, i1, i2,
4323 working_space, working_space[peak_vel],
4324 working_space[peak_vel + 1],
4325 working_space[peak_vel + 6],
4326 working_space[peak_vel + 8],
4327 working_space[peak_vel + 12],
4328 working_space[peak_vel + 13]);
4331 working_space[2 * shift + k] += chi_opt *
c;
4333 working_space[4 * shift + k] += b *
c;
4338 a =
Derby(fNPeaks, i1, i2,
4339 working_space, working_space[peak_vel],
4340 working_space[peak_vel + 1],
4341 working_space[peak_vel + 6],
4342 working_space[peak_vel + 8],
4343 working_space[peak_vel + 12],
4344 working_space[peak_vel + 13]);
4347 working_space[2 * shift + k] += chi_opt *
c;
4349 working_space[4 * shift + k] += b *
c;
4357 chi_er = chi_cel / b;
4358 for (i = 0, j = 0; i <
fNPeaks; i++) {
4360 Volume(working_space[7 * i], working_space[peak_vel],
4361 working_space[peak_vel + 1], working_space[peak_vel + 2]);
4365 a =
Derpa2(working_space[peak_vel],
4366 working_space[peak_vel + 1],
4367 working_space[peak_vel + 2]);
4368 b = working_space[4 * shift + j];
4378 working_space[peak_vel + 1],
4379 working_space[peak_vel + 2]);
4380 b = working_space[4 * shift + peak_vel];
4390 working_space[peak_vel],
4391 working_space[peak_vel + 2]);
4392 b = working_space[4 * shift + peak_vel + 1];
4401 a =
Derpro(working_space[shift + j], working_space[peak_vel],
4402 working_space[peak_vel + 1],
4403 working_space[peak_vel + 2]);
4404 b = working_space[4 * shift + peak_vel + 2];
4419 fAmpCalc[i] = working_space[shift + j];
4420 if (working_space[3 * shift + j] != 0)
4431 if (working_space[3 * shift + j] != 0)
4442 if (working_space[3 * shift + j] != 0)
4453 if (working_space[3 * shift + j] != 0)
4464 if (working_space[3 * shift + j] != 0)
4475 if (working_space[3 * shift + j] != 0)
4486 if (working_space[3 * shift + j] != 0)
4498 if (working_space[3 * shift + j] != 0)
4509 if (working_space[3 * shift + j] != 0)
4519 fRoCalc = working_space[shift + j];
4520 if (working_space[3 * shift + j] != 0)
4530 fA0Calc = working_space[shift + j];
4531 if (working_space[3 * shift + j] != 0)
4541 fAxCalc = working_space[shift + j];
4542 if (working_space[3 * shift + j] != 0)
4552 fAyCalc = working_space[shift + j];
4553 if (working_space[3 * shift + j] != 0)
4563 fTxyCalc = working_space[shift + j];
4564 if (working_space[3 * shift + j] != 0)
4574 fSxyCalc = working_space[shift + j];
4575 if (working_space[3 * shift + j] != 0)
4585 fTxCalc = working_space[shift + j];
4586 if (working_space[3 * shift + j] != 0)
4596 fTyCalc = working_space[shift + j];
4597 if (working_space[3 * shift + j] != 0)
4607 fSxCalc = working_space[shift + j];
4608 if (working_space[3 * shift + j] != 0)
4618 fSyCalc = working_space[shift + j];
4619 if (working_space[3 * shift + j] != 0)
4629 fBxCalc = working_space[shift + j];
4630 if (working_space[3 * shift + j] != 0)
4640 fByCalc = working_space[shift + j];
4641 if (working_space[3 * shift + j] != 0)
4654 f =
Shape2(fNPeaks, i1, i2,
4655 working_space, working_space[peak_vel],
4656 working_space[peak_vel + 1],
4657 working_space[peak_vel + 2],
4658 working_space[peak_vel + 3],
4659 working_space[peak_vel + 4],
4660 working_space[peak_vel + 5],
4661 working_space[peak_vel + 6],
4662 working_space[peak_vel + 7],
4663 working_space[peak_vel + 8],
4664 working_space[peak_vel + 9],
4665 working_space[peak_vel + 10],
4666 working_space[peak_vel + 11],
4667 working_space[peak_vel + 12],
4668 working_space[peak_vel + 13]);
4672 delete [] working_space;
4928 Int_t i, i1, i2, j, k, shift =
4929 7 *
fNPeaks + 14, peak_vel, size, iter, regul_cycle,
4931 Double_t a, b,
c, alpha, chi_opt, yw, ywm,
f, chi2, chi_min, chi = 0
4932 ,
pi, pmin = 0, chi_cel = 0, chi_er;
4934 for (i = 0, j = 0; i <
fNPeaks; i++) {
4935 working_space[7 * i] =
fAmpInit[i];
4937 working_space[shift + j] =
fAmpInit[i];
4982 working_space[7 * i + 2] =
fRoInit;
4984 working_space[shift + j] =
fRoInit;
4987 working_space[7 * i + 3] =
fA0Init;
4989 working_space[shift + j] =
fA0Init;
4992 working_space[7 * i + 4] =
fAxInit;
4994 working_space[shift + j] =
fAxInit;
4997 working_space[7 * i + 5] =
fAyInit;
4999 working_space[shift + j] =
fAyInit;
5002 working_space[7 * i + 6] =
fTxyInit;
5004 working_space[shift + j] =
fTxyInit;
5007 working_space[7 * i + 7] =
fSxyInit;
5009 working_space[shift + j] =
fSxyInit;
5012 working_space[7 * i + 8] =
fTxInit;
5014 working_space[shift + j] =
fTxInit;
5017 working_space[7 * i + 9] =
fTyInit;
5019 working_space[shift + j] =
fTyInit;
5022 working_space[7 * i + 10] =
fSxyInit;
5024 working_space[shift + j] =
fSxInit;
5027 working_space[7 * i + 11] =
fSyInit;
5029 working_space[shift + j] =
fSyInit;
5032 working_space[7 * i + 12] =
fBxInit;
5034 working_space[shift + j] =
fBxInit;
5037 working_space[7 * i + 13] =
fByInit;
5039 working_space[shift + j] =
fByInit;
5044 for (i = 0; i < size; i++)
5045 working_matrix[i] =
new Double_t[size + 4];
5047 for (j = 0; j < size; j++) {
5048 working_space[3 * shift + j] = 0;
5049 for (k = 0; k <= size; k++) {
5050 working_matrix[j][k] = 0;
5060 for (j = 0, k = 0; j <
fNPeaks; j++) {
5062 working_space[2 * shift + k] =
5064 working_space[7 * j + 1],
5065 working_space[7 * j + 2],
5066 working_space[peak_vel],
5067 working_space[peak_vel + 1],
5068 working_space[peak_vel + 2],
5069 working_space[peak_vel + 6],
5070 working_space[peak_vel + 7],
5071 working_space[peak_vel + 12],
5072 working_space[peak_vel + 13]);
5076 working_space[2 * shift + k] =
5078 working_space[7 * j],
5079 working_space[7 * j + 1],
5080 working_space[7 * j + 2],
5081 working_space[peak_vel],
5082 working_space[peak_vel + 1],
5083 working_space[peak_vel + 2],
5084 working_space[peak_vel + 6],
5085 working_space[peak_vel + 7],
5086 working_space[peak_vel + 12],
5087 working_space[peak_vel + 13]);
5091 working_space[2 * shift + k] =
5093 working_space[7 * j],
5094 working_space[7 * j + 1],
5095 working_space[7 * j + 2],
5096 working_space[peak_vel],
5097 working_space[peak_vel + 1],
5098 working_space[peak_vel + 2],
5099 working_space[peak_vel + 6],
5100 working_space[peak_vel + 7],
5101 working_space[peak_vel + 12],
5102 working_space[peak_vel + 13]);
5106 working_space[2 * shift + k] =
5107 Derampx(i1, working_space[7 * j + 5],
5108 working_space[peak_vel],
5109 working_space[peak_vel + 8],
5110 working_space[peak_vel + 10],
5111 working_space[peak_vel + 12]);
5115 working_space[2 * shift + k] =
5116 Derampx(i2, working_space[7 * j + 6],
5117 working_space[peak_vel + 1],
5118 working_space[peak_vel + 9],
5119 working_space[peak_vel + 11],
5120 working_space[peak_vel + 13]);
5124 working_space[2 * shift + k] =
5125 Deri01(i1, working_space[7 * j + 3],
5126 working_space[7 * j + 5],
5127 working_space[peak_vel],
5128 working_space[peak_vel + 8],
5129 working_space[peak_vel + 10],
5130 working_space[peak_vel + 12]);
5134 working_space[2 * shift + k] =
5135 Deri01(i2, working_space[7 * j + 4],
5136 working_space[7 * j + 6],
5137 working_space[peak_vel + 1],
5138 working_space[peak_vel + 9],
5139 working_space[peak_vel + 11],
5140 working_space[peak_vel + 13]);
5144 working_space[2 * shift + k] =
5146 working_space, working_space[peak_vel],
5147 working_space[peak_vel + 1],
5148 working_space[peak_vel + 2],
5149 working_space[peak_vel + 6],
5150 working_space[peak_vel + 7],
5151 working_space[peak_vel + 8],
5152 working_space[peak_vel + 10],
5153 working_space[peak_vel + 12],
5154 working_space[peak_vel + 13]);
5158 working_space[2 * shift + k] =
5160 working_space, working_space[peak_vel],
5161 working_space[peak_vel + 1],
5162 working_space[peak_vel + 2],
5163 working_space[peak_vel + 6],
5164 working_space[peak_vel + 7],
5165 working_space[peak_vel + 9],
5166 working_space[peak_vel + 11],
5167 working_space[peak_vel + 12],
5168 working_space[peak_vel + 13]);
5172 working_space[2 * shift + k] =
5173 Derro(fNPeaks, i1, i2,
5174 working_space, working_space[peak_vel],
5175 working_space[peak_vel + 1],
5176 working_space[peak_vel + 2]);
5180 working_space[2 * shift + k] = 1.;
5184 working_space[2 * shift + k] = i1;
5188 working_space[2 * shift + k] = i2;
5192 working_space[2 * shift + k] =
5194 working_space, working_space[peak_vel],
5195 working_space[peak_vel + 1],
5196 working_space[peak_vel + 12],
5197 working_space[peak_vel + 13]);
5201 working_space[2 * shift + k] =
5203 working_space, working_space[peak_vel],
5204 working_space[peak_vel + 1]);
5208 working_space[2 * shift + k] =
5209 Dertx(fNPeaks, i1, working_space,
5210 working_space[peak_vel],
5211 working_space[peak_vel + 12]);
5215 working_space[2 * shift + k] =
5216 Derty(fNPeaks, i2, working_space,
5217 working_space[peak_vel + 1],
5218 working_space[peak_vel + 13]);
5222 working_space[2 * shift + k] =
5223 Dersx(fNPeaks, i1, working_space,
5224 working_space[peak_vel]);
5228 working_space[2 * shift + k] =
5229 Dersy(fNPeaks, i2, working_space,
5230 working_space[peak_vel + 1]);
5234 working_space[2 * shift + k] =
5235 Derbx(fNPeaks, i1, i2,
5236 working_space, working_space[peak_vel],
5237 working_space[peak_vel + 1],
5238 working_space[peak_vel + 6],
5239 working_space[peak_vel + 8],
5240 working_space[peak_vel + 12],
5241 working_space[peak_vel + 13]);
5245 working_space[2 * shift + k] =
5246 Derby(fNPeaks, i1, i2,
5247 working_space, working_space[peak_vel],
5248 working_space[peak_vel + 1],
5249 working_space[peak_vel + 6],
5250 working_space[peak_vel + 8],
5251 working_space[peak_vel + 12],
5252 working_space[peak_vel + 13]);
5255 yw = source[i1][i2];
5257 f =
Shape2(fNPeaks, i1, i2,
5258 working_space, working_space[peak_vel],
5259 working_space[peak_vel + 1],
5260 working_space[peak_vel + 2],
5261 working_space[peak_vel + 3],
5262 working_space[peak_vel + 4],
5263 working_space[peak_vel + 5],
5264 working_space[peak_vel + 6],
5265 working_space[peak_vel + 7],
5266 working_space[peak_vel + 8],
5267 working_space[peak_vel + 9],
5268 working_space[peak_vel + 10],
5269 working_space[peak_vel + 11],
5270 working_space[peak_vel + 12],
5271 working_space[peak_vel + 13]);
5279 chi_opt += (yw -
f) * (yw - f) / ywm;
5297 for (j = 0; j < size; j++) {
5298 for (k = 0; k < size; k++) {
5299 b = working_space[2 * shift +
5300 j] * working_space[2 * shift +
5303 b = b * (4 * yw - 2 *
f) / ywm;
5304 working_matrix[j][k] += b;
5306 working_space[3 * shift + j] += b;
5310 b = (f * f - yw * yw) / (ywm * ywm);
5314 for (j = 0; j < size; j++) {
5315 working_matrix[j][size] -=
5316 b * working_space[2 * shift + j];
5320 for (i = 0; i < size; i++) {
5321 working_matrix[i][size + 1] = 0;
5324 for (i = 0; i < size; i++) {
5325 working_space[2 * shift + i] = working_matrix[i][size + 1];
5334 for (j = 0; j < size; j++) {
5335 working_space[4 * shift + j] = working_space[shift + j];
5341 chi_min = 10000 * chi2;
5344 chi_min = 0.1 * chi2;
5346 for (
pi = 0.1; flag == 0 &&
pi <= 100;
pi += 0.1) {
5347 for (j = 0; j < size; j++) {
5348 working_space[shift + j] = working_space[4 * shift + j] +
pi * alpha * working_space[2 * shift + j];
5350 for (i = 0, j = 0; i <
fNPeaks; i++) {
5352 if (working_space[shift + j] < 0)
5353 working_space[shift + j] = 0;
5354 working_space[7 * i] = working_space[shift + j];
5358 if (working_space[shift + j] <
fXmin)
5359 working_space[shift + j] =
fXmin;
5360 if (working_space[shift + j] >
fXmax)
5361 working_space[shift + j] =
fXmax;
5362 working_space[7 * i + 1] = working_space[shift + j];
5366 if (working_space[shift + j] <
fYmin)
5367 working_space[shift + j] =
fYmin;
5368 if (working_space[shift + j] >
fYmax)
5369 working_space[shift + j] =
fYmax;
5370 working_space[7 * i + 2] = working_space[shift + j];
5374 if (working_space[shift + j] < 0)
5375 working_space[shift + j] = 0;
5376 working_space[7 * i + 3] = working_space[shift + j];
5380 if (working_space[shift + j] < 0)
5381 working_space[shift + j] = 0;
5382 working_space[7 * i + 4] = working_space[shift + j];
5386 if (working_space[shift + j] <
fXmin)
5387 working_space[shift + j] =
fXmin;
5388 if (working_space[shift + j] >
fXmax)
5389 working_space[shift + j] =
fXmax;
5390 working_space[7 * i + 5] = working_space[shift + j];
5394 if (working_space[shift + j] <
fYmin)
5395 working_space[shift + j] =
fYmin;
5396 if (working_space[shift + j] >
fYmax)
5397 working_space[shift + j] =
fYmax;
5398 working_space[7 * i + 6] = working_space[shift + j];
5403 if (working_space[shift + j] < 0.001) {
5404 working_space[shift + j] = 0.001;
5406 working_space[peak_vel] = working_space[shift + j];
5410 if (working_space[shift + j] < 0.001) {
5411 working_space[shift + j] = 0.001;
5413 working_space[peak_vel + 1] = working_space[shift + j];
5417 if (working_space[shift + j] < -1) {
5418 working_space[shift + j] = -1;
5420 if (working_space[shift + j] > 1) {
5421 working_space[shift + j] = 1;
5423 working_space[peak_vel + 2] = working_space[shift + j];
5427 working_space[peak_vel + 3] = working_space[shift + j];
5431 working_space[peak_vel + 4] = working_space[shift + j];
5435 working_space[peak_vel + 5] = working_space[shift + j];
5439 working_space[peak_vel + 6] = working_space[shift + j];
5443 working_space[peak_vel + 7] = working_space[shift + j];
5447 working_space[peak_vel + 8] = working_space[shift + j];
5451 working_space[peak_vel + 9] = working_space[shift + j];
5455 working_space[peak_vel + 10] = working_space[shift + j];
5459 working_space[peak_vel + 11] = working_space[shift + j];
5463 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
5464 if (working_space[shift + j] < 0)
5465 working_space[shift + j] = -0.001;
5467 working_space[shift + j] = 0.001;
5469 working_space[peak_vel + 12] = working_space[shift + j];
5473 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
5474 if (working_space[shift + j] < 0)
5475 working_space[shift + j] = -0.001;
5477 working_space[shift + j] = 0.001;
5479 working_space[peak_vel + 13] = working_space[shift + j];
5485 yw = source[i1][i2];
5489 working_space[peak_vel],
5490 working_space[peak_vel + 1],
5491 working_space[peak_vel + 2],
5492 working_space[peak_vel + 3],
5493 working_space[peak_vel + 4],
5494 working_space[peak_vel + 5],
5495 working_space[peak_vel + 6],
5496 working_space[peak_vel + 7],
5497 working_space[peak_vel + 8],
5498 working_space[peak_vel + 9],
5499 working_space[peak_vel + 10],
5500 working_space[peak_vel + 11],
5501 working_space[peak_vel + 12],
5502 working_space[peak_vel + 13]);
5515 chi2 += (yw -
f) * (yw - f) / ywm;
5523 pmin =
pi, chi_min = chi2;
5533 for (j = 0; j < size; j++) {
5534 working_space[shift + j] = working_space[4 * shift + j] + pmin * alpha * working_space[2 * shift + j];
5536 for (i = 0, j = 0; i <
fNPeaks; i++) {
5538 if (working_space[shift + j] < 0)
5539 working_space[shift + j] = 0;
5540 working_space[7 * i] = working_space[shift + j];
5544 if (working_space[shift + j] <
fXmin)
5545 working_space[shift + j] =
fXmin;
5546 if (working_space[shift + j] >
fXmax)
5547 working_space[shift + j] =
fXmax;
5548 working_space[7 * i + 1] = working_space[shift + j];
5552 if (working_space[shift + j] <
fYmin)
5553 working_space[shift + j] =
fYmin;
5554 if (working_space[shift + j] >
fYmax)
5555 working_space[shift + j] =
fYmax;
5556 working_space[7 * i + 2] = working_space[shift + j];
5560 if (working_space[shift + j] < 0)
5561 working_space[shift + j] = 0;
5562 working_space[7 * i + 3] = working_space[shift + j];
5566 if (working_space[shift + j] < 0)
5567 working_space[shift + j] = 0;
5568 working_space[7 * i + 4] = working_space[shift + j];
5572 if (working_space[shift + j] <
fXmin)
5573 working_space[shift + j] =
fXmin;
5574 if (working_space[shift + j] >
fXmax)
5575 working_space[shift + j] =
fXmax;
5576 working_space[7 * i + 5] = working_space[shift + j];
5580 if (working_space[shift + j] <
fYmin)
5581 working_space[shift + j] =
fYmin;
5582 if (working_space[shift + j] >
fYmax)
5583 working_space[shift + j] =
fYmax;
5584 working_space[7 * i + 6] = working_space[shift + j];
5589 if (working_space[shift + j] < 0.001) {
5590 working_space[shift + j] = 0.001;
5592 working_space[peak_vel] = working_space[shift + j];
5596 if (working_space[shift + j] < 0.001) {
5597 working_space[shift + j] = 0.001;
5599 working_space[peak_vel + 1] = working_space[shift + j];
5603 if (working_space[shift + j] < -1) {
5604 working_space[shift + j] = -1;
5606 if (working_space[shift + j] > 1) {
5607 working_space[shift + j] = 1;
5609 working_space[peak_vel + 2] = working_space[shift + j];
5613 working_space[peak_vel + 3] = working_space[shift + j];
5617 working_space[peak_vel + 4] = working_space[shift + j];
5621 working_space[peak_vel + 5] = working_space[shift + j];
5625 working_space[peak_vel + 6] = working_space[shift + j];
5629 working_space[peak_vel + 7] = working_space[shift + j];
5633 working_space[peak_vel + 8] = working_space[shift + j];
5637 working_space[peak_vel + 9] = working_space[shift + j];
5641 working_space[peak_vel + 10] = working_space[shift + j];
5645 working_space[peak_vel + 11] = working_space[shift + j];
5649 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
5650 if (working_space[shift + j] < 0)
5651 working_space[shift + j] = -0.001;
5653 working_space[shift + j] = 0.001;
5655 working_space[peak_vel + 12] = working_space[shift + j];
5659 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
5660 if (working_space[shift + j] < 0)
5661 working_space[shift + j] = -0.001;
5663 working_space[shift + j] = 0.001;
5665 working_space[peak_vel + 13] = working_space[shift + j];
5673 for (j = 0; j < size; j++) {
5674 working_space[shift + j] = working_space[4 * shift + j] + alpha * working_space[2 * shift + j];
5676 for (i = 0, j = 0; i <
fNPeaks; i++) {
5678 if (working_space[shift + j] < 0)
5679 working_space[shift + j] = 0;
5680 working_space[7 * i] = working_space[shift + j];
5684 if (working_space[shift + j] <
fXmin)
5685 working_space[shift + j] =
fXmin;
5686 if (working_space[shift + j] >
fXmax)
5687 working_space[shift + j] =
fXmax;
5688 working_space[7 * i + 1] = working_space[shift + j];
5692 if (working_space[shift + j] <
fYmin)
5693 working_space[shift + j] =
fYmin;
5694 if (working_space[shift + j] >
fYmax)
5695 working_space[shift + j] =
fYmax;
5696 working_space[7 * i + 2] = working_space[shift + j];
5700 if (working_space[shift + j] < 0)
5701 working_space[shift + j] = 0;
5702 working_space[7 * i + 3] = working_space[shift + j];
5706 if (working_space[shift + j] < 0)
5707 working_space[shift + j] = 0;
5708 working_space[7 * i + 4] = working_space[shift + j];
5712 if (working_space[shift + j] <
fXmin)
5713 working_space[shift + j] =
fXmin;
5714 if (working_space[shift + j] >
fXmax)
5715 working_space[shift + j] =
fXmax;
5716 working_space[7 * i + 5] = working_space[shift + j];
5720 if (working_space[shift + j] <
fYmin)
5721 working_space[shift + j] =
fYmin;
5722 if (working_space[shift + j] >
fYmax)
5723 working_space[shift + j] =
fYmax;
5724 working_space[7 * i + 6] = working_space[shift + j];
5729 if (working_space[shift + j] < 0.001) {
5730 working_space[shift + j] = 0.001;
5732 working_space[peak_vel] = working_space[shift + j];
5736 if (working_space[shift + j] < 0.001) {
5737 working_space[shift + j] = 0.001;
5739 working_space[peak_vel + 1] = working_space[shift + j];
5743 if (working_space[shift + j] < -1) {
5744 working_space[shift + j] = -1;
5746 if (working_space[shift + j] > 1) {
5747 working_space[shift + j] = 1;
5749 working_space[peak_vel + 2] = working_space[shift + j];
5753 working_space[peak_vel + 3] = working_space[shift + j];
5757 working_space[peak_vel + 4] = working_space[shift + j];
5761 working_space[peak_vel + 5] = working_space[shift + j];
5765 working_space[peak_vel + 6] = working_space[shift + j];
5769 working_space[peak_vel + 7] = working_space[shift + j];
5773 working_space[peak_vel + 8] = working_space[shift + j];
5777 working_space[peak_vel + 9] = working_space[shift + j];
5781 working_space[peak_vel + 10] = working_space[shift + j];
5785 working_space[peak_vel + 11] = working_space[shift + j];
5789 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
5790 if (working_space[shift + j] < 0)
5791 working_space[shift + j] = -0.001;
5793 working_space[shift + j] = 0.001;
5795 working_space[peak_vel + 12] = working_space[shift + j];
5799 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
5800 if (working_space[shift + j] < 0)
5801 working_space[shift + j] = -0.001;
5803 working_space[shift + j] = 0.001;
5805 working_space[peak_vel + 13] = working_space[shift + j];
5811 yw = source[i1][i2];
5813 f =
Shape2(fNPeaks, i1, i2,
5814 working_space, working_space[peak_vel],
5815 working_space[peak_vel + 1],
5816 working_space[peak_vel + 2],
5817 working_space[peak_vel + 3],
5818 working_space[peak_vel + 4],
5819 working_space[peak_vel + 5],
5820 working_space[peak_vel + 6],
5821 working_space[peak_vel + 7],
5822 working_space[peak_vel + 8],
5823 working_space[peak_vel + 9],
5824 working_space[peak_vel + 10],
5825 working_space[peak_vel + 11],
5826 working_space[peak_vel + 12],
5827 working_space[peak_vel + 13]);
5840 chi += (yw -
f) * (yw - f) / ywm;
5848 alpha = alpha * chi_opt / (2 * chi);
5851 alpha = alpha / 10.0;
5854 }
while (((chi > chi_opt
5859 for (j = 0; j < size; j++) {
5860 working_space[4 * shift + j] = 0;
5861 working_space[2 * shift + j] = 0;
5863 for (i1 =
fXmin, chi_cel = 0; i1 <=
fXmax; i1++) {
5865 yw = source[i1][i2];
5868 f =
Shape2(fNPeaks, i1, i2,
5869 working_space, working_space[peak_vel],
5870 working_space[peak_vel + 1],
5871 working_space[peak_vel + 2],
5872 working_space[peak_vel + 3],
5873 working_space[peak_vel + 4],
5874 working_space[peak_vel + 5],
5875 working_space[peak_vel + 6],
5876 working_space[peak_vel + 7],
5877 working_space[peak_vel + 8],
5878 working_space[peak_vel + 9],
5879 working_space[peak_vel + 10],
5880 working_space[peak_vel + 11],
5881 working_space[peak_vel + 12],
5882 working_space[peak_vel + 13]);
5883 chi_opt = (yw -
f) * (yw - f) / yw;
5884 chi_cel += (yw -
f) * (yw - f) / yw;
5887 for (j = 0, k = 0; j <
fNPeaks; j++) {
5890 working_space[7 * j + 1],
5891 working_space[7 * j + 2],
5892 working_space[peak_vel],
5893 working_space[peak_vel + 1],
5894 working_space[peak_vel + 2],
5895 working_space[peak_vel + 6],
5896 working_space[peak_vel + 7],
5897 working_space[peak_vel + 12],
5898 working_space[peak_vel + 13]);
5900 working_space[2 * shift + k] += chi_opt;
5902 working_space[4 * shift + k] += b;
5908 working_space[7 * j],
5909 working_space[7 * j + 1],
5910 working_space[7 * j + 2],
5911 working_space[peak_vel],
5912 working_space[peak_vel + 1],
5913 working_space[peak_vel + 2],
5914 working_space[peak_vel + 6],
5915 working_space[peak_vel + 7],
5916 working_space[peak_vel + 12],
5917 working_space[peak_vel + 13]);
5919 working_space[2 * shift + k] += chi_opt;
5921 working_space[4 * shift + k] += b;
5927 working_space[7 * j],
5928 working_space[7 * j + 1],
5929 working_space[7 * j + 2],
5930 working_space[peak_vel],
5931 working_space[peak_vel + 1],
5932 working_space[peak_vel + 2],
5933 working_space[peak_vel + 6],
5934 working_space[peak_vel + 7],
5935 working_space[peak_vel + 12],
5936 working_space[peak_vel + 13]);
5938 working_space[2 * shift + k] += chi_opt;
5940 working_space[4 * shift + k] += b;
5945 a =
Derampx(i1, working_space[7 * j + 5],
5946 working_space[peak_vel],
5947 working_space[peak_vel + 8],
5948 working_space[peak_vel + 10],
5949 working_space[peak_vel + 12]);
5951 working_space[2 * shift + k] += chi_opt;
5953 working_space[4 * shift + k] += b;
5958 a =
Derampx(i2, working_space[7 * j + 6],
5959 working_space[peak_vel + 1],
5960 working_space[peak_vel + 9],
5961 working_space[peak_vel + 11],
5962 working_space[peak_vel + 13]);
5964 working_space[2 * shift + k] += chi_opt;
5966 working_space[4 * shift + k] += b;
5971 a =
Deri01(i1, working_space[7 * j + 3],
5972 working_space[7 * j + 5],
5973 working_space[peak_vel],
5974 working_space[peak_vel + 8],
5975 working_space[peak_vel + 10],
5976 working_space[peak_vel + 12]);
5978 working_space[2 * shift + k] += chi_opt;
5980 working_space[4 * shift + k] += b;
5985 a =
Deri01(i2, working_space[7 * j + 4],
5986 working_space[7 * j + 6],
5987 working_space[peak_vel + 1],
5988 working_space[peak_vel + 9],
5989 working_space[peak_vel + 11],
5990 working_space[peak_vel + 13]);
5992 working_space[2 * shift + k] += chi_opt;
5994 working_space[4 * shift + k] += b;
6001 working_space, working_space[peak_vel],
6002 working_space[peak_vel + 1],
6003 working_space[peak_vel + 2],
6004 working_space[peak_vel + 6],
6005 working_space[peak_vel + 7],
6006 working_space[peak_vel + 8],
6007 working_space[peak_vel + 10],
6008 working_space[peak_vel + 12],
6009 working_space[peak_vel + 13]);
6011 working_space[2 * shift + k] += chi_opt;
6013 working_space[4 * shift + k] += b;
6019 working_space, working_space[peak_vel],
6020 working_space[peak_vel + 1],
6021 working_space[peak_vel + 2],
6022 working_space[peak_vel + 6],
6023 working_space[peak_vel + 7],
6024 working_space[peak_vel + 9],
6025 working_space[peak_vel + 11],
6026 working_space[peak_vel + 12],
6027 working_space[peak_vel + 13]);
6029 working_space[2 * shift + k] += chi_opt;
6031 working_space[4 * shift + k] += b;
6036 a =
Derro(fNPeaks, i1, i2,
6037 working_space, working_space[peak_vel],
6038 working_space[peak_vel + 1],
6039 working_space[peak_vel + 2]);
6041 working_space[2 * shift + k] += chi_opt;
6043 working_space[4 * shift + k] += b;
6050 working_space[2 * shift + k] += chi_opt;
6052 working_space[4 * shift + k] += b;
6059 working_space[2 * shift + k] += chi_opt;
6061 working_space[4 * shift + k] += b;
6068 working_space[2 * shift + k] += chi_opt;
6070 working_space[4 * shift + k] += b;
6075 a =
Dertxy(fNPeaks, i1, i2,
6076 working_space, working_space[peak_vel],
6077 working_space[peak_vel + 1],
6078 working_space[peak_vel + 12],
6079 working_space[peak_vel + 13]);
6081 working_space[2 * shift + k] += chi_opt;
6083 working_space[4 * shift + k] += b;
6088 a =
Dersxy(fNPeaks, i1, i2,
6089 working_space, working_space[peak_vel],
6090 working_space[peak_vel + 1]);
6092 working_space[2 * shift + k] += chi_opt;
6094 working_space[4 * shift + k] += b;
6099 a =
Dertx(fNPeaks, i1, working_space,
6100 working_space[peak_vel],
6101 working_space[peak_vel + 12]);
6103 working_space[2 * shift + k] += chi_opt;
6105 working_space[4 * shift + k] += b;
6110 a =
Derty(fNPeaks, i2, working_space,
6111 working_space[peak_vel + 1],
6112 working_space[peak_vel + 13]);
6114 working_space[2 * shift + k] += chi_opt;
6116 working_space[4 * shift + k] += b;
6121 a =
Dersx(fNPeaks, i1, working_space,
6122 working_space[peak_vel]);
6124 working_space[2 * shift + k] += chi_opt;
6126 working_space[4 * shift + k] += b;
6131 a =
Dersy(fNPeaks, i2, working_space,
6132 working_space[peak_vel + 1]);
6134 working_space[2 * shift + k] += chi_opt;
6136 working_space[4 * shift + k] += b;
6141 a =
Derbx(fNPeaks, i1, i2,
6142 working_space, working_space[peak_vel],
6143 working_space[peak_vel + 1],
6144 working_space[peak_vel + 6],
6145 working_space[peak_vel + 8],
6146 working_space[peak_vel + 12],
6147 working_space[peak_vel + 13]);
6149 working_space[2 * shift + k] += chi_opt;
6151 working_space[4 * shift + k] += b;
6156 a =
Derby(fNPeaks, i1, i2,
6157 working_space, working_space[peak_vel],
6158 working_space[peak_vel + 1],
6159 working_space[peak_vel + 6],
6160 working_space[peak_vel + 8],
6161 working_space[peak_vel + 12],
6162 working_space[peak_vel + 13]);
6164 working_space[2 * shift + k] += chi_opt;
6166 working_space[4 * shift + k] += b;
6174 chi_er = chi_cel / b;
6175 for (i = 0, j = 0; i <
fNPeaks; i++) {
6177 Volume(working_space[7 * i], working_space[peak_vel],
6178 working_space[peak_vel + 1], working_space[peak_vel + 2]);
6182 a =
Derpa2(working_space[peak_vel],
6183 working_space[peak_vel + 1],
6184 working_space[peak_vel + 2]);
6185 b = working_space[4 * shift + j];
6195 working_space[peak_vel + 1],
6196 working_space[peak_vel + 2]);
6197 b = working_space[4 * shift + peak_vel];
6207 working_space[peak_vel],
6208 working_space[peak_vel + 2]);
6209 b = working_space[4 * shift + peak_vel + 1];
6218 a =
Derpro(working_space[shift + j], working_space[peak_vel],
6219 working_space[peak_vel + 1],
6220 working_space[peak_vel + 2]);
6221 b = working_space[4 * shift + peak_vel + 2];
6236 fAmpCalc[i] = working_space[shift + j];
6237 if (working_space[3 * shift + j] != 0)
6248 if (working_space[3 * shift + j] != 0)
6259 if (working_space[3 * shift + j] != 0)
6270 if (working_space[3 * shift + j] != 0)
6281 if (working_space[3 * shift + j] != 0)
6292 if (working_space[3 * shift + j] != 0)
6303 if (working_space[3 * shift + j] != 0)
6315 if (working_space[3 * shift + j] != 0)
6326 if (working_space[3 * shift + j] != 0)
6336 fRoCalc = working_space[shift + j];
6337 if (working_space[3 * shift + j] != 0)
6347 fA0Calc = working_space[shift + j];
6348 if (working_space[3 * shift + j] != 0)
6358 fAxCalc = working_space[shift + j];
6359 if (working_space[3 * shift + j] != 0)
6369 fAyCalc = working_space[shift + j];
6370 if (working_space[3 * shift + j] != 0)
6380 fTxyCalc = working_space[shift + j];
6381 if (working_space[3 * shift + j] != 0)
6391 fSxyCalc = working_space[shift + j];
6392 if (working_space[3 * shift + j] != 0)
6402 fTxCalc = working_space[shift + j];
6403 if (working_space[3 * shift + j] != 0)
6413 fTyCalc = working_space[shift + j];
6414 if (working_space[3 * shift + j] != 0)
6424 fSxCalc = working_space[shift + j];
6425 if (working_space[3 * shift + j] != 0)
6435 fSyCalc = working_space[shift + j];
6436 if (working_space[3 * shift + j] != 0)
6446 fBxCalc = working_space[shift + j];
6447 if (working_space[3 * shift + j] != 0)
6457 fByCalc = working_space[shift + j];
6458 if (working_space[3 * shift + j] != 0)
6471 f =
Shape2(fNPeaks, i1, i2,
6472 working_space, working_space[peak_vel],
6473 working_space[peak_vel + 1],
6474 working_space[peak_vel + 2],
6475 working_space[peak_vel + 3],
6476 working_space[peak_vel + 4],
6477 working_space[peak_vel + 5],
6478 working_space[peak_vel + 6],
6479 working_space[peak_vel + 7],
6480 working_space[peak_vel + 8],
6481 working_space[peak_vel + 9],
6482 working_space[peak_vel + 10],
6483 working_space[peak_vel + 11],
6484 working_space[peak_vel + 12],
6485 working_space[peak_vel + 13]);
6490 for (i = 0; i < size; i++)
delete [] working_matrix[i];
6491 delete [] working_matrix;
6492 delete [] working_space;
6511 if(xmin<0 || xmax <= xmin || ymin<0 || ymax <= ymin){
6512 Error(
"SetFitParameters",
"Wrong range");
6515 if (numberIterations <= 0){
6516 Error(
"SetFitParameters",
"Invalid number of iterations, must be positive");
6519 if (alpha <= 0 || alpha > 1){
6520 Error (
"SetFitParameters",
"Invalid step coefficient alpha, must be > than 0 and <=1");
6526 Error(
"SetFitParameters",
"Wrong type of statistic");
6531 Error(
"SetFitParameters",
"Wrong optimization algorithm");
6537 Error(
"SetFitParameters",
"Wrong power");
6542 Error(
"SetFitParameters",
"Wrong order of Taylor development");
6571 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)
6573 if (sigmaX <= 0 || sigmaY <= 0){
6574 Error (
"SetPeakParameters",
"Invalid sigma, must be > than 0");
6577 if (ro < -1 || ro > 1){
6578 Error (
"SetPeakParameters",
"Invalid ro, must be from region <-1,1>");
6583 if(positionInitX[i] <
fXmin || positionInitX[i] >
fXmax){
6584 Error (
"SetPeakParameters",
"Invalid peak position, must be in the range fXmin, fXmax");
6587 if(positionInitY[i] <
fYmin || positionInitY[i] >
fYmax){
6588 Error (
"SetPeakParameters",
"Invalid peak position, must be in the range fYmin, fYmax");
6591 if(positionInitX1[i] <
fXmin || positionInitX1[i] >
fXmax){
6592 Error (
"SetPeakParameters",
"Invalid ridge position, must be in the range fXmin, fXmax");
6595 if(positionInitY1[i] <
fYmin || positionInitY1[i] >
fYmax){
6596 Error (
"SetPeakParameters",
"Invalid ridge position, must be in the range fYmin, fYmax");
6600 Error (
"SetPeakParameters",
"Invalid peak amplitude, must be > than 0");
6603 if(ampInitX1[i] < 0){
6604 Error (
"SetPeakParameters",
"Invalid x ridge amplitude, must be > than 0");
6607 if(ampInitY1[i] < 0){
6608 Error (
"SetPeakParameters",
"Invalid y ridge amplitude, must be > than 0");
6677 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)
6771 amplitudeErrors[i] =
fAmpErr[i];
6898 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) // ...
TSpectrum2Fit(void)
default constructor
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
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)
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
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)
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) // ...