EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ParametersTestHelper.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ParametersTestHelper.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2017-2019 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 #pragma once
10 
11 #include <boost/test/unit_test.hpp>
12 
16 
17 namespace Acts {
18 namespace Test {
19 
20 template <typename Parameter>
21 void consistencyCheck(const Parameter& pars, const Vector3D& position,
22  const Vector3D& momentum, double charge, double time,
23  std::array<double, eBoundSize> values) {
24  // check parameter vector
25  CHECK_CLOSE_ABS(pars.parameters()[eBoundLoc0], values[0],
27  CHECK_CLOSE_ABS(pars.parameters()[eBoundLoc1], values[1],
29  CHECK_CLOSE_REL(pars.parameters()[eBoundPhi], values[2], 1e-6);
30  CHECK_CLOSE_REL(pars.parameters()[eBoundTheta], values[3], 1e-6);
31  CHECK_CLOSE_REL(pars.parameters()[eBoundQOverP], values[4], 1e-6);
32  CHECK_CLOSE_ABS(pars.parameters()[eBoundTime], values[5], 1e-6);
33  // check global parameters
34  CHECK_CLOSE_REL(pars.position(GeometryContext()), position, 1e-6);
35  CHECK_CLOSE_REL(pars.momentum(), momentum, 1e-6);
36  BOOST_CHECK_EQUAL(pars.charge(), charge);
37  CHECK_CLOSE_REL(pars.time(), time, 1e-6);
38 }
39 } // namespace Test
40 } // namespace Acts