cepgen is hosted by Hepforge, IPPP Durham
CepGen 1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
PDG.h
Go to the documentation of this file.
1/*
2 * CepGen: a central exclusive processes event generator
3 * Copyright (C) 2013-2024 Laurent Forthomme
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef CepGen_Physics_PDG_h
20#define CepGen_Physics_PDG_h
21
22#include <cstddef> // size_t
23
25
26namespace cepgen {
28 class PDG {
29 public:
35 down = 1,
36 up = 2,
38 muon = 13,
39 tau = 15,
40 gluon = 21,
41 photon = 22,
42 W = 24,
43 pomeron = 990,
44 reggeon = 110,
45 piZero = 111,
46 piPlus = 211,
47 eta = 221,
48 phi1680 = 100333,
49 neutron = 2112,
50 proton = 2212,
51 diffractiveProton = 9902210
52 };
53
55 class Id {
56 public:
57 inline Id(pdgid_t pdgid) : pdgid_(pdgid) {}
58 inline operator pdgid_t() const { return pdgid_; }
59 friend std::ostream& operator<<(std::ostream&, const Id&);
60
61 private:
62 pdgid_t pdgid_;
63 };
64
65 static PDG& get();
66 PDG(const PDG&) = delete;
67 void operator=(const PDG&) = delete;
68 ~PDG() = default;
69
70 void define(const ParticleProperties&);
71 pdgids_t particles() const;
72 void dump(std::ostream* = nullptr) const;
73 size_t size() const;
74
75 //--- per-particles information
76
77 bool has(spdgid_t) const;
80 const std::string& name(spdgid_t) const;
81 double colours(spdgid_t) const;
82 double mass(spdgid_t) const;
83 double width(spdgid_t) const;
84 double charge(spdgid_t) const;
85 std::vector<double> charges(spdgid_t) const;
86
87 private:
88 explicit PDG();
89 std::unordered_map<pdgid_t, ParticleProperties> particles_;
90 };
91} // namespace cepgen
92
93#endif
A class-in-the-middle PDG identifier for printout operations.
Definition PDG.h:55
Id(pdgid_t pdgid)
Construct an object from a PDG identifier.
Definition PDG.h:57
friend std::ostream & operator<<(std::ostream &, const Id &)
Human-readable PDG name.
Definition PDG.cpp:27
A singleton holding all physics constants associated to particles.
Definition PDG.h:28
double colours(spdgid_t) const
Colour factor for this particle.
Definition PDG.cpp:88
size_t size() const
Number of particles defined in this library.
Definition PDG.cpp:107
pdgids_t particles() const
All particles ids in this library.
Definition PDG.cpp:74
PDG(const PDG &)=delete
ParticleProperties & operator[](spdgid_t id)
Definition PDG.cpp:58
bool has(spdgid_t) const
Is the particle defined for a given PDG id.
Definition PDG.cpp:46
std::vector< double > charges(spdgid_t) const
Electric charges (in ) for this particle and anti-particles.
Definition PDG.cpp:100
PdgIdEnum
PDG ids of all known particles.
Definition PDG.h:33
@ down
Definition PDG.h:35
@ tau
Definition PDG.h:39
@ electron
Definition PDG.h:37
@ diffractiveProton
Definition PDG.h:51
@ photon
Definition PDG.h:41
@ reggeon
Definition PDG.h:44
@ neutron
Definition PDG.h:49
@ muon
Definition PDG.h:38
@ pomeron
Definition PDG.h:43
@ proton
Definition PDG.h:50
@ phi1680
Definition PDG.h:48
@ piZero
Definition PDG.h:45
@ invalid
Definition PDG.h:34
@ piPlus
Definition PDG.h:46
@ gluon
Definition PDG.h:40
@ eta
Definition PDG.h:47
const ParticleProperties & operator()(spdgid_t) const
All physical properties for one particle.
Definition PDG.cpp:48
void dump(std::ostream *=nullptr) const
Dump all particles in this library.
Definition PDG.cpp:109
~PDG()=default
Default destructor.
double width(spdgid_t) const
Resonance width (in GeV)
Definition PDG.cpp:96
double mass(spdgid_t) const
Particle mass (in GeV)
Definition PDG.cpp:90
const std::string & name(spdgid_t) const
Accessor for particle properties.
Definition PDG.cpp:81
void define(const ParticleProperties &)
Add a new particle definition to the library.
Definition PDG.cpp:60
static PDG & get()
Retrieve a unique instance of this particles info collection.
Definition PDG.cpp:41
double charge(spdgid_t) const
Electric charge (in ) for this particle.
Definition PDG.cpp:98
void operator=(const PDG &)=delete
Common namespace for this Monte Carlo generator.
std::vector< pdgid_t > pdgids_t
unsigned long long pdgid_t
Alias for the integer-like particle PDG id.
long long spdgid_t
A collection of physics constants associated to a single particle.