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_CHECK(std::isnan(findCharge(PdgParticle::eInvalid)));
28  BOOST_CHECK_EQUAL(findMass(PdgParticle::eInvalid), 0.0f);
29  BOOST_CHECK(findName(PdgParticle::eInvalid).empty());
30 }
31 
33  BOOST_CHECK_EQUAL(findCharge(PdgParticle::eAntiElectron), 1_e);
35  BOOST_CHECK_EQUAL(findName(PdgParticle::eAntiElectron), "e+");
36  BOOST_CHECK_EQUAL(findCharge(PdgParticle::eElectron), -1_e);
38  BOOST_CHECK_EQUAL(findName(PdgParticle::eElectron), "e-");
39  BOOST_CHECK_EQUAL(findCharge(PdgParticle::ePositron), 1_e);
41  BOOST_CHECK_EQUAL(findName(PdgParticle::ePositron), "e+");
42 }
43 
45  BOOST_CHECK_EQUAL(findCharge(PdgParticle::eGamma), 0);
46  BOOST_CHECK_EQUAL(findMass(PdgParticle::eGamma), 0);
47  BOOST_CHECK_EQUAL(findName(PdgParticle::eGamma), "gamma");
48 }
49 
51  BOOST_CHECK_EQUAL(findCharge(PdgParticle::ePionMinus), -1_e);
53  BOOST_CHECK_EQUAL(findName(PdgParticle::ePionMinus), "pi-");
54  BOOST_CHECK_EQUAL(findCharge(PdgParticle::ePionPlus), 1_e);
56  BOOST_CHECK_EQUAL(findName(PdgParticle::ePionPlus), "pi+");
57  BOOST_CHECK_EQUAL(findCharge(PdgParticle::ePionZero), 0);
59  BOOST_CHECK_EQUAL(findName(PdgParticle::ePionZero), "pi0");
60 }
61 
62 BOOST_AUTO_TEST_SUITE_END()