FCNAdapter.h

Go to the documentation of this file.
00001 // @(#)root/minuit2:$Id$
00002 // Author: L. Moneta    10/2006  
00003 
00004 /**********************************************************************
00005  *                                                                    *
00006  * Copyright (c) 2006 ROOT Foundation,  CERN/PH-SFT                   *
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 template wrapped class for adapting to FCNBase signature
00025 
00026 @author Lorenzo Moneta
00027 
00028 @ingroup Minuit
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    //virtual std::vector<double> Gradient(const std::vector<double>&) const;
00056 
00057    // forward interface
00058    //virtual double operator()(int npar, double* params,int iflag = 4) const;
00059 
00060 private:
00061    const Function & fFunc; 
00062    double fUp; 
00063 };
00064 
00065    } // end namespace Minuit2
00066 
00067 } // end namespace ROOT
00068 
00069 
00070 
00071 #endif //ROOT_Minuit2_FCNAdapter

Generated on Tue Jul 5 14:25:41 2011 for ROOT_528-00b_version by  doxygen 1.5.1