EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TestRKMatrixEigenTransformations.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TestRKMatrixEigenTransformations.cpp
1 #include <gtest/gtest.h>
2 
3 #include <RKTools.h>
4 #include <EigenMatrixTypedefs.h>
6 
7 namespace genfit {
8 
9  class RKMatrixEigenTransformations : public::testing::Test {
10  protected:
11  };
12 
13  TEST_F(RKMatrixEigenTransformations, VectorTransformation)
14  {
15  RKMatrix<1, 4> myVector4 = {{ 1, 2, 3, 4 }};
16 
17  auto myEigenMatrix(RKMatrixToEigenMatrix<1, 4>(myVector4));
18  EXPECT_EQ(myVector4[0], myEigenMatrix[0]);
19  EXPECT_EQ(myVector4[1], myEigenMatrix[1]);
20  EXPECT_EQ(myVector4[2], myEigenMatrix[2]);
21  EXPECT_EQ(myVector4[3], myEigenMatrix[3]);
22 
23  auto myRKMatrix(eigenMatrixToRKMatrix<1, 4>(myEigenMatrix));
24  EXPECT_EQ(myVector4[0], myRKMatrix[0]);
25  EXPECT_EQ(myVector4[1], myRKMatrix[1]);
26  EXPECT_EQ(myVector4[2], myRKMatrix[2]);
27  EXPECT_EQ(myVector4[3], myRKMatrix[3]);
28  }
29 
30  TEST_F(RKMatrixEigenTransformations, MatrixTransformation)
31  {
32  RKMatrix<2, 3> myMatrix2x3 = {
33  1, 2, 3,
34  4, 5, 6,
35  };
36 
37  auto myEigenMatrix(RKMatrixToEigenMatrix<2, 3>(myMatrix2x3));
38  EXPECT_EQ(myMatrix2x3(0, 0), myEigenMatrix(0, 0));
39  EXPECT_EQ(myMatrix2x3(0, 1), myEigenMatrix(0, 1));
40  EXPECT_EQ(myMatrix2x3(0, 2), myEigenMatrix(0, 2));
41  EXPECT_EQ(myMatrix2x3(1, 0), myEigenMatrix(1, 0));
42  EXPECT_EQ(myMatrix2x3(1, 1), myEigenMatrix(1, 1));
43  EXPECT_EQ(myMatrix2x3(1, 2), myEigenMatrix(1, 2));
44 
45  auto myRKMatrix(eigenMatrixToRKMatrix<2, 3>(myEigenMatrix));
46  EXPECT_EQ(myMatrix2x3(0, 0), myRKMatrix(0, 0));
47  EXPECT_EQ(myMatrix2x3(0, 1), myRKMatrix(0, 1));
48  EXPECT_EQ(myMatrix2x3(0, 2), myRKMatrix(0, 2));
49  EXPECT_EQ(myMatrix2x3(1, 0), myRKMatrix(1, 0));
50  EXPECT_EQ(myMatrix2x3(1, 1), myRKMatrix(1, 1));
51  EXPECT_EQ(myMatrix2x3(1, 2), myRKMatrix(1, 2));
52  }
53 
54 }