MINT2
MintFcnGrad.h
Go to the documentation of this file.
1 #ifndef MINTFCNGRAD_HH
2 #define MINTFCNGRAD_HH
3 
4 #include "Minuit2/FCNGradientBase.h"
5 
6 #include "Mint/IMinimisable.h"
7 
8 namespace MINT
9 {
10  class MintFcnGrad : public ROOT::Minuit2::FCNGradientBase
11  {
12  public:
16  MintFcnGrad( IMinimisable* theFunction )
17  :_theFunction(theFunction)
18  {}
19 
23  virtual double operator()( const std::vector<double>& par ) const
24  {
25  for( unsigned int i=0; i<par.size(); ++i )
28 
29  const double negll = _theFunction->getVal()-_best_min;
30 
31  std::cout << std::setprecision(std::numeric_limits<double>::digits10);
32  std::cout << "-2logL = " << negll << std::endl;
33 
34  return negll;
35  }
36 
40  virtual std::vector<double> Gradient( const std::vector<double>& par )
41  const
42  { return _theFunction->Gradient(par); }
43 
48  void SetBestMin( const double& best_min )
49  { _best_min += best_min; }
50 
51  private:
55  virtual double Up() const
56  { return _error_def; }
57 
59 
60  const double _error_def = 1.0;
61 
62  double _best_min = 0.0;
63  };
64 } //namespace MINT
65 
66 #endif //MINTFCNGRAD_HH
void SetBestMin(const double &best_min)
Definition: MintFcnGrad.h:48
MintFcnGrad(IMinimisable *theFunction)
Definition: MintFcnGrad.h:16
IMinuitParameter * getParPtr(unsigned int i)
virtual void Gradient(std::vector< double > &grad)
Definition: IMinimisable.h:24
virtual double Up() const
Definition: MintFcnGrad.h:55
virtual double operator()(const std::vector< double > &par) const
Definition: MintFcnGrad.h:23
virtual std::vector< double > Gradient(const std::vector< double > &par) const
Definition: MintFcnGrad.h:40
virtual double getVal()=0
virtual MinuitParameterSet * getParSet()=0
virtual void parametersChanged()=0
IMinimisable * _theFunction
Definition: MintFcnGrad.h:58
virtual void setCurrentFitVal(double pval)=0
const double _error_def
Definition: MintFcnGrad.h:60