Jpp 20.0.0-rc.9-29-gccc23c492-D
the software that should make you happy
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
JFIT::JEstimator< JPoint4D > Class Reference

Linear fit of bright point (position and time) between hits (objects with position and time). More...

#include <JPoint4DEstimator.hh>

Inheritance diagram for JFIT::JEstimator< JPoint4D >:
JFIT::JPoint4D

Public Types

typedef double JPoint4D::* parameter_type
 

Public Member Functions

 JEstimator ()
 Fit constructor.
 
template<class T >
 JEstimator (T __begin, T __end)
 Fit constructor.
 
template<class T >
void operator() (T __begin, T __end)
 Fit function.
 

Static Public Member Functions

static parameter_type pX ()
 
static parameter_type pY ()
 
static parameter_type pZ ()
 
static parameter_type pT ()
 

Public Attributes

JMATH::JMatrix4S V
 co-variance matrix of fit parameters
 

Static Public Attributes

static const int NUMBER_OF_PARAMETERS = 4
 number of parameters of fit
 

Detailed Description

Linear fit of bright point (position and time) between hits (objects with position and time).

\begin{center}\setlength{\unitlength}{0.6cm}\begin{picture}(12,7)

\put( 6.0, 1.0){\circle*{0.3}}
\put( 6.0, 0.0){\makebox(0,0)[b]{$(x_{0},y_{0},z_{0})$}}

\multiput(6.0, 1.0)(-0.5, 0.5){10}{\qbezier(0.0,0.0)(+0.1,0.35)(-0.25,0.25)\qbezier(-0.25,0.25)(-0.6,0.15)(-0.5,0.5)}
\put( 1.0, 6.0){\circle*{0.2}}
\put( 1.0, 6.5){\makebox(0,0)[b]{$(x_i,y_i,z_i,t_i)$}}

\multiput(6.0, 1.0)( 0.5, 0.5){10}{\qbezier(0.0,0.0)(0.35,-0.1)( 0.25,0.25)\qbezier( 0.25,0.25)(0.15, 0.6)( 0.5,0.5)}
\put(11.0, 6.0){\circle*{0.2}}
\put(11.0, 6.5){\makebox(0,0)[b]{$(x_j,y_j,z_j,t_j)$}}

\end{picture}
\end{center}

\[
t_j   =  t_0  +  \frac{c}{n} \times \sqrt((x_j - x_0)^2 + (y_j - y_0)^2 + (z_j - z_0)^2)
\]

where:

\begin{eqnarray*}
x_0   & = &  \textrm{x position of vertex      (fit parameter)}                         \\
y_0   & = &  \textrm{y position of vertex      (fit parameter)}                         \\
z_0   & = &  \textrm{z position of vertex      (fit parameter)}                         \\
t_0   & = &  \textrm{time at vertex            (fit parameter)}                         \\
\\
c     & = &  \textrm{speed of light (in vacuum)}                                        \\
n     & = &  \textrm{index of refraction corresponding to the group velocity of light}  \\
\end{eqnarray*}

Defining:

\begin{eqnarray*}
t_j'  & \equiv &  nct_j \\
t_0'  & \equiv &  nct_0 \\
\end{eqnarray*}

\[
\Rightarrow (t_j' - t_0')^2 = (x_j - x_0)^2  +  (y_j - y_0)^2  +  (z_j - z_0)^2
\]

The parameters $ \{x_0, y_0, z_0, t_0\} $ are estimated in the constructor of this class based on consecutive pairs of equations by which the quadratic terms in $ x_0 $, $ y_0 $, $ z_0 $ and $ t_0 $ are eliminated.

Definition at line 69 of file JPoint4DEstimator.hh.

Member Typedef Documentation

◆ parameter_type

typedef double JPoint4D::* JFIT::JPoint4D::parameter_type
inherited

Definition at line 56 of file JPoint4D.hh.

Constructor & Destructor Documentation

◆ JEstimator() [1/2]

JFIT::JEstimator< JPoint4D >::JEstimator ( )
inline

Fit constructor.

Definition at line 77 of file JPoint4DEstimator.hh.

77 :
78 JPoint4D()
79 {}
JPoint4D()
Default constructor.
Definition JPoint4D.hh:29

◆ JEstimator() [2/2]

template<class T >
JFIT::JEstimator< JPoint4D >::JEstimator ( T __begin,
T __end )
inline

Fit constructor.

The template argument T refers to an iterator of a data structure which should have the following member methods:

  • double getX(); // [m]
  • double getY(); // [m]
  • double getZ(); // [m]
  • double getT(); // [ns]
Parameters
__beginbegin of data
__endend of data

Definition at line 95 of file JPoint4DEstimator.hh.

95 :
96 JPoint4D()
97 {
98 (*this)(__begin, __end);
99 }

Member Function Documentation

◆ operator()()

template<class T >
void JFIT::JEstimator< JPoint4D >::operator() ( T __begin,
T __end )
inline

Fit function.

This method is used to find the vertex of a given set of hits

Parameters
__beginbegin of data
__endend of data

Definition at line 110 of file JPoint4DEstimator.hh.

111 {
112 using namespace std;
113 using namespace JPP;
114
115 const int N = distance(__begin, __end);
116
117 if (N >= NUMBER_OF_PARAMETERS) {
118
119 double t0 = 0.0;
120
121 __x = 0.0;
122 __y = 0.0;
123 __z = 0.0;
124
125 for (T i = __begin; i != __end; ++i) {
126 __x += i->getX();
127 __y += i->getY();
128 __z += i->getZ();
129 t0 += i->getT();
130 }
131
132 div(N);
133 t0 /= N;
134
135 V.reset();
136
137 t0 *= getSpeedOfLight();
138
139 double y0 = 0.0;
140 double y1 = 0.0;
141 double y2 = 0.0;
142 double y3 = 0.0;
143
144 T j = __begin;
145
146 double xi = j->getX() - getX();
147 double yi = j->getY() - getY();
148 double zi = j->getZ() - getZ();
149 double ti = (j->getT() * getSpeedOfLight() - t0) / getIndexOfRefraction();
150
151 for (bool done = false; !done; ) {
152
153 if ((done = (++j == __end))) {
154 j = __begin;
155 }
156
157 double xj = j->getX() - getX();
158 double yj = j->getY() - getY();
159 double zj = j->getZ() - getZ();
160 double tj = (j->getT() * getSpeedOfLight() - t0) / getIndexOfRefraction();
161
162 double dx = xj - xi;
163 double dy = yj - yi;
164 double dz = zj - zi;
165 double dt = ti - tj; // opposite sign!
166
167 const double y = ((xj + xi) * dx +
168 (yj + yi) * dy +
169 (zj + zi) * dz +
170 (tj + ti) * dt);
171
172 dx *= 2;
173 dy *= 2;
174 dz *= 2;
175 dt *= 2;
176
177 V.a00 += dx * dx;
178 V.a01 += dx * dy;
179 V.a02 += dx * dz;
180 V.a03 += dx * dt;
181 V.a11 += dy * dy;
182 V.a12 += dy * dz;
183 V.a13 += dy * dt;
184 V.a22 += dz * dz;
185 V.a23 += dz * dt;
186 V.a33 += dt * dt;
187
188 y0 += dx * y;
189 y1 += dy * y;
190 y2 += dz * y;
191 y3 += dt * y;
192
193 xi = xj;
194 yi = yj;
195 zi = zj;
196 ti = tj;
197 }
198
199 t0 *= getInverseSpeedOfLight();
200
201 V.a10 = V.a01;
202 V.a20 = V.a02;
203 V.a30 = V.a03;
204 V.a21 = V.a12;
205 V.a31 = V.a13;
206 V.a32 = V.a23;
207
208 V.invert();
209
210 __x += V.a00 * y0 + V.a01 * y1 + V.a02 * y2 + V.a03 * y3;
211 __y += V.a10 * y0 + V.a11 * y1 + V.a12 * y2 + V.a13 * y3;
212 __z += V.a20 * y0 + V.a21 * y1 + V.a22 * y2 + V.a23 * y3;
213 __t = V.a30 * y0 + V.a31 * y1 + V.a32 * y2 + V.a33 * y3;
214
215 __t *= getInverseSpeedOfLight() * getIndexOfRefraction();
216 __t += t0;
217
218 } else {
219 throw JValueOutOfRange("JEstimator<JPoint4D>::operator(): Not enough data points.");
220 }
221 }
JMATH::JMatrix4S V
co-variance matrix of fit parameters
static const int NUMBER_OF_PARAMETERS
number of parameters of fit

◆ pX()

static parameter_type JFIT::JPoint4D::pX ( )
inlinestaticinherited

Definition at line 58 of file JPoint4D.hh.

58{ return &JPoint4D::__x; }

◆ pY()

static parameter_type JFIT::JPoint4D::pY ( )
inlinestaticinherited

Definition at line 59 of file JPoint4D.hh.

59{ return &JPoint4D::__y; }

◆ pZ()

static parameter_type JFIT::JPoint4D::pZ ( )
inlinestaticinherited

Definition at line 60 of file JPoint4D.hh.

60{ return &JPoint4D::__z; }

◆ pT()

static parameter_type JFIT::JPoint4D::pT ( )
inlinestaticinherited

Definition at line 61 of file JPoint4D.hh.

61{ return &JPoint4D::__t; }

Member Data Documentation

◆ NUMBER_OF_PARAMETERS

const int JFIT::JEstimator< JPoint4D >::NUMBER_OF_PARAMETERS = 4
static

number of parameters of fit

Definition at line 223 of file JPoint4DEstimator.hh.

◆ V

JMATH::JMatrix4S JFIT::JEstimator< JPoint4D >::V

co-variance matrix of fit parameters

Definition at line 224 of file JPoint4DEstimator.hh.


The documentation for this class was generated from the following file: