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