R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BPDGConverter.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <cstdlib>
5#include <string>
6#include <unordered_map>
7
8namespace R3B
9{
11 {
12 public:
13 enum class Type : uint8_t
14 {
18 };
19
20 PDGConverter() = default;
21
22 auto get_pid(const std::string& name) -> int32_t;
23
24 auto get_name(int32_t pid) -> std::string;
25
40 static auto get_type(const std::string& name) -> Type;
41
54 static auto get_type(int32_t pid) -> Type;
55
56 auto reset();
57 static constexpr auto nuclear_id_min = int32_t{ 1000000000 };
58 static constexpr auto nuclear_id_max = int32_t{ 1009999990 };
59
60 private:
61 std::unordered_map<int32_t, std::string> pid_to_name_;
62 std::unordered_map<std::string, int32_t> name_to_pid_;
63
64 void register_entry(int32_t pid);
65 void register_entry(const std::string& name);
66
67 auto convert_basic_pid_to_name(int32_t pid) -> std::string;
68 };
69
70} // namespace R3B
auto convert_basic_pid_to_name(int32_t pid) -> std::string
std::unordered_map< int32_t, std::string > pid_to_name_
static constexpr auto nuclear_id_min
std::unordered_map< std::string, int32_t > name_to_pid_
static auto get_type(const std::string &name) -> Type
Get the type of the particle from its name.
PDGConverter()=default
auto get_pid(const std::string &name) -> int32_t
auto get_name(int32_t pid) -> std::string
static constexpr auto nuclear_id_max
void register_entry(int32_t pid)