8#include <mdst/dbobjects/BeamSpot.h>
9#include <gtest/gtest.h>
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.);
51 bs.
setIP(position, positionError);
54 EXPECT_EQ(testPosition.X(), 1.);
55 EXPECT_EQ(testPosition.Y(), 2.);
56 EXPECT_EQ(testPosition.Z(), 3.);
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));
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));
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)));
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.
static unsigned short getGlobalUniqueID()
Return unique ID of BeamSpot in global Millepede calibration (1)
void setSizeCovMatrix(const TMatrixDSym &size)
Set the covariance matrix of the size of the IP position.
TMatrixDSym getCovVertex() const
Get the total covariance matrix of theIP position (for compatibility with BeamParameters)
const TMatrixDSym & getSizeCovMatrix() const
Get the covariance matrix of the size of the IP position modeled as a gaussian.
void setIP(const TVector3 &ipPosition, const TMatrixDSym &covariance)
Set the IP position and its error matrix.
const TMatrixDSym & getIPPositionCovMatrix() const
Get the covariance matrix of the measured IP position.
const TVector3 & getIPPosition() const
Get the IP position.
Abstract base class for different kinds of events.