File indexing completed on 2026-05-21 07:46:20
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 eKaon0Short = 310,
0042 eLambda0 = 3122,
0043 eJPsi = 443,
0044 eB0 = 511,
0045 eBPlus = 521,
0046 eD0 = 421,
0047 eDPlus = 411,
0048 eAntiB0 = -eB0,
0049 eAntiD0 = -eD0,
0050 eNeutrinoE = 12,
0051 eNeutrinoMu = 14,
0052 eNeutrinoTau = 16,
0053 eAntiNeutrinoE = -eNeutrinoE,
0054 eAntiNeutrinoMu = -eNeutrinoMu,
0055 eAntiNeutrinoTau = -eNeutrinoTau
0056 };
0057
0058
0059
0060
0061 static constexpr PdgParticle makeAbsolutePdgParticle(PdgParticle pdg) {
0062 const auto value = static_cast<std::int32_t>(pdg);
0063 return static_cast<PdgParticle>((0 <= value) ? value : -value);
0064 }
0065
0066
0067
0068
0069
0070
0071 static constexpr bool isNucleus(PdgParticle pdg) {
0072 const auto value = static_cast<std::int32_t>(pdg);
0073 return std::abs(value) > 1e9;
0074 }
0075
0076
0077
0078
0079
0080
0081
0082 static constexpr PdgParticle makeNucleusGroundState(PdgParticle pdg) {
0083 if (!isNucleus(pdg)) {
0084 throw std::invalid_argument("PDG must represent a nucleus");
0085 }
0086
0087 const auto value = static_cast<std::int32_t>(pdg);
0088 return static_cast<PdgParticle>((value / 10) * 10);
0089 }
0090
0091
0092
0093
0094
0095
0096
0097
0098 static constexpr std::pair<std::int32_t, std::int32_t> extractNucleusZandA(
0099 PdgParticle pdg) {
0100 if (!isNucleus(pdg)) {
0101 throw std::invalid_argument("PDG must represent a nucleus");
0102 }
0103 const auto value = static_cast<std::int32_t>(pdg);
0104
0105 int Z = (value / 10000) % 1000;
0106
0107 int A = std::abs((value / 10) % 1000);
0108 return std::make_pair(Z, A);
0109 }
0110
0111
0112 enum class HadronType {
0113 Hadron = 1,
0114 BBbarMeson = 2,
0115 CCbarMeson = 3,
0116 BottomMeson = 4,
0117 BottomBaryon = 5,
0118 CharmedMeson = 6,
0119 CharmedBaryon = 7,
0120 StrangeMeson = 8,
0121 StrangeBaryon = 9,
0122 LightMeson = 10,
0123 LightBaryon = 11,
0124 Unknown = 12
0125 };
0126
0127
0128
0129
0130
0131 std::ostream& operator<<(std::ostream& os, HadronType hadron);
0132
0133
0134
0135
0136
0137
0138
0139
0140 PdgParticle parsePdgParticle(const std::string& name);
0141
0142 }