R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3B::PDGConverter Class Reference

#include <R3BPDGConverter.h>

Public Types

enum class  Type : uint8_t { basic , nuclear , invalid }
 

Public Member Functions

 PDGConverter ()=default
 
auto get_pid (const std::string &name) -> int32_t
 
auto get_name (int32_t pid) -> std::string
 
auto reset ()
 

Static Public Member Functions

static auto get_type (const std::string &name) -> Type
 Get the type of the particle from its name.
 
static auto get_type (int32_t pid) -> Type
 Get the type of the particle from its PDG ID.
 

Static Public Attributes

static constexpr auto nuclear_id_min = int32_t{ 1000000000 }
 
static constexpr auto nuclear_id_max = int32_t{ 1009999990 }
 

Private Member Functions

void register_entry (int32_t pid)
 
void register_entry (const std::string &name)
 
auto convert_basic_pid_to_name (int32_t pid) -> std::string
 

Private Attributes

std::unordered_map< int32_t, std::string > pid_to_name_
 
std::unordered_map< std::string, int32_t > name_to_pid_
 

Detailed Description

Definition at line 10 of file R3BPDGConverter.h.

Member Enumeration Documentation

◆ Type

enum class R3B::PDGConverter::Type : uint8_t
strong
Enumerator
basic 
nuclear 
invalid 

Definition at line 13 of file R3BPDGConverter.h.

Constructor & Destructor Documentation

◆ PDGConverter()

R3B::PDGConverter::PDGConverter ( )
default

Member Function Documentation

◆ convert_basic_pid_to_name()

auto R3B::PDGConverter::convert_basic_pid_to_name ( int32_t pid) -> std::string
private

◆ get_name()

auto R3B::PDGConverter::get_name ( int32_t pid) -> std::string

Definition at line 132 of file R3BPDGConverter.cxx.

◆ get_pid()

auto R3B::PDGConverter::get_pid ( const std::string & name) -> int32_t

Definition at line 126 of file R3BPDGConverter.cxx.

◆ get_type() [1/2]

auto R3B::PDGConverter::get_type ( const std::string & name) -> Type
static

To determine type from a name is a Type::nuclear, it has three criteria:

  • the name contains a dash "-"
  • At least one letter after dash "-"
  • At most two letters before dash "-"

Otherwise the type is Type::basic

Parameters
pidPid of the basic particle/nucleus
Returns
Type of the particle

Definition at line 151 of file R3BPDGConverter.cxx.

◆ get_type() [2/2]

auto R3B::PDGConverter::get_type ( int32_t pid) -> Type
static

The type of the particle can be determined by its PDG ID in the way of:

Parameters
nameName of the basic particle/nucleus
Returns
Type of the particle

Definition at line 138 of file R3BPDGConverter.cxx.

◆ register_entry() [1/2]

void R3B::PDGConverter::register_entry ( const std::string & name)
private

Definition at line 187 of file R3BPDGConverter.cxx.

◆ register_entry() [2/2]

void R3B::PDGConverter::register_entry ( int32_t pid)
private

Definition at line 177 of file R3BPDGConverter.cxx.

◆ reset()

auto R3B::PDGConverter::reset ( )

Definition at line 171 of file R3BPDGConverter.cxx.

Member Data Documentation

◆ name_to_pid_

std::unordered_map<std::string, int32_t> R3B::PDGConverter::name_to_pid_
private

Definition at line 62 of file R3BPDGConverter.h.

◆ nuclear_id_max

auto R3B::PDGConverter::nuclear_id_max = int32_t{ 1009999990 }
staticconstexpr

Definition at line 58 of file R3BPDGConverter.h.

◆ nuclear_id_min

auto R3B::PDGConverter::nuclear_id_min = int32_t{ 1000000000 }
staticconstexpr

Definition at line 57 of file R3BPDGConverter.h.

◆ pid_to_name_

std::unordered_map<int32_t, std::string> R3B::PDGConverter::pid_to_name_
private

Definition at line 61 of file R3BPDGConverter.h.


The documentation for this class was generated from the following files: