10#include <analysis/utility/DistanceTools.h>
11#include <framework/logging/Logger.h>
17ROOT::Math::XYZVector
DistanceTools::poca(ROOT::Math::XYZVector
const& trackPos, ROOT::Math::XYZVector
const& trackP,
18 ROOT::Math::XYZVector
const& vtxPos)
20 ROOT::Math::XYZVector trackDir(trackP.Unit());
21 ROOT::Math::XYZVector r(vtxPos - trackPos);
22 return trackPos + r.Dot(trackDir) * trackDir;
29 return r - (r.Dot(trackDir)) * trackDir;
38 TMatrixDSym
const& trackPosCovMat, TMatrixDSym
const& vtxPosCovMat)
40 if (trackPosCovMat.GetNcols() != 3 || vtxPosCovMat.GetNcols() != 3) {
41 B2ERROR(
"in DistanceTools::trackToVtxCovmat, matrices must be of size 3");
42 return TMatrixDSym(3);
45 TMatrixDSym rCovMat(trackPosCovMat + vtxPosCovMat);
51 TMatrixDSym Jacobian(3);
53 for (
int i(0); i < 3; ++i)
54 for (
int j(0); j < 3; ++j)
55 Jacobian(i, j) = -trackDir(i) * trackDir(j);
56 for (
int i(0); i < 3; ++i)
59 return rCovMat.Similarity(Jacobian);
64 TMatrixDSym
const& trackPosCovMat, TMatrixDSym
const& vtxPosCovMat)
74 for (
int i(0); i < 3; ++i)
75 for (
int j(0); j < 3; ++j)
76 ret += n(i) * covMat(i, j) * n(j);
78 return TMath::Sqrt(ret);
84 return vtx2Pos - vtx1Pos;
94 if (vtx1CovMat.GetNcols() != 3 || vtx2CovMat.GetNcols() != 3) {
95 B2ERROR(
"in DistanceTools::vtxToVtxCovMat, matrices must be of size 3");
96 return TMatrixDSym(3);
99 return vtx1CovMat + vtx2CovMat;
103 TMatrixDSym
const& vtx1CovMat, TMatrixDSym
const& vtx2CovMat)
112 for (
int i(0); i < 3; ++i)
113 for (
int j(0); j < 3; ++j)
114 ret += n(i) * covMat(i, j) * n(j);
116 return TMath::Sqrt(ret);
DataType Mag() const
The magnitude (rho in spherical coordinate system).
B2Vector3< DataType > Unit() const
Unit vector parallel to this.
Abstract base class for different kinds of events.