1 #ifndef __JFIT__JLINE1ZESTIMATOR__
2 #define __JFIT__JLINE1ZESTIMATOR__
19 namespace JPP {
using namespace JFIT; }
111 (*this)(__begin, __end);
135 if (
N >= NUMBER_OF_PARAMETERS) {
144 for (
T i = __begin; i != __end; ++i) {
151 const double W = 1.0/
N;
168 double xi = j->getX() - getX();
169 double yi = j->getY() - getY();
174 if ((
done = (++j == __end))) {
178 double xj = j->getX() - getX();
179 double yj = j->getY() - getY();
186 const double y = ((xj + xi) * dx +
218 if (fabs(svd.S.a11) < MINIMAL_SVD_WEIGHT * fabs(svd.S.a00)) {
219 THROW(
JValueOutOfRange,
"JEstimator<JLine1Z>::JEstimator(): singular value " << svd.S.a11 <<
' ' << svd.S.a00);
222 V = svd.invert(MINIMAL_SVD_WEIGHT);
224 __x +=
V.a00 * y0 +
V.a01 * y1 +
V.a02 * y2;
225 __y +=
V.a10 * y0 +
V.a11 * y1 +
V.a12 * y2;
226 __t =
V.a20 * y0 +
V.a21 * y1 +
V.a22 * y2;
232 throw JValueOutOfRange(
"JEstimator<JLine1Z>::JEstimator(): Not enough data points.");
263 if (
N != (
int) A.
size()) {
267 if (
N >= NUMBER_OF_PARAMETERS) {
277 for (
size_t row = 0; row != A.
size(); ++row, ++i) {
279 const double dx = i->getX() - getX();
280 const double dy = i->getY() - getY();
282 const double rt = sqrt(dx*dx + dy*dy);
295 for (
size_t col = 0; col != A.
size(); ++col, ++
j) {
297 const double dx = j->getX() - getX();
298 const double dy = j->getY() - getY();
299 const double dz = j->getZ() - getZ();
301 const double rt = sqrt(dx*dx + dy*dy);
314 const double vs =
A(row,col);
320 V.a00 += xr * vs * xc;
321 V.a01 += xr * vs * yc;
322 V.a02 += xr * vs * tc;
323 V.a11 += yr * vs * yc;
324 V.a12 += yr * vs * tc;
325 V.a22 += tr * vs * tc;
335 if (fabs(svd.S.a11) < MINIMAL_SVD_WEIGHT * fabs(svd.S.a00)) {
336 THROW(
JValueOutOfRange,
"JEstimator<JLine1Z>::update(): singular value " << svd.S.a11 <<
' ' << svd.S.a00);
339 V = svd.invert(MINIMAL_SVD_WEIGHT);
341 __x +=
V.a00 * x1 +
V.a01 * y1 +
V.a02 * t1;
342 __y +=
V.a10 * x1 +
V.a11 * y1 +
V.a12 * t1;
343 __t =
V.a20 * x1 +
V.a21 * y1 +
V.a22 * t1;
351 static const int NUMBER_OF_PARAMETERS = 3;
Linear fit of straight line parallel to z-axis to set of hits (objects with position and time)...
double getKappaC()
Get average R-dependence of arrival time of Cherenkov light (a.k.a.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
then JShowerPostfit f $INPUT_FILE o $OUTPUT_FILE N
JEstimator()
Default constructor.
Template definition of linear fit.
V(JDAQEvent-JTriggerReprocessor)*1.0/(JDAQEvent+1.0e-10)
JEstimator(T __begin, T __end)
Constructor.
Determination of the co-variance matrix of hits for a track along z-axis (JFIT::JLine1Z).
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)...
do set_variable OUTPUT_DIRECTORY $WORKDIR T
const JEstimator< JLine1Z > & operator()(T __begin, T __end)
Fit.
Singular value decomposition.
JMATH::JMatrix3S V
co-variance matrix of fit parameters
size_t size() const
Get dimension of matrix.
const double getSpeedOfLight()
Get speed of light.
const double getInverseSpeedOfLight()
Get inverse speed of light.
Data structure for fit of straight line paralel to z-axis.
Exception for accessing a value in a collection that is outside of its range.
source $JPP_DIR setenv csh $JPP_DIR &dev null eval JShellParser o a A
static double MINIMAL_SVD_WEIGHT
minimal SVD weight.