Logo ROOT   6.16/01
Reference Guide
BasicFCN.h
Go to the documentation of this file.
1// @(#)root/mathcore:$Id$
2// Author: L. Moneta 25 Nov 2014
3
4/**********************************************************************
5 * *
6 * Copyright (c) 2006 LCG ROOT Math Team, CERN/PH-SFT *
7 * *
8 * *
9 **********************************************************************/
10
11// Header file for class BasicFCN
12
13#ifndef ROOT_Fit_BasicFCN
14#define ROOT_Fit_BasicFCN
15
17
18#include "Math/IParamFunction.h"
19
21
22#include <memory>
23
24
25
26namespace ROOT {
27
28
29 namespace Fit {
30
31
32
33//___________________________________________________________________________________
34/**
35 BasicFCN class: base class for the objective functions used in the fits
36 It has a reference to the data and th emodel function used in the fit.
37 It cannot be instantiated but constructed from the derived classes
38*/
39template<class DerivFunType, class ModelFunType, class DataType>
40class BasicFCN : public ::ROOT::Math::BasicFitMethodFunction<DerivFunType> {
41
42protected:
43
44 typedef typename ModelFunType::BackendType T;
45
46 typedef ::ROOT::Math::BasicFitMethodFunction<DerivFunType> BaseObjFunction;
48
49 typedef ::ROOT::Math::IParamMultiFunctionTempl<T> IModelFunction;
50
51 /**
52 Constructor from data set and model function
53 */
54 BasicFCN (const std::shared_ptr<DataType> & data, const std::shared_ptr<IModelFunction> & func) :
55 BaseObjFunction(func->NPar(), data->Size() ),
56 fData(data),
57 fFunc(func)
58 { }
59
60
61
62 /**
63 Destructor (no operations)
64 */
65 virtual ~BasicFCN () {}
66
67public:
68
69
70 /// access to const reference to the data
71 virtual const DataType & Data() const { return *fData; }
72
73 /// access to data pointer
74 std::shared_ptr<DataType> DataPtr() const { return fData; }
75
76 /// access to const reference to the model function
77 virtual const IModelFunction & ModelFunction() const { return *fFunc; }
78
79 /// access to function pointer
80 std::shared_ptr<IModelFunction> ModelFunctionPtr() const { return fFunc; }
81
82
83
84protected:
85
86
87 /// Set the data pointer
88 void SetData(const std::shared_ptr<DataType> & data) { fData = data; }
89
90 /// Set the function pointer
91 void SetModelFunction(const std::shared_ptr<IModelFunction> & func) { fFunc = func; }
92
93
94 std::shared_ptr<DataType> fData;
95 std::shared_ptr<IModelFunction> fFunc;
96
97
98
99};
100
101
102
103 } // end namespace Fit
104
105} // end namespace ROOT
106
107
108#endif /* ROOT_Fit_BasicFCN */
BasicFCN class: base class for the objective functions used in the fits It has a reference to the dat...
Definition: BasicFCN.h:40
void SetData(const std::shared_ptr< DataType > &data)
Set the data pointer.
Definition: BasicFCN.h:88
std::shared_ptr< IModelFunction > ModelFunctionPtr() const
access to function pointer
Definition: BasicFCN.h:80
::ROOT::Math::IParamMultiFunctionTempl< T > IModelFunction
Definition: BasicFCN.h:49
void SetModelFunction(const std::shared_ptr< IModelFunction > &func)
Set the function pointer.
Definition: BasicFCN.h:91
virtual const DataType & Data() const
access to const reference to the data
Definition: BasicFCN.h:71
::ROOT::Math::BasicFitMethodFunction< DerivFunType > BaseObjFunction
Definition: BasicFCN.h:46
std::shared_ptr< IModelFunction > fFunc
Definition: BasicFCN.h:95
BaseObjFunction::BaseFunction BaseFunction
Definition: BasicFCN.h:47
virtual ~BasicFCN()
Destructor (no operations)
Definition: BasicFCN.h:65
ModelFunType::BackendType T
Definition: BasicFCN.h:44
std::shared_ptr< DataType > fData
Definition: BasicFCN.h:94
BasicFCN(const std::shared_ptr< DataType > &data, const std::shared_ptr< IModelFunction > &func)
Constructor from data set and model function.
Definition: BasicFCN.h:54
std::shared_ptr< DataType > DataPtr() const
access to data pointer
Definition: BasicFCN.h:74
virtual const IModelFunction & ModelFunction() const
access to const reference to the model function
Definition: BasicFCN.h:77
FitMethodFunction class Interface for objective functions (like chi2 and likelihood used in the fit) ...
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)
Definition: HFitImpl.cxx:134
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
const char * Size
Definition: TXMLSetup.cxx:55