13#ifndef ROOT_Fit_Chi2FCN
14#define ROOT_Fit_Chi2FCN
48template<
class DerivFunType,
class ModelFunType = ROOT::Math::IParamMultiFunction>
53 typedef typename ModelFunType::BackendType
T;
69 fGrad ( std::vector<double> ( func->NPar() ) ),
80 fGrad ( std::vector<double> ( func.NPar() ) ),
117 using BaseObjFunction::operator();
121 virtual double DataElement(
const double *
x,
unsigned int i,
double *
g)
const {
147 virtual double DoEval (
const double *
x)
const {
158 return fGrad[icoord];
BasicFCN class: base class for the objective functions used in the fits It has a reference to the dat...
void SetData(const std::shared_ptr< BinData > &data)
Set the data pointer.
std::shared_ptr< IModelFunction > ModelFunctionPtr() const
access to function pointer
void SetModelFunction(const std::shared_ptr< IModelFunction > &func)
Set the function pointer.
virtual const DataType & Data() const
access to const reference to the data
std::shared_ptr< BinData > DataPtr() const
access to data pointer
virtual const IModelFunction & ModelFunction() const
access to const reference to the model function
Class describing the binned data sets : vectors of x coordinates, y values and optionally error on y ...
Chi2FCN class for binnned fits using the least square methods.
BaseObjFunction::BaseFunction BaseFunction
virtual double DoDerivative(const double *x, unsigned int icoord) const
virtual BaseObjFunction::Type_t Type() const
get type of fit method function
virtual void Gradient(const double *x, double *g) const
Chi2FCN(const BinData &data, const IModelFunction &func, const ::ROOT::Fit::ExecutionPolicy &executionPolicy=::ROOT::Fit::ExecutionPolicy::kSerial)
Same Constructor from data set (binned ) and model function but now managed by the user we clone the ...
std::vector< double > fGrad
::ROOT::Math::IParamMultiFunctionTempl< T > IModelFunction
BasicFCN< DerivFunType, ModelFunType, BinData > BaseFCN
ModelFunType::BackendType T
virtual BaseFunction * Clone() const
virtual void SetNFitPoints(unsigned int n) const
set number of fit points (need to be called in const methods, make it const)
Chi2FCN(const Chi2FCN &f)
Copy constructor.
::ROOT::Math::BasicFitMethodFunction< DerivFunType > BaseObjFunction
virtual double DoEval(const double *x) const
Evaluation of the function (required by interface)
BaseObjFunction::Type_t Type_t
::ROOT::Fit::ExecutionPolicy fExecutionPolicy
virtual double DataElement(const double *x, unsigned int i, double *g) const
i-th chi-square residual
Chi2FCN & operator=(const Chi2FCN &rhs)
Assignment operator.
virtual ~Chi2FCN()
Destructor (no operations)
Chi2FCN(const std::shared_ptr< BinData > &data, const std::shared_ptr< IModelFunction > &func, const ::ROOT::Fit::ExecutionPolicy &executionPolicy=::ROOT::Fit::ExecutionPolicy::kSerial)
Constructor from data set (binned ) and model function.
Type_t
enumeration specyfing the possible fit method types
FunctionType::BaseFunc BaseFunction
virtual void UpdateNCalls() const
update number of calls
IParamFunction interface (abstract class) describing multi-dimensional parameteric functions It is a ...
TFitResultPtr Fit(FitObject *h1, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption, const char *goption, ROOT::Fit::DataRange &range)
Chi2FCN< ROOT::Math::IMultiGenFunction, ROOT::Math::IParamMultiFunction > Chi2Function
Chi2FCN< ROOT::Math::IMultiGradFunction, ROOT::Math::IParamMultiFunction > Chi2GradFunction
static double EvalChi2Effective(const IModelFunctionTempl< double > &func, const BinData &data, const double *p, unsigned int &nPoints)
static void EvalChi2Gradient(const IModelFunctionTempl< double > &func, const BinData &data, const double *p, double *g, unsigned int &nPoints, ::ROOT::Fit::ExecutionPolicy executionPolicy=::ROOT::Fit::ExecutionPolicy::kSerial, unsigned nChunks=0)
static double EvalChi2Residual(const IModelFunctionTempl< double > &func, const BinData &data, const double *p, unsigned int i, double *g=0)
static double EvalChi2(const IModelFunction &func, const BinData &data, const double *p, unsigned int &nPoints, ::ROOT::Fit::ExecutionPolicy executionPolicy, unsigned nChunks=0)