823 Int_t i, j, k, shift =
824 2 *
fNPeaks + 7, peak_vel, rozmer, iter, pw, regul_cycle,
826 Double_t a,
b,
c,
d = 0, alpha, chi_opt, yw, ywm,
f, chi2, chi_min, chi =
827 0, pi, pmin = 0, chi_cel = 0, chi_er;
829 for (i = 0, j = 0; i <
fNPeaks; i++) {
832 working_space[shift + j] =
fAmpInit[i];
847 working_space[2 * i + 1] =
fTInit;
848 if (
fFixT ==
false) {
849 working_space[shift + j] =
fTInit;
852 working_space[2 * i + 2] =
fBInit;
853 if (
fFixB ==
false) {
854 working_space[shift + j] =
fBInit;
857 working_space[2 * i + 3] =
fSInit;
858 if (
fFixS ==
false) {
859 working_space[shift + j] =
fSInit;
862 working_space[2 * i + 4] =
fA0Init;
864 working_space[shift + j] =
fA0Init;
867 working_space[2 * i + 5] =
fA1Init;
869 working_space[shift + j] =
fA1Init;
872 working_space[2 * i + 6] =
fA2Init;
874 working_space[shift + j] =
fA2Init;
879 delete [] working_space;
880 Error (
"FitAwmi",
"All parameters are fixed");
884 delete [] working_space;
885 Error (
"FitAwmi",
"Number of fitted parameters is larger than # of fitted points");
889 for (j = 0; j < rozmer; j++) {
890 working_space[2 * shift + j] = 0, working_space[3 * shift + j] = 0;
895 chi_opt = 0, pw =
fPower - 2;
900 working_space[peak_vel], working_space[peak_vel + 1],
901 working_space[peak_vel + 3],
902 working_space[peak_vel + 2],
903 working_space[peak_vel + 4],
904 working_space[peak_vel + 5],
905 working_space[peak_vel + 6]);
913 chi_opt += (yw -
f) * (yw -
f) / ywm;
933 for (j = 0, k = 0; j <
fNPeaks; j++) {
936 working_space[peak_vel],
937 working_space[peak_vel + 1],
938 working_space[peak_vel + 3],
939 working_space[peak_vel + 2]);
943 b =
a * (yw * yw -
f *
f) / (ywm * ywm);
944 working_space[2 * shift + k] +=
b *
c;
945 b =
a *
a * (4 * yw - 2 *
f) / (ywm * ywm);
946 working_space[3 * shift + k] +=
b *
c;
950 b =
a * (yw -
f) / ywm;
951 working_space[2 * shift + k] +=
b *
c;
953 working_space[3 * shift + k] +=
b *
c;
960 working_space[2 * j + 1],
961 working_space[peak_vel],
962 working_space[peak_vel + 1],
963 working_space[peak_vel + 3],
964 working_space[peak_vel + 2]);
967 working_space[2 * j + 1],
968 working_space[peak_vel]);
974 if (((
a +
d) <= 0 &&
a >= 0) || ((
a +
d) >= 0 &&
a <= 0))
982 b =
a * (yw * yw -
f *
f) / (ywm * ywm);
983 working_space[2 * shift + k] +=
b *
c;
984 b =
a *
a * (4 * yw - 2 *
f) / (ywm * ywm);
985 working_space[3 * shift + k] +=
b *
c;
989 b =
a * (yw -
f) / ywm;
990 working_space[2 * shift + k] +=
b *
c;
992 working_space[3 * shift + k] +=
b *
c;
1000 working_space[peak_vel],
1001 working_space[peak_vel + 1],
1002 working_space[peak_vel + 3],
1003 working_space[peak_vel + 2]);
1006 working_space, working_space[peak_vel]);
1012 if (((
a +
d) <= 0 &&
a >= 0) || ((
a +
d) >= 0 &&
a <= 0))
1020 b =
a * (yw * yw -
f *
f) / (ywm * ywm);
1021 working_space[2 * shift + k] +=
b *
c;
1022 b =
a *
a * (4 * yw - 2 *
f) / (ywm * ywm);
1023 working_space[3 * shift + k] +=
b *
c;
1027 b =
a * (yw -
f) / ywm;
1028 working_space[2 * shift + k] +=
b *
c;
1030 working_space[3 * shift + k] +=
b *
c;
1035 if (
fFixT ==
false) {
1037 working_space[peak_vel],
1038 working_space[peak_vel + 2]);
1042 b =
a * (yw * yw -
f *
f) / (ywm * ywm);
1043 working_space[2 * shift + k] +=
b *
c;
1044 b =
a *
a * (4 * yw - 2 *
f) / (ywm * ywm);
1045 working_space[3 * shift + k] +=
b *
c;
1049 b =
a * (yw -
f) / ywm;
1050 working_space[2 * shift + k] +=
b *
c;
1052 working_space[3 * shift + k] +=
b *
c;
1057 if (
fFixB ==
false) {
1059 working_space[peak_vel], working_space[peak_vel + 1],
1060 working_space[peak_vel + 2]);
1064 b =
a * (yw * yw -
f *
f) / (ywm * ywm);
1065 working_space[2 * shift + k] +=
b *
c;
1066 b =
a *
a * (4 * yw - 2 *
f) / (ywm * ywm);
1067 working_space[3 * shift + k] +=
b *
c;
1071 b =
a * (yw -
f) / ywm;
1072 working_space[2 * shift + k] +=
b *
c;
1074 working_space[3 * shift + k] +=
b *
c;
1079 if (
fFixS ==
false) {
1081 working_space[peak_vel]);
1085 b =
a * (yw * yw -
f *
f) / (ywm * ywm);
1086 working_space[2 * shift + k] +=
b *
c;
1087 b =
a *
a * (4 * yw - 2 *
f) / (ywm * ywm);
1088 working_space[3 * shift + k] +=
b *
c;
1092 b =
a * (yw -
f) / ywm;
1093 working_space[2 * shift + k] +=
b *
c;
1095 working_space[3 * shift + k] +=
b *
c;
1105 b =
a * (yw * yw -
f *
f) / (ywm * ywm);
1106 working_space[2 * shift + k] +=
b *
c;
1107 b =
a *
a * (4 * yw - 2 *
f) / (ywm * ywm);
1108 working_space[3 * shift + k] +=
b *
c;
1112 b =
a * (yw -
f) / ywm;
1113 working_space[2 * shift + k] +=
b *
c;
1115 working_space[3 * shift + k] +=
b *
c;
1125 b =
a * (yw * yw -
f *
f) / (ywm * ywm);
1126 working_space[2 * shift + k] +=
b *
c;
1127 b =
a *
a * (4 * yw - 2 *
f) / (ywm * ywm);
1128 working_space[3 * shift + k] +=
b *
c;
1132 b =
a * (yw -
f) / ywm;
1133 working_space[2 * shift + k] +=
b *
c;
1135 working_space[3 * shift + k] +=
b *
c;
1145 b =
a * (yw * yw -
f *
f) / (ywm * ywm);
1146 working_space[2 * shift + k] +=
b *
c;
1147 b =
a *
a * (4 * yw - 2 *
f) / (ywm * ywm);
1148 working_space[3 * shift + k] +=
b *
c;
1152 b =
a * (yw -
f) / ywm;
1153 working_space[2 * shift + k] +=
b *
c;
1155 working_space[3 * shift + k] +=
b *
c;
1161 for (j = 0; j < rozmer; j++) {
1162 if (
TMath::Abs(working_space[3 * shift + j]) > 0.000001)
1163 working_space[2 * shift + j] = working_space[2 * shift + j] /
TMath::Abs(working_space[3 * shift + j]);
1165 working_space[2 * shift + j] = 0;
1174 for (j = 0; j < rozmer; j++) {
1175 working_space[4 * shift + j] = working_space[shift + j];
1181 chi_min = 10000 * chi2;
1184 chi_min = 0.1 * chi2;
1186 for (pi = 0.1; flag == 0 && pi <= 100; pi += 0.1) {
1187 for (j = 0; j < rozmer; j++) {
1188 working_space[shift + j] = working_space[4 * shift + j] + pi * alpha * working_space[2 * shift + j];
1190 for (i = 0, j = 0; i <
fNPeaks; i++) {
1192 if (working_space[shift + j] < 0)
1193 working_space[shift + j] = 0;
1194 working_space[2 * i] = working_space[shift + j];
1198 if (working_space[shift + j] <
fXmin)
1199 working_space[shift + j] =
fXmin;
1200 if (working_space[shift + j] >
fXmax)
1201 working_space[shift + j] =
fXmax;
1202 working_space[2 * i + 1] = working_space[shift + j];
1207 if (working_space[shift + j] < 0.001) {
1208 working_space[shift + j] = 0.001;
1210 working_space[peak_vel] = working_space[shift + j];
1213 if (
fFixT ==
false) {
1214 working_space[peak_vel + 1] = working_space[shift + j];
1217 if (
fFixB ==
false) {
1218 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
1219 if (working_space[shift + j] < 0)
1220 working_space[shift + j] = -0.001;
1222 working_space[shift + j] = 0.001;
1224 working_space[peak_vel + 2] = working_space[shift + j];
1227 if (
fFixS ==
false) {
1228 working_space[peak_vel + 3] = working_space[shift + j];
1232 working_space[peak_vel + 4] = working_space[shift + j];
1236 working_space[peak_vel + 5] = working_space[shift + j];
1240 working_space[peak_vel + 6] = working_space[shift + j];
1248 working_space[peak_vel],
1249 working_space[peak_vel + 1],
1250 working_space[peak_vel + 3],
1251 working_space[peak_vel + 2],
1252 working_space[peak_vel + 4],
1253 working_space[peak_vel + 5],
1254 working_space[peak_vel + 6]);
1267 chi2 += (yw -
f) * (yw -
f) / ywm;
1274 pmin = pi, chi_min = chi2;
1284 for (j = 0; j < rozmer; j++) {
1285 working_space[shift + j] = working_space[4 * shift + j] + pmin * alpha * working_space[2 * shift + j];
1287 for (i = 0, j = 0; i <
fNPeaks; i++) {
1289 if (working_space[shift + j] < 0)
1290 working_space[shift + j] = 0;
1291 working_space[2 * i] = working_space[shift + j];
1295 if (working_space[shift + j] <
fXmin)
1296 working_space[shift + j] =
fXmin;
1297 if (working_space[shift + j] >
fXmax)
1298 working_space[shift + j] =
fXmax;
1299 working_space[2 * i + 1] = working_space[shift + j];
1304 if (working_space[shift + j] < 0.001) {
1305 working_space[shift + j] = 0.001;
1307 working_space[peak_vel] = working_space[shift + j];
1310 if (
fFixT ==
false) {
1311 working_space[peak_vel + 1] = working_space[shift + j];
1314 if (
fFixB ==
false) {
1315 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
1316 if (working_space[shift + j] < 0)
1317 working_space[shift + j] = -0.001;
1319 working_space[shift + j] = 0.001;
1321 working_space[peak_vel + 2] = working_space[shift + j];
1324 if (
fFixS ==
false) {
1325 working_space[peak_vel + 3] = working_space[shift + j];
1329 working_space[peak_vel + 4] = working_space[shift + j];
1333 working_space[peak_vel + 5] = working_space[shift + j];
1337 working_space[peak_vel + 6] = working_space[shift + j];
1345 for (j = 0; j < rozmer; j++) {
1346 working_space[shift + j] = working_space[4 * shift + j] + alpha * working_space[2 * shift + j];
1348 for (i = 0, j = 0; i <
fNPeaks; i++) {
1350 if (working_space[shift + j] < 0)
1351 working_space[shift + j] = 0;
1352 working_space[2 * i] = working_space[shift + j];
1356 if (working_space[shift + j] <
fXmin)
1357 working_space[shift + j] =
fXmin;
1358 if (working_space[shift + j] >
fXmax)
1359 working_space[shift + j] =
fXmax;
1360 working_space[2 * i + 1] = working_space[shift + j];
1365 if (working_space[shift + j] < 0.001) {
1366 working_space[shift + j] = 0.001;
1368 working_space[peak_vel] = working_space[shift + j];
1371 if (
fFixT ==
false) {
1372 working_space[peak_vel + 1] = working_space[shift + j];
1375 if (
fFixB ==
false) {
1376 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
1377 if (working_space[shift + j] < 0)
1378 working_space[shift + j] = -0.001;
1380 working_space[shift + j] = 0.001;
1382 working_space[peak_vel + 2] = working_space[shift + j];
1385 if (
fFixS ==
false) {
1386 working_space[peak_vel + 3] = working_space[shift + j];
1390 working_space[peak_vel + 4] = working_space[shift + j];
1394 working_space[peak_vel + 5] = working_space[shift + j];
1398 working_space[peak_vel + 6] = working_space[shift + j];
1406 working_space[peak_vel],
1407 working_space[peak_vel + 1],
1408 working_space[peak_vel + 3],
1409 working_space[peak_vel + 2],
1410 working_space[peak_vel + 4],
1411 working_space[peak_vel + 5],
1412 working_space[peak_vel + 6]);
1425 chi += (yw -
f) * (yw -
f) / ywm;
1432 alpha = alpha * chi_opt / (2 * chi);
1435 alpha = alpha / 10.0;
1438 }
while (((chi > chi_opt
1443 for (j = 0; j < rozmer; j++) {
1444 working_space[4 * shift + j] = 0;
1445 working_space[2 * shift + j] = 0;
1447 for (i =
fXmin, chi_cel = 0; i <=
fXmax; i++) {
1452 working_space[peak_vel], working_space[peak_vel + 1],
1453 working_space[peak_vel + 3],
1454 working_space[peak_vel + 2],
1455 working_space[peak_vel + 4],
1456 working_space[peak_vel + 5],
1457 working_space[peak_vel + 6]);
1458 chi_opt = (yw -
f) * (yw -
f) / yw;
1459 chi_cel += (yw -
f) * (yw -
f) / yw;
1462 for (j = 0, k = 0; j <
fNPeaks; j++) {
1465 working_space[peak_vel],
1466 working_space[peak_vel + 1],
1467 working_space[peak_vel + 3],
1468 working_space[peak_vel + 2]);
1471 working_space[2 * shift + k] += chi_opt *
c;
1473 working_space[4 * shift + k] +=
b *
c;
1479 working_space[2 * j + 1],
1480 working_space[peak_vel],
1481 working_space[peak_vel + 1],
1482 working_space[peak_vel + 3],
1483 working_space[peak_vel + 2]);
1486 working_space[2 * shift + k] += chi_opt *
c;
1488 working_space[4 * shift + k] +=
b *
c;
1495 working_space[peak_vel],
1496 working_space[peak_vel + 1],
1497 working_space[peak_vel + 3],
1498 working_space[peak_vel + 2]);
1501 working_space[2 * shift + k] += chi_opt *
c;
1503 working_space[4 * shift + k] +=
b *
c;
1507 if (
fFixT ==
false) {
1509 working_space[peak_vel],
1510 working_space[peak_vel + 2]);
1513 working_space[2 * shift + k] += chi_opt *
c;
1515 working_space[4 * shift + k] +=
b *
c;
1519 if (
fFixB ==
false) {
1521 working_space[peak_vel], working_space[peak_vel + 1],
1522 working_space[peak_vel + 2]);
1525 working_space[2 * shift + k] += chi_opt *
c;
1527 working_space[4 * shift + k] +=
b *
c;
1531 if (
fFixS ==
false) {
1533 working_space[peak_vel]);
1536 working_space[2 * shift + k] += chi_opt *
c;
1538 working_space[4 * shift + k] +=
b *
c;
1546 working_space[2 * shift + k] += chi_opt *
c;
1548 working_space[4 * shift + k] +=
b *
c;
1556 working_space[2 * shift + k] += chi_opt *
c;
1558 working_space[4 * shift + k] +=
b *
c;
1566 working_space[2 * shift + k] += chi_opt *
c;
1568 working_space[4 * shift + k] +=
b *
c;
1575 chi_er = chi_cel /
b;
1576 for (i = 0, j = 0; i <
fNPeaks; i++) {
1578 Area(working_space[2 * i], working_space[peak_vel],
1579 working_space[peak_vel + 1], working_space[peak_vel + 2]);
1581 fAmpCalc[i] = working_space[shift + j];
1582 if (working_space[3 * shift + j] != 0)
1585 a =
Derpa(working_space[peak_vel],
1586 working_space[peak_vel + 1],
1587 working_space[peak_vel + 2]);
1588 b = working_space[4 * shift + j];
1609 if (working_space[3 * shift + j] != 0)
1621 if (working_space[3 * shift + j] != 0)
1630 if (
fFixT ==
false) {
1631 fTCalc = working_space[shift + j];
1632 if (working_space[3 * shift + j] != 0)
1641 if (
fFixB ==
false) {
1642 fBCalc = working_space[shift + j];
1643 if (working_space[3 * shift + j] != 0)
1652 if (
fFixS ==
false) {
1653 fSCalc = working_space[shift + j];
1654 if (working_space[3 * shift + j] != 0)
1664 fA0Calc = working_space[shift + j];
1665 if (working_space[3 * shift + j] != 0)
1675 fA1Calc = working_space[shift + j];
1676 if (working_space[3 * shift + j] != 0)
1686 fA2Calc = working_space[shift + j];
1687 if (working_space[3 * shift + j] != 0)
1700 working_space[peak_vel], working_space[peak_vel + 1],
1701 working_space[peak_vel + 3], working_space[peak_vel + 2],
1702 working_space[peak_vel + 4], working_space[peak_vel + 5],
1703 working_space[peak_vel + 6]);
1706 delete[]working_space;
1860 Int_t i, j, k, shift =
1861 2 *
fNPeaks + 7, peak_vel, rozmer, iter, regul_cycle,
1863 Double_t a,
b, alpha, chi_opt, yw, ywm,
f, chi2, chi_min, chi =
1864 0, pi, pmin = 0, chi_cel = 0, chi_er;
1866 for (i = 0, j = 0; i <
fNPeaks; i++) {
1867 working_space[2 * i] =
fAmpInit[i];
1869 working_space[shift + j] =
fAmpInit[i];
1884 working_space[2 * i + 1] =
fTInit;
1885 if (
fFixT ==
false) {
1886 working_space[shift + j] =
fTInit;
1889 working_space[2 * i + 2] =
fBInit;
1890 if (
fFixB ==
false) {
1891 working_space[shift + j] =
fBInit;
1894 working_space[2 * i + 3] =
fSInit;
1895 if (
fFixS ==
false) {
1896 working_space[shift + j] =
fSInit;
1899 working_space[2 * i + 4] =
fA0Init;
1901 working_space[shift + j] =
fA0Init;
1904 working_space[2 * i + 5] =
fA1Init;
1906 working_space[shift + j] =
fA1Init;
1909 working_space[2 * i + 6] =
fA2Init;
1911 working_space[shift + j] =
fA2Init;
1916 Error (
"FitAwmi",
"All parameters are fixed");
1917 delete [] working_space;
1921 Error (
"FitAwmi",
"Number of fitted parameters is larger than # of fitted points");
1922 delete [] working_space;
1926 for (i = 0; i < rozmer; i++)
1927 working_matrix[i] =
new Double_t[rozmer + 4];
1929 for (j = 0; j < rozmer; j++) {
1930 working_space[3 * shift + j] = 0;
1931 for (k = 0; k < (rozmer + 4); k++) {
1932 working_matrix[j][k] = 0;
1942 for (j = 0, k = 0; j <
fNPeaks; j++) {
1944 working_space[2 * shift + k] =
1946 working_space[peak_vel],
1947 working_space[peak_vel + 1],
1948 working_space[peak_vel + 3],
1949 working_space[peak_vel + 2]);
1953 working_space[2 * shift + k] =
1955 working_space[2 * j + 1], working_space[peak_vel],
1956 working_space[peak_vel + 1],
1957 working_space[peak_vel + 3],
1958 working_space[peak_vel + 2]);
1962 working_space[2 * shift + k] =
1964 working_space[peak_vel],
1965 working_space[peak_vel + 1],
1966 working_space[peak_vel + 3],
1967 working_space[peak_vel + 2]);
1970 if (
fFixT ==
false) {
1971 working_space[2 * shift + k] =
1973 working_space[peak_vel], working_space[peak_vel + 2]);
1976 if (
fFixB ==
false) {
1977 working_space[2 * shift + k] =
1979 working_space[peak_vel], working_space[peak_vel + 1],
1980 working_space[peak_vel + 2]);
1983 if (
fFixS ==
false) {
1984 working_space[2 * shift + k] =
1986 working_space[peak_vel]);
1990 working_space[2 * shift + k] = 1.;
2004 working_space[peak_vel], working_space[peak_vel + 1],
2005 working_space[peak_vel + 3],
2006 working_space[peak_vel + 2],
2007 working_space[peak_vel + 4],
2008 working_space[peak_vel + 5],
2009 working_space[peak_vel + 6]);
2017 chi_opt += (yw -
f) * (yw -
f) / ywm;
2035 for (j = 0; j < rozmer; j++) {
2036 for (k = 0; k < rozmer; k++) {
2037 b = working_space[2 * shift +
2038 j] * working_space[2 * shift + k] / ywm;
2040 b =
b * (4 * yw - 2 *
f) / ywm;
2041 working_matrix[j][k] +=
b;
2043 working_space[3 * shift + j] +=
b;
2047 b = (
f *
f - yw * yw) / (ywm * ywm);
2051 for (j = 0; j < rozmer; j++) {
2052 working_matrix[j][rozmer] -=
b * working_space[2 * shift + j];
2055 for (i = 0; i < rozmer; i++) {
2056 working_matrix[i][rozmer + 1] = 0;
2059 for (i = 0; i < rozmer; i++) {
2060 working_space[2 * shift + i] = working_matrix[i][rozmer + 1];
2069 for (j = 0; j < rozmer; j++) {
2070 working_space[4 * shift + j] = working_space[shift + j];
2076 chi_min = 10000 * chi2;
2079 chi_min = 0.1 * chi2;
2081 for (pi = 0.1; flag == 0 && pi <= 100; pi += 0.1) {
2082 for (j = 0; j < rozmer; j++) {
2083 working_space[shift + j] = working_space[4 * shift + j] + pi * alpha * working_space[2 * shift + j];
2085 for (i = 0, j = 0; i <
fNPeaks; i++) {
2087 if (working_space[shift + j] < 0)
2088 working_space[shift + j] = 0;
2089 working_space[2 * i] = working_space[shift + j];
2093 if (working_space[shift + j] <
fXmin)
2094 working_space[shift + j] =
fXmin;
2095 if (working_space[shift + j] >
fXmax)
2096 working_space[shift + j] =
fXmax;
2097 working_space[2 * i + 1] = working_space[shift + j];
2102 if (working_space[shift + j] < 0.001) {
2103 working_space[shift + j] = 0.001;
2105 working_space[peak_vel] = working_space[shift + j];
2108 if (
fFixT ==
false) {
2109 working_space[peak_vel + 1] = working_space[shift + j];
2112 if (
fFixB ==
false) {
2113 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
2114 if (working_space[shift + j] < 0)
2115 working_space[shift + j] = -0.001;
2117 working_space[shift + j] = 0.001;
2119 working_space[peak_vel + 2] = working_space[shift + j];
2122 if (
fFixS ==
false) {
2123 working_space[peak_vel + 3] = working_space[shift + j];
2127 working_space[peak_vel + 4] = working_space[shift + j];
2131 working_space[peak_vel + 5] = working_space[shift + j];
2135 working_space[peak_vel + 6] = working_space[shift + j];
2143 working_space[peak_vel],
2144 working_space[peak_vel + 1],
2145 working_space[peak_vel + 3],
2146 working_space[peak_vel + 2],
2147 working_space[peak_vel + 4],
2148 working_space[peak_vel + 5],
2149 working_space[peak_vel + 6]);
2162 chi2 += (yw -
f) * (yw -
f) / ywm;
2169 pmin = pi, chi_min = chi2;
2179 for (j = 0; j < rozmer; j++) {
2180 working_space[shift + j] = working_space[4 * shift + j] + pmin * alpha * working_space[2 * shift + j];
2182 for (i = 0, j = 0; i <
fNPeaks; i++) {
2184 if (working_space[shift + j] < 0)
2185 working_space[shift + j] = 0;
2186 working_space[2 * i] = working_space[shift + j];
2190 if (working_space[shift + j] <
fXmin)
2191 working_space[shift + j] =
fXmin;
2192 if (working_space[shift + j] >
fXmax)
2193 working_space[shift + j] =
fXmax;
2194 working_space[2 * i + 1] = working_space[shift + j];
2199 if (working_space[shift + j] < 0.001) {
2200 working_space[shift + j] = 0.001;
2202 working_space[peak_vel] = working_space[shift + j];
2205 if (
fFixT ==
false) {
2206 working_space[peak_vel + 1] = working_space[shift + j];
2209 if (
fFixB ==
false) {
2210 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
2211 if (working_space[shift + j] < 0)
2212 working_space[shift + j] = -0.001;
2214 working_space[shift + j] = 0.001;
2216 working_space[peak_vel + 2] = working_space[shift + j];
2219 if (
fFixS ==
false) {
2220 working_space[peak_vel + 3] = working_space[shift + j];
2224 working_space[peak_vel + 4] = working_space[shift + j];
2228 working_space[peak_vel + 5] = working_space[shift + j];
2232 working_space[peak_vel + 6] = working_space[shift + j];
2240 for (j = 0; j < rozmer; j++) {
2241 working_space[shift + j] = working_space[4 * shift + j] + alpha * working_space[2 * shift + j];
2243 for (i = 0, j = 0; i <
fNPeaks; i++) {
2245 if (working_space[shift + j] < 0)
2246 working_space[shift + j] = 0;
2247 working_space[2 * i] = working_space[shift + j];
2251 if (working_space[shift + j] <
fXmin)
2252 working_space[shift + j] =
fXmin;
2253 if (working_space[shift + j] >
fXmax)
2254 working_space[shift + j] =
fXmax;
2255 working_space[2 * i + 1] = working_space[shift + j];
2260 if (working_space[shift + j] < 0.001) {
2261 working_space[shift + j] = 0.001;
2263 working_space[peak_vel] = working_space[shift + j];
2266 if (
fFixT ==
false) {
2267 working_space[peak_vel + 1] = working_space[shift + j];
2270 if (
fFixB ==
false) {
2271 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
2272 if (working_space[shift + j] < 0)
2273 working_space[shift + j] = -0.001;
2275 working_space[shift + j] = 0.001;
2277 working_space[peak_vel + 2] = working_space[shift + j];
2280 if (
fFixS ==
false) {
2281 working_space[peak_vel + 3] = working_space[shift + j];
2285 working_space[peak_vel + 4] = working_space[shift + j];
2289 working_space[peak_vel + 5] = working_space[shift + j];
2293 working_space[peak_vel + 6] = working_space[shift + j];
2301 working_space[peak_vel],
2302 working_space[peak_vel + 1],
2303 working_space[peak_vel + 3],
2304 working_space[peak_vel + 2],
2305 working_space[peak_vel + 4],
2306 working_space[peak_vel + 5],
2307 working_space[peak_vel + 6]);
2320 chi += (yw -
f) * (yw -
f) / ywm;
2327 alpha = alpha * chi_opt / (2 * chi);
2330 alpha = alpha / 10.0;
2333 }
while (((chi > chi_opt
2338 for (j = 0; j < rozmer; j++) {
2339 working_space[4 * shift + j] = 0;
2340 working_space[2 * shift + j] = 0;
2342 for (i =
fXmin, chi_cel = 0; i <=
fXmax; i++) {
2347 working_space[peak_vel], working_space[peak_vel + 1],
2348 working_space[peak_vel + 3],
2349 working_space[peak_vel + 2],
2350 working_space[peak_vel + 4],
2351 working_space[peak_vel + 5],
2352 working_space[peak_vel + 6]);
2353 chi_opt = (yw -
f) * (yw -
f) / yw;
2354 chi_cel += (yw -
f) * (yw -
f) / yw;
2357 for (j = 0, k = 0; j <
fNPeaks; j++) {
2360 working_space[peak_vel],
2361 working_space[peak_vel + 1],
2362 working_space[peak_vel + 3],
2363 working_space[peak_vel + 2]);
2365 working_space[2 * shift + k] += chi_opt;
2367 working_space[4 * shift + k] +=
b;
2373 working_space[2 * j + 1],
2374 working_space[peak_vel],
2375 working_space[peak_vel + 1],
2376 working_space[peak_vel + 3],
2377 working_space[peak_vel + 2]);
2379 working_space[2 * shift + k] += chi_opt;
2381 working_space[4 * shift + k] +=
b;
2388 working_space[peak_vel],
2389 working_space[peak_vel + 1],
2390 working_space[peak_vel + 3],
2391 working_space[peak_vel + 2]);
2393 working_space[2 * shift + k] += chi_opt;
2395 working_space[4 * shift + k] +=
b;
2399 if (
fFixT ==
false) {
2401 working_space[peak_vel],
2402 working_space[peak_vel + 2]);
2404 working_space[2 * shift + k] += chi_opt;
2406 working_space[4 * shift + k] +=
b;
2410 if (
fFixB ==
false) {
2412 working_space[peak_vel], working_space[peak_vel + 1],
2413 working_space[peak_vel + 2]);
2415 working_space[2 * shift + k] += chi_opt;
2417 working_space[4 * shift + k] +=
b;
2421 if (
fFixS ==
false) {
2423 working_space[peak_vel]);
2425 working_space[2 * shift + k] += chi_opt;
2427 working_space[4 * shift + k] +=
b;
2434 working_space[2 * shift + k] += chi_opt;
2436 working_space[4 * shift + k] +=
b;
2443 working_space[2 * shift + k] += chi_opt;
2445 working_space[4 * shift + k] +=
b;
2452 working_space[2 * shift + k] += chi_opt;
2454 working_space[4 * shift + k] +=
b;
2461 chi_er = chi_cel /
b;
2462 for (i = 0, j = 0; i <
fNPeaks; i++) {
2464 Area(working_space[2 * i], working_space[peak_vel],
2465 working_space[peak_vel + 1], working_space[peak_vel + 2]);
2467 fAmpCalc[i] = working_space[shift + j];
2468 if (working_space[3 * shift + j] != 0)
2471 a =
Derpa(working_space[peak_vel],
2472 working_space[peak_vel + 1],
2473 working_space[peak_vel + 2]);
2474 b = working_space[4 * shift + j];
2495 if (working_space[3 * shift + j] != 0)
2507 if (working_space[3 * shift + j] != 0)
2516 if (
fFixT ==
false) {
2517 fTCalc = working_space[shift + j];
2518 if (working_space[3 * shift + j] != 0)
2527 if (
fFixB ==
false) {
2528 fBCalc = working_space[shift + j];
2529 if (working_space[3 * shift + j] != 0)
2538 if (
fFixS ==
false) {
2539 fSCalc = working_space[shift + j];
2540 if (working_space[3 * shift + j] != 0)
2550 fA0Calc = working_space[shift + j];
2551 if (working_space[3 * shift + j] != 0)
2561 fA1Calc = working_space[shift + j];
2562 if (working_space[3 * shift + j] != 0)
2572 fA2Calc = working_space[shift + j];
2573 if (working_space[3 * shift + j] != 0)
2586 working_space[peak_vel], working_space[peak_vel + 1],
2587 working_space[peak_vel + 3], working_space[peak_vel + 2],
2588 working_space[peak_vel + 4], working_space[peak_vel + 5],
2589 working_space[peak_vel + 6]);
2592 for (i = 0; i < rozmer; i++)
2593 delete [] working_matrix[i];
2594 delete [] working_matrix;
2595 delete [] working_space;