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