OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
ParticleProperties.h
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//
18#ifndef PARTICLEPROPERTIES_H
19#define PARTICLEPROPERTIES_H
20
21#include <array>
22#include <map>
23#include <string>
24#include <string_view>
25
26enum class ParticleType: short {
27 UNNAMED = -1,
30 MUON,
31 PROTON,
34 HMINUS,
36 H2P,
37 H3P,
38 ALPHA,
39 CARBON,
40 XENON,
42};
44enum class ParticleOrigin: unsigned short {
45 REGULAR,
48};
49
51public:
52 static ParticleType getParticleType (std::string_view str) noexcept;
53 static std::string getParticleTypeString(const ParticleType& type) noexcept;
54
55 static double getParticleMass(const ParticleType& type);
56 static double getParticleCharge(const ParticleType& type);
57 static double getParticleChargeInCoulomb(const ParticleType& type);
58
59private:
60 static const std::array<std::pair<ParticleType, std::string_view>, 15> particleTypeMap;
62 static const std::map<ParticleType, double> particleMass_m;
63 static const std::map<ParticleType, double> particleCharge_m;
64};
65
66#endif /* PARTICLEPROPERTIES_H */
ParticleOrigin
static ParticleType getParticleType(std::string_view str) noexcept
static double getParticleMass(const ParticleType &type)
static const std::map< ParticleType, double > particleCharge_m
static std::string getParticleTypeString(const ParticleType &type) noexcept
static double getParticleCharge(const ParticleType &type)
static const std::array< std::pair< ParticleType, std::string_view >, 15 > particleTypeMap
static const std::map< ParticleType, double > particleMass_m
static double getParticleChargeInCoulomb(const ParticleType &type)