Jpp 20.0.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JPoint4DRegressor.hh
Go to the documentation of this file.
1#ifndef __JPOINT4DREGRESSOR__
2#define __JPOINT4DREGRESSOR__
3
4#include <cmath>
5
7
9
11#include "JFit/JTimeRange.hh"
12#include "JFit/JSimplex.hh"
13#include "JFit/JGandalf.hh"
14#include "JFit/JMEstimator.hh"
15#include "JFit/JRegressor.hh"
16#include "JFit/JPoint4D.hh"
17
18#include "Jeep/JMessage.hh"
19
20/**
21 * \author adomi
22 */
23
24namespace JFIT {
25
26 /**
27 * Regressor function object for JPoint4D fit using JSimplex minimiser.
28 */
29 template<>
31 public JAbstractRegressor<JPoint4D, JSimplex>
32 {
33 using JAbstractRegressor<JPoint4D, JSimplex>::operator();
34
35 /**
36 * Constructor.
37 */
38 JRegressor(double sigma)
39 {
40 this->sigma = sigma;
41 }
42
43 /* Fit Function
44 * This method is used to determine the chi2 of given hit with respect
45 * to Shower's vertex (brightest point)
46 *
47 * \param vx Shower's vertex
48 * \param hit hit
49 * \return chi2
50 */
51 template<class JHit_t>
52 double operator()(const JPoint4D& vx, const JHit_t& hit) const
53 {
54 using namespace JPP;
55
56 const double dt = hit.getT() - vx.getT(hit.getPosition());
57
58 const double u = dt / sigma;
59
60 return estimator->getRho(u) * hit.getW();
61 }
62
64 double sigma; //!< Time resolution [ns]
65 };
66 template<>
68 public JAbstractRegressor<JPoint4D, JGandalf>
69 {
70 using JAbstractRegressor<JPoint4D, JGandalf>::operator();
71
72 /**
73 * Constructor.
74 */
75 JRegressor(double sigma)
76 {
77 this->sigma = sigma;
78 }
79
80 /* Fit Function
81 * This method is used to determine the chi2 of given hit with respect
82 * to Shower's vertex (brightest point)
83 *
84 * \param vx Shower's vertex
85 * \param hit hit
86 * \return chi2
87 */
88 template<class JHit_t>
89 result_type operator()(const JPoint4D& vx, const JHit_t& hit) const
90 {
91 using namespace JPP;
92
93 const double dt = hit.getT() - vx.getT(hit.getPosition());
94
95 const double u = dt / sigma;
96 result_type result;
97 result.chi2 = estimator->getRho(u) * hit.getW();
98
99 JVector3D d = hit.getPosition() - vx.getPosition();
100
101 double weight = getIndexOfRefraction() * getInverseSpeedOfLight()/(d.getLength() * sigma);
102
103 result.gradient = hit.getW() * JPoint4D( d * weight,
104 -1/sigma);
105 result.gradient.mul(0.5 * estimator->getPsi(u));
106
107 return result;
108 }
109
110 JLANG::JSharedPointer<JMEstimator> estimator; //!< M-Estimator function
111 double sigma; //!< Time resolution [ns]
112 };
113}
114
115#endif
Maximum likelihood estimator (M-estimators).
General purpose messaging.
Physics constants.
General purpose data regression method.
Fit method based on the Levenberg-Marquardt method.
Definition JGandalf.hh:87
Data structure for vertex fit.
Definition JPoint4D.hh:24
Simple fit method based on Powell's algorithm, see reference: Numerical Recipes in C++,...
Definition JSimplex.hh:44
const JPosition3D & getPosition() const
Get position.
Data structure for vector in three dimensions.
Definition JVector3D.hh:36
double getLength() const
Get length.
Definition JVector3D.hh:246
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
Definition JVertex3D.hh:160
The template JSharedPointer class can be used to share a pointer to an object.
Auxiliary classes and methods for linear and iterative data regression.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Abstract class for global fit method.
Definition JRegressor.hh:79
JLANG::JSharedPointer< JMEstimator > estimator
M-Estimator function
double operator()(const JPoint4D &vx, const JHit_t &hit) const
Template definition of a data regressor of given model.
Definition JRegressor.hh:70
Auxiliary class to set-up Hit.
Definition JSirene.hh:58