#ifndef ROOT_Fit_BasicFCN
#define ROOT_Fit_BasicFCN
#ifndef ROOT_Math_FitMethodFunction
#include "Math/FitMethodFunction.h"
#endif
#ifndef ROOT_Math_IParamFunction
#include "Math/IParamFunction.h"
#endif
#include <memory>
namespace ROOT {
namespace Fit {
template<class FunType, class DataType>
class BasicFCN : public ::ROOT::Math::BasicFitMethodFunction<FunType> {
protected:
typedef ::ROOT::Math::BasicFitMethodFunction<FunType> BaseObjFunction;
typedef typename BaseObjFunction::BaseFunction BaseFunction;
typedef ::ROOT::Math::IParamMultiFunction IModelFunction;
BasicFCN (const std::shared_ptr<DataType> & data, const std::shared_ptr<IModelFunction> & func) :
BaseObjFunction(func->NPar(), data->Size() ),
fData(data),
fFunc(func)
{ }
virtual ~BasicFCN () {}
public:
virtual const DataType & Data() const { return *fData; }
std::shared_ptr<DataType> DataPtr() const { return fData; }
virtual const IModelFunction & ModelFunction() const { return *fFunc; }
std::shared_ptr<IModelFunction> ModelFunctionPtr() const { return fFunc; }
protected:
void SetData(const std::shared_ptr<DataType> & data) { fData = data; }
void SetModelFunction(const std::shared_ptr<IModelFunction> & func) { fFunc = func; }
std::shared_ptr<DataType> fData;
std::shared_ptr<IModelFunction> fFunc;
};
}
}
#endif /* ROOT_Fit_BasicFCN */