mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2025-04-11 03:20:46 +01:00
Minuit precsion fix
This commit is contained in:
parent
0bd347d010
commit
1f7dba7779
@ -58,9 +58,10 @@ const DVec & MinuitMinimizer::operator()(const DoubleFunction &f)
|
|||||||
using namespace ROOT;
|
using namespace ROOT;
|
||||||
using namespace Minuit2;
|
using namespace Minuit2;
|
||||||
|
|
||||||
DVec &x = getState();
|
DVec &x = getState();
|
||||||
int printLevel = 0;
|
int printLevel = 0;
|
||||||
EMinimizerType minuitAlg = kCombined;
|
EMinimizerType minuitAlg = kCombined;
|
||||||
|
double prec = getPrecision();
|
||||||
|
|
||||||
// convert Latan parameters to Minuit parameters
|
// convert Latan parameters to Minuit parameters
|
||||||
switch (getVerbosity())
|
switch (getVerbosity())
|
||||||
@ -75,16 +76,21 @@ const DVec & MinuitMinimizer::operator()(const DoubleFunction &f)
|
|||||||
printLevel = 3;
|
printLevel = 3;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// The factor of 0.002 here is to compensate the dirty hack in Minuit
|
||||||
|
// source used to match the C++ and F77 versions
|
||||||
|
// (cf. VariableMetricBuilder.cxx)
|
||||||
switch (getAlgorithm())
|
switch (getAlgorithm())
|
||||||
{
|
{
|
||||||
case Algorithm::migrad:
|
case Algorithm::migrad:
|
||||||
minuitAlg = kMigrad;
|
minuitAlg = kMigrad;
|
||||||
|
prec /= 0.002;
|
||||||
break;
|
break;
|
||||||
case Algorithm::simplex:
|
case Algorithm::simplex:
|
||||||
minuitAlg = kSimplex;
|
minuitAlg = kSimplex;
|
||||||
break;
|
break;
|
||||||
case Algorithm::combined:
|
case Algorithm::combined:
|
||||||
minuitAlg = kCombined;
|
minuitAlg = kCombined;
|
||||||
|
prec /= 0.002;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,7 +105,7 @@ const DVec & MinuitMinimizer::operator()(const DoubleFunction &f)
|
|||||||
|
|
||||||
min.SetStrategy(2);
|
min.SetStrategy(2);
|
||||||
min.SetMaxFunctionCalls(getMaxIteration());
|
min.SetMaxFunctionCalls(getMaxIteration());
|
||||||
min.SetTolerance(getPrecision());
|
min.SetTolerance(prec);
|
||||||
min.SetPrintLevel(printLevel);
|
min.SetPrintLevel(printLevel);
|
||||||
|
|
||||||
// set function and variables
|
// set function and variables
|
||||||
@ -146,7 +152,7 @@ const DVec & MinuitMinimizer::operator()(const DoubleFunction &f)
|
|||||||
min.Minimize();
|
min.Minimize();
|
||||||
status = min.Status();
|
status = min.Status();
|
||||||
n++;
|
n++;
|
||||||
} while (status and (n < getMaxPass()));
|
} while ((status >= 2) and (n < getMaxPass()));
|
||||||
if (getVerbosity() >= Verbosity::Normal)
|
if (getVerbosity() >= Verbosity::Normal)
|
||||||
{
|
{
|
||||||
cout << "=================================================" << endl;
|
cout << "=================================================" << endl;
|
||||||
@ -154,7 +160,8 @@ const DVec & MinuitMinimizer::operator()(const DoubleFunction &f)
|
|||||||
switch (status)
|
switch (status)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
LATAN_WARNING("invalid minimum: covariance matrix was made positive");
|
// covariance matrix was made positive, the minimum is still good
|
||||||
|
// it just means that Minuit error analysis is inaccurate
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
LATAN_WARNING("invalid minimum: Hesse analysis is not valid");
|
LATAN_WARNING("invalid minimum: Hesse analysis is not valid");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user