1 #define BOOST_TEST_MODULE (ClhepProduct aggregation Test) 3 #include "boost/test/unit_test.hpp" 5 #include "CLHEP/Matrix/Matrix.h" 6 #include "CLHEP/Matrix/SymMatrix.h" 7 #include "CLHEP/Matrix/Vector.h" 8 #include "CLHEP/Vector/LorentzVector.h" 9 #include "CLHEP/Vector/ThreeVector.h" 10 #include "CLHEP/Vector/TwoVector.h" 13 using CLHEP::Hep2Vector;
14 using CLHEP::Hep3Vector;
15 using CLHEP::HepLorentzVector;
16 using CLHEP::HepMatrix;
17 using CLHEP::HepSymMatrix;
18 using CLHEP::HepVector;
21 double constexpr
tolerance = std::numeric_limits<double>::epsilon();
24 BOOST_AUTO_TEST_SUITE(aggregate_clhep_t)
42 auto const&
c = r.
get<HepVector>();
43 BOOST_CHECK_CLOSE_FRACTION(
c[0], 4,
tolerance);
44 BOOST_CHECK_CLOSE_FRACTION(
c[1], 4,
tolerance);
45 BOOST_CHECK_CLOSE_FRACTION(
c[2], 4,
tolerance);
51 r.
put<Hep2Vector>(0, 3);
52 r.
put<Hep2Vector>(3, 5);
53 auto const&
c = r.
get<Hep2Vector>();
54 BOOST_CHECK_CLOSE_FRACTION(c[0], 3,
tolerance);
55 BOOST_CHECK_CLOSE_FRACTION(c[1], 8,
tolerance);
61 r.
put<Hep3Vector>(0, 3, 19.2);
62 r.
put<Hep3Vector>(3, 5, 1.34);
63 auto const&
c = r.
get<Hep3Vector>();
64 BOOST_CHECK_CLOSE_FRACTION(
c[0], 3,
tolerance);
65 BOOST_CHECK_CLOSE_FRACTION(
c[1], 8,
tolerance);
66 BOOST_CHECK_CLOSE_FRACTION(
c[2], 20.54,
tolerance);
72 r.
put<HepLorentzVector>(0, 3, 19.2, 6);
73 r.
put<HepLorentzVector>(3, 5, 1.34, 7);
74 auto const&
c = r.
get<HepLorentzVector>();
75 BOOST_CHECK_CLOSE_FRACTION(c[0], 3,
tolerance);
76 BOOST_CHECK_CLOSE_FRACTION(c[1], 8,
tolerance);
77 BOOST_CHECK_CLOSE_FRACTION(c[2], 20.54,
tolerance);
78 BOOST_CHECK_CLOSE_FRACTION(c[3], 13,
tolerance);
83 unsigned constexpr
nrows{3};
84 unsigned constexpr ncols{2};
86 HepMatrix m1(
nrows, ncols);
103 r.
put<HepMatrix>(m1);
104 r.
put<HepMatrix>(
m2);
106 auto const&
c = r.
get<HepMatrix>();
107 for (
unsigned i{1}; i <= 2; ++i)
108 for (
unsigned j{1}; j <= 2; ++j)
109 BOOST_CHECK_CLOSE_FRACTION((
c(i, j)), 1,
tolerance);
110 BOOST_CHECK_CLOSE_FRACTION((
c(3, 1)), 2,
tolerance);
111 BOOST_CHECK_CLOSE_FRACTION((
c(3, 2)), 2,
tolerance);
116 unsigned constexpr
n{2};
130 r.
put<HepSymMatrix>(m1);
131 r.
put<HepSymMatrix>(
m2);
133 auto const&
c = r.
get<HepSymMatrix>();
134 for (
unsigned i{1}; i <=
n; ++i)
135 for (
unsigned j{1}; j <=
n; ++j)
136 BOOST_CHECK_CLOSE_FRACTION((
c(i, j)), 1,
tolerance);
139 BOOST_AUTO_TEST_SUITE_END()
static constexpr double m2
BOOST_AUTO_TEST_CASE(hepvector)
unsigned nrows(sqlite3 *db, std::string const &tablename)