Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-11-05 08:53:35

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 struct ParticleData {
0021   float charge{};
0022   float mass{};
0023   std::string_view name;
0024 };
0025 
0026 /// Find the charge for a given PDG particle number.
0027 /// @param pdg PDG particle number
0028 /// @return Charge in native units.
0029 std::optional<float> findCharge(PdgParticle pdg);
0030 
0031 /// Find the charge for a given PDG particle number of a nucleus.
0032 /// Try its ground state first, and ultimately get the proton number from PDG
0033 /// @param pdg PDG particle number for the nucleus
0034 /// @return Charge in native units.
0035 float findChargeOfNucleus(PdgParticle pdg);
0036 
0037 /// Find the mass for a given PDG particle number.
0038 /// @param pdg PDG particle number
0039 /// @return Mass in native units.
0040 std::optional<float> findMass(PdgParticle pdg);
0041 
0042 /// Find the mass for a given PDG particle number of a nucleus.
0043 /// Try its ground state first, and ultimately get the mass from
0044 /// Bethe-Weizsacker formula
0045 /// @param pdg PDG particle number for the nucleus
0046 /// @return Mass in native units
0047 float findMassOfNucleus(PdgParticle pdg);
0048 
0049 /// Calculate the mass of a nucleus using Bethe-Weizsacker formula
0050 /// Parameters obtained from https://www.actaphys.uj.edu.pl/R/37/6/1833
0051 ///
0052 /// @param pdg PDG particle number for the nucleus
0053 /// @return Mass in native units
0054 float calculateNucleusMass(PdgParticle pdg);
0055 
0056 /// Find a descriptive particle name for a given PDG particle number.
0057 /// @param pdg PDG particle number
0058 /// @return Particle name.
0059 std::optional<std::string_view> findName(PdgParticle pdg);
0060 
0061 /// Find a descriptive particle name for a given PDG particle number of a
0062 /// nucleus. Try to get the name from its ground state.
0063 /// @param pdg PDG particle number for the nucleus
0064 /// @return Particle name.
0065 std::optional<std::string_view> findNameOfNucleus(PdgParticle pdg);
0066 
0067 /// Find all known particle data for a given PDG particle number.
0068 /// @param pdg PDG particle number
0069 /// @return Particle data if found
0070 std::optional<ParticleData> findParticleData(PdgParticle pdg);
0071 
0072 /// Print PDG particle numbers with a descriptive name.
0073 /// @param os Output stream
0074 /// @param pdg PDG particle to output
0075 /// @return Reference to output stream
0076 std::ostream& operator<<(std::ostream& os, PdgParticle pdg);
0077 
0078 /// Get short absolute string representation of PDG particle
0079 /// @param pdg PDG particle number
0080 /// @return Optional string view of particle name
0081 std::optional<std::string_view> pdgToShortAbsString(PdgParticle pdg);
0082 
0083 /// @brief Particle identification based on PDG number
0084 namespace ParticleIdHelper {
0085 
0086 /// @brief Check if the particle is a hadron
0087 /// @param pdg PDG particle number
0088 /// @return True if the particle is a hadron, false otherwise
0089 bool isHadron(PdgParticle pdg);
0090 
0091 /// @brief Check if the particle is a lepton
0092 /// @param pdg PDG particle number
0093 /// @return True if the particle is a lepton, false otherwise
0094 bool isLepton(PdgParticle pdg);
0095 
0096 /// @brief Check if the particle is a muon
0097 /// @param pdg PDG particle number
0098 /// @return True if the particle is a muon, false otherwise
0099 bool isMuon(PdgParticle pdg);
0100 
0101 /// @brief Check if the particle is an electron
0102 /// @param pdg PDG particle number
0103 /// @return True if the particle is an electron, false otherwise
0104 bool isElectron(PdgParticle pdg);
0105 
0106 /// @brief Check if the particle is a photon
0107 /// @param pdg PDG particle number
0108 /// @return True if the particle is a photon, false otherwise
0109 bool isPhoton(PdgParticle pdg);
0110 
0111 /// @brief Check if the particle is a tau
0112 /// @param pdg PDG particle number
0113 /// @return True if the particle is a tau, false otherwise
0114 bool isTau(PdgParticle pdg);
0115 
0116 /// @brief Check if the particle is a quark
0117 /// @param pdg PDG particle number
0118 /// @return True if the particle is a quark, false otherwise
0119 bool isQuark(PdgParticle pdg);
0120 
0121 /// @brief Check if the particle is interacting
0122 /// @param pdg PDG particle number
0123 /// @return True if the particle is interacting, false otherwise
0124 bool isInteracting(PdgParticle pdg);
0125 
0126 HadronType hadronType(PdgParticle pdg);
0127 
0128 }  // namespace ParticleIdHelper
0129 
0130 }  // namespace Acts