Regressor function object for JPoint4D fit using JSimplex minimiser.
More...
#include <JPoint4DRegressor.hh>
|
| JRegressor (const bool __prefit) |
| Constructor. More...
|
|
| JRegressor (TH2D *hPDF2D, bool __prefit) |
| Constructor for a 2D histogram as PDF. More...
|
|
template<class JHit_t > |
double | operator() (const JPoint4D &vertex, const JHit_t &hit) const |
|
double | evaluatePrefit (const double t_res, const double cosT, const double cosT_th) const |
|
double | evaluateFit (const double t_res, const double D) const |
|
double | operator() (const JPoint4D &value, T __begin, T __end) |
| Global fit. More...
|
|
double | operator() (const JPoint4D &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 JPoint4D &step) |
| 1D fit. More...
|
|
template<>
struct JFIT::JRegressor< JPoint4D, JSimplex >
Regressor function object for JPoint4D fit using JSimplex minimiser.
Definition at line 47 of file JPoint4DRegressor.hh.
Constructor.
Definition at line 55 of file JPoint4DRegressor.hh.
JLANG::JSharedPointer< JMEstimator > estimator
M-Estimator function.
Constructor for a 2D histogram as PDF.
Definition at line 64 of file JPoint4DRegressor.hh.
68 hpdf2d[0] = (TH2D*)hPDF2D->Clone();
JLANG::JSharedPointer< JMEstimator > estimator
M-Estimator function.
TH2D * hpdf2d[NUMBER_OF_PDFS]
PDF 2D.
Definition at line 82 of file JPoint4DRegressor.hh.
85 using namespace JGEOMETRY3D;
86 using namespace JTOOLS;
90 const double t_res = hit.getT() - vertex.getT(hit_pos);
91 const JDirection3D photonDir(hit_pos - vertex.getPosition());
92 const double cosT = photonDir.
getDot(hit.getDirection());
Data structure for direction in three dimensions.
double evaluateFit(const double t_res, const double D) const
static const double d_ref
double getDistance(const JVector3D &pos) const
Get distance to point.
double getDot(const JAngle3D &angle) const
Get dot product.
double evaluatePrefit(const double t_res, const double cosT, const double cosT_th) const
Data structure for position in three dimensions.
Definition at line 111 of file JPoint4DRegressor.hh.
118 }
else if(cosT > cosT_th){
121 p_T =
p_max * cosT/cosT_th;
124 double lik = 1 / (sqrt(
a*
a + t_res*t_res) + p_T);
125 double u = -log(lik);
static const double p_max
static const double a
constant to prevent the likelihood going to infinity
JLANG::JSharedPointer< JMEstimator > estimator
M-Estimator function.
Definition at line 131 of file JPoint4DRegressor.hh.
134 int x_bin =
hpdf2d[0]->GetXaxis()->FindBin(t_res);
135 int y_bin =
hpdf2d[0]->GetYaxis()->FindBin(D);
137 int nbinsX =
hpdf2d[0]->GetXaxis()->GetNbins();
138 int nbinsY =
hpdf2d[0]->GetYaxis()->GetNbins();
142 if(x_bin > 1 && x_bin < nbinsX){
143 if(y_bin > 1 && y_bin < nbinsY){
144 lik =
hpdf2d[0]->Interpolate(t_res, D);
152 double u = -log(lik);
JLANG::JSharedPointer< JMEstimator > estimator
M-Estimator function.
TH2D * hpdf2d[NUMBER_OF_PDFS]
PDF 2D.
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< JPoint4D > minimiser_type
JRegressor< JPoint4D, 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< JPoint4D > minimiser_type
JRegressor< JPoint4D, 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< JPoint4D > 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< JPoint4D > 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: