-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParticles.h
executable file
·154 lines (109 loc) · 4.09 KB
/
Particles.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#ifndef PARTICLES_H
#define PARTICLES_H
#include <string>
#include <iostream>
////////////////////////////////////////////
// This class contains all the attibutes //
// necessary to define a single //
// hadron and information about its //
// decay. //
////////////////////////////////////////////
class SingleParticle
{
public:
// Particle attributes
//Basic attributes
long PDGID { 0 }; // PDG ID
int ID { -1 }; // Index of particle (starts from 0)
std::string name { }; // Name
float mass { 0 }; // mass(in GeV)
short int spinDegeneracy { 0 }; // spin degeneracy
// Conserved charges
short int baryonNumber { 0 }; // Baryon number
short int charge { 0 }; // Charge
short int strangeness { 0 }; // Strangeness
// Extra attributes
float radius { 0 }; // Hadron radius (in GeV^-1)
// Flags
bool isStable { false }; // Stable or not
bool isAntiParticle { false }; // Whether it is anti-particle or not
// Decay attributes(useful if not stable)
int n_decayChannels { 0 }; // No. of decay Channels
struct decayChannel
{
int daughters { 0 }; // No. of daughters in the channel
int *daughterID { nullptr }; // IDs of each daughters in the channel
float branchingRatio { 0 }; // Branching ratio of the channel
~decayChannel();
};
decayChannel *dChannels { nullptr };
// default constructor
SingleParticle(){}
SingleParticle(int i_ID, long i_PDGID, std::string i_name, float i_m,
short int i_spinDegeneracy, short int i_B, short int i_Q, short int i_S,
bool i_isStable, bool i_isAntiParticle)
: PDGID { i_PDGID },
ID { i_ID },
name { i_name },
mass { i_m },
spinDegeneracy { i_spinDegeneracy },
baryonNumber { i_B },
charge { i_Q },
strangeness { i_S},
isStable { i_isStable},
isAntiParticle { i_isAntiParticle }
{
}
// copy constructor
SingleParticle(const SingleParticle ©);
SingleParticle& operator=(const SingleParticle ©);
// destructor
~SingleParticle();
};
class ParticleSystem
{
private:
//particle attributes
int species { 0 };
SingleParticle *particles { nullptr };
//thermal attributes of the system
double temperature { 0 }; // in GeV units
double baryonChemicalPotential { 0 }; // in GeV units
double chargeChemicalPotential { 0 }; // in GeV units
double strangenessChemicalPotential { 0 }; // in GeV units
double *chemicalPotentialEach { nullptr }; // chemical potential of each species
// flags
bool PDGDataLoaded { false };
bool decaysLoaded { false };
public:
ParticleSystem(){}
// copy constructor
ParticleSystem(const ParticleSystem ©);
ParticleSystem& operator=(const ParticleSystem ©);
ParticleSystem(double T, double mub, double muq, double mus);
// destructor
~ParticleSystem();
int getSpecies() const{ return species; }
double getTemperature () const { return temperature; }
double getBaryonChemicalPotential () const { return baryonChemicalPotential; }
double getChargeChemicalPotential () const { return chargeChemicalPotential; }
double getStrangenessChemicalPotential () const { return strangenessChemicalPotential; }
const double *getChemicalPotentialAll () const { return chemicalPotentialEach; }
double getChemicalPotentialEach (int ID);
void setTemperature(double T);
void setBaryonChemicalPotential(double mub);
void setChargeChemicalPotential(double muq);
void settStrangenessChemicalPotential(double mus);
void setChemicalPotential(double mub, double muq, double mus);
void setThermalParameters(double T, double mub, double muq, double mus);
void calculateChemicalPotentialEach();
int getIDfromPDGID(long PDGID);
int getAntiParticleID(int ID);
void addParticle(SingleParticle &p);
SingleParticle &getParticle(int ID);
void loadPDGTable(std::string fname = "data/pdg_hadrons.dat");
void loadDecayChannels(std::string fname = "data/decays.dat");
void loadDefaultData();
void printDataToFile(std::string fname = "PDG_and_decays.txt");
};
#endif