Garfield++ 3.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
particle_def.h
Go to the documentation of this file.
1#ifndef PARTICLE_DEF_H
2#define PARTICLE_DEF_H
3
4#include <string>
5#include <list>
6
7namespace Heed {
8
9/// Helper class for definition of spin.
10
11class spin_def {
12 public:
13 float total = 0.;
14 float projection = 0.;
15 spin_def() = default;
16 spin_def(float ftotal, float fprojection);
17};
18std::ostream& operator<<(std::ostream& file, const spin_def& f);
19
20/// Definition of particles. Only the basic information: the name, the notation,
21/// the mass, the charge, and other auxiliary data.
22///
23/// The organization is similar to AtomDef from directory matter, with
24/// the exception that the internal data are not declared as private.
25/// Of course, the user should not change them.
26///
27/// The principle of definitions of particles is dictionary or a database:
28/// the particles are not repeated,
29/// each particle is presented in the total system no more than one time.
30/// The system knows each particle presented in it.
31/// The particle characteristics can be obtained by literal notation.
32/// The system declines the secondary initialization.
33/// The copying is not declined.
34/// When the user program wants to refer to particle,
35/// it has to use either char* (string) notation, or pointer (or reference)
36/// to one of these objects.
37/// The user pogram can initialize the new particles.
38/// The standard particles are initiated right here, below.
39///
40/// 1999 - 2004, I. Smirnov
41
43 public:
44 std::string name = "none";
45 /// Short name to make data summary files short.
46 std::string notation = "none";
47 double mass = 0.;
48 double charge = 0.;
49 // The following is not yet used in programs
50 int lepton_n = 0;
51 int baryon_n = 0;
52 float spin = 0.;
55 particle_def::get_logbook().push_back(this);
56 }
57 particle_def(const std::string& fname, const std::string& fnotation,
58 double fmass, double fcharge, int flepton_n, int fbarion_n,
59 float fspin, const spin_def& fisospin);
60 particle_def(const std::string& fname, const std::string& fnotation,
61 double fmass, double fcharge, int flepton_n, int fbarion_n,
62 float fspin, float fisospin_total, float fisospin_proj) {
63 *this = particle_def(fname, fnotation, fmass, fcharge, flepton_n, fbarion_n,
64 fspin, spin_def(fisospin_total, fisospin_proj));
65 }
66
68 *this = f;
69 verify();
70 particle_def::get_logbook().push_back(this);
71 }
72
73 /// Function for making an anti-particle.
75 /// Create anti-particle through the call of anti_particle(p)
76 particle_def(const std::string& fname, const std::string& fnotation,
77 particle_def& p);
78
80 void print(std::ostream& file, int l) const;
81 static void printall(std::ostream& file);
82
83 void set_mass(const double m);
84 void set_charge(const double z);
85
86 /// Initialize the logbook at the first request
87 /// and keep it as internal static variable.
88 static std::list<particle_def*>& get_logbook();
89 static const std::list<particle_def*>& get_const_logbook();
90
91 /// Return the address of particle with this name
92 /// if it is registered in system, or NULL otherwise.
93 static particle_def* get_particle_def(const std::string& fnotation);
94 /// Check that there is no particle with the same name in the container.
95 void verify() {};
96};
97std::ostream& operator<<(std::ostream& file, const particle_def& f);
98
110
111// light unflavored mesons
118
121
122// "exotic" particles with properties specified by user
124
125/// Auxiliary class for definition of classes derived from particle.
126/// The derivation from particle is not possible by the standard way,
127/// since the system rejects the second particle with the same name.
128/// One cannot derive the class from pointer. But the pointer can be
129/// allocated as member of another little class, and from this class
130/// one can derive anything. This little class with pointer is
131/// class particle_type.
132/// This class is also convenient identity of particles by comparing the
133/// pointers.
134
136 public:
138 particle_type() = default;
140 particle_type(const char* name, int s = 0);
141 // name is notation or name.
142 // First the list of notations is checked,
143 // then the list of names is checked as well.
144 // s controls error handling
145 // If the name is absent in the particle list then
146 // If s==0, the program is terminated
147 // Otherwise the pardef is set to NULL
148 int operator==(const particle_type& f) {
149 return pardef == f.pardef ? 1 : 0;
150 }
151 int operator!=(const particle_type& f) {
152 return pardef != f.pardef ? 1 : 0;
153 }
154 void print_notation(std::ostream& file) const;
155};
156std::ostream& operator<<(std::ostream& file, const particle_type& f);
157}
158
159#endif
static particle_def * get_particle_def(const std::string &fnotation)
void verify()
Check that there is no particle with the same name in the container.
Definition: particle_def.h:95
static const std::list< particle_def * > & get_const_logbook()
void print(std::ostream &file, int l) const
particle_def(const particle_def &f)
Definition: particle_def.h:67
void set_mass(const double m)
std::string name
Definition: particle_def.h:44
static std::list< particle_def * > & get_logbook()
particle_def anti_particle(const particle_def &p)
Function for making an anti-particle.
particle_def(const std::string &fname, const std::string &fnotation, double fmass, double fcharge, int flepton_n, int fbarion_n, float fspin, float fisospin_total, float fisospin_proj)
Definition: particle_def.h:60
void set_charge(const double z)
static void printall(std::ostream &file)
std::string notation
Short name to make data summary files short.
Definition: particle_def.h:46
int operator==(const particle_type &f)
Definition: particle_def.h:148
void print_notation(std::ostream &file) const
int operator!=(const particle_type &f)
Definition: particle_def.h:151
particle_type(particle_def *f)
Definition: particle_def.h:139
particle_type()=default
particle_def * pardef
Definition: particle_def.h:137
Helper class for definition of spin.
Definition: particle_def.h:11
spin_def()=default
Definition: BGMesh.cpp:6
particle_def pi_minus_meson_def("pi_minus_meson", "pi-", 139.56755 *MeV/c_squared, -eplus, 0, 0, 0.0, spin_def(1.0, -1.0))
Definition: particle_def.h:114
particle_def pi_plus_meson_def("pi_plus_meson", "pi+", 139.56755 *MeV/c_squared, eplus, 0, 0, 0.0, spin_def(1.0, 1.0))
Definition: particle_def.h:112
particle_def D13_def("D13", "D13", 1520.0 *MeV/c_squared, 1 *eplus, 0, 1, 1.5, spin_def(0.5, 0.5))
Definition: particle_def.h:108
particle_def muon_minus_def("muon_minus", "mu-", 105.658367 *MeV/c_squared, electron_charge, 1, 0, 0.5, spin_def(0.0, 0.0))
Definition: particle_def.h:101
particle_def alpha_particle_def("alpha_particle", "alpha", 3727.417 *MeV/c_squared, 2 *eplus, 0, 4, 0.0, spin_def(0.0, 0.0))
Definition: particle_def.h:120
particle_def anti_proton_def("", "p-", proton_def)
Definition: particle_def.h:104
std::ostream & operator<<(std::ostream &file, const BGMesh &bgm)
Definition: BGMesh.cpp:37
particle_def deuteron_def("deuteron", "dtr", 1875.613 *MeV/c_squared, eplus, 0, 2, 0.0, spin_def(0.0, 0.0))
Definition: particle_def.h:119
particle_def proton_def("proton", "p+", proton_mass_c2/c_squared, eplus, 0, 1, 0.5, spin_def(0.5, 0.5))
Definition: particle_def.h:103
particle_def pi_0_meson_def("pi_0_meson", "pi0", 134.9734 *MeV/c_squared, 0, 0, 0, 0.0, spin_def(1.0, 0.0))
Definition: particle_def.h:113
particle_def neutron_def("neutron", "n", neutron_mass_c2/c_squared, 0, 0, 1, 0.5, spin_def(0.5, -0.5))
Definition: particle_def.h:105
particle_def K_minus_meson_def("K_minus_meson_def", "K-", K_plus_meson_def)
Definition: particle_def.h:117
particle_def eta_meson_def("eta_meson_def", "eta", 548.8 *MeV/c_squared, 0, 0, 0, 1.0, spin_def(0.0, 0.0))
Definition: particle_def.h:115
particle_def K_plus_meson_def("K_plus_meson_def", "K+", 493.677 *MeV/c_squared, 1, 0, 0, 0.0, spin_def(0.5, -0.5))
Definition: particle_def.h:116
particle_def P11_def("P11", "P11", 1440.0 *MeV/c_squared, 1 *eplus, 0, 1, 0.5, spin_def(0.5, 0.5))
Definition: particle_def.h:107
particle_def user_particle_def("user_particle", "X", 139.56755 *MeV/c_squared, eplus, 0, 0, 0.0, spin_def(0.0, 0.0))
Definition: particle_def.h:123
particle_def S11_def("S11", "S11", 1535.0 *MeV/c_squared, 1 *eplus, 0, 1, 0.5, spin_def(0.5, 0.5))
Definition: particle_def.h:109
particle_def muon_plus_def("muon_plus", "mu+", muon_minus_def)
Definition: particle_def.h:102
particle_def positron_def("positron", "e+", electron_def)
Definition: particle_def.h:100
particle_def electron_def("electron", "e-", electron_mass_c2/c_squared, electron_charge, 1, 0, 0.5, spin_def(0.0, 0.0))
Definition: particle_def.h:99
particle_def anti_neutron_def("", "", neutron_def)
Definition: particle_def.h:106