EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BinAdjustmentVolumeTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file BinAdjustmentVolumeTests.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 
14 
18 
19 #include <cmath>
20 
21 namespace Acts {
22 namespace Test {
23 
24 namespace tt = boost::test_tools;
25 
26 // Test Cylinder
27 BOOST_AUTO_TEST_CASE(BinAdjustmentVolume_Cylinder) {
28  CylinderVolumeBounds bound(10, 50, 150, M_PI / 2, 0);
29  BinUtility bu;
30  bu += BinUtility(1, 0, 1, Acts::open, Acts::binR);
31  bu += BinUtility(1, 0, 1, Acts::open, Acts::binPhi);
32  bu += BinUtility(1, 0, 1, Acts::open, Acts::binZ);
33 
34  BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3D::Identity());
35 
36  BOOST_CHECK_EQUAL(buAdjust.binningData()[0].min, 10);
37  BOOST_CHECK_EQUAL(buAdjust.binningData()[0].max, 50);
38  BOOST_CHECK_EQUAL(buAdjust.binningData()[1].min, float(-M_PI / 2));
39  BOOST_CHECK_EQUAL(buAdjust.binningData()[1].max, float(M_PI / 2));
40  BOOST_CHECK_EQUAL(buAdjust.binningData()[2].min, -150);
41  BOOST_CHECK_EQUAL(buAdjust.binningData()[2].max, 150);
42 }
43 
44 // Test Cutout Cylinder
45 BOOST_AUTO_TEST_CASE(BinAdjustmentVolume_CutoutCylinder) {
46  CutoutCylinderVolumeBounds bound(10, 20, 50, 100, 15);
47  BinUtility bu;
48  bu += BinUtility(1, 0, 1, Acts::open, Acts::binR);
49  bu += BinUtility(1, 0, 1, Acts::closed, Acts::binPhi);
50  bu += BinUtility(1, 0, 1, Acts::open, Acts::binZ);
51 
52  BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3D::Identity());
53 
54  BOOST_CHECK_EQUAL(buAdjust.binningData()[0].min, 10);
55  BOOST_CHECK_EQUAL(buAdjust.binningData()[0].max, 50);
56  BOOST_CHECK_EQUAL(buAdjust.binningData()[1].min, float(-M_PI));
57  BOOST_CHECK_EQUAL(buAdjust.binningData()[1].max, float(M_PI));
58  BOOST_CHECK_EQUAL(buAdjust.binningData()[2].min, -100);
59  BOOST_CHECK_EQUAL(buAdjust.binningData()[2].max, 100);
60 }
61 
62 // Test Cuboid
63 BOOST_AUTO_TEST_CASE(BinAdjustmentVolume_Cuboid) {
64  CuboidVolumeBounds bound(13, 23, 42);
65  BinUtility bu;
66  bu += BinUtility(1, 0, 1, Acts::open, Acts::binX);
67  bu += BinUtility(1, 0, 1, Acts::open, Acts::binY);
68  bu += BinUtility(1, 0, 1, Acts::open, Acts::binZ);
69 
70  BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3D::Identity());
71 
72  BOOST_CHECK_EQUAL(buAdjust.binningData()[0].min, -13);
73  BOOST_CHECK_EQUAL(buAdjust.binningData()[0].max, 13);
74  BOOST_CHECK_EQUAL(buAdjust.binningData()[1].min, -23);
75  BOOST_CHECK_EQUAL(buAdjust.binningData()[1].max, 23);
76  BOOST_CHECK_EQUAL(buAdjust.binningData()[2].min, -42);
77  BOOST_CHECK_EQUAL(buAdjust.binningData()[2].max, 42);
78 }
79 
80 } // namespace Test
81 } // namespace Acts