OPAL (Object Oriented Parallel Accelerator Library)  2024.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 {
29  return ParticleType::UNNAMED;
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 
46  return getParticleCharge(type) * Physics::q_e;
47 }
48 
49 const 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 
67 const std::map<ParticleType, double> ParticleProperties::particleMass_m = {
82 };
83 
84 const std::map<ParticleType, double> ParticleProperties::particleCharge_m = {
85  {ParticleType::ELECTRON, -1.0},
87  {ParticleType::MUON, -1.0},
88  {ParticleType::PROTON, 1.0},
91  {ParticleType::HMINUS, -1.0},
93  {ParticleType::H2P, 1.0},
94  {ParticleType::H3P, 1.0},
95  {ParticleType::ALPHA, 2.0},
96  {ParticleType::CARBON, 6.0},
97  {ParticleType::XENON, 54.0},
98  {ParticleType::URANIUM, 92.0}
99 };
constexpr double m_h3p
The H3+ rest mass in GeV.
Definition: Physics.h:132
static ParticleType getParticleType(const std::string &str)
static const std::map< ParticleType, double > particleMass_m
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two distribute and or modify the software for each author s protection and we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed we want its recipients to know that what they have is not the so that any problems introduced by others will not reflect on the original authors reputations any free program is threatened constantly by software patents We wish to avoid the danger that redistributors of a free program will individually obtain patent in effect making the program proprietary To prevent we have made it clear that any patent must be licensed for everyone s free use or not licensed at all The precise terms and conditions for distribution and modification follow GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR DISTRIBUTION AND MODIFICATION This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License The refers to any such program or and a work based on the Program means either the Program or any derivative work under copyright a work containing the Program or a portion of it
Definition: LICENSE:43
static const std::map< ParticleType, double > particleCharge_m
constexpr double m_h2p
The H2+ rest mass in GeV.
Definition: Physics.h:129
constexpr double m_xe
The xenon-129 (fully-stripped) rest mass in GeV.
Definition: Physics.h:120
constexpr double m_d
The deuteron rest mass in GeV.
Definition: Physics.h:117
constexpr double m_mu
The muon rest mass in GeV.
Definition: Physics.h:114
constexpr double m_h
The hydrogen atom rest mass in GeV.
Definition: Physics.h:126
constexpr double m_c
The carbon-12 (fully-stripped) rest mass in GeV.
Definition: Physics.h:105
constexpr double m_u
The uranium-238 (fully-stripped) rest mass in GeV.
Definition: Physics.h:111
constexpr double q_e
The elementary charge in As.
Definition: Physics.h:69
static double getParticleCharge(const ParticleType &type)
constexpr double m_e
The electron rest mass in GeV.
Definition: Physics.h:78
constexpr double m_alpha
The alpha particle rest mass in GeV.
Definition: Physics.h:123
ParticleType
constexpr double m_p
The proton rest mass in GeV.
Definition: Physics.h:90
static double getParticleChargeInCoulomb(const ParticleType &type)
static double getParticleMass(const ParticleType &type)
static const boost::bimap< ParticleType, std::string > bmParticleType_s
constexpr double m_hm
The H- rest mass in GeV.
Definition: Physics.h:108
SDDS1 &description type
Definition: test.stat:4
static std::string getParticleTypeString(const ParticleType &type)