fixes the inadequate attempt to use log max likelihood fit for asymmetry/non-muSR fit (MUSR-148)
This commit is contained in:
@ -282,6 +282,9 @@ Bool_t PFitter::CheckCommands()
|
||||
{
|
||||
fIsValid = true;
|
||||
|
||||
// check if chisq or log max likelihood fit
|
||||
fUseChi2 = fRunInfo->GetMsrStatistic()->fChisq;
|
||||
|
||||
// walk through the msr-file COMMAND block
|
||||
PIntPair cmd;
|
||||
PMsrLines::iterator it;
|
||||
@ -298,9 +301,9 @@ Bool_t PFitter::CheckCommands()
|
||||
} else if (it->fLine.Contains("END RETURN", TString::kIgnoreCase)) { // needed for backward compatibility
|
||||
continue;
|
||||
} else if (it->fLine.Contains("CHI_SQUARE", TString::kIgnoreCase)) {
|
||||
fUseChi2 = true;
|
||||
continue;
|
||||
} else if (it->fLine.Contains("MAX_LIKELIHOOD", TString::kIgnoreCase)) {
|
||||
fUseChi2 = false;
|
||||
continue;
|
||||
} else if (it->fLine.Contains("INTERACTIVE", TString::kIgnoreCase)) {
|
||||
cmd.first = PMN_INTERACTIVE;
|
||||
cmd.second = cmdLineNo;
|
||||
@ -805,8 +808,7 @@ Bool_t PFitter::CheckCommands()
|
||||
cmd.second = cmdLineNo;
|
||||
fCmdList.push_back(cmd);
|
||||
} else { // unkown command
|
||||
cerr << endl << ">> **FATAL ERROR**";
|
||||
cerr << endl << ">> PFitter::CheckCommands(): In line " << it->fLineNo << " an unkown command is found:";
|
||||
cerr << endl << ">> PFitter::CheckCommands(): **FATAL ERROR** in line " << it->fLineNo << " an unkown command is found:";
|
||||
cerr << endl << ">> " << it->fLine.Data();
|
||||
cerr << endl << ">> Will stop ...";
|
||||
cerr << endl;
|
||||
|
@ -53,18 +53,6 @@ PFitterFcn::PFitterFcn(PRunListCollection *runList, Bool_t useChi2)
|
||||
fUp = 0.5;
|
||||
|
||||
fRunListCollection = runList;
|
||||
|
||||
// check if max likelihood is used together with asymmetry/nonMusr data.
|
||||
// if yes place a warning since this option is not implemented and a fall back
|
||||
// to chi2 will be used.
|
||||
if (!fUseChi2) {
|
||||
if ((fRunListCollection->GetNoOfAsymmetry() > 0) ||
|
||||
(fRunListCollection->GetNoOfNonMusr() > 0)) {
|
||||
cerr << endl << "**WARNING**: Maximum Log Likelihood Fit is only implemented for Single Histogram Fit";
|
||||
cerr << endl << " Will fall back to Chi Square Fit.";
|
||||
cerr << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@ -99,13 +87,6 @@ Double_t PFitterFcn::operator()(const std::vector<Double_t>& par) const
|
||||
value += fRunListCollection->GetNonMusrMaximumLikelihood(par);
|
||||
}
|
||||
|
||||
// cout << endl;
|
||||
// for (UInt_t i=0; i<par.size(); i++) {
|
||||
// cout << par[i] << ", ";
|
||||
// }
|
||||
//cout << endl << "chisq = " << value;
|
||||
// cout << endl << "------" << endl;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -297,6 +297,10 @@ Int_t PMsrHandler::ReadMsrFile()
|
||||
if (!CheckAddRunParameters())
|
||||
result = PMUSR_MSR_SYNTAX_ERROR;
|
||||
|
||||
// check if the user wants to use max likelihood with asymmetry/non-muSR fit (which is not implemented)
|
||||
if (result == PMUSR_SUCCESS)
|
||||
CheckMaxLikelihood();
|
||||
|
||||
|
||||
// clean up
|
||||
fit_parameter.clear();
|
||||
@ -4633,6 +4637,29 @@ Bool_t PMsrHandler::CheckAddRunParameters()
|
||||
return result;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// CheckMaxLikelihood (private)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>If log max likelihood is requested, make sure that all run blocks are of single histogram type.
|
||||
* If this is not the case, fall back to chisq, since for asymmetry/non-muSR fit, log max likelihood
|
||||
* is not defined.
|
||||
*/
|
||||
void PMsrHandler::CheckMaxLikelihood()
|
||||
{
|
||||
if (!fStatistic.fChisq) {
|
||||
for (UInt_t i=0; i<fRuns.size(); i++) {
|
||||
if (fRuns[i].GetFitType() != MSR_FITTYPE_SINGLE_HISTO) {
|
||||
cerr << endl << ">> PMsrHandler::CheckMaxLikelihood: **WARNING**: Maximum Log Likelihood Fit is only implemented";
|
||||
cerr << endl << ">> for Single Histogram Fit. Will fall back to Chi Square Fit.";
|
||||
cerr << endl << endl;
|
||||
fStatistic.fChisq = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// NeededPrecision (private)
|
||||
//--------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user