825 2 *
fNPeaks + 7, peak_vel, rozmer, iter, pw, regul_cycle,
827 Double_t a,
b,
c,
d = 0, alpha, chi_opt, yw, ywm,
f, chi2, chi_min, chi =
828 0, pi, pmin = 0, chi_cel = 0, chi_er;
848 working_space[2 *
i + 1] =
fTInit;
849 if (
fFixT ==
false) {
850 working_space[shift + j] =
fTInit;
853 working_space[2 *
i + 2] =
fBInit;
854 if (
fFixB ==
false) {
855 working_space[shift + j] =
fBInit;
858 working_space[2 *
i + 3] =
fSInit;
859 if (
fFixS ==
false) {
860 working_space[shift + j] =
fSInit;
865 working_space[shift + j] =
fA0Init;
870 working_space[shift + j] =
fA1Init;
875 working_space[shift + j] =
fA2Init;
880 delete [] working_space;
881 Error (
"FitAwmi",
"All parameters are fixed");
885 delete [] working_space;
886 Error (
"FitAwmi",
"Number of fitted parameters is larger than # of fitted points");
890 for (j = 0; j < rozmer; j++) {
891 working_space[2 * shift + j] = 0, working_space[3 * shift + j] = 0;
896 chi_opt = 0, pw =
fPower - 2;
901 working_space[peak_vel], working_space[peak_vel + 1],
902 working_space[peak_vel + 3],
903 working_space[peak_vel + 2],
904 working_space[peak_vel + 4],
905 working_space[peak_vel + 5],
906 working_space[peak_vel + 6]);
914 chi_opt += (yw -
f) * (yw -
f) / ywm;
934 for (j = 0, k = 0; j <
fNPeaks; j++) {
937 working_space[peak_vel],
938 working_space[peak_vel + 1],
939 working_space[peak_vel + 3],
940 working_space[peak_vel + 2]);
944 b =
a * (yw * yw -
f *
f) / (ywm * ywm);
945 working_space[2 * shift + k] +=
b *
c;
946 b =
a *
a * (4 * yw - 2 *
f) / (ywm * ywm);
947 working_space[3 * shift + k] +=
b *
c;
951 b =
a * (yw -
f) / ywm;
952 working_space[2 * shift + k] +=
b *
c;
954 working_space[3 * shift + k] +=
b *
c;
961 working_space[2 * j + 1],
962 working_space[peak_vel],
963 working_space[peak_vel + 1],
964 working_space[peak_vel + 3],
965 working_space[peak_vel + 2]);
968 working_space[2 * j + 1],
969 working_space[peak_vel]);
975 if (((
a +
d) <= 0 &&
a >= 0) || ((
a +
d) >= 0 &&
a <= 0))
983 b =
a * (yw * yw -
f *
f) / (ywm * ywm);
984 working_space[2 * shift + k] +=
b *
c;
985 b =
a *
a * (4 * yw - 2 *
f) / (ywm * ywm);
986 working_space[3 * shift + k] +=
b *
c;
990 b =
a * (yw -
f) / ywm;
991 working_space[2 * shift + k] +=
b *
c;
993 working_space[3 * shift + k] +=
b *
c;
1001 working_space[peak_vel],
1002 working_space[peak_vel + 1],
1003 working_space[peak_vel + 3],
1004 working_space[peak_vel + 2]);
1007 working_space, working_space[peak_vel]);
1013 if (((
a +
d) <= 0 &&
a >= 0) || ((
a +
d) >= 0 &&
a <= 0))
1021 b =
a * (yw * yw -
f *
f) / (ywm * ywm);
1022 working_space[2 * shift + k] +=
b *
c;
1023 b =
a *
a * (4 * yw - 2 *
f) / (ywm * ywm);
1024 working_space[3 * shift + k] +=
b *
c;
1028 b =
a * (yw -
f) / ywm;
1029 working_space[2 * shift + k] +=
b *
c;
1031 working_space[3 * shift + k] +=
b *
c;
1036 if (
fFixT ==
false) {
1038 working_space[peak_vel],
1039 working_space[peak_vel + 2]);
1043 b =
a * (yw * yw -
f *
f) / (ywm * ywm);
1044 working_space[2 * shift + k] +=
b *
c;
1045 b =
a *
a * (4 * yw - 2 *
f) / (ywm * ywm);
1046 working_space[3 * shift + k] +=
b *
c;
1050 b =
a * (yw -
f) / ywm;
1051 working_space[2 * shift + k] +=
b *
c;
1053 working_space[3 * shift + k] +=
b *
c;
1058 if (
fFixB ==
false) {
1060 working_space[peak_vel], working_space[peak_vel + 1],
1061 working_space[peak_vel + 2]);
1065 b =
a * (yw * yw -
f *
f) / (ywm * ywm);
1066 working_space[2 * shift + k] +=
b *
c;
1067 b =
a *
a * (4 * yw - 2 *
f) / (ywm * ywm);
1068 working_space[3 * shift + k] +=
b *
c;
1072 b =
a * (yw -
f) / ywm;
1073 working_space[2 * shift + k] +=
b *
c;
1075 working_space[3 * shift + k] +=
b *
c;
1080 if (
fFixS ==
false) {
1082 working_space[peak_vel]);
1086 b =
a * (yw * yw -
f *
f) / (ywm * ywm);
1087 working_space[2 * shift + k] +=
b *
c;
1088 b =
a *
a * (4 * yw - 2 *
f) / (ywm * ywm);
1089 working_space[3 * shift + k] +=
b *
c;
1093 b =
a * (yw -
f) / ywm;
1094 working_space[2 * shift + k] +=
b *
c;
1096 working_space[3 * shift + k] +=
b *
c;
1106 b =
a * (yw * yw -
f *
f) / (ywm * ywm);
1107 working_space[2 * shift + k] +=
b *
c;
1108 b =
a *
a * (4 * yw - 2 *
f) / (ywm * ywm);
1109 working_space[3 * shift + k] +=
b *
c;
1113 b =
a * (yw -
f) / ywm;
1114 working_space[2 * shift + k] +=
b *
c;
1116 working_space[3 * shift + k] +=
b *
c;
1126 b =
a * (yw * yw -
f *
f) / (ywm * ywm);
1127 working_space[2 * shift + k] +=
b *
c;
1128 b =
a *
a * (4 * yw - 2 *
f) / (ywm * ywm);
1129 working_space[3 * shift + k] +=
b *
c;
1133 b =
a * (yw -
f) / ywm;
1134 working_space[2 * shift + k] +=
b *
c;
1136 working_space[3 * shift + k] +=
b *
c;
1146 b =
a * (yw * yw -
f *
f) / (ywm * ywm);
1147 working_space[2 * shift + k] +=
b *
c;
1148 b =
a *
a * (4 * yw - 2 *
f) / (ywm * ywm);
1149 working_space[3 * shift + k] +=
b *
c;
1153 b =
a * (yw -
f) / ywm;
1154 working_space[2 * shift + k] +=
b *
c;
1156 working_space[3 * shift + k] +=
b *
c;
1162 for (j = 0; j < rozmer; j++) {
1163 if (
TMath::Abs(working_space[3 * shift + j]) > 0.000001)
1164 working_space[2 * shift + j] = working_space[2 * shift + j] /
TMath::Abs(working_space[3 * shift + j]);
1166 working_space[2 * shift + j] = 0;
1175 for (j = 0; j < rozmer; j++) {
1176 working_space[4 * shift + j] = working_space[shift + j];
1182 chi_min = 10000 * chi2;
1185 chi_min = 0.1 * chi2;
1187 for (pi = 0.1; flag == 0 && pi <= 100; pi += 0.1) {
1188 for (j = 0; j < rozmer; j++) {
1189 working_space[shift + j] = working_space[4 * shift + j] + pi * alpha * working_space[2 * shift + j];
1193 if (working_space[shift + j] < 0)
1194 working_space[shift + j] = 0;
1195 working_space[2 *
i] = working_space[shift + j];
1199 if (working_space[shift + j] <
fXmin)
1200 working_space[shift + j] =
fXmin;
1201 if (working_space[shift + j] >
fXmax)
1202 working_space[shift + j] =
fXmax;
1203 working_space[2 *
i + 1] = working_space[shift + j];
1208 if (working_space[shift + j] < 0.001) {
1209 working_space[shift + j] = 0.001;
1211 working_space[peak_vel] = working_space[shift + j];
1214 if (
fFixT ==
false) {
1215 working_space[peak_vel + 1] = working_space[shift + j];
1218 if (
fFixB ==
false) {
1219 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
1220 if (working_space[shift + j] < 0)
1221 working_space[shift + j] = -0.001;
1223 working_space[shift + j] = 0.001;
1225 working_space[peak_vel + 2] = working_space[shift + j];
1228 if (
fFixS ==
false) {
1229 working_space[peak_vel + 3] = working_space[shift + j];
1233 working_space[peak_vel + 4] = working_space[shift + j];
1237 working_space[peak_vel + 5] = working_space[shift + j];
1241 working_space[peak_vel + 6] = working_space[shift + j];
1249 working_space[peak_vel],
1250 working_space[peak_vel + 1],
1251 working_space[peak_vel + 3],
1252 working_space[peak_vel + 2],
1253 working_space[peak_vel + 4],
1254 working_space[peak_vel + 5],
1255 working_space[peak_vel + 6]);
1268 chi2 += (yw -
f) * (yw -
f) / ywm;
1275 pmin = pi, chi_min = chi2;
1285 for (j = 0; j < rozmer; j++) {
1286 working_space[shift + j] = working_space[4 * shift + j] + pmin * alpha * working_space[2 * shift + j];
1290 if (working_space[shift + j] < 0)
1291 working_space[shift + j] = 0;
1292 working_space[2 *
i] = working_space[shift + j];
1296 if (working_space[shift + j] <
fXmin)
1297 working_space[shift + j] =
fXmin;
1298 if (working_space[shift + j] >
fXmax)
1299 working_space[shift + j] =
fXmax;
1300 working_space[2 *
i + 1] = working_space[shift + j];
1305 if (working_space[shift + j] < 0.001) {
1306 working_space[shift + j] = 0.001;
1308 working_space[peak_vel] = working_space[shift + j];
1311 if (
fFixT ==
false) {
1312 working_space[peak_vel + 1] = working_space[shift + j];
1315 if (
fFixB ==
false) {
1316 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
1317 if (working_space[shift + j] < 0)
1318 working_space[shift + j] = -0.001;
1320 working_space[shift + j] = 0.001;
1322 working_space[peak_vel + 2] = working_space[shift + j];
1325 if (
fFixS ==
false) {
1326 working_space[peak_vel + 3] = working_space[shift + j];
1330 working_space[peak_vel + 4] = working_space[shift + j];
1334 working_space[peak_vel + 5] = working_space[shift + j];
1338 working_space[peak_vel + 6] = working_space[shift + j];
1346 for (j = 0; j < rozmer; j++) {
1347 working_space[shift + j] = working_space[4 * shift + j] + alpha * working_space[2 * shift + j];
1351 if (working_space[shift + j] < 0)
1352 working_space[shift + j] = 0;
1353 working_space[2 *
i] = working_space[shift + j];
1357 if (working_space[shift + j] <
fXmin)
1358 working_space[shift + j] =
fXmin;
1359 if (working_space[shift + j] >
fXmax)
1360 working_space[shift + j] =
fXmax;
1361 working_space[2 *
i + 1] = working_space[shift + j];
1366 if (working_space[shift + j] < 0.001) {
1367 working_space[shift + j] = 0.001;
1369 working_space[peak_vel] = working_space[shift + j];
1372 if (
fFixT ==
false) {
1373 working_space[peak_vel + 1] = working_space[shift + j];
1376 if (
fFixB ==
false) {
1377 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
1378 if (working_space[shift + j] < 0)
1379 working_space[shift + j] = -0.001;
1381 working_space[shift + j] = 0.001;
1383 working_space[peak_vel + 2] = working_space[shift + j];
1386 if (
fFixS ==
false) {
1387 working_space[peak_vel + 3] = working_space[shift + j];
1391 working_space[peak_vel + 4] = working_space[shift + j];
1395 working_space[peak_vel + 5] = working_space[shift + j];
1399 working_space[peak_vel + 6] = working_space[shift + j];
1407 working_space[peak_vel],
1408 working_space[peak_vel + 1],
1409 working_space[peak_vel + 3],
1410 working_space[peak_vel + 2],
1411 working_space[peak_vel + 4],
1412 working_space[peak_vel + 5],
1413 working_space[peak_vel + 6]);
1426 chi += (yw -
f) * (yw -
f) / ywm;
1433 alpha = alpha * chi_opt / (2 * chi);
1436 alpha = alpha / 10.0;
1439 }
while (((chi > chi_opt
1444 for (j = 0; j < rozmer; j++) {
1445 working_space[4 * shift + j] = 0;
1446 working_space[2 * shift + j] = 0;
1453 working_space[peak_vel], working_space[peak_vel + 1],
1454 working_space[peak_vel + 3],
1455 working_space[peak_vel + 2],
1456 working_space[peak_vel + 4],
1457 working_space[peak_vel + 5],
1458 working_space[peak_vel + 6]);
1459 chi_opt = (yw -
f) * (yw -
f) / yw;
1460 chi_cel += (yw -
f) * (yw -
f) / yw;
1463 for (j = 0, k = 0; j <
fNPeaks; j++) {
1466 working_space[peak_vel],
1467 working_space[peak_vel + 1],
1468 working_space[peak_vel + 3],
1469 working_space[peak_vel + 2]);
1472 working_space[2 * shift + k] += chi_opt *
c;
1474 working_space[4 * shift + k] +=
b *
c;
1480 working_space[2 * j + 1],
1481 working_space[peak_vel],
1482 working_space[peak_vel + 1],
1483 working_space[peak_vel + 3],
1484 working_space[peak_vel + 2]);
1487 working_space[2 * shift + k] += chi_opt *
c;
1489 working_space[4 * shift + k] +=
b *
c;
1496 working_space[peak_vel],
1497 working_space[peak_vel + 1],
1498 working_space[peak_vel + 3],
1499 working_space[peak_vel + 2]);
1502 working_space[2 * shift + k] += chi_opt *
c;
1504 working_space[4 * shift + k] +=
b *
c;
1508 if (
fFixT ==
false) {
1510 working_space[peak_vel],
1511 working_space[peak_vel + 2]);
1514 working_space[2 * shift + k] += chi_opt *
c;
1516 working_space[4 * shift + k] +=
b *
c;
1520 if (
fFixB ==
false) {
1522 working_space[peak_vel], working_space[peak_vel + 1],
1523 working_space[peak_vel + 2]);
1526 working_space[2 * shift + k] += chi_opt *
c;
1528 working_space[4 * shift + k] +=
b *
c;
1532 if (
fFixS ==
false) {
1534 working_space[peak_vel]);
1537 working_space[2 * shift + k] += chi_opt *
c;
1539 working_space[4 * shift + k] +=
b *
c;
1547 working_space[2 * shift + k] += chi_opt *
c;
1549 working_space[4 * shift + k] +=
b *
c;
1557 working_space[2 * shift + k] += chi_opt *
c;
1559 working_space[4 * shift + k] +=
b *
c;
1567 working_space[2 * shift + k] += chi_opt *
c;
1569 working_space[4 * shift + k] +=
b *
c;
1576 chi_er = chi_cel /
b;
1579 Area(working_space[2 *
i], working_space[peak_vel],
1580 working_space[peak_vel + 1], working_space[peak_vel + 2]);
1583 if (working_space[3 * shift + j] != 0)
1586 a =
Derpa(working_space[peak_vel],
1587 working_space[peak_vel + 1],
1588 working_space[peak_vel + 2]);
1589 b = working_space[4 * shift + j];
1610 if (working_space[3 * shift + j] != 0)
1622 if (working_space[3 * shift + j] != 0)
1631 if (
fFixT ==
false) {
1632 fTCalc = working_space[shift + j];
1633 if (working_space[3 * shift + j] != 0)
1642 if (
fFixB ==
false) {
1643 fBCalc = working_space[shift + j];
1644 if (working_space[3 * shift + j] != 0)
1653 if (
fFixS ==
false) {
1654 fSCalc = working_space[shift + j];
1655 if (working_space[3 * shift + j] != 0)
1665 fA0Calc = working_space[shift + j];
1666 if (working_space[3 * shift + j] != 0)
1676 fA1Calc = working_space[shift + j];
1677 if (working_space[3 * shift + j] != 0)
1687 fA2Calc = working_space[shift + j];
1688 if (working_space[3 * shift + j] != 0)
1701 working_space[peak_vel], working_space[peak_vel + 1],
1702 working_space[peak_vel + 3], working_space[peak_vel + 2],
1703 working_space[peak_vel + 4], working_space[peak_vel + 5],
1704 working_space[peak_vel + 6]);
1707 delete[]working_space;
1862 2 *
fNPeaks + 7, peak_vel, rozmer, iter, regul_cycle,
1864 Double_t a,
b, alpha, chi_opt, yw, ywm,
f, chi2, chi_min, chi =
1865 0, pi, pmin = 0, chi_cel = 0, chi_er;
1885 working_space[2 *
i + 1] =
fTInit;
1886 if (
fFixT ==
false) {
1887 working_space[shift + j] =
fTInit;
1890 working_space[2 *
i + 2] =
fBInit;
1891 if (
fFixB ==
false) {
1892 working_space[shift + j] =
fBInit;
1895 working_space[2 *
i + 3] =
fSInit;
1896 if (
fFixS ==
false) {
1897 working_space[shift + j] =
fSInit;
1900 working_space[2 *
i + 4] =
fA0Init;
1902 working_space[shift + j] =
fA0Init;
1905 working_space[2 *
i + 5] =
fA1Init;
1907 working_space[shift + j] =
fA1Init;
1910 working_space[2 *
i + 6] =
fA2Init;
1912 working_space[shift + j] =
fA2Init;
1917 Error (
"FitAwmi",
"All parameters are fixed");
1918 delete [] working_space;
1922 Error (
"FitAwmi",
"Number of fitted parameters is larger than # of fitted points");
1923 delete [] working_space;
1927 for (
i = 0;
i < rozmer;
i++)
1928 working_matrix[
i] =
new Double_t[rozmer + 4];
1930 for (j = 0; j < rozmer; j++) {
1931 working_space[3 * shift + j] = 0;
1932 for (k = 0; k < (rozmer + 4); k++) {
1933 working_matrix[j][k] = 0;
1943 for (j = 0, k = 0; j <
fNPeaks; j++) {
1945 working_space[2 * shift + k] =
1947 working_space[peak_vel],
1948 working_space[peak_vel + 1],
1949 working_space[peak_vel + 3],
1950 working_space[peak_vel + 2]);
1954 working_space[2 * shift + k] =
1956 working_space[2 * j + 1], working_space[peak_vel],
1957 working_space[peak_vel + 1],
1958 working_space[peak_vel + 3],
1959 working_space[peak_vel + 2]);
1963 working_space[2 * shift + k] =
1965 working_space[peak_vel],
1966 working_space[peak_vel + 1],
1967 working_space[peak_vel + 3],
1968 working_space[peak_vel + 2]);
1971 if (
fFixT ==
false) {
1972 working_space[2 * shift + k] =
1974 working_space[peak_vel], working_space[peak_vel + 2]);
1977 if (
fFixB ==
false) {
1978 working_space[2 * shift + k] =
1980 working_space[peak_vel], working_space[peak_vel + 1],
1981 working_space[peak_vel + 2]);
1984 if (
fFixS ==
false) {
1985 working_space[2 * shift + k] =
1987 working_space[peak_vel]);
1991 working_space[2 * shift + k] = 1.;
2005 working_space[peak_vel], working_space[peak_vel + 1],
2006 working_space[peak_vel + 3],
2007 working_space[peak_vel + 2],
2008 working_space[peak_vel + 4],
2009 working_space[peak_vel + 5],
2010 working_space[peak_vel + 6]);
2018 chi_opt += (yw -
f) * (yw -
f) / ywm;
2036 for (j = 0; j < rozmer; j++) {
2037 for (k = 0; k < rozmer; k++) {
2038 b = working_space[2 * shift +
2039 j] * working_space[2 * shift + k] / ywm;
2041 b =
b * (4 * yw - 2 *
f) / ywm;
2042 working_matrix[j][k] +=
b;
2044 working_space[3 * shift + j] +=
b;
2048 b = (
f *
f - yw * yw) / (ywm * ywm);
2052 for (j = 0; j < rozmer; j++) {
2053 working_matrix[j][rozmer] -=
b * working_space[2 * shift + j];
2056 for (
i = 0;
i < rozmer;
i++) {
2057 working_matrix[
i][rozmer + 1] = 0;
2060 for (
i = 0;
i < rozmer;
i++) {
2061 working_space[2 * shift +
i] = working_matrix[
i][rozmer + 1];
2070 for (j = 0; j < rozmer; j++) {
2071 working_space[4 * shift + j] = working_space[shift + j];
2077 chi_min = 10000 * chi2;
2080 chi_min = 0.1 * chi2;
2082 for (pi = 0.1; flag == 0 && pi <= 100; pi += 0.1) {
2083 for (j = 0; j < rozmer; j++) {
2084 working_space[shift + j] = working_space[4 * shift + j] + pi * alpha * working_space[2 * shift + j];
2088 if (working_space[shift + j] < 0)
2089 working_space[shift + j] = 0;
2090 working_space[2 *
i] = working_space[shift + j];
2094 if (working_space[shift + j] <
fXmin)
2095 working_space[shift + j] =
fXmin;
2096 if (working_space[shift + j] >
fXmax)
2097 working_space[shift + j] =
fXmax;
2098 working_space[2 *
i + 1] = working_space[shift + j];
2103 if (working_space[shift + j] < 0.001) {
2104 working_space[shift + j] = 0.001;
2106 working_space[peak_vel] = working_space[shift + j];
2109 if (
fFixT ==
false) {
2110 working_space[peak_vel + 1] = working_space[shift + j];
2113 if (
fFixB ==
false) {
2114 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
2115 if (working_space[shift + j] < 0)
2116 working_space[shift + j] = -0.001;
2118 working_space[shift + j] = 0.001;
2120 working_space[peak_vel + 2] = working_space[shift + j];
2123 if (
fFixS ==
false) {
2124 working_space[peak_vel + 3] = working_space[shift + j];
2128 working_space[peak_vel + 4] = working_space[shift + j];
2132 working_space[peak_vel + 5] = working_space[shift + j];
2136 working_space[peak_vel + 6] = working_space[shift + j];
2144 working_space[peak_vel],
2145 working_space[peak_vel + 1],
2146 working_space[peak_vel + 3],
2147 working_space[peak_vel + 2],
2148 working_space[peak_vel + 4],
2149 working_space[peak_vel + 5],
2150 working_space[peak_vel + 6]);
2163 chi2 += (yw -
f) * (yw -
f) / ywm;
2170 pmin = pi, chi_min = chi2;
2180 for (j = 0; j < rozmer; j++) {
2181 working_space[shift + j] = working_space[4 * shift + j] + pmin * alpha * working_space[2 * shift + j];
2185 if (working_space[shift + j] < 0)
2186 working_space[shift + j] = 0;
2187 working_space[2 *
i] = working_space[shift + j];
2191 if (working_space[shift + j] <
fXmin)
2192 working_space[shift + j] =
fXmin;
2193 if (working_space[shift + j] >
fXmax)
2194 working_space[shift + j] =
fXmax;
2195 working_space[2 *
i + 1] = working_space[shift + j];
2200 if (working_space[shift + j] < 0.001) {
2201 working_space[shift + j] = 0.001;
2203 working_space[peak_vel] = working_space[shift + j];
2206 if (
fFixT ==
false) {
2207 working_space[peak_vel + 1] = working_space[shift + j];
2210 if (
fFixB ==
false) {
2211 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
2212 if (working_space[shift + j] < 0)
2213 working_space[shift + j] = -0.001;
2215 working_space[shift + j] = 0.001;
2217 working_space[peak_vel + 2] = working_space[shift + j];
2220 if (
fFixS ==
false) {
2221 working_space[peak_vel + 3] = working_space[shift + j];
2225 working_space[peak_vel + 4] = working_space[shift + j];
2229 working_space[peak_vel + 5] = working_space[shift + j];
2233 working_space[peak_vel + 6] = working_space[shift + j];
2241 for (j = 0; j < rozmer; j++) {
2242 working_space[shift + j] = working_space[4 * shift + j] + alpha * working_space[2 * shift + j];
2246 if (working_space[shift + j] < 0)
2247 working_space[shift + j] = 0;
2248 working_space[2 *
i] = working_space[shift + j];
2252 if (working_space[shift + j] <
fXmin)
2253 working_space[shift + j] =
fXmin;
2254 if (working_space[shift + j] >
fXmax)
2255 working_space[shift + j] =
fXmax;
2256 working_space[2 *
i + 1] = working_space[shift + j];
2261 if (working_space[shift + j] < 0.001) {
2262 working_space[shift + j] = 0.001;
2264 working_space[peak_vel] = working_space[shift + j];
2267 if (
fFixT ==
false) {
2268 working_space[peak_vel + 1] = working_space[shift + j];
2271 if (
fFixB ==
false) {
2272 if (
TMath::Abs(working_space[shift + j]) < 0.001) {
2273 if (working_space[shift + j] < 0)
2274 working_space[shift + j] = -0.001;
2276 working_space[shift + j] = 0.001;
2278 working_space[peak_vel + 2] = working_space[shift + j];
2281 if (
fFixS ==
false) {
2282 working_space[peak_vel + 3] = working_space[shift + j];
2286 working_space[peak_vel + 4] = working_space[shift + j];
2290 working_space[peak_vel + 5] = working_space[shift + j];
2294 working_space[peak_vel + 6] = working_space[shift + j];
2302 working_space[peak_vel],
2303 working_space[peak_vel + 1],
2304 working_space[peak_vel + 3],
2305 working_space[peak_vel + 2],
2306 working_space[peak_vel + 4],
2307 working_space[peak_vel + 5],
2308 working_space[peak_vel + 6]);
2321 chi += (yw -
f) * (yw -
f) / ywm;
2328 alpha = alpha * chi_opt / (2 * chi);
2331 alpha = alpha / 10.0;
2334 }
while (((chi > chi_opt
2339 for (j = 0; j < rozmer; j++) {
2340 working_space[4 * shift + j] = 0;
2341 working_space[2 * shift + j] = 0;
2348 working_space[peak_vel], working_space[peak_vel + 1],
2349 working_space[peak_vel + 3],
2350 working_space[peak_vel + 2],
2351 working_space[peak_vel + 4],
2352 working_space[peak_vel + 5],
2353 working_space[peak_vel + 6]);
2354 chi_opt = (yw -
f) * (yw -
f) / yw;
2355 chi_cel += (yw -
f) * (yw -
f) / yw;
2358 for (j = 0, k = 0; j <
fNPeaks; j++) {
2361 working_space[peak_vel],
2362 working_space[peak_vel + 1],
2363 working_space[peak_vel + 3],
2364 working_space[peak_vel + 2]);
2366 working_space[2 * shift + k] += chi_opt;
2368 working_space[4 * shift + k] +=
b;
2374 working_space[2 * j + 1],
2375 working_space[peak_vel],
2376 working_space[peak_vel + 1],
2377 working_space[peak_vel + 3],
2378 working_space[peak_vel + 2]);
2380 working_space[2 * shift + k] += chi_opt;
2382 working_space[4 * shift + k] +=
b;
2389 working_space[peak_vel],
2390 working_space[peak_vel + 1],
2391 working_space[peak_vel + 3],
2392 working_space[peak_vel + 2]);
2394 working_space[2 * shift + k] += chi_opt;
2396 working_space[4 * shift + k] +=
b;
2400 if (
fFixT ==
false) {
2402 working_space[peak_vel],
2403 working_space[peak_vel + 2]);
2405 working_space[2 * shift + k] += chi_opt;
2407 working_space[4 * shift + k] +=
b;
2411 if (
fFixB ==
false) {
2413 working_space[peak_vel], working_space[peak_vel + 1],
2414 working_space[peak_vel + 2]);
2416 working_space[2 * shift + k] += chi_opt;
2418 working_space[4 * shift + k] +=
b;
2422 if (
fFixS ==
false) {
2424 working_space[peak_vel]);
2426 working_space[2 * shift + k] += chi_opt;
2428 working_space[4 * shift + k] +=
b;
2435 working_space[2 * shift + k] += chi_opt;
2437 working_space[4 * shift + k] +=
b;
2444 working_space[2 * shift + k] += chi_opt;
2446 working_space[4 * shift + k] +=
b;
2453 working_space[2 * shift + k] += chi_opt;
2455 working_space[4 * shift + k] +=
b;
2462 chi_er = chi_cel /
b;
2465 Area(working_space[2 *
i], working_space[peak_vel],
2466 working_space[peak_vel + 1], working_space[peak_vel + 2]);
2469 if (working_space[3 * shift + j] != 0)
2472 a =
Derpa(working_space[peak_vel],
2473 working_space[peak_vel + 1],
2474 working_space[peak_vel + 2]);
2475 b = working_space[4 * shift + j];
2496 if (working_space[3 * shift + j] != 0)
2508 if (working_space[3 * shift + j] != 0)
2517 if (
fFixT ==
false) {
2518 fTCalc = working_space[shift + j];
2519 if (working_space[3 * shift + j] != 0)
2528 if (
fFixB ==
false) {
2529 fBCalc = working_space[shift + j];
2530 if (working_space[3 * shift + j] != 0)
2539 if (
fFixS ==
false) {
2540 fSCalc = working_space[shift + j];
2541 if (working_space[3 * shift + j] != 0)
2551 fA0Calc = working_space[shift + j];
2552 if (working_space[3 * shift + j] != 0)
2562 fA1Calc = working_space[shift + j];
2563 if (working_space[3 * shift + j] != 0)
2573 fA2Calc = working_space[shift + j];
2574 if (working_space[3 * shift + j] != 0)
2587 working_space[peak_vel], working_space[peak_vel + 1],
2588 working_space[peak_vel + 3], working_space[peak_vel + 2],
2589 working_space[peak_vel + 4], working_space[peak_vel + 5],
2590 working_space[peak_vel + 6]);
2593 for (
i = 0;
i < rozmer;
i++)
2594 delete [] working_matrix[
i];
2595 delete [] working_matrix;
2596 delete [] working_space;