Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
FumiliStandardMaximumLikelihoodFCN.h
Go to the documentation of this file.
1// @(#)root/minuit2:$Id$
2// Authors: M. Winkler, F. James, L. Moneta, A. Zsenei 2003-2005
3
4/**********************************************************************
5 * *
6 * Copyright (c) 2005 LCG ROOT Math team, CERN/PH-SFT *
7 * *
8 **********************************************************************/
9
10#ifndef ROOT_Minuit2_FumiliStandardMaximumLikelihoodFCN
11#define ROOT_Minuit2_FumiliStandardMaximumLikelihoodFCN
12
15#include <vector>
16
17namespace ROOT {
18
19namespace Minuit2 {
20
21/**
22
23Class implementing the Elements member function for the standard
24maximum likelihood method.
25
26@author Andras Zsenei and Lorenzo Moneta, Creation date: 4 Sep 2004
27
28@see FumiliMaximumLikelihoodFCN
29
30@ingroup Minuit
31
32*/
33
35
36public:
37 /**
38
39 Constructor which initializes the measurement points for the one dimensional model function.
40
41 @param modelFCN the model function used for describing the data.
42
43 @param pos vector containing the x values corresponding to the
44 measurements
45
46 */
47
48 FumiliStandardMaximumLikelihoodFCN(const ParametricFunction &modelFCN, const std::vector<double> &pos)
49 {
50 this->SetModelFunction(modelFCN);
51 unsigned int n = pos.size();
52 fPositions.reserve(n);
53 std::vector<double> x(1);
54 for (unsigned int i = 0; i < n; ++i) {
55 x[0] = pos[i];
56 fPositions.push_back(x);
57 }
58 }
59
60 /**
61
62 Constructor which initializes the measurement points for the multi dimensional model function.
63
64 @param modelFCN the model function used for describing the data.
65
66 @param pos vector containing the x values corresponding to the
67 measurements
68
69 */
70
71 FumiliStandardMaximumLikelihoodFCN(const ParametricFunction &modelFCN, const std::vector<std::vector<double>> &pos)
72 {
73 this->SetModelFunction(modelFCN);
74 fPositions = pos;
75 }
76
78
79 /**
80
81 Evaluates the model function for the different measurement points and
82 the Parameter values supplied.
83
84 @param par vector of Parameter values to feed to the model function.
85
86 @return A vector containing the model function evaluated
87 for each measurement point.
88
89 */
90
91 std::vector<double> Elements(const std::vector<double> &par) const override;
92
93 /**
94
95 Accessor to the position of the measurement (x coordinate).
96
97 @param Index Index of the measuerement the position of which to return.
98
99 @return the position of the measurement.
100
101 */
102
103 const std::vector<double> &GetMeasurement(int Index) const override;
104
105 /**
106
107 Accessor to the number of measurements used for calculating
108 the maximum likelihood.
109
110 @return the number of measurements.
111
112 */
113
114 int GetNumberOfMeasurements() const override;
115
116 /**
117
118 Evaluate function Value, Gradient and Hessian using Fumili approximation, for values of parameters p
119 The result is cached inside and is return from the FumiliFCNBase::Value , FumiliFCNBase::Gradient and
120 FumiliFCNBase::Hessian methods
121
122 @param par vector of parameters
123
124 **/
125
126 void EvaluateAll(const std::vector<double> &par) override;
127
128private:
129 std::vector<std::vector<double>> fPositions;
130};
131
132} // namespace Minuit2
133
134} // namespace ROOT
135
136#endif // ROOT_Minuit2_FumiliStandardMaximumLikelihoodFCN
Extension of the FCNBase for the Fumili method.
void SetModelFunction(const ParametricFunction &modelFCN)
Sets the model function for the data (for example gaussian+linear for a peak)
Class implementing the Elements member function for the standard maximum likelihood method.
std::vector< double > Elements(const std::vector< double > &par) const override
Evaluates the model function for the different measurement points and the Parameter values supplied.
int GetNumberOfMeasurements() const override
Accessor to the number of measurements used for calculating the maximum likelihood.
const std::vector< double > & GetMeasurement(int Index) const override
Accessor to the position of the measurement (x coordinate).
void EvaluateAll(const std::vector< double > &par) override
Evaluate function Value, Gradient and Hessian using Fumili approximation, for values of parameters p ...
FumiliStandardMaximumLikelihoodFCN(const ParametricFunction &modelFCN, const std::vector< std::vector< double > > &pos)
Constructor which initializes the measurement points for the multi dimensional model function.
FumiliStandardMaximumLikelihoodFCN(const ParametricFunction &modelFCN, const std::vector< double > &pos)
Constructor which initializes the measurement points for the one dimensional model function.
Function which has parameters.
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.