diff --git a/src/classes/PFitter.cpp b/src/classes/PFitter.cpp index b235c0ee5..00359fb48 100644 --- a/src/classes/PFitter.cpp +++ b/src/classes/PFitter.cpp @@ -2298,18 +2298,25 @@ Bool_t PFitter::ExecuteSave(Bool_t firstSave) // calculate expected chisq std::vector param; + std::vector err; Double_t totalExpectedChisq = 0.0; std::vector expectedchisqPerRun; std::vector ndfPerHisto; - for (UInt_t i=0; iCalcExpectedChiSquare(param, totalExpectedChisq, expectedchisqPerRun); + fFitterFcnDKS->CalcExpectedChiSquare(par_r, totalExpectedChisq, expectedchisqPerRun); else - fFitterFcn->CalcExpectedChiSquare(param, totalExpectedChisq, expectedchisqPerRun); + fFitterFcn->CalcExpectedChiSquare(par_r, totalExpectedChisq, expectedchisqPerRun); // calculate chisq per run std::vector chisqPerRun; @@ -3160,6 +3167,45 @@ std::string PFitter::GetCPUInfo() return cpuInfo; } +//-------------------------------------------------------------------------- +// ParamRound (private) +//-------------------------------------------------------------------------- +/** + *

Rounds the parameter vector value according to the given error estimate, + * so that the msr-file value and the fitter result are consistent with each + * other. This means that musrfit -c, and musrfit -e -t should give essentially + * the same values of expected chisq (up to small rounding values). + * + * @param par parameter value vector + * @param err error value vector + * @param ok true if size of par and err are identically, otherwise false. + * + * @return rounded parameter value vector, compatible with the msr-file output. + */ +PDoubleVector PFitter::ParamRound(const PDoubleVector &par, const PDoubleVector &err, Bool_t &ok) +{ + PDoubleVector par_r; + + par_r.resize(par.size()); + ok = true; + + if (par.size() != err.size()) { + // error msg + ok = false; + return par_r; + } + + int exp; + double dval; + for (unsigned int i=0; i