Thermal-FIST  1.3
Package for hadron resonance gas model applications
ThermalModelIdeal.cpp
Go to the documentation of this file.
1 /*
2  * Thermal-FIST package
3  *
4  * Copyright (c) 2014-2019 Volodymyr Vovchenko
5  *
6  * GNU General Public License (GPLv3 or later)
7  */
9 
10 #ifdef USE_OPENMP
11 #include <omp.h>
12 #endif
13 
14 #include <iostream>
15 #include <cmath>
16 
17 
18 using namespace std;
19 
20 namespace thermalfist {
21 
22  ThermalModelIdeal::ThermalModelIdeal(ThermalParticleSystem *TPS_, const ThermalModelParameters& params) :
23  ThermalModelBase(TPS_, params)
24  {
25  m_TAG = "ThermalModelIdeal";
26 
27  m_Ensemble = GCE;
29  }
30 
32  {
33  }
34 
37 
38  for (int i = 0; i < m_TPS->ComponentsNumber(); ++i) {
40  }
41 
42  m_Calculated = true;
44  }
45 
47  int NN = m_densities.size();
48  vector<double> tN(NN), tW(NN);
49  for (int i = 0; i < NN; ++i) tN[i] = m_densities[i];
50 
51  for (int i = 0; i < NN; ++i) tW[i] = ParticleScaledVariance(i);
52 
53  m_PrimCorrel.resize(NN);
54  for (int i = 0; i < NN; ++i) m_PrimCorrel[i].resize(NN);
56 
57  for (int i = 0; i < NN; ++i)
58  for (int j = 0; j < NN; ++j) {
59  m_PrimCorrel[i][j] = 0.;
60  if (i == j) m_PrimCorrel[i][j] += m_densities[i] * tW[i];
61  m_PrimCorrel[i][j] /= m_Parameters.T;
62  }
63 
64  for (int i = 0; i < NN; ++i) {
65  m_wprim[i] = m_PrimCorrel[i][i];
66  if (m_densities[i] > 0.) m_wprim[i] *= m_Parameters.T / m_densities[i];
67  else m_wprim[i] = 1.;
68  }
69 
70  }
71 
72 
79 
80  for (size_t i = 0; i < m_wprim.size(); ++i) {
84  }
85  for (size_t i = 0; i < m_wtot.size(); ++i) {
86  double tmp1 = 0., tmp2 = 0., tmp3 = 0., tmp4 = 0.;
87  tmp2 = m_densities[i] * m_wprim[i];
88  tmp3 = m_densities[i] * m_wprim[i] * m_skewprim[i];
89  tmp4 = m_densities[i] * m_wprim[i] * m_kurtprim[i];
91  for (size_t r = 0; r < decayContributions.size(); ++r) {
92  const ThermalParticleSystem::SingleDecayContribution& decayContrib = decayContributions[r];
94  tmp2 += m_densities[decayContrib.second] *
95  (m_wprim[decayContrib.second] * decayContrib.first * decayContrib.first
96  + decayCumulantsSingle.first[1]);
97 
98  int rr = decayContrib.second;
99  double ni = decayContrib.first;
100  tmp3 += m_densities[rr] * m_wprim[rr] * (m_skewprim[rr] * ni * ni * ni + 3. * ni * decayCumulantsSingle.first[1]);
101  tmp3 += m_densities[rr] * decayCumulantsSingle.first[2];
102 
103  tmp4 += m_densities[rr] * m_wprim[rr] * (m_kurtprim[rr] * ni * ni * ni * ni
104  + 6. * m_skewprim[rr] * ni * ni * decayCumulantsSingle.first[1]
105  + 3. * decayCumulantsSingle.first[1] * decayCumulantsSingle.first[1]
106  + 4. * ni * decayCumulantsSingle.first[2]);
107 
108  tmp4 += m_densities[rr] * decayCumulantsSingle.first[3];
109  }
110 
111 
112  tmp1 = m_densitiestotal[i];
113 
114  m_wtot[i] = tmp2 / tmp1;
115  m_skewtot[i] = tmp3 / tmp2;
116  m_kurttot[i] = tmp4 / tmp2;
117  }
118 
120  }
121 
122  std::vector<double> ThermalModelIdeal::CalculateChargeFluctuations(const std::vector<double>& chgs, int order)
123  {
124  vector<double> ret(order + 1, 0.);
125 
126  // chi1
127  for (size_t i = 0; i < m_densities.size(); ++i)
128  ret[0] += chgs[i] * m_densities[i];
129 
130  ret[0] /= pow(m_Parameters.T * xMath::GeVtoifm(), 3);
131 
132  if (order < 2) return ret;
133 
134  for (size_t i = 0; i < m_densities.size(); ++i)
135  ret[1] += chgs[i] * chgs[i] * m_TPS->Particles()[i].chi(2, m_Parameters, m_UseWidth, m_Chem[i]);
136 
137  if (order < 3) return ret;
138 
139  for (size_t i = 0; i < m_densities.size(); ++i)
140  ret[2] += chgs[i] * chgs[i] * chgs[i] * m_TPS->Particles()[i].chi(3, m_Parameters, m_UseWidth, m_Chem[i]);
141 
142  if (order < 4) return ret;
143 
144  for (size_t i = 0; i < m_densities.size(); ++i)
145  ret[3] += chgs[i] * chgs[i] * chgs[i] * chgs[i] * m_TPS->Particles()[i].chi(4, m_Parameters, m_UseWidth, m_Chem[i]);
146 
147  return ret;
148  }
149 
151  double ret = 0.;
152 
153  for (int i = 0; i < m_TPS->ComponentsNumber(); ++i) ret += m_TPS->Particles()[i].Density(m_Parameters, IdealGasFunctions::EnergyDensity, m_UseWidth, m_Chem[i]);
154 
155  return ret;
156  }
157 
159  double ret = 0.;
160 
161  for (int i = 0; i < m_TPS->ComponentsNumber(); ++i) ret += m_TPS->Particles()[i].Density(m_Parameters, IdealGasFunctions::EntropyDensity, m_UseWidth, m_Chem[i]);
162 
163  return ret;
164  }
165 
167  double ret = 0.;
168  for (int i = 0; i < m_TPS->ComponentsNumber(); ++i)
169  if (m_TPS->Particles()[i].BaryonCharge() != 0)
171  return ret;
172  }
173 
175  double ret = 0.;
176  for (int i = 0; i < m_TPS->ComponentsNumber(); ++i)
177  if (m_TPS->Particles()[i].BaryonCharge() == 0)
179  return ret;
180  }
181 
183  double ret = 0.;
184 
185  for (int i = 0; i < m_TPS->ComponentsNumber(); ++i) ret += m_TPS->Particles()[i].Density(m_Parameters, IdealGasFunctions::Pressure, m_UseWidth, m_Chem[i]);
186 
187  return ret;
188  }
189 
191  return m_TPS->Particles()[part].ScaledVariance(m_Parameters, m_UseWidth, m_Chem[part]);
192  }
193 
195  return m_TPS->Particles()[part].Skewness(m_Parameters, m_UseWidth, m_Chem[part]);
196  }
197 
199  return m_TPS->Particles()[part].Kurtosis(m_Parameters, m_UseWidth, m_Chem[part]);
200  }
201 
204  }
205 
206 } // namespace thermalfist
Abstract base class for an HRG model implementation.
virtual void CalculateTwoParticleFluctuationsDecays()
Computes particle number correlations and fluctuations for all final-state particles which are marked...
std::vector< double > m_Chem
virtual double ParticleSkewness(int part)
Skewness of primordial particle number fluctuations for species i.
double GeVtoifm()
A constant to transform GeV into fm .
Definition: xMath.h:27
std::vector< double > m_kurttot
std::vector< double > m_wprim
virtual double CalculatePressure()
Implementation of the equation of state functions.
std::vector< double > m_skewprim
virtual void CalculateFluctuations()
Computes the fluctuation observables.
std::pair< std::vector< double >, int > SingleDecayCumulantsContribution
Class containing the particle list.
Grand canonical ensemble.
ThermalModelParameters m_Parameters
Structure containing all thermal parameters of the model.
virtual void CalculateTwoParticleCorrelations()
Computes the fluctuations and correlations of the primordial particle numbers.
int ComponentsNumber() const
Number of different particle species in the list.
virtual double ParticleScalarDensity(int part)
The scalar density of the particle species i.
virtual void CalculateSusceptibilityMatrix()
Calculates the conserved charges susceptibility matrix.
ThermalParticleSystem * m_TPS
std::vector< double > m_wtot
std::vector< SingleDecayContribution > DecayContributionsToParticle
A vector of SingleDecayContribution where each element corresponds to a certain resonance species...
virtual void CalculateProxySusceptibilityMatrix()
Calculates the susceptibility matrix of conserved charges proxies.
virtual std::vector< double > CalculateChargeFluctuations(const std::vector< double > &chgs, int order=4)
Calculates fluctuations (diagonal susceptibilities) of an arbitrary "conserved" charge.
virtual double CalculateBaryonMatterEntropyDensity()
The fraction of entropy carried by baryons (Ideal GCE only)
std::vector< double > m_kurtprim
const std::vector< ThermalParticle > & Particles() const
Returns the vector of all particle species.
std::vector< std::vector< double > > m_TotalCorrel
ThermalModelInteraction m_InteractionModel
virtual void ValidateCalculation()
Checks whether issues have occured during the calculation of particle densities in the CalculateDensi...
virtual double CalculateMesonMatterEntropyDensity()
The fraction of entropy carried by mesons (Ideal GCE only)
const DecayCumulantsContributionsToAllParticles & DecayCumulants() const
Cumulants of particle number distributions of from decays.
std::vector< double > m_densities
virtual double ParticleScaledVariance(int part)
Scaled variance of primordial particle number fluctuations for species i.
std::vector< std::vector< double > > m_PrimCorrel
ThermalModelEnsemble m_Ensemble
std::vector< double > m_skewtot
virtual void CalculateParticleChargeCorrelationMatrix()
Calculates the matrix of correlators between primordial (and also final) particle numbers and conserv...
virtual ~ThermalModelIdeal(void)
Destroy the ThermalModelIdeal object.
const std::vector< DecayContributionsToAllParticles > & DecayContributionsByFeeddown() const
std::vector< double > m_densitiestotal
virtual double ParticleKurtosis(int part)
Kurtosis of primordial particle number fluctuations for species i.
virtual void CalculatePrimordialDensities()
Calculates the primordial densities of all species.
The main namespace where all classes and functions of the Thermal-FIST library reside.
std::pair< double, int > SingleDecayContribution
Feeddown from all particles marked as unstable.
Definition: ParticleDecay.h:37