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
ParticleDataTests.cpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file ParticleDataTests.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 "
Acts/Utilities/Units.hpp
"
13
#include "
ActsFatras/Utilities/ParticleData.hpp
"
14
15
using
Acts::PdgParticle
;
16
using namespace
Acts::UnitLiterals;
17
using namespace
ActsFatras;
18
19
namespace
{
20
// NOTE: the used mass comparison values are not as exact as the data values
21
static
constexpr
float
eps
= 0.001f;
22
}
// namespace
23
24
BOOST_AUTO_TEST_SUITE(FatrasParticleData)
25
26
BOOST_AUTO_TEST_CASE
(InvalidInput) {
27
BOOST_TEST(std::isnan(
findCharge
(
PdgParticle::eInvalid
)));
28
BOOST_TEST(
findMass
(
PdgParticle::eInvalid
) == 0.0
f
);
29
BOOST_TEST(
findName
(
PdgParticle::eInvalid
).empty());
30
}
31
32
BOOST_AUTO_TEST_CASE
(Electron) {
33
BOOST_TEST(
findCharge
(
PdgParticle::eAntiElectron
) == 1
_e
);
34
CHECK_CLOSE_REL
(
findMass
(
PdgParticle::eAntiElectron
), 511
_keV
,
eps
);
35
BOOST_TEST(
findName
(
PdgParticle::eAntiElectron
) ==
"e+"
);
36
BOOST_TEST(
findCharge
(
PdgParticle::eElectron
) == -1
_e
);
37
CHECK_CLOSE_REL
(
findMass
(
PdgParticle::eElectron
), 511
_keV
,
eps
);
38
BOOST_TEST(
findName
(
PdgParticle::eElectron
) ==
"e-"
);
39
BOOST_TEST(
findCharge
(
PdgParticle::ePositron
) == 1
_e
);
40
CHECK_CLOSE_REL
(
findMass
(
PdgParticle::ePositron
), 511
_keV
,
eps
);
41
BOOST_TEST(
findName
(
PdgParticle::ePositron
) ==
"e+"
);
42
}
43
44
BOOST_AUTO_TEST_CASE
(Gamma) {
45
BOOST_TEST(
findCharge
(
PdgParticle::eGamma
) == 0);
46
BOOST_TEST(
findMass
(
PdgParticle::eGamma
) == 0);
47
BOOST_TEST(
findName
(
PdgParticle::eGamma
) ==
"gamma"
);
48
}
49
50
BOOST_AUTO_TEST_CASE
(Pion) {
51
BOOST_TEST(
findCharge
(
PdgParticle::ePionMinus
) == -1
_e
);
52
CHECK_CLOSE_REL
(
findMass
(
PdgParticle::ePionMinus
), 139.57
_MeV
,
eps
);
53
BOOST_TEST(
findName
(
PdgParticle::ePionMinus
) ==
"pi-"
);
54
BOOST_TEST(
findCharge
(
PdgParticle::ePionPlus
) == 1
_e
);
55
CHECK_CLOSE_REL
(
findMass
(
PdgParticle::ePionPlus
), 139.57
_MeV
,
eps
);
56
BOOST_TEST(
findName
(
PdgParticle::ePionPlus
) ==
"pi+"
);
57
BOOST_TEST(
findCharge
(
PdgParticle::ePionZero
) == 0);
58
CHECK_CLOSE_REL
(
findMass
(
PdgParticle::ePionZero
), 134.98
_MeV
,
eps
);
59
BOOST_TEST(
findName
(
PdgParticle::ePionZero
) ==
"pi0"
);
60
}
61
62
BOOST_AUTO_TEST_SUITE_END()
acts
blob
master
Tests
UnitTests
Fatras
Utilities
ParticleDataTests.cpp
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:27
using
1.8.2 with
ECCE GitHub integration