24 std::vector<double>
result;
26 unsigned int fPositionsSize =
fPositions.size();
28 for (
unsigned int i = 0; i < fPositionsSize; i++) {
30 const std::vector<double> ¤tPosition =
fPositions[i];
61 const double minDouble = 8.0 * std::numeric_limits<double>::min();
62 const double minDouble2 = std::sqrt(minDouble);
63 const double maxDouble2 = 1.0 / minDouble2;
67 std::vector<double> &grad =
Gradient();
69 int npar = par.size();
70 double logLikelihood = 0;
71 grad.assign(npar, 0.0);
72 h.assign(
static_cast<unsigned int>(0.5 * npar * (npar + 1)), 0.0);
76 for (
int i = 0; i < nmeas; ++i) {
79 const std::vector<double> ¤tPosition =
fPositions[i];
81 double fval = modelFunc(par);
84 logLikelihood -= std::log(fval);
85 double invFval = 1.0 / fval;
87 std::vector<double> mfg = modelFunc.
GetGradient(par);
91 for (
int j = 0; j < npar; ++j) {
92 if (std::fabs(mfg[j]) < minDouble) {
101 double dfj = invFval * mfg[j];
103 if (std::fabs(dfj) > maxDouble2) {
120 for (
int k = j; k < npar; ++k) {
121 int idx = j + k * (k + 1) / 2;
122 if (std::fabs(mfg[k]) < minDouble) {
129 double dfk = invFval * mfg[k];
132 if (std::fabs(dfk) > maxDouble2) {
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
std::vector< double > & Hessian()
virtual const std::vector< double > & Gradient() const
Return cached Value of function Gradient estimated previously using the FumiliFCNBase::EvaluateAll me...
void SetFCNValue(double value)
const ParametricFunction * ModelFunction() const
Returns the model function used for the data.
std::vector< std::vector< double > > fPositions
int GetNumberOfMeasurements() const override
Accessor to the number of measurements used for calculating the maximum likelihood.
void EvaluateAll(std::vector< double > const &par) override
Evaluate function Value, Gradient and Hessian using Fumili approximation, for values of parameters p ...
const std::vector< double > & GetMeasurement(int Index) const override
Accessor to the position of the measurement (x coordinate).
std::vector< double > Elements(std::vector< double > const &par) const override
Evaluates the model function for the different measurement points and the Parameter values supplied.
Function which has parameters.
virtual std::vector< double > GetGradient(std::vector< double > const &x) const
Member function returning the Gradient of the function with respect to its variables (but without inc...
virtual void SetParameters(std::vector< double > const ¶ms) const
Sets the parameters of the ParametricFunction.