Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:22:11

0001 // @(#)root/minuit2:$Id$
0002 // Author: L. Moneta    10/2006
0003 
0004 /**********************************************************************
0005  *                                                                    *
0006  * Copyright (c) 2006 ROOT Foundation,  CERN/PH-SFT                   *
0007  *                                                                    *
0008  **********************************************************************/
0009 
0010 #ifndef ROOT_Minuit2_FCNAdapter
0011 #define ROOT_Minuit2_FCNAdapter
0012 
0013 #include "Minuit2/FCNBase.h"
0014 
0015 #include <vector>
0016 
0017 namespace ROOT {
0018 
0019 namespace Minuit2 {
0020 
0021 /**
0022 
0023 
0024 template wrapped class for adapting to FCNBase signature
0025 
0026 @author Lorenzo Moneta
0027 
0028 @ingroup Minuit
0029 
0030 */
0031 
0032 template <class Function>
0033 class FCNAdapter : public FCNBase {
0034 
0035 public:
0036    FCNAdapter(const Function &f, double up = 1.) : fFunc(f), fUp(up) {}
0037 
0038    ~FCNAdapter() override {}
0039 
0040    double operator()(const std::vector<double> &v) const override { return fFunc.operator()(&v[0]); }
0041    double operator()(const double *v) const { return fFunc.operator()(v); }
0042    double Up() const override { return fUp; }
0043 
0044    void SetErrorDef(double up) override { fUp = up; }
0045 
0046    // virtual std::vector<double> Gradient(const std::vector<double>&) const;
0047 
0048    // forward interface
0049    // virtual double operator()(int npar, double* params,int iflag = 4) const;
0050 
0051 private:
0052    const Function &fFunc;
0053    double fUp;
0054 };
0055 
0056 } // end namespace Minuit2
0057 
0058 } // end namespace ROOT
0059 
0060 #endif // ROOT_Minuit2_FCNAdapter