Logo ROOT   6.08/07
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 
16 #ifndef ROOT_Math_FitMethodFunction
17 #include "Math/FitMethodFunction.h"
18 #endif
19 
20 #ifndef ROOT_Math_IParamFunction
21 #include "Math/IParamFunction.h"
22 #endif
23 
24 #include "Math/IParamFunctionfwd.h"
25 
26 #include <memory>
27 
28 
29 
30 namespace ROOT {
31 
32 
33  namespace Fit {
34 
35 
36 
37 //___________________________________________________________________________________
38 /**
39  BasicFCN class: base class for the objective functions used in the fits
40  It has a reference to the data and th emodel function used in the fit.
41  It cannot be instantiated but constructed from the derived classes
42 */
43 template<class FunType, class DataType>
45 
46 protected:
47 
48 
49  typedef ::ROOT::Math::BasicFitMethodFunction<FunType> BaseObjFunction;
51 
53 
54  /**
55  Constructor from data set and model function
56  */
57  BasicFCN (const std::shared_ptr<DataType> & data, const std::shared_ptr<IModelFunction> & func) :
58  BaseObjFunction(func->NPar(), data->Size() ),
59  fData(data),
60  fFunc(func)
61  { }
62 
63 
64 
65  /**
66  Destructor (no operations)
67  */
68  virtual ~BasicFCN () {}
69 
70 public:
71 
72 
73  /// access to const reference to the data
74  virtual const DataType & Data() const { return *fData; }
75 
76  /// access to data pointer
77  std::shared_ptr<DataType> DataPtr() const { return fData; }
78 
79  /// access to const reference to the model function
80  virtual const IModelFunction & ModelFunction() const { return *fFunc; }
81 
82  /// access to function pointer
83  std::shared_ptr<IModelFunction> ModelFunctionPtr() const { return fFunc; }
84 
85 
86 
87 protected:
88 
89 
90  /// Set the data pointer
91  void SetData(const std::shared_ptr<DataType> & data) { fData = data; }
92 
93  /// Set the function pointer
94  void SetModelFunction(const std::shared_ptr<IModelFunction> & func) { fFunc = func; }
95 
96 
97  std::shared_ptr<DataType> fData;
98  std::shared_ptr<IModelFunction> fFunc;
99 
100 
101 
102 };
103 
104 
105 
106  } // end namespace Fit
107 
108 } // end namespace ROOT
109 
110 
111 #endif /* ROOT_Fit_BasicFCN */
::ROOT::Math::BasicFitMethodFunction< FunType > BaseObjFunction
Definition: BasicFCN.h:49
This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
Definition: StringConv.hxx:21
virtual const IModelFunction & ModelFunction() const
access to const reference to the model function
Definition: BasicFCN.h:80
const char * Size
Definition: TXMLSetup.cxx:56
void SetModelFunction(const std::shared_ptr< IModelFunction > &func)
Set the function pointer.
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:57
std::shared_ptr< DataType > fData
Definition: BasicFCN.h:97
std::shared_ptr< IModelFunction > fFunc
Definition: BasicFCN.h:98
virtual const DataType & Data() const
access to const reference to the data
Definition: BasicFCN.h:74
void SetData(const std::shared_ptr< DataType > &data)
Set the data pointer.
Definition: BasicFCN.h:91
BasicFCN class: base class for the objective functions used in the fits It has a reference to the dat...
Definition: BasicFCN.h:44
std::shared_ptr< IModelFunction > ModelFunctionPtr() const
access to function pointer
Definition: BasicFCN.h:83
FitMethodFunction class Interface for objective functions (like chi2 and likelihood used in the fit) ...
Definition: Fitter.h:57
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
double func(double *x, double *p)
Definition: stressTF1.cxx:213
::ROOT::Math::IParamMultiFunction IModelFunction
Definition: BasicFCN.h:52
IParametricFunctionMultiDim IParamMultiFunction
const int NPar
BaseObjFunction::BaseFunction BaseFunction
Definition: BasicFCN.h:50
std::shared_ptr< DataType > DataPtr() const
access to data pointer
Definition: BasicFCN.h:77
virtual ~BasicFCN()
Destructor (no operations)
Definition: BasicFCN.h:68