File indexing completed on 2025-12-16 09:22:14
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include <cmath>
0012 #include <cstdint>
0013 #include <iosfwd>
0014 #include <stdexcept>
0015 #include <string>
0016 #include <utility>
0017
0018 namespace Acts {
0019
0020
0021 enum PdgParticle : std::int32_t {
0022 eInvalid = 0,
0023 eElectron = 11,
0024 eAntiElectron = -eElectron,
0025 ePositron = -eElectron,
0026 eMuon = 13,
0027 eAntiMuon = -eMuon,
0028 eTau = 15,
0029 eAntiTau = -eTau,
0030 eGamma = 22,
0031 ePionZero = 111,
0032 ePionPlus = 211,
0033 ePionMinus = -ePionPlus,
0034 eKaonPlus = 321,
0035 eKaonMinus = -eKaonPlus,
0036 eNeutron = 2112,
0037 eAntiNeutron = -eNeutron,
0038 eProton = 2212,
0039 eAntiProton = -eProton,
0040 eLead = 1000822080,
0041 eJPsi = 443,
0042 eB0 = 511,
0043 eBPlus = 521,
0044 eD0 = 421,
0045 eDPlus = 411,
0046 eAntiB0 = -eB0,
0047 eAntiD0 = -eD0,
0048 eNeutrinoE = 12,
0049 eNeutrinoMu = 14,
0050 eNeutrinoTau = 16,
0051 eAntiNeutrinoE = -eNeutrinoE,
0052 eAntiNeutrinoMu = -eNeutrinoMu,
0053 eAntiNeutrinoTau = -eNeutrinoTau
0054 };
0055
0056
0057 static constexpr PdgParticle makeAbsolutePdgParticle(PdgParticle pdg) {
0058 const auto value = static_cast<std::int32_t>(pdg);
0059 return static_cast<PdgParticle>((0 <= value) ? value : -value);
0060 }
0061
0062
0063
0064
0065 static constexpr bool isNucleus(PdgParticle pdg) {
0066 const auto value = static_cast<std::int32_t>(pdg);
0067 return std::abs(value) > 1e9;
0068 }
0069
0070
0071
0072
0073
0074 static constexpr PdgParticle makeNucleusGroundState(PdgParticle pdg) {
0075 if (!isNucleus(pdg)) {
0076 throw std::invalid_argument("PDG must represent a nucleus");
0077 }
0078
0079 const auto value = static_cast<std::int32_t>(pdg);
0080 return static_cast<PdgParticle>((value / 10) * 10);
0081 }
0082
0083
0084
0085
0086
0087
0088 static constexpr std::pair<std::int32_t, std::int32_t> extractNucleusZandA(
0089 PdgParticle pdg) {
0090 if (!isNucleus(pdg)) {
0091 throw std::invalid_argument("PDG must represent a nucleus");
0092 }
0093 const auto value = static_cast<std::int32_t>(pdg);
0094
0095 int Z = (value / 10000) % 1000;
0096
0097 int A = std::abs((value / 10) % 1000);
0098 return std::make_pair(Z, A);
0099 }
0100
0101
0102 enum class HadronType {
0103 Hadron = 1,
0104 BBbarMeson = 2,
0105 CCbarMeson = 3,
0106 BottomMeson = 4,
0107 BottomBaryon = 5,
0108 CharmedMeson = 6,
0109 CharmedBaryon = 7,
0110 StrangeMeson = 8,
0111 StrangeBaryon = 9,
0112 LightMeson = 10,
0113 LightBaryon = 11,
0114 Unknown = 12
0115 };
0116
0117 std::ostream& operator<<(std::ostream& os, HadronType hadron);
0118
0119
0120
0121
0122
0123
0124
0125
0126 PdgParticle parsePdgParticle(const std::string& name);
0127
0128 }