Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
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/Definitions/ParticleData.hpp
"
12
#include "
Acts/Definitions/PdgParticle.hpp
"
13
#include "
Acts/Definitions/Units.hpp
"
14
#include "
Acts/Tests/CommonHelpers/FloatComparisons.hpp
"
15
16
#include <cmath>
17
#include <string_view>
18
19
using namespace
Acts;
20
using namespace
Acts::UnitLiterals;
21
22
namespace
{
23
// NOTE: the used mass comparison values are not as exact as the data values
24
static
constexpr
float
eps
= 0.001f;
25
}
// namespace
26
27
BOOST_AUTO_TEST_SUITE(FatrasParticleData)
28
29
BOOST_AUTO_TEST_CASE
(InvalidInput) {
30
BOOST_CHECK(!
findCharge
(
PdgParticle::eInvalid
));
31
BOOST_CHECK(!
findMass
(
PdgParticle::eInvalid
));
32
BOOST_CHECK(!
findName
(
PdgParticle::eInvalid
));
33
}
34
35
BOOST_AUTO_TEST_CASE
(Electron) {
36
BOOST_CHECK_EQUAL(*
findCharge
(
PdgParticle::eAntiElectron
), 1_e);
37
CHECK_CLOSE_REL
(*
findMass
(
PdgParticle::eAntiElectron
), 511_keV,
eps
);
38
BOOST_CHECK_EQUAL(*
findName
(
PdgParticle::eAntiElectron
),
"e+"
);
39
BOOST_CHECK_EQUAL(*
findCharge
(
PdgParticle::eElectron
), -1_e);
40
CHECK_CLOSE_REL
(*
findMass
(
PdgParticle::eElectron
), 511_keV,
eps
);
41
BOOST_CHECK_EQUAL(*
findName
(
PdgParticle::eElectron
),
"e-"
);
42
BOOST_CHECK_EQUAL(*
findCharge
(
PdgParticle::ePositron
), 1_e);
43
CHECK_CLOSE_REL
(*
findMass
(
PdgParticle::ePositron
), 511_keV,
eps
);
44
BOOST_CHECK_EQUAL(*
findName
(
PdgParticle::ePositron
),
"e+"
);
45
}
46
47
BOOST_AUTO_TEST_CASE
(Gamma) {
48
BOOST_CHECK_EQUAL(*
findCharge
(
PdgParticle::eGamma
), 0);
49
BOOST_CHECK_EQUAL(*
findMass
(
PdgParticle::eGamma
), 0);
50
BOOST_CHECK_EQUAL(*
findName
(
PdgParticle::eGamma
),
"gamma"
);
51
}
52
53
BOOST_AUTO_TEST_CASE
(Pion) {
54
BOOST_CHECK_EQUAL(*
findCharge
(
PdgParticle::ePionMinus
), -1_e);
55
CHECK_CLOSE_REL
(*
findMass
(
PdgParticle::ePionMinus
), 139.57_MeV,
eps
);
56
BOOST_CHECK_EQUAL(*
findName
(
PdgParticle::ePionMinus
),
"pi-"
);
57
BOOST_CHECK_EQUAL(*
findCharge
(
PdgParticle::ePionPlus
), 1_e);
58
CHECK_CLOSE_REL
(*
findMass
(
PdgParticle::ePionPlus
), 139.57_MeV,
eps
);
59
BOOST_CHECK_EQUAL(*
findName
(
PdgParticle::ePionPlus
),
"pi+"
);
60
BOOST_CHECK_EQUAL(*
findCharge
(
PdgParticle::ePionZero
), 0);
61
CHECK_CLOSE_REL
(*
findMass
(
PdgParticle::ePionZero
), 134.98_MeV,
eps
);
62
BOOST_CHECK_EQUAL(*
findName
(
PdgParticle::ePionZero
),
"pi0"
);
63
}
64
65
BOOST_AUTO_TEST_SUITE_END()
acts
blob
sPHENIX
Tests
UnitTests
Core
Utilities
ParticleDataTests.cpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:45
using
1.8.2 with
sPHENIX GitHub integration