Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-19 07:33:43

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Definitions/PdgParticle.hpp"
0012 #include "Acts/Definitions/Units.hpp"
0013 
0014 #include <iosfwd>
0015 #include <optional>
0016 #include <string_view>
0017 
0018 namespace Acts {
0019 
0020 /// Lightweight particle properties description.
0021 struct ParticleData {
0022   float charge{};         ///< Particle electric charge
0023   float mass{};           ///< Particle mass
0024   std::string_view name;  ///< Particle name
0025 };
0026 
0027 /// Find the charge for a given PDG particle number.
0028 /// @param pdg PDG particle number
0029 /// @return Charge in native units.
0030 std::optional<float> findCharge(PdgParticle pdg);
0031 
0032 /// Find the charge for a given PDG particle number of a nucleus.
0033 /// Try its ground state first, and ultimately get the proton number from PDG
0034 /// @param pdg PDG particle number for the nucleus
0035 /// @return Charge in native units.
0036 float findChargeOfNucleus(PdgParticle pdg);
0037 
0038 /// Find the mass for a given PDG particle number.
0039 /// @param pdg PDG particle number
0040 /// @return Mass in native units.
0041 std::optional<float> findMass(PdgParticle pdg);
0042 
0043 /// Find the mass for a given PDG particle number of a nucleus.
0044 /// Try its ground state first, and ultimately get the mass from
0045 /// Bethe-Weizsacker formula
0046 /// @param pdg PDG particle number for the nucleus
0047 /// @return Mass in native units
0048 float findMassOfNucleus(PdgParticle pdg);
0049 
0050 /// Calculate the mass of a nucleus using Bethe-Weizsacker formula
0051 /// Parameters obtained from
0052 /// https://www.actaphys.uj.edu.pl/index_n.php?I=R&V=37&N=6#1833
0053 ///
0054 /// @param pdg PDG particle number for the nucleus
0055 /// @return Mass in native units
0056 float calculateNucleusMass(PdgParticle pdg);
0057 
0058 /// Find a descriptive particle name for a given PDG particle number.
0059 /// @param pdg PDG particle number
0060 /// @return Particle name.
0061 std::optional<std::string_view> findName(PdgParticle pdg);
0062 
0063 /// Find a descriptive particle name for a given PDG particle number of a
0064 /// nucleus. Try to get the name from its ground state.
0065 /// @param pdg PDG particle number for the nucleus
0066 /// @return Particle name.
0067 std::optional<std::string_view> findNameOfNucleus(PdgParticle pdg);
0068 
0069 /// Find all known particle data for a given PDG particle number.
0070 /// @param pdg PDG particle number
0071 /// @return Particle data if found
0072 std::optional<ParticleData> findParticleData(PdgParticle pdg);
0073 
0074 /// Print PDG particle numbers with a descriptive name.
0075 /// @param os Output stream
0076 /// @param pdg PDG particle to output
0077 /// @return Reference to output stream
0078 std::ostream& operator<<(std::ostream& os, PdgParticle pdg);
0079 
0080 /// Get short absolute string representation of PDG particle
0081 /// @param pdg PDG particle number
0082 /// @return Optional string view of particle name
0083 std::optional<std::string_view> pdgToShortAbsString(PdgParticle pdg);
0084 
0085 /// @brief Particle identification based on PDG number
0086 namespace ParticleIdHelper {
0087 
0088 /// @brief Check if the particle is a hadron
0089 /// @param pdg PDG particle number
0090 /// @return True if the particle is a hadron, false otherwise
0091 bool isHadron(PdgParticle pdg);
0092 
0093 /// @brief Check if the particle is a lepton
0094 /// @param pdg PDG particle number
0095 /// @return True if the particle is a lepton, false otherwise
0096 bool isLepton(PdgParticle pdg);
0097 
0098 /// @brief Check if the particle is a muon
0099 /// @param pdg PDG particle number
0100 /// @return True if the particle is a muon, false otherwise
0101 bool isMuon(PdgParticle pdg);
0102 
0103 /// @brief Check if the particle is an electron
0104 /// @param pdg PDG particle number
0105 /// @return True if the particle is an electron, false otherwise
0106 bool isElectron(PdgParticle pdg);
0107 
0108 /// @brief Check if the particle is a photon
0109 /// @param pdg PDG particle number
0110 /// @return True if the particle is a photon, false otherwise
0111 bool isPhoton(PdgParticle pdg);
0112 
0113 /// @brief Check if the particle is a tau
0114 /// @param pdg PDG particle number
0115 /// @return True if the particle is a tau, false otherwise
0116 bool isTau(PdgParticle pdg);
0117 
0118 /// @brief Check if the particle is a quark
0119 /// @param pdg PDG particle number
0120 /// @return True if the particle is a quark, false otherwise
0121 bool isQuark(PdgParticle pdg);
0122 
0123 /// @brief Check if the particle is interacting
0124 /// @param pdg PDG particle number
0125 /// @return True if the particle is interacting, false otherwise
0126 bool isInteracting(PdgParticle pdg);
0127 
0128 /// @brief Get hadron type classification
0129 /// @param pdg PDG particle number
0130 /// @return Hadron type
0131 HadronType hadronType(PdgParticle pdg);
0132 
0133 }  // namespace ParticleIdHelper
0134 
0135 }  // namespace Acts