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
KinematicCastsTests.cpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file KinematicCastsTests.cpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2018-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/unit_test.hpp>
10
11
#include "
Acts/Tests/CommonHelpers/FloatComparisons.hpp
"
12
#include "
ActsFatras/Selectors/KinematicCasts.hpp
"
13
14
#include <limits>
15
16
#include "
Dataset.hpp
"
17
18
using namespace
Acts::UnitLiterals;
19
using namespace
ActsFatras::Casts;
20
21
namespace
{
22
// TODO why does this have to be so high to avoid failure in eta tests?
23
constexpr
auto
eps
= 128 *
std::numeric_limits<double>::epsilon
();
24
}
// namespace
25
26
BOOST_AUTO_TEST_SUITE(FatrasKinematicCasts)
27
28
BOOST_AUTO_TEST_CASE
(BackwardParticle) {
29
const
auto
&
particle
=
Dataset::backwardPion
;
30
31
CHECK_SMALL
(
Vrho
()(
particle
),
eps
);
32
CHECK_CLOSE_REL
(
Vz
()(
particle
), -100_mm,
eps
);
33
CHECK_CLOSE_REL
(
AbsVz
()(
particle
), 100_mm,
eps
);
34
CHECK_CLOSE_REL
(
Eta
()(
particle
), -4.5,
eps
);
35
CHECK_CLOSE_REL
(
AbsEta
()(
particle
), 4.5,
eps
);
36
CHECK_CLOSE_REL
(
Pt
()(
particle
), 1.5_GeV / std::cosh(4.5),
eps
);
37
CHECK_CLOSE_REL
(
P
()(
particle
), 1.5_GeV,
eps
);
38
// allow higher threshold to allow for potential mass term differences
39
CHECK_CLOSE_REL
(
E
()(
particle
), std::hypot(1.5_GeV, 139.57018_MeV), 1
e
-7);
40
}
41
42
BOOST_AUTO_TEST_CASE
(CentralParticle) {
43
const
auto
&
particle
=
Dataset::centralPion
;
44
45
CHECK_SMALL
(
Vrho
()(
particle
),
eps
);
46
CHECK_SMALL
(
Vz
()(
particle
),
eps
);
47
CHECK_SMALL
(
AbsVz
()(
particle
),
eps
);
48
CHECK_SMALL
(
Eta
()(
particle
),
eps
);
49
CHECK_SMALL
(
AbsEta
()(
particle
),
eps
);
50
CHECK_CLOSE_REL
(
Pt
()(
particle
), 1.5_GeV,
eps
);
51
CHECK_CLOSE_REL
(
P
()(
particle
), 1.5_GeV,
eps
);
52
// allow higher threshold to allow for potential mass term differences
53
CHECK_CLOSE_REL
(
E
()(
particle
), std::hypot(1.5_GeV, 139.57018_MeV), 1
e
-7);
54
}
55
56
BOOST_AUTO_TEST_CASE
(ForwardParticle) {
57
const
auto
&
particle
=
Dataset::forwardPion
;
58
59
CHECK_SMALL
(
Vrho
()(
particle
),
eps
);
60
CHECK_CLOSE_REL
(
Vz
()(
particle
), 100_mm,
eps
);
61
CHECK_CLOSE_REL
(
AbsVz
()(
particle
), 100_mm,
eps
);
62
CHECK_CLOSE_REL
(
Eta
()(
particle
), 4.5,
eps
);
63
CHECK_CLOSE_REL
(
AbsEta
()(
particle
), 4.5,
eps
);
64
CHECK_CLOSE_REL
(
Pt
()(
particle
), 1.5_GeV / std::cosh(4.5),
eps
);
65
CHECK_CLOSE_REL
(
P
()(
particle
), 1.5_GeV,
eps
);
66
// allow higher threshold to allow for potential mass term differences
67
CHECK_CLOSE_REL
(
E
()(
particle
), std::hypot(1.5_GeV, 139.57018_MeV), 1
e
-7);
68
}
69
70
BOOST_AUTO_TEST_SUITE_END()
acts
blob
sPHENIX
Tests
UnitTests
Fatras
Selectors
KinematicCastsTests.cpp
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:28
using
1.8.2 with
EIC GitHub integration