File indexing completed on 2025-01-30 10:22:14
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef ROOT_Minuit2_VariableMetricBuilder
0011 #define ROOT_Minuit2_VariableMetricBuilder
0012
0013 #include "Minuit2/MnConfig.h"
0014 #include "Minuit2/MinimumBuilder.h"
0015 #include "Minuit2/VariableMetricEDMEstimator.h"
0016 #include "Minuit2/DavidonErrorUpdator.h"
0017 #include "Minuit2/BFGSErrorUpdator.h"
0018
0019 #include <vector>
0020 #include <memory>
0021
0022 namespace ROOT {
0023
0024 namespace Minuit2 {
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 class VariableMetricBuilder : public MinimumBuilder {
0035
0036 public:
0037 enum ErrorUpdatorType { kDavidon, kBFGS };
0038
0039 VariableMetricBuilder(ErrorUpdatorType type = kDavidon) : fEstimator(VariableMetricEDMEstimator())
0040 {
0041 if (type == kBFGS)
0042 fErrorUpdator = std::unique_ptr<MinimumErrorUpdator>(new BFGSErrorUpdator());
0043 else
0044 fErrorUpdator = std::unique_ptr<MinimumErrorUpdator>(new DavidonErrorUpdator());
0045 }
0046
0047 ~VariableMetricBuilder() override {}
0048
0049 FunctionMinimum Minimum(const MnFcn &, const GradientCalculator &, const MinimumSeed &, const MnStrategy &,
0050 unsigned int, double) const override;
0051
0052 FunctionMinimum Minimum(const MnFcn &, const GradientCalculator &, const MinimumSeed &, std::vector<MinimumState> &,
0053 unsigned int, double) const;
0054
0055 const VariableMetricEDMEstimator &Estimator() const { return fEstimator; }
0056 const MinimumErrorUpdator &ErrorUpdator() const { return *fErrorUpdator; }
0057
0058 void AddResult(std::vector<MinimumState> &result, const MinimumState &state) const;
0059
0060 private:
0061 VariableMetricEDMEstimator fEstimator;
0062 std::shared_ptr<MinimumErrorUpdator> fErrorUpdator;
0063 };
0064
0065 }
0066
0067 }
0068
0069 #endif