58 std::cout <<
"MnSeedGenerator: operator() - var par = " << n <<
" mnfcn pointer " << &fcn << std::endl;
66 double fcnmin =
fcn(x);
69 std::cout <<
"MnSeedGenerator: for initial parameters FCN = ";
78 for(
unsigned int i = 0; i <
n; i++)
79 for(
unsigned int j = i; j <
n; j++) mat(i,j) = st.
IntCovariance()(i,j);
82 for(
unsigned int i = 0; i <
n; i++)
83 mat(i,i) = (
fabs(dgrad.
G2()(i)) > prec.
Eps2() ? 1./dgrad.
G2()(i) : 1.);
97 std::cout <<
"MnSeedGenerator: Negative G2 Found: " << std::endl;
98 std::cout << x << std::endl;
99 std::cout << dgrad.
Grad() << std::endl;
100 std::cout << dgrad.
G2() << std::endl;
102 state = ng2ls(fcn, state, gc, prec);
114 std::cout <<
"MnSeedGenerator: calling MnHesse " << std::endl;
137 double fcnmin =
fcn(x);
148 std::pair<FunctionGradient, MnAlgebraicVector> hgrd = hgc.
DeltaGradient(pa, dgrad);
149 for(
unsigned int i = 0; i <
n; i++) {
150 if(
fabs(hgrd.first.Grad()(i) - grd.
Grad()(i)) > hgrd.second(i)) {
152 MN_INFO_MSG(
"MnSeedGenerator:gradient discrepancy of external Parameter too large");
154 const char * parameter_name = st.
Trafo().
Name(externalParameterIndex);
164 MN_ERROR_MSG(
"Minuit does not accept user specified Gradient. To force acceptance, override 'virtual bool CheckGradient() const' of FCNGradientBase.h in the derived class.");
173 for(
unsigned int i = 0; i <
n; i++)
174 for(
unsigned int j = i; j <
n; j++) mat(i,j) = st.
IntCovariance()(i,j);
177 for(
unsigned int i = 0; i <
n; i++)
178 mat(i,i) = (
fabs(dgrad.G2()(i)) > prec.
Eps2() ? 1./dgrad.G2()(i) : 1.);
185 if(ng2ls.HasNegativeG2(dgrad, prec)) {
187 state = ng2ls(fcn, state, ngc, prec);
#define MN_INFO_VAL2(loc, x)
#define MN_ERROR_MSG(str)
void fcn(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
unsigned int VariableParameters() const
static void PrintFcn(std::ostream &os, double value, bool endline=true)
MinimumSeed contains the starting values for the minimization produced by the SeedGenerator.
Class describing a symmetric matrix of size n.
virtual bool CheckGradient() const
determines the relative floating point arithmetic precision.
const MnUserTransformation & Trafo() const
std::pair< FunctionGradient, MnAlgebraicVector > DeltaGradient(const MinimumParameters &, const FunctionGradient &) const
bool HasCovariance() const
class performing the numerical gradient calculation
API class for calculating the numerical covariance matrix (== 2x Inverse Hessian == 2x Inverse 2nd de...
virtual MinimumSeed operator()(const MnFcn &, const GradientCalculator &, const MnUserParameterState &, const MnStrategy &) const
static void PrintState(std::ostream &os, const MinimumState &state, const char *msg, int iter=-1)
Wrapper class to FCNBase interface used internally by Minuit.
HessianGradientCalculator: class to calculate Gradient for Hessian.
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
double Eps2() const
eps2 returns 2*sqrt(eps)
class which holds the external user and/or internal Minuit representation of the parameters and error...
double Estimate(const FunctionGradient &, const MinimumError &) const
const MnMachinePrecision & Precision() const
const std::vector< double > & IntParameters() const
Class to calculate an initial estimate of the gradient.
unsigned int Strategy() const
bool HasNegativeG2(const FunctionGradient &, const MnMachinePrecision &) const
In case that one of the components of the second derivative g2 calculated by the numerical Gradient c...
const MnAlgebraicVector & Grad() const
MinimumError keeps the inv.
unsigned int NumOfCalls() const
MinimumState keeps the information (position, Gradient, 2nd deriv, etc) after one minimization step (...
const MnUserCovariance & IntCovariance() const
API class for defining three levels of strategies: low (0), medium (1), high (>=2); acts on: Migrad (...
const MnAlgebraicVector & G2() const
interface class for gradient calculators