Jpp  19.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JPoint4DRegressor.hh
Go to the documentation of this file.
1 #ifndef __JPOINT4DREGRESSOR__
2 #define __JPOINT4DREGRESSOR__
3 
4 #include <cmath>
5 
6 #include "JPhysics/JConstants.hh"
7 
9 
10 #include "JLang/JSharedPointer.hh"
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 
24 namespace JFIT {
25 
26  /**
27  * Regressor function object for JPoint4D fit using JSimplex minimiser.
28  */
29  template<>
31  public JAbstractRegressor<JPoint4D, JSimplex>
32  {
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 
63  JLANG::JSharedPointer<JMEstimator> estimator; //!< M-Estimator function
64  double sigma; //!< Time resolution [ns]
65  };
66  template<>
68  public JAbstractRegressor<JPoint4D, JGandalf>
69  {
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;
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 
111  double sigma; //!< Time resolution [ns]
112  };
113 }
114 
115 #endif
Template definition of a data regressor of given model.
Definition: JRegressor.hh:70
JRegressor(double sigma)
Constructor.
General purpose data regression method.
double getIndexOfRefraction()
Get average index of refraction of water corresponding to group velocity.
Data structure for vertex fit.
Definition: JPoint4D.hh:22
const double sigma[]
Definition: JQuadrature.cc:74
JLANG::JSharedPointer< JMEstimator > estimator
M-Estimator function.
double operator()(const JPoint4D &vx, const JHit_t &hit) const
minimiser_type::result_type result_type
Definition: JRegressor.hh:82
The template JSharedPointer class can be used to share a pointer to an object.
Data structure for vector in three dimensions.
Definition: JVector3D.hh:34
double sigma
Time resolution [ns].
JLANG::JSharedPointer< JMEstimator > estimator
M-Estimator function.
Physics constants.
const JPosition3D & getPosition() const
Get position.
Definition: JPosition3D.hh:130
General purpose messaging.
double sigma
Time resolution [ns].
result_type operator()(const JPoint4D &vx, const JHit_t &hit) const
Fit method based on the Levenberg-Marquardt method.
Definition: JGandalf.hh:84
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
Definition: JMuonStart.sh:47
Simple fit method based on Powell&#39;s algorithm, see reference: Numerical Recipes in C++...
const double getInverseSpeedOfLight()
Get inverse speed of light.
JRegressor(double sigma)
Constructor.
double u[N+1]
Definition: JPolint.hh:865
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
Definition: JVertex3D.hh:147
Abstract class for global fit method.
Definition: JRegressor.hh:77
Maximum likelihood estimator (M-estimators).