ECCE @ 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 
15 
16 namespace Acts {
17 namespace Test {
18 
19 template <typename Parameter>
20 void consistencyCheck(const Parameter& pars, const Vector3D& position,
21  const Vector3D& momentum, double charge, double time,
22  std::array<double, eBoundParametersSize> values) {
23  // check parameter vector
24  CHECK_CLOSE_ABS(pars.parameters()[eLOC_0], values[0], s_onSurfaceTolerance);
25  CHECK_CLOSE_ABS(pars.parameters()[eLOC_1], values[1], s_onSurfaceTolerance);
26  CHECK_CLOSE_REL(pars.parameters()[ePHI], values[2], 1e-6);
27  CHECK_CLOSE_REL(pars.parameters()[eTHETA], values[3], 1e-6);
28  CHECK_CLOSE_REL(pars.parameters()[eQOP], values[4], 1e-6);
29  CHECK_CLOSE_ABS(pars.parameters()[eT], values[5], 1e-6);
30  // check global parameters
31  CHECK_CLOSE_REL(pars.position(), position, 1e-6);
32  CHECK_CLOSE_REL(pars.momentum(), momentum, 1e-6);
33  BOOST_CHECK_EQUAL(pars.charge(), charge);
34  CHECK_CLOSE_REL(pars.time(), time, 1e-6);
35 }
36 } // namespace Test
37 } // namespace Acts