ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MeasurementTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MeasurementTests.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2016-2018 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #include <boost/test/unit_test.hpp>
10 
11 #include <random>
12 
17 
18 namespace Acts {
19 namespace Test {
20 
21 using SourceLink = MinimalSourceLink;
22 
23 template <ParID_t... params>
24 using MeasurementType = Measurement<SourceLink, params...>;
25 
28 BOOST_AUTO_TEST_CASE(measurement_initialization) {
29  auto cylinder = Surface::makeShared<CylinderSurface>(nullptr, 3, 10);
30 
32  cov << 0.04, 0, 0, 0.1;
34  std::move(cov), -0.1, 0.45);
35 
36  std::default_random_engine generator(42);
37 
38  // Create a measurement on a cylinder
39  ActsSymMatrixD<2> covc;
40  covc << 0.04, 0, 0, 0.1;
42  cylinder, {}, std::move(covc), -0.1, 0.45);
43 
44  // Check the copy constructor
45  auto mcCopy(mc);
46 
47  // The surface should be not null and point to the same
48  const Surface* sfCopy = &mcCopy.referenceSurface();
49  BOOST_CHECK_NE(sfCopy, nullptr);
50  BOOST_CHECK_EQUAL(sfCopy, cylinder.get());
51  // The parameters should be identical though
52  BOOST_CHECK_EQUAL(mc.parameters(), mcCopy.parameters());
53 
54  // check the assignment operator
55  auto mcAssigned = mc;
56 
57  // The surface should be not null and point to the same
58  const Surface* sfAssigned = &mcAssigned.referenceSurface();
59  BOOST_CHECK_NE(sfAssigned, nullptr);
60  BOOST_CHECK_EQUAL(sfAssigned, cylinder.get());
61  // The parameters should be identical though
62  BOOST_CHECK_EQUAL(mc.parameters(), mcAssigned.parameters());
63 
64  std::vector<MeasurementType<ParDef::eLOC_0, ParDef::eLOC_1>> caMeasurements{
65  std::move(mcCopy), std::move(mcAssigned)};
66 
67  auto plane = Surface::makeShared<PlaneSurface>(Vector3D(0., 0., 0.),
68  Vector3D(1., 0., 0.));
69  ActsSymMatrixD<1> covp;
70  covp << 0.01;
71  MeasurementType<ParDef::eLOC_0> mp(plane, {}, std::move(covp), 0.1);
72 
73  ActsSymMatrixD<2> covpp;
74  covpp << 0.01, 0., 0., 0.02;
76  plane, {}, std::move(covpp), 0.1, 0.2);
77 
78  std::vector<FittableMeasurement<SourceLink>> measurements{
79  std::move(mc), std::move(mp), std::move(mpp)};
80 }
81 } // namespace Test
82 } // namespace Acts