ECCE @ EIC Software
 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 
12 #include "Acts/Utilities/Units.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.0f);
29  BOOST_TEST(findName(PdgParticle::eInvalid).empty());
30 }
31 
33  BOOST_TEST(findCharge(PdgParticle::eAntiElectron) == 1_e);
35  BOOST_TEST(findName(PdgParticle::eAntiElectron) == "e+");
36  BOOST_TEST(findCharge(PdgParticle::eElectron) == -1_e);
38  BOOST_TEST(findName(PdgParticle::eElectron) == "e-");
39  BOOST_TEST(findCharge(PdgParticle::ePositron) == 1_e);
41  BOOST_TEST(findName(PdgParticle::ePositron) == "e+");
42 }
43 
45  BOOST_TEST(findCharge(PdgParticle::eGamma) == 0);
46  BOOST_TEST(findMass(PdgParticle::eGamma) == 0);
47  BOOST_TEST(findName(PdgParticle::eGamma) == "gamma");
48 }
49 
51  BOOST_TEST(findCharge(PdgParticle::ePionMinus) == -1_e);
53  BOOST_TEST(findName(PdgParticle::ePionMinus) == "pi-");
54  BOOST_TEST(findCharge(PdgParticle::ePionPlus) == 1_e);
56  BOOST_TEST(findName(PdgParticle::ePionPlus) == "pi+");
57  BOOST_TEST(findCharge(PdgParticle::ePionZero) == 0);
59  BOOST_TEST(findName(PdgParticle::ePionZero) == "pi0");
60 }
61 
62 BOOST_AUTO_TEST_SUITE_END()