8#include <mdst/dataobjects/TrackFitResult.h>
9#include <framework/gearbox/Const.h>
12#include <TMatrixDSym.h>
18#include <gtest/gtest.h>
39 unsigned int nCases = 1;
40 double absError = 1e-6;
43 for (
unsigned int i = 0; i < nCases; ++i) {
45 short int charge = generator.Uniform(-1, 1) > 0 ? 1 : -1;
50 TVector2 d(generator.Uniform(-1, 1), generator.Uniform(-1, 1));
51 TVector2 pt(generator.Uniform(-1, 1), generator.Uniform(-1, 1));
52 d.Set(d.X(), -(d.X()*pt.Px()) / pt.Py());
54 ROOT::Math::XYZVector position(d.X(), d.Y(), generator.Uniform(-1, 1));
55 ROOT::Math::XYZVector momentum(pt.Px(), pt.Py(), generator.Uniform(-1, 1));
60 TrackFitResult myResult(position, momentum, cov6, charge, pType, pValue, bField, 0, 0, 0);
63 EXPECT_NEAR(position.X(), myResult.
getPosition().X(), absError);
64 EXPECT_NEAR(position.Y(), myResult.
getPosition().Y(), absError);
65 EXPECT_NEAR(position.Z(), myResult.
getPosition().Z(), absError);
66 EXPECT_NEAR(momentum.X(), myResult.
getMomentum().X(), absError);
67 EXPECT_NEAR(momentum.Y(), myResult.
getMomentum().Y(), absError);
68 EXPECT_NEAR(momentum.Z(), myResult.
getMomentum().Z(), absError);
85 unsigned int nCases = 1;
86 double absError = 1e-6;
88 for (
unsigned int iCase = 0; iCase < nCases; ++iCase) {
93 std::vector<float> tau;
94 for (
int i = 0; i < 5; ++i) {
98 std::vector<float> cov(15);
99 for (
auto& element : cov) {
100 element = generator.Gaus(1e-4);
105 for (
int i = 0; i < 5; ++i)
106 for (
int j = i; j < 5; ++j)
107 EXPECT_EQ(covariance(i, j), covariance(j, i));
110 for (
unsigned int row = 0; row < 6; ++row) {
111 for (
unsigned int col = 0; col < 6; ++col) {
112 cov6(row, col) = covariance(row, col);
121 EXPECT_NEAR(myResultCov5(0, 0), myResult2Cov5(0, 0), absError);
122 EXPECT_NEAR(myResultCov5(0, 1), myResult2Cov5(0, 1), absError);
123 EXPECT_NEAR(myResultCov5(0, 2), myResult2Cov5(0, 2), absError);
124 EXPECT_NEAR(myResultCov5(0, 3), myResult2Cov5(0, 3), absError);
125 EXPECT_NEAR(myResultCov5(0, 4), myResult2Cov5(0, 4), absError);
126 EXPECT_NEAR(myResultCov5(1, 0), myResult2Cov5(1, 0), absError);
127 EXPECT_NEAR(myResultCov5(1, 1), myResult2Cov5(1, 1), absError);
128 EXPECT_NEAR(myResultCov5(1, 2), myResult2Cov5(1, 2), absError);
129 EXPECT_NEAR(myResultCov5(1, 3), myResult2Cov5(1, 3), absError);
130 EXPECT_NEAR(myResultCov5(1, 4), myResult2Cov5(1, 4), absError);
131 EXPECT_NEAR(myResultCov5(2, 0), myResult2Cov5(2, 0), absError);
132 EXPECT_NEAR(myResultCov5(2, 1), myResult2Cov5(2, 1), absError);
133 EXPECT_NEAR(myResultCov5(2, 2), myResult2Cov5(2, 2), absError);
134 EXPECT_NEAR(myResultCov5(2, 3), myResult2Cov5(2, 3), absError);
135 EXPECT_NEAR(myResultCov5(2, 4), myResult2Cov5(2, 4), absError);
136 EXPECT_NEAR(myResultCov5(3, 0), myResult2Cov5(3, 0), absError);
137 EXPECT_NEAR(myResultCov5(3, 1), myResult2Cov5(3, 1), absError);
138 EXPECT_NEAR(myResultCov5(3, 2), myResult2Cov5(3, 2), absError);
139 EXPECT_NEAR(myResultCov5(3, 3), myResult2Cov5(3, 3), absError);
140 EXPECT_NEAR(myResultCov5(3, 4), myResult2Cov5(3, 4), absError);
141 EXPECT_NEAR(myResultCov5(4, 0), myResult2Cov5(4, 0), absError);
142 EXPECT_NEAR(myResultCov5(4, 1), myResult2Cov5(4, 1), absError);
143 EXPECT_NEAR(myResultCov5(4, 2), myResult2Cov5(4, 2), absError);
144 EXPECT_NEAR(myResultCov5(4, 3), myResult2Cov5(4, 3), absError);
145 EXPECT_NEAR(myResultCov5(4, 4), myResult2Cov5(4, 4), absError);
155 ROOT::Math::XYZVector position(0., 0., 0.);
156 ROOT::Math::XYZVector momentum(1., 1., 1.);
The ParticleType class for identifying different particle types.
static const ChargedStable electron
electron particle
Set up a few arrays and objects in the datastore.
Values of the result of a track fit with a given particle hypothesis.
TMatrixDSym getCovariance5() const
Getter for covariance matrix of perigee parameters in matrix form.
short getChargeSign() const
Return track charge (1 or -1).
double getPValue() const
Getter for Chi2 Probability of the track fit.
TMatrixDSym getCovariance6() const
Position and Momentum Covariance Matrix.
double getTransverseMomentum() const
Getter for the absolute value of the transverse momentum at the perigee.
Const::ParticleType getParticleType() const
Getter for ParticleType of the mass hypothesis of the track fit.
ROOT::Math::XYZVector getMomentum() const
Getter for vector of momentum at closest approach of track in r/phi projection.
ROOT::Math::XYZVector getPosition() const
Getter for vector of position at closest approach of track in r/phi projection.
Abstract base class for different kinds of events.