Analysis Software
Documentation for sPHENIX simulation 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 
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 
36  BOOST_CHECK_EQUAL(*findCharge(PdgParticle::eAntiElectron), 1_e);
38  BOOST_CHECK_EQUAL(*findName(PdgParticle::eAntiElectron), "e+");
39  BOOST_CHECK_EQUAL(*findCharge(PdgParticle::eElectron), -1_e);
41  BOOST_CHECK_EQUAL(*findName(PdgParticle::eElectron), "e-");
42  BOOST_CHECK_EQUAL(*findCharge(PdgParticle::ePositron), 1_e);
44  BOOST_CHECK_EQUAL(*findName(PdgParticle::ePositron), "e+");
45 }
46 
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 
54  BOOST_CHECK_EQUAL(*findCharge(PdgParticle::ePionMinus), -1_e);
56  BOOST_CHECK_EQUAL(*findName(PdgParticle::ePionMinus), "pi-");
57  BOOST_CHECK_EQUAL(*findCharge(PdgParticle::ePionPlus), 1_e);
59  BOOST_CHECK_EQUAL(*findName(PdgParticle::ePionPlus), "pi+");
60  BOOST_CHECK_EQUAL(*findCharge(PdgParticle::ePionZero), 0);
62  BOOST_CHECK_EQUAL(*findName(PdgParticle::ePionZero), "pi0");
63 }
64 
65 BOOST_AUTO_TEST_SUITE_END()