generating global fit msr-files including a GLOBAL block is working now as expected.

This commit is contained in:
suter_a 2015-09-22 16:33:02 +02:00
parent fc9c573f2a
commit 1f95678764
2 changed files with 164 additions and 53 deletions

View File

@ -6,6 +6,8 @@ changes since 0.14.0
=================================== ===================================
NEW 2015-02-23 implemented an average-per-data-set option for musrFT. NEW 2015-02-23 implemented an average-per-data-set option for musrFT.
NEW 2015-02-21 add proper Mac icon to musredit NEW 2015-02-21 add proper Mac icon to musredit
FIXED 2015-09-22 generating global fit msr-files including a GLOBAL block is working
now as expected.
FIXED 2015-09-17 in PMsr2Data::PrepareGlobalInputFile() there seem to be 'unmotivated' FIXED 2015-09-17 in PMsr2Data::PrepareGlobalInputFile() there seem to be 'unmotivated'
break; commands in some loops. They prevent a proper map handling. break; commands in some loops. They prevent a proper map handling.
Since this is a real puzzle I contacted BMW for clarification. Since this is a real puzzle I contacted BMW for clarification.

View File

@ -8,7 +8,7 @@
***************************************************************************/ ***************************************************************************/
/*************************************************************************** /***************************************************************************
* Copyright (C) 2007-2014 by Andreas Suter * * Copyright (C) 2007-2015 by Andreas Suter *
* andreas.suter@psi.ch * * andreas.suter@psi.ch *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
@ -242,7 +242,7 @@ Int_t PMsrHandler::ReadMsrFile()
if (result == PMUSR_SUCCESS) if (result == PMUSR_SUCCESS)
if (!HandleFunctionsEntry(functions)) if (!HandleFunctionsEntry(functions))
result = PMUSR_MSR_SYNTAX_ERROR; result = PMUSR_MSR_SYNTAX_ERROR;
if (result == PMUSR_SUCCESS) if ((result == PMUSR_SUCCESS) && (global.size()>0))
if (!HandleGlobalEntry(global)) if (!HandleGlobalEntry(global))
result = PMUSR_MSR_SYNTAX_ERROR; result = PMUSR_MSR_SYNTAX_ERROR;
if (result == PMUSR_SUCCESS) if (result == PMUSR_SUCCESS)
@ -1595,7 +1595,106 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map<UInt_t, TString> *co
// write GLOBAL block // write GLOBAL block
if (fGlobal.IsPresent()) { if (fGlobal.IsPresent()) {
// not sure that anything needs to be done here ... fout << "GLOBAL" << endl;
// fittype
if (fGlobal.GetFitType() != -1) {
fout.width(16);
switch (fGlobal.GetFitType()) {
case MSR_FITTYPE_SINGLE_HISTO:
fout << left << "fittype" << MSR_FITTYPE_SINGLE_HISTO << " (single histogram fit)" << endl;
break;
case MSR_FITTYPE_ASYM:
fout << left << "fittype" << MSR_FITTYPE_ASYM << " (asymmetry fit)" << endl ;
break;
case MSR_FITTYPE_MU_MINUS:
fout << left << "fittype" << MSR_FITTYPE_MU_MINUS << " (mu minus fit)" << endl ;
break;
case MSR_FITTYPE_NON_MUSR:
fout << left << "fittype" << MSR_FITTYPE_NON_MUSR << " (non muSR fit)" << endl ;
break;
default:
break;
}
}
// data range
if ((fGlobal.GetDataRange(0) != -1) || (fGlobal.GetDataRange(1) != -1) || (fGlobal.GetDataRange(2) != -1) || (fGlobal.GetDataRange(3) != -1)) {
fout.width(16);
fout << left << "data";
for (UInt_t j=0; j<4; ++j) {
if (fGlobal.GetDataRange(j) > 0) {
fout.width(8);
fout << left << fGlobal.GetDataRange(j);
}
}
fout << endl;
}
// t0
if (fGlobal.GetT0BinSize() > 0) {
fout.width(16);
fout << left << "t0";
for (UInt_t j=0; j<fGlobal.GetT0BinSize(); ++j) {
fout.width(8);
fout.precision(1);
fout.setf(ios::fixed,ios::floatfield);
fout << left << fGlobal.GetT0Bin(j);
}
fout << endl;
}
// addt0
for (UInt_t j = 0; j < fGlobal.GetAddT0BinEntries(); ++j) {
if (fGlobal.GetAddT0BinSize(j) > 0) {
fout.width(16);
fout << left << "addt0";
for (Int_t k=0; k<fGlobal.GetAddT0BinSize(j); ++k) {
fout.width(8);
fout.precision(1);
fout.setf(ios::fixed,ios::floatfield);
fout << left << fGlobal.GetAddT0Bin(j, k);
}
fout << endl;
}
}
// fit range
if ( (fGlobal.IsFitRangeInBin() && fGlobal.GetFitRangeOffset(0) != -1) ||
(fGlobal.GetFitRange(0) != PMUSR_UNDEFINED) ) {
fout.width(16);
fout << left << "fit";
if (fGlobal.IsFitRangeInBin()) { // fit range given in bins
fout << "fgb";
if (fGlobal.GetFitRangeOffset(0) > 0)
fout << "+" << fGlobal.GetFitRangeOffset(0);
fout << " lgb";
if (fGlobal.GetFitRangeOffset(1) > 0)
fout << "-" << fGlobal.GetFitRangeOffset(1);
} else { // fit range given in time
for (UInt_t j=0; j<2; j++) {
if (fGlobal.GetFitRange(j) == -1)
break;
UInt_t neededWidth = 7;
UInt_t neededPrec = LastSignificant(fRuns[i].GetFitRange(j));
fout.width(neededWidth);
fout.precision(neededPrec);
fout << left << fixed << fGlobal.GetFitRange(j);
if (j==0)
fout << " ";
}
}
fout << endl;
}
// packing
if (fGlobal.GetPacking() != -1) {
fout.width(16);
fout << left << "packing";
fout << fGlobal.GetPacking() << endl;
}
fout << endl << hline.Data() << endl;
} }
// write RUN blocks // write RUN blocks
@ -1660,22 +1759,24 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map<UInt_t, TString> *co
} }
// fittype // fittype
fout.width(16); if (fRuns[i].GetFitType() != -1) {
switch (fRuns[i].GetFitType()) { fout.width(16);
case MSR_FITTYPE_SINGLE_HISTO: switch (fRuns[i].GetFitType()) {
fout << left << "fittype" << MSR_FITTYPE_SINGLE_HISTO << " (single histogram fit)" << endl; case MSR_FITTYPE_SINGLE_HISTO:
break; fout << left << "fittype" << MSR_FITTYPE_SINGLE_HISTO << " (single histogram fit)" << endl;
case MSR_FITTYPE_ASYM: break;
fout << left << "fittype" << MSR_FITTYPE_ASYM << " (asymmetry fit)" << endl ; case MSR_FITTYPE_ASYM:
break; fout << left << "fittype" << MSR_FITTYPE_ASYM << " (asymmetry fit)" << endl ;
case MSR_FITTYPE_MU_MINUS: break;
fout << left << "fittype" << MSR_FITTYPE_MU_MINUS << " (mu minus fit)" << endl ; case MSR_FITTYPE_MU_MINUS:
break; fout << left << "fittype" << MSR_FITTYPE_MU_MINUS << " (mu minus fit)" << endl ;
case MSR_FITTYPE_NON_MUSR: break;
fout << left << "fittype" << MSR_FITTYPE_NON_MUSR << " (non muSR fit)" << endl ; case MSR_FITTYPE_NON_MUSR:
break; fout << left << "fittype" << MSR_FITTYPE_NON_MUSR << " (non muSR fit)" << endl ;
default: break;
break; default:
break;
}
} }
// alpha // alpha
@ -1815,17 +1916,19 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map<UInt_t, TString> *co
} }
// addt0 // addt0
for (UInt_t j = 0; j < fRuns[i].GetRunNameSize() - 1; ++j) { if (fRuns[i].GetAddT0BinEntries() > 0) {
if (fRuns[i].GetAddT0BinSize(j) > 0) { for (UInt_t j = 0; j < fRuns[i].GetRunNameSize() - 1; ++j) {
fout.width(16); if (fRuns[i].GetAddT0BinSize(j) > 0) {
fout << left << "addt0"; fout.width(16);
for (Int_t k=0; k<fRuns[i].GetAddT0BinSize(j); ++k) { fout << left << "addt0";
fout.width(8); for (Int_t k=0; k<fRuns[i].GetAddT0BinSize(j); ++k) {
fout.precision(1); fout.width(8);
fout.setf(ios::fixed,ios::floatfield); fout.precision(1);
fout << left << fRuns[i].GetAddT0Bin(j, k); fout.setf(ios::fixed,ios::floatfield);
fout << left << fRuns[i].GetAddT0Bin(j, k);
}
fout << endl;
} }
fout << endl;
} }
} }
@ -1852,34 +1955,40 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map<UInt_t, TString> *co
} }
// fit // fit
fout.width(16); if ( (fRuns[i].IsFitRangeInBin() && fRuns[i].GetFitRangeOffset(0) != -1) ||
fout << left << "fit"; (fRuns[i].GetFitRange(0) != PMUSR_UNDEFINED) ) {
if (fRuns[i].IsFitRangeInBin()) { // fit range given in bins fout.width(16);
fout << "fgb"; fout << left << "fit";
if (fRuns[i].GetFitRangeOffset(0) > 0) if (fRuns[i].IsFitRangeInBin()) { // fit range given in bins
fout << "+" << fRuns[i].GetFitRangeOffset(0); fout << "fgb";
fout << " lgb"; if (fRuns[i].GetFitRangeOffset(0) > 0)
if (fRuns[i].GetFitRangeOffset(1) > 0) fout << "+" << fRuns[i].GetFitRangeOffset(0);
fout << "-" << fRuns[i].GetFitRangeOffset(1); fout << " lgb";
} else { // fit range given in time if (fRuns[i].GetFitRangeOffset(1) > 0)
for (UInt_t j=0; j<2; j++) { fout << "-" << fRuns[i].GetFitRangeOffset(1);
if (fRuns[i].GetFitRange(j) == -1) } else { // fit range given in time
break; for (UInt_t j=0; j<2; j++) {
UInt_t neededWidth = 7; if (fRuns[i].GetFitRange(j) == -1)
UInt_t neededPrec = LastSignificant(fRuns[i].GetFitRange(j)); break;
fout.width(neededWidth); UInt_t neededWidth = 7;
fout.precision(neededPrec); UInt_t neededPrec = LastSignificant(fRuns[i].GetFitRange(j));
fout << left << fixed << fRuns[i].GetFitRange(j); fout.width(neededWidth);
if (j==0) fout.precision(neededPrec);
fout << " "; fout << left << fixed << fRuns[i].GetFitRange(j);
if (j==0)
fout << " ";
}
} }
fout << endl;
} }
fout << endl;
// packing // packing
fout.width(16); if (fRuns[i].GetPacking() != -1) {
fout << left << "packing"; fout.width(16);
fout << fRuns[i].GetPacking() << endl; fout << left << "packing";
fout << fRuns[i].GetPacking() << endl;
}
fout << endl; fout << endl;
} }