37 const MnStrategy &strategy,
unsigned int maxfcn,
double edmval)
const
47 print.
Debug(
"Convergence when edm <", edmval);
59 print.
Warn(
"Initial matrix not pos.def.");
63 std::vector<MinimumState> result;
67 result.push_back(seed.
State());
78 int maxfcn_eff =
int(0.5 * maxfcn);
84 min =
Minimum(fcn, gc, seed, result, maxfcn_eff, edmval);
90 print.
Warn(
"FunctionMinimum is invalid");
97 edm = result.back().
Edm();
99 print.
Debug(
"Approximate Edm", edm,
"npass", ipass);
103 print.
Debug(
"FumiliBuilder will verify convergence and Error matrix; "
114 result.push_back(st);
116 print.
Info(
"After Hessian");
123 print.
Debug(
"Edm", edm,
"State", st);
126 if (ipass > 0 && edm >= edmprev) {
127 print.
Warn(
"Stop iterations, no improvements after Hesse; current Edm", edm,
"previous value", edmprev);
131 print.
Debug(
"Tolerance not sufficient, continue minimization; Edm", edm,
"Requested", edmval);
152 }
while (edm > edmval);
155 min.
Add(result.back());
161 std::vector<MinimumState> &result,
unsigned int maxfcn,
double edmval)
const
198 double edm = initialState.
Edm();
200 MnPrint print(
"FumiliBuilder");
202 print.
Debug(
"Initial State:",
"\n Parameter", initialState.
Vec(),
"\n Gradient", initialState.
Gradient().
Vec(),
203 "\n Inv Hessian", initialState.
Error().
InvHessian(),
"\n edm", initialState.
Edm(),
"\n maxfcn",
204 maxfcn,
"\n tolerance", edmval);
211 double lambda = 0.001;
218 step = -1. *
s0.Error().InvHessian() *
s0.Gradient().Vec();
220 print.
Debug(
"Iteration -", result.size(),
"\n Fval",
s0.Fval(),
"numOfCall", fcn.
NumOfCalls(),
221 "\n Internal Parameter values",
s0.Vec(),
"\n Newton step", step);
225 print.
Warn(
"Matrix not pos.def, gdel =", gdel,
" > 0");
229 step = -1. *
s0.Error().InvHessian() *
s0.Gradient().Vec();
232 print.
Warn(
"After correction, gdel =", gdel);
235 result.push_back(
s0);
257 if (p.
Fval() >=
s0.Fval()) {
261 if (std::fabs(pp.
Y() -
s0.Fval()) < prec.
Eps()) {
282 print.
Debug(
"Updated new point:",
"\n FVAL ", p.
Fval(),
"\n Parameter", p.
Vec(),
"\n Gradient",
g.Vec(),
283 "\n InvHessian",
e.Matrix(),
"\n Hessian",
e.Hessian(),
"\n Edm", edm);
286 print.
Warn(
"Matrix not pos.def., Edm < 0");
292 result.push_back(
s0);
310 print.
Debug(
"finish iteration -", result.size(),
"lambda =", lambda,
"f1 =", p.
Fval(),
"f0 =",
s0.Fval(),
311 "num of calls =", fcn.
NumOfCalls(),
"edm =", edm);
319 edm *= (1. + 3. *
e.Dcovar());
321 }
while (edm > edmval && fcn.
NumOfCalls() < maxfcn);
324 print.
Warn(
"Call limit exceeded");
330 if (edm < std::fabs(prec.
Eps2() * result.back().Fval())) {
331 print.
Warn(
"Machine accuracy limits further improvement");
334 }
else if (edm < 10 * edmval) {
338 print.
Warn(
"No convergence; Edm", edm,
"is above tolerance", 10 * edmval);
345 print.
Debug(
"Exiting successfully",
"Ncalls", fcn.
NumOfCalls(),
"FCN", result.back().Fval(),
"Edm", edm,
"Requested",
virtual FunctionMinimum Minimum(const MnFcn &fMnFcn, const GradientCalculator &fGradienCalculator, const MinimumSeed &fMinimumSeed, const MnStrategy &fMnStrategy, unsigned int maxfcn, double edmval) const
Class the member function calculating the Minimum and verifies the result depending on the strategy.
const FumiliErrorUpdator & ErrorUpdator() const
Accessor to the Error updator of the builder.
const VariableMetricEDMEstimator & Estimator() const
Accessor to the EDM (expected vertical distance to the Minimum) estimator.
virtual MinimumError Update(const MinimumState &fMinimumState, const MinimumParameters &fMinimumParameters, const GradientCalculator &fGradientCalculator, double lambda) const
Member function that calculates the Error matrix (or the Hessian matrix containing the (approximate) ...
const MnAlgebraicVector & Vec() const
class holding the full result of the minimization; both internal and external (MnUserParameterState) ...
void Add(const MinimumState &state)
const std::vector< ROOT::Minuit2::MinimumState > & States() const
const MinimumError & Error() const
const MinimumState & State() const
bool IsAboveMaxEdm() const
const MinimumSeed & Seed() const
interface class for gradient calculators
unsigned int size() const
void TraceIteration(int iter, const MinimumState &state) const
MinimumError keeps the inv.
const MnAlgebraicSymMatrix & InvHessian() const
const MnAlgebraicVector & Vec() const
MinimumSeed contains the starting values for the minimization produced by the SeedGenerator.
const MnUserTransformation & Trafo() const
const MinimumParameters & Parameters() const
const MnMachinePrecision & Precision() const
const MinimumState & State() const
MinimumState keeps the information (position, Gradient, 2nd deriv, etc) after one minimization step (...
const MinimumError & Error() const
const MnAlgebraicVector & Vec() const
const FunctionGradient & Gradient() const
Wrapper class to FCNBase interface used internally by Minuit.
unsigned int NumOfCalls() const
API class for calculating the numerical covariance matrix (== 2x Inverse Hessian == 2x Inverse 2nd de...
Implements a 1-dimensional minimization along a given direction (i.e.
Sets the relative floating point (double) arithmetic precision.
double Eps() const
eps returns the smallest possible number so that 1.+eps > 1.
double Eps2() const
eps2 returns 2*sqrt(eps)
double Y() const
Accessor to the y (second) coordinate.
double X() const
Accessor to the x (first) coordinate.
Force the covariance matrix to be positive defined by adding extra terms in the diagonal.
void Debug(const Ts &... args)
void Info(const Ts &... args)
void Warn(const Ts &... args)
API class for defining three levels of strategies: low (0), medium (1), high (>=2); acts on: Migrad (...
double Estimate(const FunctionGradient &, const MinimumError &) const
double inner_product(const LAVector &, const LAVector &)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...