File indexing completed on 2025-01-18 09:12:59
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/unit_test.hpp>
0010
0011 #include "Acts/Definitions/ParticleData.hpp"
0012 #include "Acts/Definitions/PdgParticle.hpp"
0013 #include "Acts/Definitions/Units.hpp"
0014 #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp"
0015
0016 #include <cmath>
0017 #include <string_view>
0018
0019 using namespace Acts;
0020 using namespace Acts::UnitLiterals;
0021
0022 namespace {
0023
0024 static constexpr float eps = 0.001f;
0025 }
0026
0027 BOOST_AUTO_TEST_SUITE(FatrasParticleData)
0028
0029 BOOST_AUTO_TEST_CASE(InvalidInput) {
0030 BOOST_CHECK(!findCharge(PdgParticle::eInvalid));
0031 BOOST_CHECK(!findMass(PdgParticle::eInvalid));
0032 BOOST_CHECK(!findName(PdgParticle::eInvalid));
0033 }
0034
0035 BOOST_AUTO_TEST_CASE(Electron) {
0036 BOOST_CHECK_EQUAL(*findCharge(PdgParticle::eAntiElectron), 1_e);
0037 CHECK_CLOSE_REL(*findMass(PdgParticle::eAntiElectron), 511_keV, eps);
0038 BOOST_CHECK_EQUAL(*findName(PdgParticle::eAntiElectron), "e+");
0039 BOOST_CHECK_EQUAL(*findCharge(PdgParticle::eElectron), -1_e);
0040 CHECK_CLOSE_REL(*findMass(PdgParticle::eElectron), 511_keV, eps);
0041 BOOST_CHECK_EQUAL(*findName(PdgParticle::eElectron), "e-");
0042 BOOST_CHECK_EQUAL(*findCharge(PdgParticle::ePositron), 1_e);
0043 CHECK_CLOSE_REL(*findMass(PdgParticle::ePositron), 511_keV, eps);
0044 BOOST_CHECK_EQUAL(*findName(PdgParticle::ePositron), "e+");
0045 }
0046
0047 BOOST_AUTO_TEST_CASE(Gamma) {
0048 BOOST_CHECK_EQUAL(*findCharge(PdgParticle::eGamma), 0);
0049 BOOST_CHECK_EQUAL(*findMass(PdgParticle::eGamma), 0);
0050 BOOST_CHECK_EQUAL(*findName(PdgParticle::eGamma), "gamma");
0051 }
0052
0053 BOOST_AUTO_TEST_CASE(Pion) {
0054 BOOST_CHECK_EQUAL(*findCharge(PdgParticle::ePionMinus), -1_e);
0055 CHECK_CLOSE_REL(*findMass(PdgParticle::ePionMinus), 139.57_MeV, eps);
0056 BOOST_CHECK_EQUAL(*findName(PdgParticle::ePionMinus), "pi-");
0057 BOOST_CHECK_EQUAL(*findCharge(PdgParticle::ePionPlus), 1_e);
0058 CHECK_CLOSE_REL(*findMass(PdgParticle::ePionPlus), 139.57_MeV, eps);
0059 BOOST_CHECK_EQUAL(*findName(PdgParticle::ePionPlus), "pi+");
0060 BOOST_CHECK_EQUAL(*findCharge(PdgParticle::ePionZero), 0);
0061 CHECK_CLOSE_REL(*findMass(PdgParticle::ePionZero), 134.98_MeV, eps);
0062 BOOST_CHECK_EQUAL(*findName(PdgParticle::ePionZero), "pi0");
0063 }
0064
0065 BOOST_AUTO_TEST_SUITE_END()