Garfield++ 4.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 initialized 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.;
54 /// Default constructor.
56 particle_def::get_logbook().push_back(this);
57 }
58 /// Constructor.
59 particle_def(const std::string& fname, const std::string& fnotation,
60 double fmass, double fcharge, int flepton_n, int fbarion_n,
61 float fspin, const spin_def& fisospin);
62 /// Constructor.
63 particle_def(const std::string& fname, const std::string& fnotation,
64 double fmass, double fcharge, int flepton_n, int fbarion_n,
65 float fspin, float fisospin_total, float fisospin_proj)
66 : particle_def(fname, fnotation, fmass, fcharge, flepton_n, fbarion_n,
67 fspin, spin_def(fisospin_total, fisospin_proj)) {}
68 /// Constructor to create an anti-particle.
69 particle_def(const std::string& fname, const std::string& fnotation,
70 particle_def& p);
71 /// Copy constructor.
73 : name(f.name), notation(f.notation), mass(f.mass), charge(f.charge),
75 spin(f.spin), isospin(f.isospin) {
76 verify();
77 particle_def::get_logbook().push_back(this);
78 }
79 /// Assignment operator.
80 particle_def& operator=(const particle_def& f) = default;
81
82 /// Destructor.
84
85 /// Function for making an anti-particle.
87 void print(std::ostream& file, int l) const;
88 static void printall(std::ostream& file);
89
90 void set_mass(const double m);
91 void set_charge(const double z);
92
93 /// Initialize the logbook at the first request
94 /// and keep it as internal static variable.
95 static std::list<particle_def*>& get_logbook();
96 static const std::list<particle_def*>& get_const_logbook();
97
98 /// Return the address of particle with this name
99 /// if it is registered in system, or NULL otherwise.
100 static particle_def* get_particle_def(const std::string& fnotation);
101 /// Check that there is no particle with the same name in the container.
102 void verify() {}
103};
104std::ostream& operator<<(std::ostream& file, const particle_def& f);
105
117
118// light unflavored mesons
125
128
129// "exotic" particles with properties specified by user
131
132/// Auxiliary class for definition of classes derived from particle.
133/// The derivation from particle is not possible by the standard way,
134/// since the system rejects the second particle with the same name.
135/// One cannot derive the class from pointer. But the pointer can be
136/// allocated as member of another little class, and from this class
137/// one can derive anything. This little class with pointer is
138/// class particle_type.
139/// This class is also convenient identity of particles by comparing the
140/// pointers.
141
143 public:
145 particle_type() = default;
147 particle_type(const char* name, int s = 0);
148 // name is notation or name.
149 // First the list of notations is checked,
150 // then the list of names is checked as well.
151 // s controls error handling
152 // If the name is absent in the particle list then
153 // If s==0, the program is terminated
154 // Otherwise the pardef is set to NULL
155 int operator==(const particle_type& f) {
156 return pardef == f.pardef ? 1 : 0;
157 }
158 int operator!=(const particle_type& f) {
159 return pardef != f.pardef ? 1 : 0;
160 }
161 void print_notation(std::ostream& file) const;
162};
163std::ostream& operator<<(std::ostream& file, const particle_type& f);
164}
165
166#endif
particle_def & operator=(const particle_def &f)=default
Assignment operator.
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:102
static const std::list< particle_def * > & get_const_logbook()
void print(std::ostream &file, int l) const
particle_def(const particle_def &f)
Copy constructor.
Definition: particle_def.h:72
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)
Constructor.
Definition: particle_def.h:63
~particle_def()
Destructor.
Definition: particle_def.h:83
particle_def()
Default constructor.
Definition: particle_def.h:55
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:155
void print_notation(std::ostream &file) const
int operator!=(const particle_type &f)
Definition: particle_def.h:158
particle_type(particle_def *f)
Definition: particle_def.h:146
particle_type()=default
particle_def * pardef
Definition: particle_def.h:144
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:121
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:119
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:115
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:108
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:127
particle_def anti_proton_def("", "p-", proton_def)
Definition: particle_def.h:111
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:126
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:110
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:120
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:112
particle_def K_minus_meson_def("K_minus_meson_def", "K-", K_plus_meson_def)
Definition: particle_def.h:124
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:122
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:123
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:114
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:130
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:116
particle_def muon_plus_def("muon_plus", "mu+", muon_minus_def)
Definition: particle_def.h:109
particle_def positron_def("positron", "e+", electron_def)
Definition: particle_def.h:107
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:106
particle_def anti_neutron_def("", "", neutron_def)
Definition: particle_def.h:113