EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BinAdjustmentTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file BinAdjustmentTests.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2017-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 
13 
17 
18 #include <cmath>
19 
20 namespace Acts {
21 namespace Test {
22 
23 namespace tt = boost::test_tools;
24 
25 // Test Radial
26 BOOST_AUTO_TEST_CASE(BinAdjustment_Radial) {
27  RadialBounds bound(50, 75, M_PI, 0);
28  BinUtility bu;
29  bu += BinUtility(1, 0, 1, Acts::open, Acts::binR);
30  bu += BinUtility(1, 0, 1, Acts::closed, Acts::binPhi);
31 
32  BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3D::Identity());
33 
34  BOOST_CHECK_EQUAL(buAdjust.binningData()[0].min, 50);
35  BOOST_CHECK_EQUAL(buAdjust.binningData()[0].max, 75);
36  BOOST_CHECK_EQUAL(buAdjust.binningData()[1].min, float(-M_PI));
37  BOOST_CHECK_EQUAL(buAdjust.binningData()[1].max, float(M_PI));
38 }
39 
40 // Test Cylinder
41 BOOST_AUTO_TEST_CASE(BinAdjustment_Cylinder) {
42  CylinderBounds bound(25, 50, M_PI / 4, 0);
43  BinUtility bu;
44  bu += BinUtility(1, 0, 1, Acts::open, Acts::binPhi);
45  bu += BinUtility(1, 0, 1, Acts::open, Acts::binZ);
46 
47  BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3D::Identity());
48 
49  BOOST_CHECK_EQUAL(buAdjust.binningData()[0].min, float(-M_PI / 4));
50  BOOST_CHECK_EQUAL(buAdjust.binningData()[0].max, float(M_PI / 4));
51  BOOST_CHECK_EQUAL(buAdjust.binningData()[1].min, -50);
52  BOOST_CHECK_EQUAL(buAdjust.binningData()[1].max, 50);
53 }
54 
55 } // namespace Test
56 } // namespace Acts