gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-2191-ga4742ac
a Global And Modular Bsm Inference Tool
partmap.hpp
Go to the documentation of this file.
1 // GAMBIT: Global and Modular BSM Inference Tool
2 // *********************************************
21 
22 
23 #ifndef __partmaps_hpp__
24 #define __partmaps_hpp__
25 
26 #include <map>
27 
29 
30 
31 namespace Gambit
32 {
33 
34  namespace Models
35  {
36 
37  class partmap
38  {
39 
40  public:
41 
43  partmap();
44 
46  void add(str, std::pair<int, int>, int, int, int);
47 
49  void add_SM(str, std::pair<int, int>, int, int, int);
50 
52  void add_generic(str, std::pair<int, int>, int, int, int);
53 
55  void add_with_short_pair(str, std::pair<int, int>, std::pair<str, int>, int, int, int);
56 
58  void add_SM_with_short_pair(str, std::pair<int, int>, std::pair<str, int>, int, int, int);
59 
61  std::pair<int, int> pdg_pair(str) const;
62 
64  std::pair<int, int> pdg_pair(str,int) const;
65 
67  std::pair<int, int> pdg_pair(std::pair<str,int>) const;
68 
70  str long_name(str,int) const;
71 
73  str long_name(std::pair<int, int>) const;
74 
76  str long_name(int,int) const;
77 
79  std::pair<str, int> short_name_pair(str) const;
80 
82  std::pair<str, int> short_name_pair(std::pair<int, int>) const;
83 
85  std::pair<str, int> short_name_pair(int,int) const;
86 
88  const std::vector<std::pair<int, int> >& get_SM_particles() const;
89 
91  const std::vector<std::pair<int, int> >& get_generic_particles() const;
92 
94  bool has_particle(str) const;
95 
97  bool has_particle(str, int) const;
98  bool has_particle(std::pair<str, int>) const;
99 
101  bool has_particle(std::pair<int, int>) const;
102 
104  str get_antiparticle(str) const;
105 
108  std::pair<str, int> get_antiparticle(std::pair<str, int>) const;
109  std::pair<str, int> get_antiparticle(str, int) const;
111 
114  std::pair<int, int> get_antiparticle(std::pair<int, int>) const;
115  std::pair<int, int> get_antiparticle(int, int) const;
117 
119  bool has_antiparticle(str) const;
120 
123  bool has_antiparticle(std::pair<str, int>) const;
124  bool has_antiparticle(str, int) const;
126 
129  bool has_antiparticle(std::pair<int, int>) const;
130  bool has_antiparticle(int, int) const;
132 
134  bool has_short_name(str) const;
135 
137  bool has_short_name(std::pair<int, int>) const;
138 
140  bool has_spinx2(str) const;
141 
143  bool has_spinx2(std::pair<int, int>) const;
144  bool has_spinx2(int, int) const;
145 
147  bool has_spinx2(std::pair<str, int>) const;
148  bool has_spinx2(str, int) const;
149 
152  int get_spinx2(std::pair<int, int>) const;
153  int get_spinx2(int, int) const;
155 
158  int get_spinx2(str) const;
160 
163  int get_spinx2(std::pair<str, int>) const;
164  int get_spinx2(str, int) const;
166 
168  bool has_chargex3(str) const;
169 
171  bool has_chargex3(std::pair<int, int>) const;
172  bool has_chargex3(int, int) const;
173 
175  bool has_chargex3(std::pair<str, int>) const;
176  bool has_chargex3(str, int) const;
177 
180  int get_chargex3(std::pair<int, int>) const;
181  int get_chargex3(int, int) const;
183 
186  int get_chargex3(str) const;
188 
191  int get_chargex3(std::pair<str, int>) const;
192  int get_chargex3(str, int) const;
194 
196  bool has_color(str) const;
197 
199  bool has_color(std::pair<int, int>) const;
200  bool has_color(int, int) const;
201 
203  bool has_color(std::pair<str, int>) const;
204  bool has_color(str, int) const;
205 
208  int get_color(std::pair<int, int>) const;
209  int get_color(int, int) const;
211 
214  int get_color(str) const;
216 
219  int get_color(std::pair<str, int>) const;
220  int get_color(str, int) const;
222 
224  void check_contents() const;
225 
226  private:
227 
229  std::vector<std::pair<int, int> > SM;
231  std::vector<std::pair<int, int> > generic;
233  std::map<str, std::pair<int, int> > long_name_to_pdg_pair;
235  std::map<std::pair<int, int>, str> pdg_pair_to_long_name;
237  std::map<std::pair<str, int>, std::pair<int, int> > short_name_pair_to_pdg_pair;
239  std::map<std::pair<int, int>, std::pair<str, int> > pdg_pair_to_short_name_pair;
241  std::map<str, std::pair<str, int> > long_name_to_short_name_pair;
243  std::map<std::pair<str, int>, str> short_name_pair_to_long_name;
245  std::map<str, int> long_name_to_spinx2;
247  std::map<str, int> long_name_to_chargex3;
249  std::map<str, int> long_name_to_color;
250 
251  };
252 
254  partmap& ParticleDB();
255 
256  }
257 
258 }
259 
260 
261 #endif //__partmaps_hpp__
bool has_short_name(str) const
Check if a particle has a short name, using the long name.
Definition: partmap.cpp:227
std::pair< str, int > short_name_pair(str) const
Retrieve the short name and index, from the long name.
Definition: partmap.cpp:155
std::map< std::pair< int, int >, std::pair< str, int > > pdg_pair_to_short_name_pair
Map from PDG code and context integer to short name and index.
Definition: partmap.hpp:239
bool has_chargex3(str) const
Check if a particle has a charge (x3) entry, using the long name.
Definition: partmap.cpp:384
void add(str, std::pair< int, int >, int, int, int)
Add a new particle to the database.
Definition: partmap.cpp:49
bool has_color(str) const
Check if a particle has a color entry, using the long name.
Definition: partmap.cpp:456
int get_spinx2(std::pair< int, int >) const
Get spin (x2) of a given particle, using the PDG code and context integer.
Definition: partmap.cpp:360
void add_with_short_pair(str, std::pair< int, int >, std::pair< str, int >, int, int, int)
Add a new particle to the database with a short name and an index.
Definition: partmap.cpp:78
str long_name(str, int) const
Retrieve the long name, from the short name and index.
Definition: partmap.cpp:124
General small utility classes, typedefs, etc.
std::vector< std::pair< int, int > > SM
All SM particles in the database, by PDG code and context integer.
Definition: partmap.hpp:229
void add_SM_with_short_pair(str, std::pair< int, int >, std::pair< str, int >, int, int, int)
Add a new Standard Model particle to the database with a short name and an index. ...
Definition: partmap.cpp:88
int get_chargex3(std::pair< int, int >) const
Get charge (x3) of a given particle, using the PDG code and context integer.
Definition: partmap.cpp:432
std::string str
Definition: models.hpp:49
std::pair< int, int > pdg_pair(str) const
Retrieve the PDG code and context integer, from the long name.
Definition: partmap.cpp:95
std::map< std::pair< int, int >, str > pdg_pair_to_long_name
Map from PDG code and context integer to long name.
Definition: partmap.hpp:235
bool has_antiparticle(str) const
Check if a particle has a matching anti-particle in the database, using the long name.
Definition: partmap.cpp:277
str get_antiparticle(str) const
Get the matching anti-particle long name for a particle in the database, using the long name...
Definition: partmap.cpp:239
const std::vector< std::pair< int, int > > & get_generic_particles() const
Get a vector PDG codes and context integers of generic particle classes in the database.
Definition: partmap.cpp:199
bool has_particle(str) const
Check if a particle is in the database, using the long name.
Definition: partmap.cpp:205
bool has_spinx2(str) const
Check if a particle has a spin (x2) entry, using the long name.
Definition: partmap.cpp:312
partmap & ParticleDB()
Database accessor function.
Definition: partmap.cpp:36
void add_SM(str, std::pair< int, int >, int, int, int)
Add a new Standard Model particle to the database.
Definition: partmap.cpp:64
std::map< std::pair< str, int >, str > short_name_pair_to_long_name
Map from short name and index to long name.
Definition: partmap.hpp:243
const std::vector< std::pair< int, int > > & get_SM_particles() const
Get a vector PDG codes and context integers of Standard Model particles in the database.
Definition: partmap.cpp:193
void add_generic(str, std::pair< int, int >, int, int, int)
Add a new generic particle class to the database.
Definition: partmap.cpp:71
std::map< str, std::pair< int, int > > long_name_to_pdg_pair
Map from long name to PDG code and context integer.
Definition: partmap.hpp:233
std::map< str, int > long_name_to_chargex3
Map from long name to three times the charge of particle.
Definition: partmap.hpp:247
std::map< str, int > long_name_to_spinx2
Map from long name to twice the spin of particle.
Definition: partmap.hpp:245
std::map< std::pair< str, int >, std::pair< int, int > > short_name_pair_to_pdg_pair
Map from short name and index to PDG code and context integer.
Definition: partmap.hpp:237
int get_color(std::pair< int, int >) const
Get color of a given particle, using the PDG code and context integer.
Definition: partmap.cpp:504
void check_contents() const
For debugging: use to check the contents of the particle database.
Definition: partmap.cpp:527
std::map< str, int > long_name_to_color
Map from long name to color representation of particle.
Definition: partmap.hpp:249
TODO: see if we can use this one:
Definition: Analysis.hpp:33
partmap()
Constructor.
Definition: partmap.cpp:46
std::map< str, std::pair< str, int > > long_name_to_short_name_pair
Map from long name to short name and index.
Definition: partmap.hpp:241