00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef ROOT_Minuit2_FCNAdapter
00011 #define ROOT_Minuit2_FCNAdapter
00012
00013 #ifndef ROOT_Minuit2_FCNBase
00014 #include "Minuit2/FCNBase.h"
00015 #endif
00016
00017 namespace ROOT {
00018
00019 namespace Minuit2 {
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 template< class Function>
00033 class FCNAdapter : public FCNBase {
00034
00035 public:
00036
00037 FCNAdapter(const Function & f, double up = 1.) :
00038 fFunc(f) ,
00039 fUp (up)
00040 {}
00041
00042 ~FCNAdapter() {}
00043
00044
00045 double operator()(const std::vector<double>& v) const {
00046 return fFunc.operator()(&v[0]);
00047 }
00048 double operator()(const double * v) const {
00049 return fFunc.operator()(v);
00050 }
00051 double Up() const {return fUp;}
00052
00053 void SetErrorDef(double up) { fUp = up; }
00054
00055
00056
00057
00058
00059
00060 private:
00061 const Function & fFunc;
00062 double fUp;
00063 };
00064
00065 }
00066
00067 }
00068
00069
00070
00071 #endif //ROOT_Minuit2_FCNAdapter