|
if (string(minType)!="OldMinuit") { |
|
|
|
#ifndef __ROOFIT_NOROOMINIMIZER |
|
RooMinimizer m(*nll) ; |
|
|
|
m.setMinimizerType(minType) ; |
|
|
|
m.setEvalErrorWall(doEEWall) ; |
|
m.setRecoverFromNaNStrength(recoverFromNaN); |
|
if (doWarn==0) { |
|
// m.setNoWarn() ; WVE FIX THIS |
|
} |
|
|
|
m.setPrintEvalErrors(numee) ; |
|
if (plevel!=1) { |
|
m.setPrintLevel(plevel) ; |
|
} |
|
|
|
if (optConst) { |
|
// Activate constant term optimization |
|
m.optimizeConst(optConst) ; |
|
} |
|
|
|
if (fitOpt) { |
|
|
|
// Play fit options as historically defined |
|
ret = m.fit(fitOpt) ; |
|
|
|
} else { |
|
|
|
if (verbose) { |
|
// Activate verbose options |
|
m.setVerbose(1) ; |
|
} |
|
if (doTimer) { |
|
// Activate timer options |
|
m.setProfile(1) ; |
|
} |
|
|
|
if (strat!=1) { |
|
// Modify fit strategy |
|
m.setStrategy(strat) ; |
|
} |
|
|
|
if (initHesse) { |
|
// Initialize errors with hesse |
|
m.hesse() ; |
|
} |
|
|
|
// Minimize using chosen algorithm |
|
m.minimize(minType,minAlg) ; |
|
|
|
if (hesse) { |
|
// Evaluate errors with Hesse |
|
m.hesse() ; |
|
} |
|
|
|
int corrCovQual = -1; |
|
|
|
//asymptotically correct approach |
|
if (doAsymptotic==1 && m.getNPar()>0) { |
|
corrCovQual = calculateAsymptoticCorrectedCovMatrix(m, data); |
|
} |
|
|
|
if (doSumW2==1 && m.getNPar()>0) { |
|
corrCovQual = calculateSumW2CorrectedCovMatrix(m, *nll); |
|
} |
|
|
|
if (minos) { |
|
// Evaluate errs with Minos |
|
if (minosSet) { |
|
m.minos(*minosSet) ; |
|
} else { |
|
m.minos() ; |
|
} |
|
} |
|
|
|
// Optionally return fit result |
|
if (doSave) { |
|
string name = Form("fitresult_%s_%s",GetName(),data.GetName()) ; |
|
string title = Form("Result of fit of p.d.f. %s to dataset %s",GetName(),data.GetName()) ; |
|
ret = m.save(name.c_str(),title.c_str()) ; |
|
if((doSumW2==1 || doAsymptotic==1) && m.getNPar()>0) { |
|
ret->setCovQual(corrCovQual); |
|
} |
|
} |
|
|
|
} |
|
|
|
if (optConst) { |
|
m.optimizeConst(0) ; |
|
} |
|
|
|
#endif |
|
|
|
} else { |
|
|
|
RooMinuit m(*nll) ; |
|
|
|
m.setEvalErrorWall(doEEWall) ; |
|
if (doWarn==0) { |
|
m.setNoWarn() ; |
|
} |
|
|
|
m.setPrintEvalErrors(numee) ; |
|
if (plevel!=1) { |
|
m.setPrintLevel(plevel) ; |
|
} |
|
|
|
if (optConst) { |
|
// Activate constant term optimization |
|
m.optimizeConst(optConst) ; |
|
} |
|
|
|
if (fitOpt) { |
|
|
|
// Play fit options as historically defined |
|
ret = m.fit(fitOpt) ; |
|
|
|
} else { |
|
|
|
if (verbose) { |
|
// Activate verbose options |
|
m.setVerbose(1) ; |
|
} |
|
if (doTimer) { |
|
// Activate timer options |
|
m.setProfile(1) ; |
|
} |
|
|
|
if (strat!=1) { |
|
// Modify fit strategy |
|
m.setStrategy(strat) ; |
|
} |
|
|
|
if (initHesse) { |
|
// Initialize errors with hesse |
|
m.hesse() ; |
|
} |
|
|
|
// Minimize using migrad |
|
m.migrad() ; |
|
|
|
if (hesse) { |
|
// Evaluate errors with Hesse |
|
m.hesse() ; |
|
} |
|
|
|
int corrCovQual = -1; |
|
|
|
//asymptotically correct approach |
|
if (doAsymptotic==1 && m.getNPar()>0) { |
|
corrCovQual = calculateAsymptoticCorrectedCovMatrix(m, data); |
|
} |
|
|
|
if (doSumW2==1 && m.getNPar()>0) { |
|
corrCovQual = calculateSumW2CorrectedCovMatrix(m, *nll); |
|
} |
|
|
|
if (minos) { |
|
// Evaluate errs with Minos |
|
if (minosSet) { |
|
m.minos(*minosSet) ; |
|
} else { |
|
m.minos() ; |
|
} |
|
} |
|
|
|
// Optionally return fit result |
|
if (doSave) { |
|
string name = Form("fitresult_%s_%s",GetName(),data.GetName()) ; |
|
string title = Form("Result of fit of p.d.f. %s to dataset %s",GetName(),data.GetName()) ; |
|
ret = m.save(name.c_str(),title.c_str()) ; |
|
if((doSumW2==1 || doAsymptotic==1) && m.getNPar()>0) { |
|
ret->setCovQual(corrCovQual); |
|
} |
|
} |
|
|
|
} |
|
|
|
if (optConst) { |
|
m.optimizeConst(0) ; |
|
} |
|
|
|
} |
There is a large section of code that's never checked (compiled) related to a time before RooMinimizer.
For example:
root/roofit/roofitcore/src/RooAbsPdf.cxx
Lines 1599 to 1783 in 7c4f932
This, together with the minimiser option
OldMinuit(see RooAbsPdf::fitTo) should be removed.Originally posted by @hageboeck in #8569 (comment)