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, std::span<const 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, std::span<const std::vector<double>> pos)
72 {
73 this->SetModelFunction(modelFCN);
74 fPositions.assign(pos.begin(), pos.end());
75 }
76
77 /**
78
79 Evaluates the model function for the different measurement points and
80 the Parameter values supplied.
81
82 @param par vector of Parameter values to feed to the model function.
83
84 @return A vector containing the model function evaluated
85 for each measurement point.
86
87 */
88
89 std::vector<double> Elements(std::vector<double> const &par) const override;
90
91 /**
92
93 Accessor to the position of the measurement (x coordinate).
94
95 @param Index Index of the measuerement the position of which to return.
96
97 @return the position of the measurement.
98
99 */
100
101 const std::vector<double> &GetMeasurement(int Index) const override;
102
103 /**
104
105 Accessor to the number of measurements used for calculating
106 the maximum likelihood.
107
108 @return the number of measurements.
109
110 */
111
112 int GetNumberOfMeasurements() const override;
113
114 /**
115
116 Evaluate function Value, Gradient and Hessian using Fumili approximation, for values of parameters p
117 The result is cached inside and is return from the FumiliFCNBase::Value , FumiliFCNBase::Gradient and
118 FumiliFCNBase::Hessian methods
119
120 @param par vector of parameters
121
122 **/
123
124 void EvaluateAll(std::vector<double> const &par) override;
125
126private:
127 std::vector<std::vector<double>> fPositions;
128};
129
130} // namespace Minuit2
131
132} // namespace ROOT
133
134#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.
FumiliStandardMaximumLikelihoodFCN(const ParametricFunction &modelFCN, std::span< const double > pos)
Constructor which initializes the measurement points for the one dimensional model function.
int GetNumberOfMeasurements() const override
Accessor to the number of measurements used for calculating the maximum likelihood.
void EvaluateAll(std::vector< double > const &par) override
Evaluate function Value, Gradient and Hessian using Fumili approximation, for values of parameters p ...
FumiliStandardMaximumLikelihoodFCN(const ParametricFunction &modelFCN, std::span< const std::vector< double > > pos)
Constructor which initializes the measurement points for the multi dimensional model function.
const std::vector< double > & GetMeasurement(int Index) const override
Accessor to the position of the measurement (x coordinate).
std::vector< double > Elements(std::vector< double > const &par) const override
Evaluates the model function for the different measurement points and the Parameter values supplied.
Function which has parameters.
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...