8#include <mdst/dbobjects/BeamSpot.h>
9#include <gtest/gtest.h>
28 EXPECT_EQ(bs.getIPPosition().X(), 0.);
29 EXPECT_EQ(bs.getIPPosition().Y(), 0.);
30 EXPECT_EQ(bs.getIPPosition().Z(), 0.);
32 std::function<float (
int,
int)> sizeElement = [ & sizeElement](
int i,
int j) {
33 return j >= i ? (i + 1) + 10 * (j + 1) : sizeElement(j, i) ;
36 std::function<float (
int,
int)> errorElement = [& errorElement](
int i,
int j) {
37 return j >= i ? 100 + (i + 1) + 10 * (j + 1) : errorElement(j, i);
40 TMatrixDSym size(3), positionError(3);
41 for (
int i = 0; i < 3; i++)
42 for (
int j = i; j < 3; j++) {
43 size(i, j) = size(j, i) = sizeElement(i, j);
44 positionError(i, j) = positionError(j, i) = errorElement(i, j);
48 position.SetXYZ(1., 2., 3.);
50 bs.setSizeCovMatrix(size);
51 bs.setIP(position, positionError);
53 TVector3 testPosition = bs.getIPPosition();
54 EXPECT_EQ(testPosition.X(), 1.);
55 EXPECT_EQ(testPosition.Y(), 2.);
56 EXPECT_EQ(testPosition.Z(), 3.);
58 TMatrixDSym testError = bs.getIPPositionCovMatrix();
59 for (
int i = 0; i < 3; i++)
60 for (
int j = 0; j < 3; j++)
61 EXPECT_EQ(testError(i, j), errorElement(i, j));
63 TMatrixDSym testSize = bs.getSizeCovMatrix();
64 for (
int i = 0; i < 3; i++)
65 for (
int j = 0; j < 3; j++)
66 EXPECT_EQ(testSize(i, j), sizeElement(i, j));
69 TMatrixDSym testCovVertex = bs.getCovVertex();
70 for (
int i = 0; i < 3; i++)
71 for (
int j = 0; j < 3; j++)
72 EXPECT_EQ(testCovVertex(i, j), (sizeElement(i, j) + errorElement(i, j)));
74 EXPECT_EQ(bs.getGlobalUniqueID(), 1);
76 EXPECT_EQ(bs == bs2,
true);
80 EXPECT_EQ(bs == bs3,
true);
87 size(2, 2) = std::numeric_limits<double>::min();
90 EXPECT_EQ(bs4 == bs3,
false);
This class contains the beam spot position and size modeled as a gaussian distribution in space.
void setSizeCovMatrix(const TMatrixDSym &size)
Set the covariance matrix of the size of the IP position.
Abstract base class for different kinds of events.