// @(#)root/mathcore:$Id$ // Author: L. Moneta 25 Nov 2014 /********************************************************************** * * * Copyright (c) 2006 LCG ROOT Math Team, CERN/PH-SFT * * * * * **********************************************************************/ // Header file for class BasicFCN #ifndef ROOT_Fit_BasicFCN #define ROOT_Fit_BasicFCN #include "Math/FitMethodFunction.h" #include "Math/IParamFunction.h" #include "Math/IParamFunctionfwd.h" #include namespace ROOT { namespace Fit { //___________________________________________________________________________________ /** BasicFCN class: base class for the objective functions used in the fits It has a reference to the data and th emodel function used in the fit. It cannot be instantiated but constructed from the derived classes */ template class BasicFCN : public ::ROOT::Math::BasicFitMethodFunction { protected: typedef typename ModelFunType::BackendType T; typedef ::ROOT::Math::BasicFitMethodFunction BaseObjFunction; typedef typename BaseObjFunction::BaseFunction BaseFunction; typedef ::ROOT::Math::IParamMultiFunctionTempl IModelFunction; /** Constructor from data set and model function */ BasicFCN (const std::shared_ptr & data, const std::shared_ptr & func) : BaseObjFunction(func->NPar(), data->Size() ), fData(data), fFunc(func) { } /** Destructor (no operations) */ virtual ~BasicFCN () {} public: /// access to const reference to the data virtual const DataType & Data() const { return *fData; } /// access to data pointer std::shared_ptr DataPtr() const { return fData; } /// access to const reference to the model function virtual const IModelFunction & ModelFunction() const { return *fFunc; } /// access to function pointer std::shared_ptr ModelFunctionPtr() const { return fFunc; } protected: /// Set the data pointer void SetData(const std::shared_ptr & data) { fData = data; } /// Set the function pointer void SetModelFunction(const std::shared_ptr & func) { fFunc = func; } std::shared_ptr fData; std::shared_ptr fFunc; }; } // end namespace Fit } // end namespace ROOT #endif /* ROOT_Fit_BasicFCN */