#ifndef TMinuitMinimizer_hxx_seen #define TMinuitMinimizer_hxx_seen #include #include "IMinimizer.hxx" #include namespace COMET { class TMinuitMinimizer; }; /// A Concrete IMinimizer using a gradient minimization routine (see \ref /// minimization). This uses Minuit. The primary difference between this and /// the ISimplexMinimizer is that this uses the "MINIMIZE" option which /// requires the gradient. For a smooth function, this can do better than /// SIMPLEX, but if the function isn't smooth, it does much worse. See a /// reference book like "Numerical Recipes" for a detailed discussion of /// fitting methods. class COMET::TMinuitMinimizer : public COMET::IMinimizer, public TMinuit { public: using IMinimizer::GetParameter; using TMinuit::GetParameter; TMinuitMinimizer(IMinimizerFunc& func); virtual ~TMinuitMinimizer() { } /// Override TMinuit virtual member function to provide our /// own minimizing function. Int_t Eval(Int_t npar, Double_t *grad, Double_t &fval, Double_t *par, Int_t flag); /// Get the current estimated value of a parameter. virtual double GetParameter(int i) const; /// Get the i,j element of the covariance matrix virtual double GetCovariance(int i, int j) const; /// Get the current minimum value of the function. virtual double GetMinimum(void) const; /// Get the status of the last optimization. virtual int GetStatus(void) const; /// Set the precision for the minimum to be found. virtual void SetPrecision(double accuracy); /// Set the printing level of Minuit's output. virtual Int_t SetPrintLevel(int printLevel); protected: /// Minimize using Minuit. virtual int Minimize(int npar, double *par); private: /// The minimum value found by the last call to Minimize. double fMinimum; /// The status of the last call to Minimize. int fStatus; }; #endif