ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
ExtentTests.cpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file ExtentTests.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/data/test_case.hpp>
10
#include <boost/test/tools/output_test_stream.hpp>
11
#include <boost/test/unit_test.hpp>
12
13
// Helper
14
#include "
Acts/Tests/CommonHelpers/FloatComparisons.hpp
"
15
16
// The class to test
17
#include "
Acts/Geometry/Extent.hpp
"
18
19
#include "
Acts/Utilities/Definitions.hpp
"
20
#include "
Acts/Utilities/Units.hpp
"
21
22
namespace
Acts {
23
24
using namespace
UnitLiterals;
25
26
namespace
Test {
27
28
BOOST_AUTO_TEST_SUITE(Geometry)
29
30
31
BOOST_AUTO_TEST_CASE
(ExtentTest) {
32
std::vector<Vector3D> vertices = {
33
Vector3D
(15
_mm
, -3
_mm
, -10
_mm
),
Vector3D
(18
_mm
, 0
_mm
, -10
_mm
),
34
Vector3D
(15
_mm
, 3
_mm
, -10
_mm
),
Vector3D
(15
_mm
, -3
_mm
, 10
_mm
),
35
Vector3D
(18
_mm
, 0
_mm
, 10
_mm
),
Vector3D
(15
_mm
, 3
_mm
, 10
_mm
)};
36
37
// Create an Extent
38
Extent
gExt;
39
for
(
const
auto
&
v
: vertices) {
40
gExt.
check
(
v
);
41
}
42
43
double
phiMin
= std::atan2(-3
_mm
, 15
_mm
);
44
double
phiMax = std::atan2(3
_mm
, 15
_mm
);
45
double
rMin = std::sqrt(15
_mm
* 15
_mm
+ 3
_mm
* 3
_mm
);
46
47
CHECK_CLOSE_ABS
(gExt.
min
(
binX
), 15
_mm
, 1
e
-6);
48
CHECK_CLOSE_ABS
(gExt.
max
(
binX
), 18
_mm
, 1
e
-6);
49
CHECK_CLOSE_ABS
(gExt.
min
(
binY
), -3
_mm
, 1
e
-6);
50
CHECK_CLOSE_ABS
(gExt.
max
(
binY
), 3
_mm
, 1
e
-6);
51
CHECK_CLOSE_ABS
(gExt.
min
(
binZ
), -10
_mm
, 1
e
-6);
52
CHECK_CLOSE_ABS
(gExt.
max
(
binZ
), 10
_mm
, 1
e
-6);
53
CHECK_CLOSE_ABS
(gExt.
min
(
binR
), rMin, 1
e
-6);
54
CHECK_CLOSE_ABS
(gExt.
max
(
binR
), 18
_mm
, 1
e
-6);
55
CHECK_CLOSE_ABS
(gExt.
min
(
binPhi
),
phiMin
, 1
e
-6);
56
CHECK_CLOSE_ABS
(gExt.
max
(
binPhi
), phiMax, 1
e
-6);
57
58
// Create a second Extent
59
Extent
otherExt;
60
otherExt.
extend
(gExt);
61
62
CHECK_CLOSE_ABS
(otherExt.min(
binX
), 15
_mm
, 1
e
-6);
63
CHECK_CLOSE_ABS
(otherExt.max(
binX
), 18
_mm
, 1
e
-6);
64
CHECK_CLOSE_ABS
(otherExt.min(
binY
), -3
_mm
, 1
e
-6);
65
CHECK_CLOSE_ABS
(otherExt.max(
binY
), 3
_mm
, 1
e
-6);
66
CHECK_CLOSE_ABS
(otherExt.min(
binZ
), -10
_mm
, 1
e
-6);
67
CHECK_CLOSE_ABS
(otherExt.max(
binZ
), 10
_mm
, 1
e
-6);
68
CHECK_CLOSE_ABS
(otherExt.min(
binR
), rMin, 1
e
-6);
69
CHECK_CLOSE_ABS
(otherExt.max(
binR
), 18
_mm
, 1
e
-6);
70
CHECK_CLOSE_ABS
(otherExt.min(
binPhi
),
phiMin
, 1
e
-6);
71
CHECK_CLOSE_ABS
(otherExt.max(
binPhi
), phiMax, 1
e
-6);
72
}
73
74
BOOST_AUTO_TEST_SUITE_END()
75
76
}
// namespace Test
77
}
// namespace Acts
acts
blob
master
Tests
UnitTests
Core
Geometry
ExtentTests.cpp
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:26
using
1.8.2 with
ECCE GitHub integration