Macros | Functions
aggregate_clhep_t.cc File Reference
#include "MockRun.h"
#include "boost/test/unit_test.hpp"
#include "CLHEP/Matrix/Matrix.h"
#include "CLHEP/Matrix/SymMatrix.h"
#include "CLHEP/Matrix/Vector.h"
#include "CLHEP/Vector/LorentzVector.h"
#include "CLHEP/Vector/ThreeVector.h"
#include "CLHEP/Vector/TwoVector.h"

Go to the source code of this file.

Macros

#define BOOST_TEST_MODULE   (ClhepProduct aggregation Test)
 

Functions

 BOOST_AUTO_TEST_CASE (hepvector)
 
 BOOST_AUTO_TEST_CASE (hep2vector)
 
 BOOST_AUTO_TEST_CASE (hep3vector)
 
 BOOST_AUTO_TEST_CASE (heplorentzvector)
 
 BOOST_AUTO_TEST_CASE (hepmatrix)
 
 BOOST_AUTO_TEST_CASE (hepsymmatrix)
 

Macro Definition Documentation

#define BOOST_TEST_MODULE   (ClhepProduct aggregation Test)

Definition at line 1 of file aggregate_clhep_t.cc.

Function Documentation

BOOST_AUTO_TEST_CASE ( hepvector  )

Definition at line 26 of file aggregate_clhep_t.cc.

27 {
28  HepVector a(3, 0);
29  a[0] = 1;
30  a[1] = 2;
31  a[2] = 3;
32 
33  HepVector b(3, 0);
34  b[0] = 3;
35  b[1] = 2;
36  b[2] = 1;
37 
38  MockRun r;
39  r.put<HepVector>(a);
40  r.put<HepVector>(b);
41 
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);
46 }
auto const tolerance
const double a
T get() const
Definition: MockRun.h:24
void put(ARGS &&...args)
Definition: MockRun.h:16
static bool * b
Definition: config.cpp:1043
BOOST_AUTO_TEST_CASE ( hep2vector  )

Definition at line 48 of file aggregate_clhep_t.cc.

49 {
50  MockRun r;
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);
56 }
auto const tolerance
T get() const
Definition: MockRun.h:24
void put(ARGS &&...args)
Definition: MockRun.h:16
BOOST_AUTO_TEST_CASE ( hep3vector  )

Definition at line 58 of file aggregate_clhep_t.cc.

59 {
60  MockRun r;
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);
67 }
auto const tolerance
void put(ARGS &&...args)
Definition: MockRun.h:16
BOOST_AUTO_TEST_CASE ( heplorentzvector  )

Definition at line 69 of file aggregate_clhep_t.cc.

70 {
71  MockRun r;
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);
79 }
auto const tolerance
T get() const
Definition: MockRun.h:24
void put(ARGS &&...args)
Definition: MockRun.h:16
BOOST_AUTO_TEST_CASE ( hepmatrix  )

Definition at line 81 of file aggregate_clhep_t.cc.

82 {
83  unsigned constexpr nrows{3};
84  unsigned constexpr ncols{2};
85 
86  HepMatrix m1(nrows, ncols);
87  m1(1, 1) = 1;
88  m1(1, 2) = 0;
89  m1(2, 1) = 0;
90  m1(2, 2) = 1;
91  m1(3, 1) = 1;
92  m1(3, 2) = 1;
93 
94  HepMatrix m2(nrows, ncols);
95  m2(1, 1) = 0;
96  m2(1, 2) = 1;
97  m2(2, 1) = 1;
98  m2(2, 2) = 0;
99  m2(3, 1) = 1;
100  m2(3, 2) = 1;
101 
102  MockRun r;
103  r.put<HepMatrix>(m1);
104  r.put<HepMatrix>(m2);
105 
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);
112 }
auto const tolerance
static constexpr double m2
Definition: Units.h:72
T get() const
Definition: MockRun.h:24
void put(ARGS &&...args)
Definition: MockRun.h:16
unsigned nrows(sqlite3 *db, std::string const &tablename)
Definition: helpers.cc:82
BOOST_AUTO_TEST_CASE ( hepsymmatrix  )

Definition at line 114 of file aggregate_clhep_t.cc.

115 {
116  unsigned constexpr n{2};
117  MockRun r;
118  HepSymMatrix m1(n);
119  m1(1, 1) = 1;
120  m1(1, 2) = 0;
121  m1(2, 1) = 0;
122  m1(2, 2) = 1;
123 
124  HepSymMatrix m2(n);
125  m2(1, 1) = 0;
126  m2(1, 2) = 1;
127  m2(2, 1) = 1;
128  m2(2, 2) = 0;
129 
130  r.put<HepSymMatrix>(m1);
131  r.put<HepSymMatrix>(m2);
132 
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);
137 }
auto const tolerance
static constexpr double m2
Definition: Units.h:72
std::void_t< T > n
T get() const
Definition: MockRun.h:24
void put(ARGS &&...args)
Definition: MockRun.h:16