OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
ParticleProperties.cpp
Go to the documentation of this file.
1//
2// Class ParticleProperties
3// Base class for representing particle properties
4//
5// Copyright (c) 2021, Pedro Calvo, CIEMAT, Spain
6// All rights reserved
7//
8// This file is part of OPAL.
9//
10// OPAL is free software: you can redistribute it and/or modify
11// it under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// You should have received a copy of the GNU General Public License
16// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
17//
19#include "Physics/Physics.h"
20
21#include <boost/assign.hpp>
22
23
25 auto it = bmParticleType_s.right.find(str);
26 if (it != bmParticleType_s.right.end()) {
27 return it->second;
28 } else {
30 }
31}
32
34 return bmParticleType_s.left.at(type);
35}
36
38 return particleMass_m.at(type);
39}
40
42 return particleCharge_m.at(type);
43}
44
47}
48
49const boost::bimap<ParticleType, std::string> ParticleProperties::bmParticleType_s =
50 boost::assign::list_of<const boost::bimap<ParticleType, std::string>::relation>
51 (ParticleType::UNNAMED, "UNNAMED")
52 (ParticleType::ELECTRON, "ELECTRON")
53 (ParticleType::POSITRON, "POSITRON")
54 (ParticleType::MUON, "MUON")
55 (ParticleType::PROTON, "PROTON")
56 (ParticleType::ANTIPROTON, "ANTIPROTON")
57 (ParticleType::DEUTERON, "DEUTERON")
58 (ParticleType::HMINUS, "HMINUS")
59 (ParticleType::HYDROGEN, "HYDROGEN")
60 (ParticleType::H2P, "H2P")
61 (ParticleType::H3P, "H3P")
62 (ParticleType::ALPHA, "ALPHA")
63 (ParticleType::CARBON, "CARBON")
64 (ParticleType::XENON, "XENON")
65 (ParticleType::URANIUM, "URANIUM");
66
67const std::map<ParticleType, double> ParticleProperties::particleMass_m = {
82};
83
84const std::map<ParticleType, double> ParticleProperties::particleCharge_m = {
87 {ParticleType::MUON, -1.0},
93 {ParticleType::H2P, 1.0},
94 {ParticleType::H3P, 1.0},
97 {ParticleType::XENON, 54.0},
99};
ParticleType
constexpr double m_xe
The xenon-129 (fully-stripped) rest mass in GeV.
Definition: Physics.h:120
constexpr double m_alpha
The alpha particle rest mass in GeV.
Definition: Physics.h:123
constexpr double m_u
The uranium-238 (fully-stripped) rest mass in GeV.
Definition: Physics.h:111
constexpr double m_p
The proton rest mass in GeV.
Definition: Physics.h:90
constexpr double m_h3p
The H3+ rest mass in GeV.
Definition: Physics.h:132
constexpr double m_h2p
The H2+ rest mass in GeV.
Definition: Physics.h:129
constexpr double q_e
The elementary charge in As.
Definition: Physics.h:69
constexpr double m_e
The electron rest mass in GeV.
Definition: Physics.h:78
constexpr double m_hm
The H- rest mass in GeV.
Definition: Physics.h:108
constexpr double m_h
The hydrogen atom rest mass in GeV.
Definition: Physics.h:126
constexpr double m_mu
The muon rest mass in GeV.
Definition: Physics.h:114
constexpr double m_c
The carbon-12 (fully-stripped) rest mass in GeV.
Definition: Physics.h:105
constexpr double m_d
The deuteron rest mass in GeV.
Definition: Physics.h:117
boost::function< boost::tuple< double, bool >(arguments_t)> type
Definition: function.hpp:21
static std::string getParticleTypeString(const ParticleType &type)
static const boost::bimap< ParticleType, std::string > bmParticleType_s
static double getParticleMass(const ParticleType &type)
static const std::map< ParticleType, double > particleCharge_m
static double getParticleCharge(const ParticleType &type)
static const std::map< ParticleType, double > particleMass_m
static double getParticleChargeInCoulomb(const ParticleType &type)
static ParticleType getParticleType(const std::string &str)