File indexing completed on 2025-01-30 10:22:12
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef ROOT_Minuit2_MinimumState
0011 #define ROOT_Minuit2_MinimumState
0012
0013 #include "Minuit2/MinimumParameters.h"
0014 #include "Minuit2/MinimumError.h"
0015 #include "Minuit2/FunctionGradient.h"
0016
0017 #include <memory>
0018
0019 namespace ROOT {
0020
0021 namespace Minuit2 {
0022
0023
0024
0025
0026
0027 class MinimumState {
0028
0029 public:
0030
0031 MinimumState(unsigned int n) : MinimumState(MinimumParameters(n, 0.0), MinimumError(n), FunctionGradient(n), 0.0, 0)
0032 {
0033 }
0034
0035
0036
0037 MinimumState(double fval, double edm, int nfcn)
0038 : MinimumState(MinimumParameters(0, fval), MinimumError(0), FunctionGradient(0), edm, nfcn)
0039 {
0040 }
0041
0042
0043
0044
0045 MinimumState(const MinimumParameters &states, double edm, int nfcn)
0046 : MinimumState(states, MinimumError(states.Vec().size()), FunctionGradient(states.Vec().size()), edm, nfcn)
0047 {
0048 }
0049
0050
0051 MinimumState(const MinimumParameters &states, const MinimumError &err, const FunctionGradient &grad, double edm,
0052 int nfcn)
0053 : fPtr{new Data{states, err, grad, edm, nfcn}}
0054 {
0055 }
0056
0057 const MinimumParameters &Parameters() const { return fPtr->fParameters; }
0058 const MnAlgebraicVector &Vec() const { return Parameters().Vec(); }
0059 int size() const { return Vec().size(); }
0060
0061 const MinimumError &Error() const { return fPtr->fError; }
0062 const FunctionGradient &Gradient() const { return fPtr->fGradient; }
0063 double Fval() const { return Parameters().Fval(); }
0064 double Edm() const { return fPtr->fEDM; }
0065 int NFcn() const { return fPtr->fNFcn; }
0066
0067 bool IsValid() const
0068 {
0069 if (HasParameters() && HasCovariance())
0070 return Parameters().IsValid() && Error().IsValid();
0071 else if (HasParameters())
0072 return Parameters().IsValid();
0073 else
0074 return false;
0075 }
0076
0077 bool HasParameters() const { return Parameters().IsValid(); }
0078 bool HasCovariance() const { return Error().IsAvailable(); }
0079
0080 private:
0081 struct Data {
0082 MinimumParameters fParameters;
0083 MinimumError fError;
0084 FunctionGradient fGradient;
0085 double fEDM;
0086 int fNFcn;
0087 };
0088
0089 std::shared_ptr<Data> fPtr;
0090 };
0091
0092 }
0093
0094 }
0095
0096 #endif