Thermal-FIST  1.3
Package for hadron resonance gas model applications
ThermalModelCanonicalCharm.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 #include "HRGBase/xMath.h"
11 
12 
13 using namespace std;
14 
15 namespace thermalfist {
16 
17  ThermalModelCanonicalCharm::ThermalModelCanonicalCharm(ThermalParticleSystem *TPS_, const ThermalModelParameters& params) :
18  ThermalModelBase(TPS_, params)
19  {
20  m_densitiesGCE.resize(m_TPS->Particles().size());
21 
22  m_CharmValues.resize(0);
23  m_CharmValues.push_back(0);
24  m_CharmValues.push_back(1);
25  m_CharmValues.push_back(-1);
26 
27  m_CharmMap.clear();
28  for (unsigned int i = 0; i < m_CharmValues.size(); ++i) m_CharmMap[m_CharmValues[i]] = i;
29 
30  m_Parameters.muC = 0.;
31 
32  m_TAG = "ThermalModelCanonicalCharm";
33 
34  m_Ensemble = CCE;
36 
37  }
38 
40  {
41  }
42 
43 
46  m_Parameters.muC = 0.;
47  }
48 
50  {
51  m_Parameters.muC = 0.0;
52  }
53 
56  m_densitiesGCE.resize(m_TPS->Particles().size());
57  }
58 
60  m_QuantumStats = stats;
61  for (int i = 0; i < m_TPS->ComponentsNumber(); ++i)
62  if (m_TPS->Particles()[i].Charm() == 0) m_TPS->Particle(i).UseStatistics(stats);
63  else m_TPS->Particle(i).UseStatistics(false);
64  }
65 
67  for (int i = 0; i < m_TPS->ComponentsNumber(); ++i) {
68  m_densitiesGCE[i] = m_TPS->Particles()[i].Density(m_Parameters, IdealGasFunctions::ParticleDensity, m_UseWidth, m_Chem[i]);
69  }
70  m_GCECalculated = true;
71  }
72 
74  m_energydensitiesGCE.resize(m_densitiesGCE.size());
75  for (int i = 0; i < m_TPS->ComponentsNumber(); ++i) {
76  m_energydensitiesGCE[i] = m_TPS->Particles()[i].Density(m_Parameters, IdealGasFunctions::EnergyDensity, m_UseWidth, m_Chem[i]);
77  }
78  }
79 
81  {
82  m_ConstrainMuC = false;
84  }
85 
88  printf("**ERROR** ThermalModelCanonicalCharm::CalculatePrimordialDensities(): PCE not supported!\n");
89  exit(1);
90  }
91 
93  m_energydensitiesGCE.resize(0);
94 
96 
97  m_Zsum.resize(m_CharmValues.size());
98 
99  m_partialZ.resize(m_CharmValues.size());
100  vector<double> xi(1, 0.), yi(1, 0.);
101 
102  for (size_t i = 0; i < m_CharmValues.size(); ++i) {
103  m_partialZ[i] = 0.;
104  for (int j = 0; j < m_TPS->ComponentsNumber(); ++j)
105  if (m_CharmValues[i] == m_TPS->Particles()[j].Charm()) m_partialZ[i] += m_densitiesGCE[j] * m_Volume;
106  if (m_partialZ[i] < 1.e-10) m_partialZ[i] += 1e-10;
107  }
108 
109 
110  for (int i = 0; i < 1; ++i) {
111  xi[i] = 2. * sqrt(m_partialZ[m_CharmMap[i + 1]] * m_partialZ[m_CharmMap[-(i + 1)]]);
112  yi[i] = sqrt(m_partialZ[m_CharmMap[i + 1]] / m_partialZ[m_CharmMap[-(i + 1)]]);
113  }
114 
115  for (size_t i = 0; i < m_CharmValues.size(); ++i) {
116  double res = 0.;
117 
118  res = xMath::BesselI(abs(-m_CharmValues[i]), xi[0]) * pow(yi[0], m_CharmValues[i]);
119  m_Zsum[i] = res;
120  }
121 
122  for (int i = 0; i < m_TPS->ComponentsNumber(); ++i) {
123  if (m_CharmMap.count(-m_TPS->Particles()[i].Charm())) m_densities[i] = (m_Zsum[m_CharmMap[-m_TPS->Particles()[i].Charm()]] / m_Zsum[m_CharmMap[0]]) * m_densitiesGCE[i];
124  }
125 
126  m_Calculated = true;
128  }
129 
131  m_wprim.resize(m_densities.size());
132  m_wtot.resize(m_densities.size());
133  for (size_t i = 0; i < m_wprim.size(); ++i) {
134  m_wprim[i] = 1.;
135  m_wtot[i] = 1.;
136  m_skewprim[i] = 1.;
137  m_skewtot[i] = 1.;
138  }
139  }
140 
143  if (m_energydensitiesGCE.size() == 0) CalculateEnergyDensitiesGCE();
144  double ret = 0.;
145  for (int i = 0; i < m_TPS->ComponentsNumber(); ++i) ret += (m_Zsum[m_CharmMap[-m_TPS->Particles()[i].Charm()]] / m_Zsum[m_CharmMap[0]]) * m_energydensitiesGCE[i];
146  return ret;
147  }
148 
150  double ret = m_partialZ[0] + log(m_Zsum[m_CharmMap[0]]);
151  if (m_energydensitiesGCE.size() == 0) CalculateEnergyDensitiesGCE();
152  for (int i = 0; i < m_TPS->ComponentsNumber(); ++i) if (m_CharmMap.count(-m_TPS->Particles()[i].Charm())) ret += (m_Zsum[m_CharmMap[-m_TPS->Particles()[i].Charm()]] / m_Zsum[m_CharmMap[0]]) * ((m_energydensitiesGCE[i] - (m_Parameters.muB * m_TPS->Particles()[i].BaryonCharge() + m_Parameters.muQ * m_TPS->Particles()[i].ElectricCharge() + m_Parameters.muS * m_TPS->Particles()[i].Strangeness()) * m_densitiesGCE[i]) / m_Parameters.T);
153  return ret;
154  }
155 
156 
158  double ret = 0.;
159  for (int i = 0; i < m_TPS->ComponentsNumber(); ++i) ret += (m_Zsum[m_CharmMap[-m_TPS->Particles()[i].Charm()]] / m_Zsum[m_CharmMap[0]]) * m_Parameters.T * m_densitiesGCE[i];
160  return ret;
161  }
162 
164  return (charge == ConservedCharge::CharmCharge);
165  }
166 
167 } // namespace thermalfist
Abstract base class for an HRG model implementation.
virtual double CalculatePressure()
Implementation of the equation of state functions.
std::vector< double > m_Chem
std::vector< double > m_wprim
const ThermalParticle & Particle(int id) const
ThermalParticle object corresponding to particle species with a provided 0-based index.
std::vector< double > m_skewprim
virtual void FixParameters()
Method which actually implements ConstrainChemicalPotentials() (for backward compatibility).
Class containing the particle list.
virtual void SetParameters(const ThermalModelParameters &params)
The thermal parameters.
ThermalModelParameters m_Parameters
Structure containing all thermal parameters of the model.
int ComponentsNumber() const
Number of different particle species in the list.
virtual void ChangeTPS(ThermalParticleSystem *TPS)
Change the particle list.
Charm-canonical ensemble.
virtual void SetCharmChemicalPotential(double muC)
Override the base class method to always set to zero.
Contains some extra mathematical functions used in the code.
ThermalParticleSystem * m_TPS
std::vector< double > m_wtot
double BesselI(int n, double x)
integer order modified Bessel function I_n(x)
Definition: xMath.cpp:191
virtual void SetParameters(const ThermalModelParameters &params)
The thermal parameters.
const std::vector< ThermalParticle > & Particles() const
Returns the vector of all particle species.
ThermalModelInteraction m_InteractionModel
virtual void ValidateCalculation()
Checks whether issues have occured during the calculation of particle densities in the CalculateDensi...
virtual bool IsConservedChargeCanonical(ConservedCharge::Name charge) const
Whether the given conserved charge is treated canonically.
void UseStatistics(bool enable)
Use quantum statistics.
Name
Set of all conserved charges considered.
virtual void CalculatePrimordialDensities()
Calculates the primordial densities of all species.
virtual void CalculateDensities()
Calculates the primordial and total (after decays) densities of all species.
std::vector< double > m_densities
virtual void ChangeTPS(ThermalParticleSystem *TPS)
Change the particle list.
bool UsePartialChemicalEquilibrium()
Whether partial chemical equilibrium with additional chemical potentials is used. ...
ThermalModelEnsemble m_Ensemble
std::vector< double > m_skewtot
void CalculateEnergyDensitiesGCE()
Calculates the grand-canonical energy densities.
virtual ~ThermalModelCanonicalCharm(void)
Destroy the ThermalModelCanonicalCharm object.
void CalculateFluctuations()
Dummy function. Fluctuations not yet supported.
The main namespace where all classes and functions of the Thermal-FIST library reside.
void CalculateDensitiesGCE()
Calculates the particle densities in a grand-canonical ensemble.
virtual void FixParameters()
Method which actually implements ConstrainChemicalPotentials() (for backward compatibility).