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...
|
|
double | operator() (const JLine3Z &value, T __begin, T __end) |
| Global fit. More...
|
|
double | 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...
|
|
template<>
struct JFIT::JRegressor< JLine3Z, JSimplex >
Regressor function object for JLine3Z fit using JSimplex minimiser.
Definition at line 50 of file JLine3ZRegressor.hh.
Constructor.
- Parameters
-
sigma | time resolution of hit [ns] |
Definition at line 60 of file JLine3ZRegressor.hh.
JLANG::JSharedPointer< JMEstimator > estimator
M-Estimator function.
double sigma
Time resolution [ns].
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 82 of file JLine3ZRegressor.hh.
84 using namespace JGEOMETRY3D;
85 using namespace JTOOLS;
92 const double R = sqrt(D.getLengthSquared() - z*z);
96 const double u = (t1 - hit.getT()) /
sigma;
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
JVersor3D getDirection(const JVector3D &pos) const
Get photon direction of Cherenkov light on PMT.
JVector3D & sub(const JVector3D &vector)
Subtract vector.
JLANG::JSharedPointer< JMEstimator > estimator
M-Estimator function.
const JPosition3D & getPosition() const
Get position.
double sigma
Time resolution [ns].
double getDot(const JVector3D &vector) const
Get dot product.
Data structure for position in three dimensions.
Global fit.
- Parameters
-
value | start value |
__begin | begin of data set |
__end | end of data set |
- Returns
- chi2
Definition at line 89 of file JRegressor.hh.
JSimplex< JLine3Z > minimiser_type
JRegressor< JLine3Z, JSimplex > regressor_type
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 108 of file JRegressor.hh.
JSimplex< JLine3Z > minimiser_type
JRegressor< JLine3Z, JSimplex > regressor_type
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 69 of file JSimplex.hh.
74 double chi2_old =
evaluate(fit, __begin, __end);
76 const int N =
step.size();
86 DEBUG(
"old: " <<
FIXED(12,5) << chi2_old << endl);
88 const JModel_t p0(
value);
90 for (
int i = 0; i != N; ++i) {
94 chi2[i] = (*this)(fit, __begin, __end,
step[i]);
99 JModel_t wall =
value - p0;
101 const double chi2_new = (*this)(fit, __begin, __end, wall);
103 DEBUG(
"new: " <<
FIXED(12,5) << chi2_new << endl);
106 if (fabs(chi2_old - chi2_new) <
EPSILON*fabs(chi2_old)) {
116 const double fe =
evaluate(fit, __begin, __end);
121 for (
int i = N-1; i != 0; --i) {
122 chi2[i] = chi2[i-1] - chi2[i];
125 chi2[0] = chi2_old - chi2[0];
130 for (
int i = 0; i != N; ++i) {
136 const double fn = chi2_new;
137 const double f0 = chi2_old;
138 const double ff = f0 - fn - df;
142 if (fe < f0 && 2.0*(f0 - 2.0*fn + fe)*ff*ff < (f0-fe)*(f0-fe)*df) {
144 for (
int i = 0; i != N - 1; ++i) {
Auxiliary data structure for floating point format specification.
double evaluate(const JFunction_t &fit, T __begin, T __end) const
Evaluate chi2 for given data set.
static int MAXIMUM_ITERATIONS
maximal number of iterations
static double EPSILON
maximal distance to minimum
#define DEBUG(A)
Message macros.
std::vector< JLine3Z > step
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 171 of file JSimplex.hh.
179 double chi2_old =
evaluate(fit, __begin, __end);
185 const double chi2_new =
evaluate(fit, __begin, __end);
187 DEBUG(
"step: " << setw(3) << i <<
' ' <<
FIXED(12,5) << chi2_old <<
' ' <<
FIXED(12,5) << chi2_new <<
' ' <<
FIXED(5,2) << lambda << endl);
189 if (fabs(chi2_old - chi2_new) <
EPSILON*fabs(chi2_old)) {
191 if (chi2_new > chi2_old) {
203 if (chi2_new < chi2_old) {
217 lambda = factor * lambda;
Auxiliary data structure for floating point format specification.
double evaluate(const JFunction_t &fit, T __begin, T __end) const
Evaluate chi2 for given data set.
static int MAXIMUM_ITERATIONS
maximal number of iterations
static double EPSILON
maximal distance to minimum
#define DEBUG(A)
Message macros.
std::vector< JLine3Z > step
maximal number of iterations
maximal number of iterations.
Definition at line 224 of file JSimplex.hh.
maximal distance to minimum
maximal distance to minimum.
Definition at line 225 of file JSimplex.hh.
debug level (default is off).
Definition at line 43 of file JMessage.hh.
The documentation for this struct was generated from the following file: