#include "TMinuitMinimizer.h"
#include "Math/IFunction.h"
#include "Fit/ParameterSettings.h"
#include "TMinuit.h"
#include "TROOT.h"
#include "TGraph.h"
#include "TError.h"
#include "TMatrixDSym.h"
#include <iostream>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
ROOT::Math::IMultiGenFunction * TMinuitMinimizer::fgFunc = 0;
TMinuit * TMinuitMinimizer::fgMinuit = 0;
bool TMinuitMinimizer::fgUsed = false;
bool TMinuitMinimizer::fgUseStaticMinuit = true;
ClassImp(TMinuitMinimizer)
TMinuitMinimizer::TMinuitMinimizer(ROOT::Minuit::EMinimizerType type, unsigned int ndim ) :
fUsed(false),
fMinosRun(false),
fDim(ndim),
fType(type),
fMinuit(0)
{
if (fDim > 0) InitTMinuit(fDim);
}
TMinuitMinimizer::TMinuitMinimizer(const char * type, unsigned int ndim ) :
fUsed(false),
fMinosRun(false),
fDim(ndim),
fMinuit(0)
{
std::string algoname(type);
std::transform(algoname.begin(), algoname.end(), algoname.begin(), (int(*)(int)) tolower );
ROOT::Minuit::EMinimizerType algoType = ROOT::Minuit::kMigrad;
if (algoname == "simplex") algoType = ROOT::Minuit::kSimplex;
if (algoname == "minimize" ) algoType = ROOT::Minuit::kCombined;
if (algoname == "migradimproved" ) algoType = ROOT::Minuit::kMigradImproved;
if (algoname == "scan" ) algoType = ROOT::Minuit::kScan;
if (algoname == "seek" ) algoType = ROOT::Minuit::kSeek;
fType = algoType;
if (fDim > 0) InitTMinuit(fDim);
}
TMinuitMinimizer::~TMinuitMinimizer()
{
if (fMinuit && !fgUseStaticMinuit) {
delete fMinuit;
fgMinuit = 0;
}
}
TMinuitMinimizer::TMinuitMinimizer(const TMinuitMinimizer &) :
Minimizer()
{
}
TMinuitMinimizer & TMinuitMinimizer::operator = (const TMinuitMinimizer &rhs)
{
if (this == &rhs) return *this;
return *this;
}
bool TMinuitMinimizer::UseStaticMinuit(bool on ) {
bool prev = fgUseStaticMinuit;
fgUseStaticMinuit = on;
return prev;
}
void TMinuitMinimizer::InitTMinuit(int dim) {
if (fMinuit ==0 || dim > fMinuit->fMaxpar) {
if (fgUseStaticMinuit) {
if (fgMinuit != gMinuit) {
if (fgMinuit ) {
if (gROOT->GetListOfSpecials()->FindObject(fgMinuit) == 0) {
fgMinuit = 0;
}
else {
gMinuit = fgMinuit;
}
}
else {
}
}
if (fgMinuit == 0) {
fgUsed = false;
fgMinuit = new TMinuit(dim);
}
else if (fgMinuit->GetNumPars() != int(dim) ) {
delete fgMinuit;
fgUsed = false;
fgMinuit = new TMinuit(dim);
}
fMinuit = fgMinuit;
}
else {
if (fMinuit) delete fMinuit;
fMinuit = new TMinuit(dim);
fgMinuit = fMinuit;
fgUsed = false;
}
}
fDim = dim;
R__ASSERT(fMinuit);
double arglist[1];
int ierr= 0;
arglist[0] = PrintLevel() - 1;
fMinuit->mnexcm("SET PRINT",arglist,1,ierr);
if (PrintLevel() <= 0) SuppressMinuitWarnings();
}
void TMinuitMinimizer::SetFunction(const ROOT::Math::IMultiGenFunction & func) {
fDim = func.NDim();
InitTMinuit(fDim);
fgFunc = const_cast<ROOT::Math::IMultiGenFunction *>(&func);
fMinuit->SetFCN(&TMinuitMinimizer::Fcn);
double arglist[1];
int ierr = 0;
fMinuit->mnexcm("SET NOGrad",arglist,0,ierr);
}
void TMinuitMinimizer::SetFunction(const ROOT::Math::IMultiGradFunction & func) {
fDim = func.NDim();
InitTMinuit(fDim);
fgFunc = const_cast<ROOT::Math::IMultiGradFunction *>(&func);
fMinuit->SetFCN(&TMinuitMinimizer::FcnGrad);
double arglist[1];
int ierr = 0;
arglist[0] = 1;
fMinuit->mnexcm("SET GRAD",arglist,1,ierr);
}
void TMinuitMinimizer::Fcn( int &, double * , double & f, double * x , int ) {
f = fgFunc->operator()(x);
}
void TMinuitMinimizer::FcnGrad( int &, double * g, double & f, double * x , int iflag ) {
ROOT::Math::IMultiGradFunction * gFunc = dynamic_cast<ROOT::Math::IMultiGradFunction *> ( fgFunc);
assert(gFunc != 0);
f = gFunc->operator()(x);
if (iflag == 2) gFunc->Gradient(x,g);
}
bool TMinuitMinimizer::SetVariable(unsigned int ivar, const std::string & name, double val, double step) {
if (!CheckMinuitInstance()) return false;
fUsed = fgUsed;
if (fUsed) DoClear();
DoReleaseFixParameter(ivar);
int iret = fMinuit->DefineParameter(ivar , name.c_str(), val, step, 0., 0. );
return (iret == 0);
}
bool TMinuitMinimizer::SetLimitedVariable(unsigned int ivar, const std::string & name, double val, double step, double lower, double upper) {
if (!CheckMinuitInstance()) return false;
fUsed = fgUsed;
if (fUsed) DoClear();
DoReleaseFixParameter(ivar);
int iret = fMinuit->DefineParameter(ivar, name.c_str(), val, step, lower, upper );
return (iret == 0);
}
bool TMinuitMinimizer::CheckMinuitInstance() const {
if (fMinuit == 0) {
Error("CheckMinuitInstance","Invalid TMinuit pointer. Need to call first SetFunction");
return false;
}
return true;
}
bool TMinuitMinimizer::CheckVarIndex(unsigned int ivar) const {
if ((int) ivar >= fMinuit->fNu ) {
Error("CheckVarIndex","Invalid parameter index");
return false;
}
return true;
}
bool TMinuitMinimizer::SetLowerLimitedVariable(unsigned int ivar , const std::string & name , double val , double step , double lower ) {
Warning("TMinuitMinimizer::SetLowerLimitedVariable","not implemented - use as upper limit 1.E7 instead of +inf");
return SetLimitedVariable(ivar, name, val , step, lower, lower+ 1.E7);
}
bool TMinuitMinimizer::SetUpperLimitedVariable(unsigned int ivar , const std::string & name , double val , double step , double upper ) {
Warning("TMinuitMinimizer::SetUpperLimitedVariable","not implemented - use as lower limit -1.E7 instead of -inf");
return SetLimitedVariable(ivar, name, val , step, upper -1.E7, upper);
}
bool TMinuitMinimizer::SetFixedVariable(unsigned int ivar, const std::string & name, double val) {
if (!CheckMinuitInstance()) return false;
fUsed = fgUsed;
if (fUsed) DoClear();
double step = ( val != 0) ? 0.1 * std::abs(val) : 0.1;
int iret = fMinuit->DefineParameter(ivar, name.c_str(), val, step, 0., 0. );
if (iret == 0) iret = fMinuit->FixParameter(ivar);
return (iret == 0);
}
bool TMinuitMinimizer::SetVariableValue(unsigned int ivar, double val) {
if (!CheckMinuitInstance()) return false;
double arglist[2];
int ierr = 0;
arglist[0] = ivar+1;
arglist[1] = val;
fMinuit->mnexcm("SET PAR",arglist,2,ierr);
return (ierr==0);
}
bool TMinuitMinimizer::SetVariableStepSize(unsigned int ivar, double step) {
if (!CheckMinuitInstance()) return false;
double curval,err, lowlim, uplim;
int iuint;
TString name;
fMinuit->mnpout(ivar, name, curval, err, lowlim, uplim,iuint);
if (iuint == -1) return false;
int iret = fMinuit->DefineParameter(ivar, name, curval, step, lowlim, uplim );
return (iret == 0);
}
bool TMinuitMinimizer::SetVariableLowerLimit(unsigned int , double ) {
Error("SetVariableLowerLimit","not implemented - use SetVariableLimits");
return false;
}
bool TMinuitMinimizer::SetVariableUpperLimit(unsigned int , double ) {
Error("SetVariableUpperLimit","not implemented - use SetVariableLimits");
return false;
}
bool TMinuitMinimizer::SetVariableLimits(unsigned int ivar, double lower, double upper) {
if (!CheckMinuitInstance()) return false;
double curval,err, lowlim, uplim;
int iuint;
TString name;
fMinuit->mnpout(ivar, name, curval, err, lowlim, uplim,iuint);
if (iuint == -1) return false;
int iret = fMinuit->DefineParameter(ivar, name, curval, err, lower, upper );
return (iret == 0);
}
bool TMinuitMinimizer::FixVariable(unsigned int ivar) {
if (!CheckMinuitInstance()) return false;
if (!CheckVarIndex(ivar)) return false;
int iret = fMinuit->FixParameter(ivar);
return (iret == 0);
}
bool TMinuitMinimizer::ReleaseVariable(unsigned int ivar) {
if (!CheckMinuitInstance()) return false;
if (!CheckVarIndex(ivar)) return false;
int iret = fMinuit->Release(ivar);
return (iret == 0);
}
bool TMinuitMinimizer::IsFixedVariable(unsigned int ivar) const {
if (!CheckMinuitInstance()) return false;
if (!CheckVarIndex(ivar)) return false;
return (fMinuit->fNiofex[ivar] == 0 );
}
bool TMinuitMinimizer::GetVariableSettings(unsigned int ivar, ROOT::Fit::ParameterSettings & var) const {
if (!CheckMinuitInstance()) return false;
if (!CheckVarIndex(ivar)) return false;
double curval,err, lowlim, uplim;
int iuint;
TString name;
fMinuit->mnpout(ivar, name, curval, err, lowlim, uplim,iuint);
if (iuint == -1) return false;
var.Set(name.Data(), curval, err, lowlim, uplim);
if (IsFixedVariable(ivar)) var.Fix();
return true;
}
std::string TMinuitMinimizer::VariableName(unsigned int ivar) const {
if (!CheckMinuitInstance()) return std::string();
if (!CheckVarIndex(ivar)) return std::string();
return std::string(fMinuit->fCpnam[ivar]);
}
int TMinuitMinimizer::VariableIndex(const std::string & ) const {
Error("TMinuitMinimizer::VariableIndex"," find index of a variable from its name is not implemented in TMinuit");
return -1;
}
bool TMinuitMinimizer::Minimize() {
if (fMinuit == 0) {
Error("TMinuitMinimizer::Minimize","invalid TMinuit pointer. Need to call first SetFunction and SetVariable");
return false;
}
if (fMinuit->fNu < static_cast<int>(fDim) ) {
Error("TMinuitMinimizer::Minimize","The total number of defined parameters is different than the function dimension, npar = %d, dim = %d",fMinuit->fNu, fDim);
return false;
}
int printlevel = PrintLevel();
if (fMinuit->fNpar <= 0) {
RetrieveParams();
fMinuit->fAmin = (*fgFunc)(&fParams.front());
if (printlevel > 0) Info("TMinuitMinimizer::Minimize","There are no free parameter - just compute the function value");
return true;
}
double arglist[10];
int ierr = 0;
arglist[0] = ErrorDef();
fMinuit->mnexcm("SET Err",arglist,1,ierr);
arglist[0] = printlevel - 1;
fMinuit->mnexcm("SET PRINT",arglist,1,ierr);
if (printlevel == 0) fMinuit->mnexcm("SET NOW",arglist,0,ierr);
if (Precision() > 0) {
arglist[0] = Precision();
fMinuit->mnexcm("SET EPS",arglist,1,ierr);
}
int strategy = Strategy();
if (strategy >=0 && strategy <=2 ) {
arglist[0] = strategy;
fMinuit->mnexcm("SET STR",arglist,1,ierr);
}
arglist[0] = MaxFunctionCalls();
arglist[1] = Tolerance();
int nargs = 2;
switch (fType){
case ROOT::Minuit::kMigrad:
fMinuit->mnexcm("MIGRAD",arglist,nargs,ierr);
break;
case ROOT::Minuit::kCombined:
fMinuit->mnexcm("MINIMIZE",arglist,nargs,ierr);
break;
case ROOT::Minuit::kSimplex:
fMinuit->mnexcm("SIMPLEX",arglist,nargs,ierr);
break;
case ROOT::Minuit::kScan:
nargs = 0;
fMinuit->mnexcm("SCAN",arglist,nargs,ierr);
break;
case ROOT::Minuit::kSeek:
nargs = 1;
if (arglist[1] >= 1.) nargs = 2;
fMinuit->mnexcm("SEEK",arglist,nargs,ierr);
break;
default:
fMinuit->mnexcm("MIGRAD",arglist,nargs,ierr);
}
fgUsed = true;
fUsed = true;
fStatus = ierr;
int minErrStatus = ierr;
if (printlevel>2) Info("TMinuitMinimizer::Minimize","Finished to run MIGRAD - status %d",ierr);
if (ierr == 0 && fType == ROOT::Minuit::kMigradImproved) {
fMinuit->mnexcm("IMPROVE",arglist,1,ierr);
fStatus += 1000*ierr;
if (printlevel>2) Info("TMinuitMinimizer::Minimize","Finished to run IMPROVE - status %d",ierr);
}
if (minErrStatus == 0 && (IsValidError() || ( strategy >=1 && CovMatrixStatus() < 3) ) ) {
fMinuit->mnexcm("HESSE",arglist,1,ierr);
fStatus += 100*ierr;
if (printlevel>2) Info("TMinuitMinimizer::Minimize","Finished to run HESSE - status %d",ierr);
}
RetrieveParams();
if (minErrStatus == 0) {
RetrieveErrorMatrix();
fMinosRun = false;
return true;
}
return false;
}
void TMinuitMinimizer::RetrieveParams() {
assert(fMinuit != 0);
if (fParams.size() != fDim) fParams.resize( fDim);
if (fErrors.size() != fDim) fErrors.resize( fDim);
for (unsigned int i = 0; i < fDim; ++i) {
fMinuit->GetParameter( i, fParams[i], fErrors[i]);
}
}
void TMinuitMinimizer::RetrieveErrorMatrix() {
assert(fMinuit != 0);
unsigned int nfree = NFree();
unsigned int ndim2 = fDim*fDim;
if (fCovar.size() != ndim2 ) fCovar.resize(fDim*fDim);
if (nfree >= fDim) {
fMinuit->mnemat(&fCovar.front(), fDim);
}
else {
std::vector<double> tmpMat(nfree*nfree);
fMinuit->mnemat(&tmpMat.front(), nfree);
unsigned int l = 0;
for (unsigned int i = 0; i < fDim; ++i) {
if ( fMinuit->fNiofex[i] > 0 ) {
unsigned int m = 0;
for (unsigned int j = 0; j <= i; ++j) {
if ( fMinuit->fNiofex[j] > 0 ) {
fCovar[i*fDim + j] = tmpMat[l*nfree + m];
fCovar[j*fDim + i] = fCovar[i*fDim + j];
m++;
}
}
l++;
}
}
}
}
unsigned int TMinuitMinimizer::NCalls() const {
if (fMinuit == 0) return 0;
return fMinuit->fNfcn;
}
double TMinuitMinimizer::MinValue() const {
if (!fMinuit) return 0;
double minval = fMinuit->fAmin;
if (minval == fMinuit->fUndefi) return 0;
return minval;
}
double TMinuitMinimizer::Edm() const {
if (!fMinuit) return -1;
if (fMinuit->fAmin == fMinuit->fUndefi || fMinuit->fEDM == fMinuit->fBigedm) return fMinuit->fUp;
return fMinuit->fEDM;
}
unsigned int TMinuitMinimizer::NFree() const {
if (!fMinuit) return 0;
if (fMinuit->fNpar < 0) return 0;
return fMinuit->fNpar;
}
bool TMinuitMinimizer::GetCovMatrix(double * cov) const {
int covStatus = CovMatrixStatus();
if ( fCovar.size() != fDim*fDim || covStatus < 2) {
Error("TMinuitMinimizer::GetHessianMatrix","Hessian matrix has not been computed - status %d",covStatus);
return false;
}
std::copy(fCovar.begin(), fCovar.end(), cov);
TMatrixDSym cmat(fDim,cov);
return true;
}
bool TMinuitMinimizer::GetHessianMatrix(double * hes) const {
int covStatus = CovMatrixStatus();
if ( fCovar.size() != fDim*fDim || covStatus < 2) {
Error("TMinuitMinimizer::GetHessianMatrix","Hessian matrix has not been computed - status %d",covStatus);
return false;
}
unsigned int nfree = NFree();
TMatrixDSym mat(nfree);
fMinuit->mnemat(mat.GetMatrixArray(), nfree);
mat.Invert();
unsigned int l = 0;
for (unsigned int i = 0; i < fDim; ++i) {
if ( fMinuit->fNiofex[i] > 0 ) {
unsigned int m = 0;
for (unsigned int j = 0; j <= i; ++j) {
if ( fMinuit->fNiofex[j] > 0 ) {
hes[i*fDim + j] = mat(l,m);
hes[j*fDim + i] = hes[i*fDim + j];
m++;
}
}
l++;
}
}
return true;
}
int TMinuitMinimizer::CovMatrixStatus() const {
if (!fMinuit) return 0;
if (fMinuit->fAmin == fMinuit->fUndefi) return 0;
return fMinuit->fISW[1];
}
double TMinuitMinimizer::GlobalCC(unsigned int i) const {
if (!fMinuit) return 0;
if (!fMinuit->fGlobcc) return 0;
if (int(i) >= fMinuit->fNu) return 0;
int iin = fMinuit->fNiofex[i];
if (iin < 1) return 0;
return fMinuit->fGlobcc[iin-1];
}
bool TMinuitMinimizer::GetMinosError(unsigned int i, double & errLow, double & errUp, int ) {
if (fMinuit == 0) {
Error("TMinuitMinimizer::GetMinosError","invalid TMinuit pointer. Need to call first SetFunction and SetVariable");
return false;
}
if (fMinuit->fNiofex[i] == 0 ) {
if (PrintLevel() > 0) Info("TMinuitMinimizer::GetMinosError","Parameter %s is fixed. There are no Minos error to calculate. Ignored.",VariableName(i).c_str());
errLow = 0; errUp = 0;
return true;
}
double arglist[2];
int ierr = 0;
if (fMinuit->fUp != ErrorDef() ) {
arglist[0] = ErrorDef();
fMinuit->mnexcm("SET Err",arglist,1,ierr);
}
if (fMinuit->fISW[4] != (PrintLevel()-1) ) {
arglist[0] = PrintLevel()-1;
fMinuit->mnexcm("SET PRINT",arglist,1,ierr);
if (PrintLevel() == 0) fMinuit->mnexcm("SET NOW",arglist,0,ierr);
}
if (fMinuit->fIstrat != Strategy() ) {
arglist[0] = Strategy();
fMinuit->mnexcm("SET STR",arglist,1,ierr);
}
if (Precision() > 0 && fMinuit->fEpsma2 != Precision() ) {
arglist[0] = Precision();
fMinuit->mnexcm("SET EPS",arglist,1,ierr);
}
arglist[0] = MaxFunctionCalls();
arglist[1] = i+1;
int nargs = 2;
fMinuit->mnexcm("MINOS",arglist,nargs,ierr);
bool isValid = (ierr == 0);
if (isValid && fMinuit->fCstatu != "SUCCESSFUL") {
if (fMinuit->fCstatu == "FAILURE" ) {
ierr = 5;
isValid = false;
}
if (fMinuit->fCstatu == "PROBLEMS") ierr = 6;
ierr = 7;
}
fStatus += 10*ierr;
fMinosRun = true;
double errParab = 0;
double gcor = 0;
fMinuit->mnerrs(i,errUp,errLow, errParab, gcor);
return isValid;
}
void TMinuitMinimizer::DoClear() {
fMinuit->mncler();
double val = 3;
int inseed = 12345;
fMinuit->mnrn15(val,inseed);
fUsed = false;
fgUsed = false;
}
void TMinuitMinimizer::DoReleaseFixParameter(int ivar) {
if (fMinuit == 0) return;
if (fMinuit->GetNumFixedPars() == 0) return;
if (int(ivar) >= fMinuit->GetNumPars() ) return;
for (int i = 0; i < fMinuit->fNpfix; ++i) {
if (fMinuit->fIpfix[i] == ivar+1 ) {
fMinuit->Release(ivar);
return;
}
}
}
void TMinuitMinimizer::PrintResults() {
if (fMinuit == 0) return;
if (PrintLevel() > 2)
fMinuit->mnprin(4,fMinuit->fAmin);
else
fMinuit->mnprin(3,fMinuit->fAmin);
}
void TMinuitMinimizer::SuppressMinuitWarnings(bool nowarn) {
double arglist = 0;
int ierr = 0;
if (nowarn)
fMinuit->mnexcm("SET NOW",&arglist,0,ierr);
else
fMinuit->mnexcm("SET WAR",&arglist,0,ierr);
}
bool TMinuitMinimizer::Contour(unsigned int ipar, unsigned int jpar, unsigned int &npoints, double * x, double * y) {
if (fMinuit == 0) {
Error("TMinuitMinimizer::Contour"," invalid TMinuit instance");
return false;
}
double arglist[1];
int ierr = 0;
arglist[0] = ErrorDef();
fMinuit->mnexcm("SET Err",arglist,1,ierr);
arglist[0] = PrintLevel()-1;
fMinuit->mnexcm("SET PRINT",arglist,1,ierr);
if (PrintLevel() == 0) fMinuit->mnexcm("SET NOW",arglist,0,ierr);
if (Precision() > 0) {
arglist[0] = Precision();
fMinuit->mnexcm("SET EPS",arglist,1,ierr);
}
if (npoints < 4) {
Error("TMinuitMinimizer::Contour","Cannot make contour with so few points");
return false;
}
int npfound = 0;
fMinuit->mncont( ipar,jpar,npoints, x, y,npfound);
if (npfound<4) {
Error("TMinuitMinimizer::Contour","Cannot find more than 4 points");
return false;
}
if (npfound!=(int)npoints) {
Warning("TMinuitMinimizer::Contour","Returning only %d points ",npfound);
npoints = npfound;
}
return true;
}
bool TMinuitMinimizer::Scan(unsigned int ipar, unsigned int & nstep, double * x, double * y, double xmin, double xmax) {
if (fMinuit == 0) {
Error("TMinuitMinimizer::Scan"," invalid TMinuit instance");
return false;
}
if (xmin >= xmax && (int) ipar < fMinuit->GetNumPars() ) {
double val = 0; double err = 0;
TString name;
double xlow = 0; double xup = 0 ;
int iuint = 0;
fMinuit->mnpout( ipar, name, val, err, xlow, xup, iuint);
if (iuint > 0 && err > 0) {
xmin = val - 2.*err;
xmax = val + 2 * err;
}
}
double arglist[4];
int ierr = 0;
arglist[0] = PrintLevel()-1;
fMinuit->mnexcm("SET PRINT",arglist,1,ierr);
if (PrintLevel() == 0) fMinuit->mnexcm("SET NOW",arglist,0,ierr);
if (Precision() > 0) {
arglist[0] = Precision();
fMinuit->mnexcm("SET EPS",arglist,1,ierr);
}
if (nstep == 0) return false;
arglist[0] = ipar+1;
arglist[1] = nstep+2;
int nargs = 2;
if (xmax > xmin ) {
arglist[2] = xmin;
arglist[3] = xmax;
nargs = 4;
}
fMinuit->mnexcm("SCAN",arglist,nargs,ierr);
if (ierr) {
Error("TMinuitMinimizer::Scan"," Error executing command SCAN");
return false;
}
TGraph * gr = dynamic_cast<TGraph *>(fMinuit->GetPlot() );
if (!gr) {
Error("TMinuitMinimizer::Scan"," Error in returned graph object");
return false;
}
nstep = std::min(gr->GetN(), (int) nstep);
std::copy(gr->GetX(), gr->GetX()+nstep, x);
std::copy(gr->GetY(), gr->GetY()+nstep, y);
nstep = gr->GetN();
return true;
}
bool TMinuitMinimizer::Hesse() {
if (fMinuit == 0) {
Error("TMinuitMinimizer::Hesse","invalid TMinuit pointer. Need to call first SetFunction and SetVariable");
return false;
}
double arglist[10];
int ierr = 0;
arglist[0] = ErrorDef();
fMinuit->mnexcm("SET ERR",arglist,1,ierr);
int printlevel = PrintLevel();
arglist[0] = printlevel - 1;
fMinuit->mnexcm("SET PRINT",arglist,1,ierr);
if (printlevel == 0) fMinuit->mnexcm("SET NOW",arglist,0,ierr);
if (Precision() > 0) {
arglist[0] = Precision();
fMinuit->mnexcm("SET EPS",arglist,1,ierr);
}
arglist[0] = MaxFunctionCalls();
fMinuit->mnexcm("HESSE",arglist,1,ierr);
fStatus += 100*ierr;
if (ierr != 0) return false;
RetrieveParams();
RetrieveErrorMatrix();
return true;
}
TMinuitMinimizer.cxx:1000 TMinuitMinimizer.cxx:1001 TMinuitMinimizer.cxx:1002 TMinuitMinimizer.cxx:1003 TMinuitMinimizer.cxx:1004 TMinuitMinimizer.cxx:1005 TMinuitMinimizer.cxx:1006 TMinuitMinimizer.cxx:1007 TMinuitMinimizer.cxx:1008 TMinuitMinimizer.cxx:1009 TMinuitMinimizer.cxx:1010 TMinuitMinimizer.cxx:1011 TMinuitMinimizer.cxx:1012 TMinuitMinimizer.cxx:1013 TMinuitMinimizer.cxx:1014 TMinuitMinimizer.cxx:1015 TMinuitMinimizer.cxx:1016 TMinuitMinimizer.cxx:1017 TMinuitMinimizer.cxx:1018 TMinuitMinimizer.cxx:1019 TMinuitMinimizer.cxx:1020 TMinuitMinimizer.cxx:1021 TMinuitMinimizer.cxx:1022 TMinuitMinimizer.cxx:1023 TMinuitMinimizer.cxx:1024 TMinuitMinimizer.cxx:1025 TMinuitMinimizer.cxx:1026 TMinuitMinimizer.cxx:1027 TMinuitMinimizer.cxx:1028 TMinuitMinimizer.cxx:1029 TMinuitMinimizer.cxx:1030 TMinuitMinimizer.cxx:1031 TMinuitMinimizer.cxx:1032 TMinuitMinimizer.cxx:1033 TMinuitMinimizer.cxx:1034 TMinuitMinimizer.cxx:1035 TMinuitMinimizer.cxx:1036 TMinuitMinimizer.cxx:1037 TMinuitMinimizer.cxx:1038 TMinuitMinimizer.cxx:1039 TMinuitMinimizer.cxx:1040 TMinuitMinimizer.cxx:1041 TMinuitMinimizer.cxx:1042 TMinuitMinimizer.cxx:1043 TMinuitMinimizer.cxx:1044 TMinuitMinimizer.cxx:1045 TMinuitMinimizer.cxx:1046 TMinuitMinimizer.cxx:1047 TMinuitMinimizer.cxx:1048 TMinuitMinimizer.cxx:1049 TMinuitMinimizer.cxx:1050 TMinuitMinimizer.cxx:1051 TMinuitMinimizer.cxx:1052 TMinuitMinimizer.cxx:1053 TMinuitMinimizer.cxx:1054 TMinuitMinimizer.cxx:1055 TMinuitMinimizer.cxx:1056 TMinuitMinimizer.cxx:1057 TMinuitMinimizer.cxx:1058 TMinuitMinimizer.cxx:1059 TMinuitMinimizer.cxx:1060