diff --git a/src/msr2msr.cpp b/src/msr2msr.cpp index cf4ab961..0ab9bf1e 100644 --- a/src/msr2msr.cpp +++ b/src/msr2msr.cpp @@ -585,6 +585,46 @@ bool msr2msr_finalize_theory(char *fln, int theoryTag, int noOfAddionalParams) return true; } +//-------------------------------------------------------------------------- +/** + *
Filters out the old chi-square related informations. And sets them according
+ * to the new scheme.
+ *
+ * return:
+ * - true if everything went smooth
+ * - false otherwise
+ *
+ * \param str msr-file statistic block line
+ */
+bool msr2msr_statistic(char *str) {
+ bool success = true;
+
+ char *pstr;
+ int status;
+ double chisq, chisqred;
+ if (strstr(str, " chi")) {
+ pstr = strstr(str, "abs = ");
+ if (pstr != 0) {
+ status = sscanf(pstr, "abs = %lf", &chisq);
+ if (status != 1) {
+ success = false;
+ }
+ }
+ pstr = strstr(str, "norm = ");
+ if (pstr != 0) {
+ status = sscanf(pstr, "norm = %lf", &chisqred);
+ if (status != 1) {
+ success = false;
+ }
+ }
+ if (success) {
+ sprintf(str, " chisq = %lf, NDF = %d, chisq/NDF = %lf", chisq, static_cast msr2msr is needed to convert old WKM msr-files to musrfit msr-files. Eventhough the syntax is very
@@ -636,6 +676,8 @@ int main(int argc, char *argv[])
tag = MSR_TAG_RUN;
} else if (strstr(str, "THEORY")) {
tag = MSR_TAG_THEORY;
+ } else if (strstr(str, "STATISTIC")) {
+ tag = MSR_TAG_STATISTIC;
}
switch (tag) {
@@ -648,6 +690,9 @@ int main(int argc, char *argv[])
case MSR_TAG_RUN:
success = msr2msr_run(str);
break;
+ case MSR_TAG_STATISTIC:
+ success = msr2msr_statistic(str);
+ break;
default:
break;
}