EIC Software
Reference for
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
TransformFreeToBoundTests.cpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file TransformFreeToBoundTests.cpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2020 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/unit_test.hpp>
11
12
#include "
Acts/EventData/detail/TransformationFreeToBound.hpp
"
13
#include "
Acts/Tests/CommonHelpers/FloatComparisons.hpp
"
14
#include "
Acts/Utilities/UnitVectors.hpp
"
15
#include "
Acts/Utilities/Units.hpp
"
16
17
#include <cmath>
18
#include <limits>
19
20
#include "
TrackParametersDatasets.hpp
"
21
22
using namespace
Acts;
23
using namespace
Acts::UnitLiterals;
24
25
namespace
{
26
constexpr
auto
eps
=
std::numeric_limits<BoundScalar>::epsilon
();
27
}
28
29
BOOST_AUTO_TEST_SUITE(TransformFreeToBound)
30
31
BOOST_DATA_TEST_CASE
(
32
GlobalToBoundTrackParameters,
33
surfaces* posSymmetric* posSymmetric* ts* phis* thetas*
ps
* qsNonZero,
34
surface
, l0, l1,
time
, phiInput,
theta
,
p
, q) {
35
// phi is ill-defined in forward/backward tracks
36
const
auto
phi
= ((0 <
theta
) and (theta <
M_PI
)) ? phiInput : 0.0;
37
const
auto
qOverP = q /
p
;
38
39
GeometryContext
geoCtx
;
40
Vector2D
loc(l0, l1);
41
Vector3D
dir =
makeDirectionUnitFromPhiTheta
(
phi
, theta);
42
// transform reference position
43
Vector3D
pos
= surface->localToGlobal(geoCtx, loc, dir);
44
45
// convert free parameters to bound parameters
46
{
47
BOOST_TEST_INFO(
"Transform free parameters vector onto surface "
48
<< surface->name());
49
50
FreeVector
fv
= FreeVector::Zero();
51
fv[
eFreePos0
] = pos[
ePos0
];
52
fv[
eFreePos1
] = pos[
ePos1
];
53
fv[
eFreePos2
] = pos[
ePos2
];
54
fv[
eFreeTime
] =
time
;
55
fv[
eFreeDir0
] = dir[
eMom0
];
56
fv[
eFreeDir1
] = dir[
eMom1
];
57
fv[
eFreeDir2
] = dir[
eMom2
];
58
fv[
eFreeQOverP
] = qOverP;
59
BoundVector
bv =
60
detail::transformFreeToBoundParameters
(fv, *surface, geoCtx);
61
CHECK_CLOSE_OR_SMALL
(bv[
eBoundLoc0
], l0,
eps
,
eps
);
62
CHECK_CLOSE_OR_SMALL
(bv[
eBoundLoc1
], l1,
eps
,
eps
);
63
CHECK_CLOSE_OR_SMALL
(bv[
eBoundTime
], time,
eps
,
eps
);
64
CHECK_CLOSE_OR_SMALL
(bv[
eBoundPhi
],
phi
,
eps
,
eps
);
65
CHECK_CLOSE_OR_SMALL
(bv[
eBoundTheta
], theta,
eps
,
eps
);
66
CHECK_CLOSE_OR_SMALL
(bv[
eBoundQOverP
], qOverP,
eps
,
eps
);
67
}
68
// convert separate components to bound parameters
69
{
70
BOOST_TEST_INFO(
"Transform free parameters components onto surface "
71
<< surface->name());
72
73
BoundVector
bv =
detail::transformFreeToBoundParameters
(
74
pos, time, dir, qOverP, *surface, geoCtx);
75
CHECK_CLOSE_OR_SMALL
(bv[
eBoundLoc0
], l0,
eps
,
eps
);
76
CHECK_CLOSE_OR_SMALL
(bv[
eBoundLoc1
], l1,
eps
,
eps
);
77
CHECK_CLOSE_OR_SMALL
(bv[
eBoundTime
], time,
eps
,
eps
);
78
CHECK_CLOSE_OR_SMALL
(bv[
eBoundPhi
],
phi
,
eps
,
eps
);
79
CHECK_CLOSE_OR_SMALL
(bv[
eBoundTheta
], theta,
eps
,
eps
);
80
CHECK_CLOSE_OR_SMALL
(bv[
eBoundQOverP
], qOverP,
eps
,
eps
);
81
}
82
}
83
84
BOOST_DATA_TEST_CASE
(GlobalToCurvilinearParameters,
85
ts* phis* thetas*
ps
* qsNonZero,
time
, phiInput,
theta
,
p
,
86
q) {
87
// phi is ill-defined in forward/backward tracks
88
const
auto
phi
= ((0 <
theta
) and (
theta
<
M_PI
)) ? phiInput : 0.0;
89
const
auto
qOverP = q /
p
;
90
91
GeometryContext
geoCtx
;
92
Vector3D
dir =
makeDirectionUnitFromPhiTheta
(
phi
,
theta
);
93
94
// convert w/ direction
95
{
96
BoundVector
bv =
97
detail::transformFreeToCurvilinearParameters
(
time
, dir, qOverP);
98
CHECK_SMALL
(bv[
eBoundLoc0
],
eps
);
99
CHECK_SMALL
(bv[
eBoundLoc1
],
eps
);
100
CHECK_CLOSE_OR_SMALL
(bv[
eBoundTime
],
time
,
eps
,
eps
);
101
CHECK_CLOSE_OR_SMALL
(bv[
eBoundPhi
],
phi
,
eps
,
eps
);
102
CHECK_CLOSE_OR_SMALL
(bv[
eBoundTheta
],
theta
,
eps
,
eps
);
103
CHECK_CLOSE_OR_SMALL
(bv[
eBoundQOverP
], qOverP,
eps
,
eps
);
104
}
105
// convert w/ angles
106
{
107
BoundVector
bv =
108
detail::transformFreeToCurvilinearParameters
(
time
,
phi
,
theta
, qOverP);
109
CHECK_SMALL
(bv[
eBoundLoc0
],
eps
);
110
CHECK_SMALL
(bv[
eBoundLoc1
],
eps
);
111
CHECK_CLOSE_OR_SMALL
(bv[
eBoundTime
],
time
,
eps
,
eps
);
112
CHECK_CLOSE_OR_SMALL
(bv[
eBoundPhi
],
phi
,
eps
,
eps
);
113
CHECK_CLOSE_OR_SMALL
(bv[
eBoundTheta
],
theta
,
eps
,
eps
);
114
CHECK_CLOSE_OR_SMALL
(bv[
eBoundQOverP
], qOverP,
eps
,
eps
);
115
}
116
}
117
118
BOOST_AUTO_TEST_SUITE_END()
acts
blob
sPHENIX
Tests
UnitTests
Core
EventData
TransformFreeToBoundTests.cpp
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:26
using
1.8.2 with
EIC GitHub integration