fixes the inadequate attempt to use log max likelihood fit for asymmetry/non-muSR fit (MUSR-148)
This commit is contained in:
parent
81f59e3538
commit
a1b94ae247
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
changes since 0.8.0
|
changes since 0.8.0
|
||||||
===================================
|
===================================
|
||||||
|
FIXED fixes the inadequate attempt to use log max likelihood fit for asymmetry/non-muSR fit (MUSR-148)
|
||||||
CHANGED maximum possible run number for the use in msr2data to numeric_limits<unsigned int>::max() (MUSR-155)
|
CHANGED maximum possible run number for the use in msr2data to numeric_limits<unsigned int>::max() (MUSR-155)
|
||||||
|
|
||||||
musrfit 0.8.0 - changes since 0.7.0
|
musrfit 0.8.0 - changes since 0.7.0
|
||||||
|
@ -23,7 +23,7 @@ PROJECT_NAME = musrfit
|
|||||||
# This could be handy for archiving the generated documentation or
|
# This could be handy for archiving the generated documentation or
|
||||||
# if some version control system is used.
|
# if some version control system is used.
|
||||||
|
|
||||||
PROJECT_NUMBER = 0.99
|
PROJECT_NUMBER = 0.8.0
|
||||||
|
|
||||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
||||||
# base path where the generated documentation will be put.
|
# base path where the generated documentation will be put.
|
||||||
|
@ -282,6 +282,9 @@ Bool_t PFitter::CheckCommands()
|
|||||||
{
|
{
|
||||||
fIsValid = true;
|
fIsValid = true;
|
||||||
|
|
||||||
|
// check if chisq or log max likelihood fit
|
||||||
|
fUseChi2 = fRunInfo->GetMsrStatistic()->fChisq;
|
||||||
|
|
||||||
// walk through the msr-file COMMAND block
|
// walk through the msr-file COMMAND block
|
||||||
PIntPair cmd;
|
PIntPair cmd;
|
||||||
PMsrLines::iterator it;
|
PMsrLines::iterator it;
|
||||||
@ -298,9 +301,9 @@ Bool_t PFitter::CheckCommands()
|
|||||||
} else if (it->fLine.Contains("END RETURN", TString::kIgnoreCase)) { // needed for backward compatibility
|
} else if (it->fLine.Contains("END RETURN", TString::kIgnoreCase)) { // needed for backward compatibility
|
||||||
continue;
|
continue;
|
||||||
} else if (it->fLine.Contains("CHI_SQUARE", TString::kIgnoreCase)) {
|
} else if (it->fLine.Contains("CHI_SQUARE", TString::kIgnoreCase)) {
|
||||||
fUseChi2 = true;
|
continue;
|
||||||
} else if (it->fLine.Contains("MAX_LIKELIHOOD", TString::kIgnoreCase)) {
|
} else if (it->fLine.Contains("MAX_LIKELIHOOD", TString::kIgnoreCase)) {
|
||||||
fUseChi2 = false;
|
continue;
|
||||||
} else if (it->fLine.Contains("INTERACTIVE", TString::kIgnoreCase)) {
|
} else if (it->fLine.Contains("INTERACTIVE", TString::kIgnoreCase)) {
|
||||||
cmd.first = PMN_INTERACTIVE;
|
cmd.first = PMN_INTERACTIVE;
|
||||||
cmd.second = cmdLineNo;
|
cmd.second = cmdLineNo;
|
||||||
@ -805,8 +808,7 @@ Bool_t PFitter::CheckCommands()
|
|||||||
cmd.second = cmdLineNo;
|
cmd.second = cmdLineNo;
|
||||||
fCmdList.push_back(cmd);
|
fCmdList.push_back(cmd);
|
||||||
} else { // unkown command
|
} else { // unkown command
|
||||||
cerr << endl << ">> **FATAL ERROR**";
|
cerr << endl << ">> PFitter::CheckCommands(): **FATAL ERROR** in line " << it->fLineNo << " an unkown command is found:";
|
||||||
cerr << endl << ">> PFitter::CheckCommands(): In line " << it->fLineNo << " an unkown command is found:";
|
|
||||||
cerr << endl << ">> " << it->fLine.Data();
|
cerr << endl << ">> " << it->fLine.Data();
|
||||||
cerr << endl << ">> Will stop ...";
|
cerr << endl << ">> Will stop ...";
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
|
@ -53,18 +53,6 @@ PFitterFcn::PFitterFcn(PRunListCollection *runList, Bool_t useChi2)
|
|||||||
fUp = 0.5;
|
fUp = 0.5;
|
||||||
|
|
||||||
fRunListCollection = runList;
|
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);
|
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;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,6 +297,10 @@ Int_t PMsrHandler::ReadMsrFile()
|
|||||||
if (!CheckAddRunParameters())
|
if (!CheckAddRunParameters())
|
||||||
result = PMUSR_MSR_SYNTAX_ERROR;
|
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
|
// clean up
|
||||||
fit_parameter.clear();
|
fit_parameter.clear();
|
||||||
@ -4633,6 +4637,29 @@ Bool_t PMsrHandler::CheckAddRunParameters()
|
|||||||
return result;
|
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)
|
// NeededPrecision (private)
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
@ -102,6 +102,7 @@ class PMsrHandler
|
|||||||
virtual Bool_t CheckFuncs();
|
virtual Bool_t CheckFuncs();
|
||||||
virtual Bool_t CheckHistoGrouping();
|
virtual Bool_t CheckHistoGrouping();
|
||||||
virtual Bool_t CheckAddRunParameters();
|
virtual Bool_t CheckAddRunParameters();
|
||||||
|
virtual void CheckMaxLikelihood();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TString fFileName; ///< file name of the msr-file
|
TString fFileName; ///< file name of the msr-file
|
||||||
|
Loading…
x
Reference in New Issue
Block a user