Garfield++ 3.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
Heed::particle_def Class Reference

#include <particle_def.h>

Public Member Functions

 particle_def ()
 
 particle_def (const std::string &fname, const std::string &fnotation, double fmass, double fcharge, int flepton_n, int fbarion_n, float fspin, const spin_def &fisospin)
 
 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)
 
 particle_def (const particle_def &f)
 
particle_def anti_particle (const particle_def &p)
 Function for making an anti-particle.
 
 particle_def (const std::string &fname, const std::string &fnotation, particle_def &p)
 Create anti-particle through the call of anti_particle(p)
 
 ~particle_def ()
 
void print (std::ostream &file, int l) const
 
void set_mass (const double m)
 
void set_charge (const double z)
 
void verify ()
 Check that there is no particle with the same name in the container.
 

Static Public Member Functions

static void printall (std::ostream &file)
 
static std::list< particle_def * > & get_logbook ()
 
static const std::list< particle_def * > & get_const_logbook ()
 
static particle_defget_particle_def (const std::string &fnotation)
 

Public Attributes

std::string name = "none"
 
std::string notation = "none"
 Short name to make data summary files short.
 
double mass = 0.
 
double charge = 0.
 
int lepton_n = 0
 
int baryon_n = 0
 
float spin = 0.
 
spin_def isospin
 

Detailed Description

Definition of particles. Only the basic information: the name, the notation, the mass, the charge, and other auxiliary data.

The organization is similar to AtomDef from directory matter, with the exception that the internal data are not declared as private. Of course, the user should not change them.

The principle of definitions of particles is dictionary or a database: the particles are not repeated, each particle is presented in the total system no more than one time. The system knows each particle presented in it. The particle characteristics can be obtained by literal notation. The system declines the secondary initialization. The copying is not declined. When the user program wants to refer to particle, it has to use either char* (string) notation, or pointer (or reference) to one of these objects. The user pogram can initialize the new particles. The standard particles are initiated right here, below.

1999 - 2004, I. Smirnov

Definition at line 42 of file particle_def.h.

Constructor & Destructor Documentation

◆ particle_def() [1/5]

Heed::particle_def::particle_def ( )
inline

Definition at line 54 of file particle_def.h.

54 {
55 particle_def::get_logbook().push_back(this);
56 }
static std::list< particle_def * > & get_logbook()

Referenced by anti_particle(), and particle_def().

◆ particle_def() [2/5]

Heed::particle_def::particle_def ( const std::string &  fname,
const std::string &  fnotation,
double  fmass,
double  fcharge,
int  flepton_n,
int  fbarion_n,
float  fspin,
const spin_def fisospin 
)

Definition at line 78 of file particle_def.cpp.

81 {
82 name = fname;
83 notation = fnotation;
84 mass = fmass;
85 charge = fcharge;
86 baryon_n = fbaryon_n;
87 lepton_n = flepton_n;
88 spin = fspin;
89 isospin = fisospin;
90 verify();
91 particle_def::get_logbook().push_back(this);
92}
void verify()
Check that there is no particle with the same name in the container.
Definition: particle_def.h:95
std::string name
Definition: particle_def.h:44
std::string notation
Short name to make data summary files short.
Definition: particle_def.h:46

◆ particle_def() [3/5]

Heed::particle_def::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 
)
inline

Definition at line 60 of file particle_def.h.

62 {
63 *this = particle_def(fname, fnotation, fmass, fcharge, flepton_n, fbarion_n,
64 fspin, spin_def(fisospin_total, fisospin_proj));
65 }

◆ particle_def() [4/5]

Heed::particle_def::particle_def ( const particle_def f)
inline

Definition at line 67 of file particle_def.h.

67 {
68 *this = f;
69 verify();
70 particle_def::get_logbook().push_back(this);
71 }

◆ particle_def() [5/5]

Heed::particle_def::particle_def ( const std::string &  fname,
const std::string &  fnotation,
particle_def p 
)

Create anti-particle through the call of anti_particle(p)

Definition at line 94 of file particle_def.cpp.

95 {
96 // creates anti-particle through the call of anti_particle(p)
97 *this = anti_particle(p);
98 // if(strlen(fname) > 0)
99 // strcpy(name,fname);
100 if (!(fname == "" || fname == " ")) name = fname;
101 if (!(fnotation == "" || fnotation == " ")) notation = fnotation;
102 verify();
103 particle_def::get_logbook().push_back(this);
104}
particle_def anti_particle(const particle_def &p)
Function for making an anti-particle.

◆ ~particle_def()

Heed::particle_def::~particle_def ( )
inline

Definition at line 79 of file particle_def.h.

79{ particle_def::get_logbook().remove(this); }

Member Function Documentation

◆ anti_particle()

particle_def Heed::particle_def::anti_particle ( const particle_def p)

Function for making an anti-particle.

Definition at line 106 of file particle_def.cpp.

106 {
107 std::string aname = "anti-" + p.name;
108 std::string anot = "anti-" + p.notation;
109 return particle_def(aname, anot, p.mass, -p.charge, -p.lepton_n, -p.baryon_n,
110 -p.spin, p.isospin);
111}

Referenced by particle_def().

◆ get_const_logbook()

const std::list< particle_def * > & Heed::particle_def::get_const_logbook ( )
static

Definition at line 117 of file particle_def.cpp.

117 {
119}

◆ get_logbook()

std::list< particle_def * > & Heed::particle_def::get_logbook ( )
static

Initialize the logbook at the first request and keep it as internal static variable.

Definition at line 112 of file particle_def.cpp.

112 {
113 static std::list<particle_def*> logbook;
114 return logbook;
115}

Referenced by get_const_logbook(), get_particle_def(), particle_def(), Heed::particle_type::particle_type(), printall(), and ~particle_def().

◆ get_particle_def()

particle_def * Heed::particle_def::get_particle_def ( const std::string &  fnotation)
static

Return the address of particle with this name if it is registered in system, or NULL otherwise.

Definition at line 121 of file particle_def.cpp.

121 {
122 for (auto particle : particle_def::get_logbook()) {
123 if (!particle) continue;
124 if (particle->notation == fnotation) return particle;
125 }
126 return nullptr;
127}

◆ print()

void Heed::particle_def::print ( std::ostream &  file,
int  l 
) const

Definition at line 133 of file particle_def.cpp.

133 {
134 if (l > 0) file << (*this);
135}

◆ printall()

void Heed::particle_def::printall ( std::ostream &  file)
static

Definition at line 136 of file particle_def.cpp.

136 {
137 Ifile << "particle_def::printall:\n";
138 for (auto particle : particle_def::get_logbook()) {
139 if (particle) file << particle;
140 }
141}
#define Ifile
Definition: prstream.h:196

◆ set_charge()

void Heed::particle_def::set_charge ( const double  z)

Definition at line 131 of file particle_def.cpp.

131{ charge = z * eplus; }

Referenced by Garfield::TrackHeed::NewTrack().

◆ set_mass()

void Heed::particle_def::set_mass ( const double  m)

Definition at line 129 of file particle_def.cpp.

129{ mass = m * MeV / c_squared; }

Referenced by Garfield::TrackHeed::NewTrack().

◆ verify()

void Heed::particle_def::verify ( )
inline

Check that there is no particle with the same name in the container.

Definition at line 95 of file particle_def.h.

95{};

Referenced by particle_def().

Member Data Documentation

◆ baryon_n

int Heed::particle_def::baryon_n = 0

Definition at line 51 of file particle_def.h.

Referenced by anti_particle(), Heed::operator<<(), and particle_def().

◆ charge

double Heed::particle_def::charge = 0.

◆ isospin

spin_def Heed::particle_def::isospin

Definition at line 53 of file particle_def.h.

Referenced by anti_particle(), Heed::operator<<(), and particle_def().

◆ lepton_n

int Heed::particle_def::lepton_n = 0

Definition at line 50 of file particle_def.h.

Referenced by anti_particle(), Heed::operator<<(), and particle_def().

◆ mass

double Heed::particle_def::mass = 0.

◆ name

std::string Heed::particle_def::name = "none"

Definition at line 44 of file particle_def.h.

Referenced by anti_particle(), Heed::operator<<(), and particle_def().

◆ notation

std::string Heed::particle_def::notation = "none"

Short name to make data summary files short.

Definition at line 46 of file particle_def.h.

Referenced by anti_particle(), Heed::operator<<(), particle_def(), and Heed::particle_type::print_notation().

◆ spin

float Heed::particle_def::spin = 0.

Definition at line 52 of file particle_def.h.

Referenced by anti_particle(), Heed::operator<<(), and particle_def().


The documentation for this class was generated from the following files: