Regressor function object for JLine3Z fit using JSimplex minimiser.
More...
#include <JLine3ZRegressor.hh>
|
| JRegressor (double sigma) |
| Constructor. More...
|
|
template<class JHit_t > |
double | operator() (const JLine3Z &track, const JHit_t &hit) const |
| Fit function. More...
|
|
result_type | operator() (const JLine3Z &value, T __begin, T __end) |
| Global fit. More...
|
|
result_type | operator() (const JLine3Z &value, T1 __begin1, T1 __end1, T2 __begin2, T2 __end2) |
| Global fit. More...
|
|
double | operator() (const JFunction_t &fit, T __begin, T __end) |
| Multi-dimensional fit. More...
|
|
double | operator() (const JFunction_t &fit, T __begin, T __end, const JLine3Z &step) |
| 1D fit. More...
|
|
|
double | evaluate (const JFunction_t &fit, T __begin, T __end) const |
| Evaluate chi2 for given data set. More...
|
|
template<>
struct JFIT::JRegressor< JLine3Z, JSimplex >
Regressor function object for JLine3Z fit using JSimplex minimiser.
Definition at line 52 of file JLine3ZRegressor.hh.
◆ minimiser_type
◆ regressor_type
◆ result_type
◆ JRegressor()
Constructor.
- Parameters
-
sigma | time resolution of hit [ns] |
Definition at line 62 of file JLine3ZRegressor.hh.
◆ operator()() [1/5]
Fit function.
This method is used to determine the chi2 of given hit with respect to trajectory of muon.
The template argument JHit_t
refers to a data structure which should have the following member methods:
- double getX(); // [m]
- double getY(); // [m]
- double getZ(); // [m]
- double getT(); // [ns]
- Parameters
-
- Returns
- chi2
Definition at line 84 of file JLine3ZRegressor.hh.
93 const double R = sqrt(D.getLengthSquared() - z*z);
97 const double u = (t1 - hit.getT()) /
sigma;
◆ operator()() [2/5]
Global fit.
- Parameters
-
value | start value |
__begin | begin of data set |
__end | end of data set |
- Returns
- chi2
Definition at line 92 of file JRegressor.hh.
94 static_cast<minimiser_type&>(*this).value =
value;
96 return static_cast<minimiser_type&>(*
this)(static_cast<regressor_type&>(*
this), __begin, __end);
◆ operator()() [3/5]
Global fit.
- Parameters
-
value | start value |
__begin1 | begin of first data set |
__end1 | end of first data set |
__begin2 | begin of second data set |
__end2 | end of second data set |
- Returns
- chi2
Definition at line 111 of file JRegressor.hh.
115 static_cast<minimiser_type&>(*this).value =
value;
117 return static_cast<minimiser_type&>(*
this)(static_cast<regressor_type&>(*
this), __begin1, __end1, __begin2, __end2);
◆ operator()() [4/5]
Multi-dimensional fit.
The given fit function should return the equivalent of chi2 for the current value of the given model and a given data point.
- Parameters
-
fit | fit function |
__begin | begin of data |
__end | end of data |
- Returns
- chi2
Definition at line 71 of file JSimplex.hh.
76 double chi2_old =
evaluate(fit, __begin, __end);
78 const int N =
step.size();
88 DEBUG(
"old: " <<
FIXED(12,5) << chi2_old << endl);
90 const JModel_t p0(
value);
92 for (
int i = 0; i != N; ++i) {
96 chi2[i] = (*this)(fit, __begin, __end,
step[i]);
101 JModel_t wall =
value - p0;
103 const double chi2_new = (*this)(fit, __begin, __end, wall);
105 DEBUG(
"new: " <<
FIXED(12,5) << chi2_new << endl);
108 if (fabs(chi2_old - chi2_new) <
EPSILON*fabs(chi2_old)) {
118 const double fe =
evaluate(fit, __begin, __end);
123 for (
int i = N-1; i != 0; --i) {
124 chi2[i] = chi2[i-1] - chi2[i];
127 chi2[0] = chi2_old - chi2[0];
132 for (
int i = 0; i != N; ++i) {
138 const double fn = chi2_new;
139 const double f0 = chi2_old;
140 const double ff = f0 - fn - df;
144 if (fe < f0 && 2.0*(f0 - 2.0*fn + fe)*ff*ff < (f0-fe)*(f0-fe)*df) {
146 for (
int i = 0; i != N - 1; ++i) {
◆ operator()() [5/5]
1D fit.
The given fit function should return the equivalent of chi2 for the current value of the given model and a given data point.
- Parameters
-
fit | fit function |
__begin | begin of data |
__end | end of data |
step | step direction |
Definition at line 173 of file JSimplex.hh.
181 double chi2_old =
evaluate(fit, __begin, __end);
187 const double chi2_new =
evaluate(fit, __begin, __end);
189 DEBUG(
"step: " << setw(3) << i <<
' ' <<
FIXED(12,5) << chi2_old <<
' ' <<
FIXED(12,5) << chi2_new <<
' ' <<
FIXED(5,2) << lambda << endl);
191 if (fabs(chi2_old - chi2_new) <
EPSILON*fabs(chi2_old)) {
193 if (chi2_new > chi2_old) {
205 if (chi2_new < chi2_old) {
219 lambda = factor * lambda;
◆ evaluate()
Evaluate chi2 for given data set.
- Parameters
-
fit | fit function |
__begin | begin of data |
__end | end of data |
Definition at line 242 of file JSimplex.hh.
246 for (T hit = __begin; hit != __end; ++hit) {
247 chi2 += fit(
value, *hit);
◆ estimator
◆ sigma
◆ MAXIMUM_ITERATIONS
maximal number of iterations
maximal number of iterations.
Definition at line 226 of file JSimplex.hh.
◆ EPSILON
maximal distance to minimum
maximal distance to minimum.
Definition at line 227 of file JSimplex.hh.
◆ value
◆ step
◆ numberOfIterations
◆ debug
debug level (default is off).
Definition at line 45 of file JMessage.hh.
The documentation for this struct was generated from the following file: