Skip to content
Snippets Groups Projects
Commit 77f13f12 authored by Wouter Hulsbergen's avatar Wouter Hulsbergen Committed by Gerhard Raven
Browse files

Add TrackCompactVertex and TrackNProngVertex (see Rec!1477).

parent fed70df1
No related branches found
No related tags found
No related merge requests found
......@@ -56,68 +56,6 @@ namespace LHCb {
return dx * dx * invcov00 + 2 * dx * dy * invcov10 + dy * dy * invcov11;
}
///////////////////////////////////////////////////////////////////////////
/// Return the chi2 of the vertex of two track states
///////////////////////////////////////////////////////////////////////////
double vertexChi2( const LHCb::State& stateA, const LHCb::State& stateB ) {
// first compute the cross product of the directions. we'll need this in any case
const double txA = stateA.tx();
const double tyA = stateA.ty();
const double txB = stateB.tx();
const double tyB = stateB.ty();
double nx = tyA - tyB; // y1 * z2 - y2 * z1
double ny = txB - txA; // - x1 * z2 + x2 * z1
double nz = txA * tyB - tyA * txB; // x1 * y2 - x2 * y1
// double n2 = nx*nx + ny*ny + nz*nz ;
// compute doca. we don't divide by the normalization to save time. we call it 'ndoca'
double dx = stateA.x() - stateB.x();
double dy = stateA.y() - stateB.y();
double dz = stateA.z() - stateB.z();
double ndoca = dx * nx + dy * ny + dz * nz;
// the hard part: compute the jacobians :-)
Gaudi::Vector4 jacA, jacB;
jacA( 0 ) = nx;
jacA( 1 ) = ny;
jacA( 2 ) = -dy + dz * tyB;
jacA( 3 ) = +dx - dz * txB;
jacB( 0 ) = -nx;
jacB( 1 ) = -ny;
jacB( 2 ) = +dy - dz * tyA;
jacB( 3 ) = -dx + dz * txA;
// compute the variance on ndoca
const Gaudi::TrackSymMatrix& covA = stateA.covariance();
const Gaudi::TrackSymMatrix& covB = stateB.covariance();
double varndoca = ROOT::Math::Similarity( jacA, covA.Sub<Gaudi::SymMatrix4x4>( 0, 0 ) ) +
ROOT::Math::Similarity( jacB, covB.Sub<Gaudi::SymMatrix4x4>( 0, 0 ) );
// return the chi2
return ndoca * ndoca / varndoca;
}
///////////////////////////////////////////////////////////////////////////
/// Return the doca between two track states
///////////////////////////////////////////////////////////////////////////
double doca( const LHCb::State& stateA, const LHCb::State& stateB ) {
// first compute the cross product of the directions.
const double txA = stateA.tx();
const double tyA = stateA.ty();
const double txB = stateB.tx();
const double tyB = stateB.ty();
double nx = tyA - tyB; // y1 * z2 - y2 * z1
double ny = txB - txA; // - x1 * z2 + x2 * z1
double nz = txA * tyB - tyA * txB; // x1 * y2 - x2 * y1
double n = std::sqrt( nx * nx + ny * ny + nz * nz );
// compute the doca
double dx = stateA.x() - stateB.x();
double dy = stateA.y() - stateB.y();
double dz = stateA.z() - stateB.z();
double ndoca = dx * nx + dy * ny + dz * nz;
return ndoca / n;
}
///////////////////////////////////////////////////////////////////////////
/// Return the distance between a track state and a point
///////////////////////////////////////////////////////////////////////////
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment