Garfield++ v2r0
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 <list>
5
7
8namespace Heed {
9
10/// Helper class for definition of spin.
11
12class spin_def {
13 public:
14 float total;
17 spin_def(float ftotal, float fprojection);
18};
19std::ostream& operator<<(std::ostream& file, const spin_def& f);
20
21/// Definition of particles. Only the basic information: the name, the notation,
22/// the mass, the charge, and other auxiliary data.
23///
24/// The organization is similar to AtomDef from directory matter, with
25/// the exception that the internal data are not declared as private.
26/// Of course, the user should not change them.
27///
28/// The principle of definitions of particles is dictionary or a database:
29/// the particles are not repeated,
30/// each particle is presented in the total system no more than one time.
31/// The system knows each particle presented in it.
32/// The particle characteristics can be obtained by literal notation.
33/// The system declines the secondary initialization.
34/// The copying is not declined.
35/// When the user program wants to refer to particle,
36/// it has to use either char* (string) notation, or pointer (or reference)
37/// to one of these objects.
38/// As usually, in the case of pointers I recommend to use protected pointers
39/// to external objects PassivePtr.
40/// The user pogram can initialize the new particles.
41/// The standard particles are initiated right here, below.
42///
43/// 1999 - 2004, I. Smirnov
44
46 public:
47 std::string name;
48 /// Short name to make data summary files short.
49 std::string notation;
50 double mass;
51 double charge;
52 // The following is not yet used in programs
55 float spin;
58 : name("none"),
59 notation("none"),
60 mass(0),
61 charge(0),
62 lepton_n(0),
63 baryon_n(0),
64 spin(0),
65 isospin(0, 0) {
66 particle_def::get_logbook().push_back(this);
67 }
68 particle_def(const std::string& fname, const std::string& fnotation,
69 double fmass, double fcharge, int flepton_n, int fbarion_n,
70 float fspin, const spin_def& fisospin);
71 particle_def(const std::string& fname, const std::string& fnotation,
72 double fmass, double fcharge, int flepton_n, int fbarion_n,
73 float fspin, float fisospin_total, float fisospin_proj) {
74 *this = particle_def(fname, fnotation, fmass, fcharge, flepton_n, fbarion_n,
75 fspin, spin_def(fisospin_total, fisospin_proj));
76 }
77
79 *this = f;
80 verify();
81 particle_def::get_logbook().push_back(this);
82 }
83
84 /// Function for making an anti-particle.
86 /// Create anti-particle through the call of anti_particle(p)
87 particle_def(const std::string& fname, const std::string& fnotation,
88 particle_def& p);
89
91 void print(std::ostream& file, int l) const;
92 static void printall(std::ostream& file);
93
94 void set_mass(const double m);
95 void set_charge(const double z);
96
97 /// Initialize the logbook at the first request
98 /// and keep it as internal static variable.
99 static std::list<particle_def*>& get_logbook();
100 static const std::list<particle_def*>& get_const_logbook();
101
102 /// Return the address of particle with this name
103 /// if it is registered in system, or NULL otherwise.
104 static particle_def* get_particle_def(const std::string& fnotation);
105 /// Check that there is no particle with the same name in the container.
106 void verify() {};
107};
108std::ostream& operator<<(std::ostream& file, const particle_def& f);
109
121
122// light unflavored mesons
129
132
133// "exotic" particles with properties specified by user
135
136/// Auxiliary class for definition of classes derived from particle.
137/// The derivation from particle is not possible by the standard way,
138/// since the system rejects the second particle with the same name.
139/// One cannot derive the class from pointer. But the pointer can be
140/// allocated as member of another little class, and from this class
141/// one can derive anything. This little class with pointer is
142/// class particle_type.
143/// This class is also convenient identity of particles by comparing the
144/// pointers.
145
147 public:
151 particle_type(const char* name, int s = 0);
152 // name is notation or name.
153 // First the list of notations is checked,
154 // then the list of names is checked as well.
155 // s controls error handling
156 // If the name is absent in the particle list then
157 // If s==0, the program is terminated
158 // Otherwise the pardef is set to NULL
159 int operator==(const particle_type& f) {
160 return pardef.getver() == f.pardef.getver() ? 1 : 0;
161 }
162 int operator!=(const particle_type& f) {
163 return pardef.getver() != f.pardef.getver() ? 1 : 0;
164 }
165 void print_notation(std::ostream& file) const;
166};
167std::ostream& operator<<(std::ostream& file, const particle_type& f);
168}
169
170#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:106
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:78
void set_mass(const double m)
std::string name
Definition: particle_def.h:47
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:71
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:49
int operator==(const particle_type &f)
Definition: particle_def.h:159
void print_notation(std::ostream &file) const
int operator!=(const particle_type &f)
Definition: particle_def.h:162
particle_type(particle_def *f)
Definition: particle_def.h:150
PassivePtr< particle_def > pardef
Definition: particle_def.h:148
Helper class for definition of spin.
Definition: particle_def.h:12
Definition: BGMesh.cpp:5
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:125
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:123
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:119
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:112
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:131
particle_def anti_proton_def("", "p-", proton_def)
Definition: particle_def.h:115
std::ostream & operator<<(std::ostream &file, const BGMesh &bgm)
Definition: BGMesh.cpp:36
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:130
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:114
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:124
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:116
particle_def K_minus_meson_def("K_minus_meson_def", "K-", K_plus_meson_def)
Definition: particle_def.h:128
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:126
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:127
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:118
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:134
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:120
particle_def muon_plus_def("muon_plus", "mu+", muon_minus_def)
Definition: particle_def.h:113
particle_def positron_def("positron", "e+", electron_def)
Definition: particle_def.h:111
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:110
particle_def anti_neutron_def("", "", neutron_def)
Definition: particle_def.h:117