1 #ifndef __JFIT__JLINE1ZESTIMATOR__
2 #define __JFIT__JLINE1ZESTIMATOR__
19 namespace JPP {
using namespace JFIT; }
111 (*this)(__begin, __end);
134 const int N =
distance(__begin, __end);
136 if (N >= NUMBER_OF_PARAMETERS) {
145 for (T i = __begin; i != __end; ++i) {
152 const double W = 1.0/N;
169 double xi =
j->getX() - getX();
170 double yi =
j->getY() - getY();
173 for (
bool done =
false; !done; ) {
175 if ((done = (++
j == __end))) {
179 double xj =
j->getX() - getX();
180 double yj =
j->getY() - getY();
187 const double y = ((xj + xi) * dx +
219 if (fabs(svd.S.a11) < MINIMAL_SVD_WEIGHT * fabs(svd.S.a00)) {
220 THROW(
JValueOutOfRange,
"JEstimator<JLine1Z>::JEstimator(): singular value " << svd.S.a11 <<
' ' << svd.S.a00);
223 V = svd.invert(MINIMAL_SVD_WEIGHT);
225 __x += V.a00 * y0 + V.a01 * y1 + V.a02 * y2;
226 __y += V.a10 * y0 + V.a11 * y1 + V.a12 * y2;
227 __t = V.a20 * y0 + V.a21 * y1 + V.a22 * y2;
233 throw JValueOutOfRange(
"JEstimator<JLine1Z>::JEstimator(): Not enough data points.");
262 const int N =
distance(__begin, __end);
264 if (N != (
int) A.
size()) {
268 if (N >= NUMBER_OF_PARAMETERS) {
278 for (
size_t row = 0; row != A.
size(); ++row, ++i) {
280 const double dx = i->getX() - getX();
281 const double dy = i->getY() - getY();
283 const double rt = sqrt(dx*dx + dy*dy);
296 for (
size_t col = 0; col != A.
size(); ++col, ++
j) {
298 const double dx =
j->getX() - getX();
299 const double dy =
j->getY() - getY();
300 const double dz =
j->getZ() - getZ();
302 const double rt = sqrt(dx*dx + dy*dy);
315 const double vs = A(row,col);
321 V.a00 += xr *
vs * xc;
322 V.a01 += xr *
vs * yc;
323 V.a02 += xr *
vs * tc;
324 V.a11 += yr *
vs * yc;
325 V.a12 += yr *
vs * tc;
326 V.a22 += tr *
vs * tc;
336 if (fabs(svd.S.a11) < MINIMAL_SVD_WEIGHT * fabs(svd.S.a00)) {
337 THROW(
JValueOutOfRange,
"JEstimator<JLine1Z>::update(): singular value " << svd.S.a11 <<
' ' << svd.S.a00);
340 V = svd.invert(MINIMAL_SVD_WEIGHT);
342 __x += V.a00 * x1 + V.a01 * y1 + V.a02 * t1;
343 __y += V.a10 * x1 + V.a11 * y1 + V.a12 * t1;
344 __t = V.a20 * x1 + V.a21 * y1 + V.a22 * t1;
352 static const int NUMBER_OF_PARAMETERS = 3;
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Linear fit of straight line parallel to z-axis to set of hits (objects with position and time).
const JEstimator< JLine1Z > & operator()(T __begin, T __end)
Fit.
JEstimator()
Default constructor.
JEstimator(T __begin, T __end)
Constructor.
void update(T __begin, T __end, const JMatrixNZ &A)
Update track parameters using updated co-variance matrix (e.g. matrix with one hit switched off).
static double MINIMAL_SVD_WEIGHT
minimal SVD weight.
JMATH::JMatrix3S V
co-variance matrix of fit parameters
Template definition of linear fit.
Data structure for fit of straight line paralel to z-axis.
Determination of the co-variance matrix of hits for a track along z-axis (JFIT::JLine1Z).
Exception for accessing a value in a collection that is outside of its range.
Singular value decomposition.
Auxiliary classes and methods for linear and iterative data regression.
double getKappaC()
Get average R-dependence of arrival time of Cherenkov light (a.k.a.
const double getInverseSpeedOfLight()
Get inverse speed of light.
const double getSpeedOfLight()
Get speed of light.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
size_t size() const
Get dimension of matrix.