Calculates the collision energy dependence of 2nd order susceptibilities of (proxy) conserved charges, computed within the Ideal HRG model along the phenomenological chemical freeze-out curve.
where <withMonteCarlo> flag determines whether Monte Carlo calculations are performed and <nevents> is the number of Monte Carlo events per single collision energy
#include <string.h>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <ctime>
#include <cstdio>
#include "ThermalFISTConfig.h"
using namespace std;
#ifdef ThermalFIST_USENAMESPACE
#endif
double muBss(
double ss) {
return 1.308 / (1. + 0.273 * ss);
}
double tmpmuB =
muBss(ss);
return 0.166 - 0.139 * tmpmuB * tmpmuB - 0.053 * tmpmuB * tmpmuB * tmpmuB * tmpmuB;
}
{
double ret = 0.;
for (int r = 0; r < model->TPS()->ComponentsNumber(); ++r) {
double mn1 = model->ScaledVariancePrimordial(r) * model->Densities()[r] / pow(model->
Parameters().
T, 3) / pow(
xMath::GeVtoifm(), 3);
double mn2 = 0., mn3 = 0.;
for (int j = 0; j < model->TPS()->ComponentsNumber(); ++j) {
double njavr = 0.;
for (size_t i = 0; i < decayDistributions.size(); ++i) {
njavr += decayDistributions[i].first * decayDistributions[i].second[j];
}
mn2 += ch1[j] * njavr;
mn3 += ch2[j] * njavr;
}
ret += mn1 * mn2 * mn3;
}
return ret;
}
int main(
int argc,
char *argv[])
{
int withMonteCarlo = 1;
if (argc > 1)
withMonteCarlo = atoi(argv[1]);
int nevents = 100000;
if (argc >2)
nevents = atoi(argv[2]);
string listname = string(ThermalFIST_INPUT_FOLDER) + "/list/PDG2014/list.dat";
parts.ParticleByPDG(311).SetStable(true);
parts.ParticleByPDG(-311).SetStable(true);
vector<double> coefsk(parts.Particles().size(), 0.);
coefsk[parts.PdgToId(321)] = 1.;
coefsk[parts.PdgToId(-321)] = -1.;
double smin = 3.;
double smax = 3000.;
int iterss = 100;
int iters = 0;
double musp = 0., muqp = 0., mucp = 0.;
printf("Analytic\n");
FILE *f = fopen("cpc4.analyt.dat", "w");
fprintf(f, "%15s%15s%15s%15s%15s%15s%15s%15s%15s%15s%15s%15s%15s\n",
"sqrts[GeV]",
"T[MeV]",
"muB[MeV]",
"muQ[MeV]",
"muS[MeV]",
"c2k/c1k",
"C_B,S",
"C_p,k_fd",
"C_Q,S",
"C_Q,k_fd",
"C_B,Q",
"C_p,Q_fd",
"c2k_av/c1k"
);
vector<double> ens, Ts, muBs, muQs, muSs;
double logSmin = log(smin);
double logSmax = log(smax);
double dlogS = (logSmax - logSmin) / iterss;
for (int is = 0; is <= iterss; ++is) {
double ss = exp(logSmin + is * dlogS);
ens.push_back(ss);
Ts.push_back(T);
muBs.push_back(muB);
muQs.push_back(muqp);
muSs.push_back(musp);
double chi1B = model->CalculateBaryonDensity() / pow(T, 3) / pow(
xMath::GeVtoifm(), 3);
double chi1Q = model->CalculateChargeDensity() / pow(T, 3) / pow(
xMath::GeVtoifm(), 3);
double chi1S = model->CalculateStrangenessDensity() / pow(T, 3) / pow(
xMath::GeVtoifm(), 3);
printf("%15lf%15lf%15lf%15lf%15lf%15lf%15lf\n",
ss,
chi11BS / chi2S,
chi11QS / chi2S,
chi11BQ / chi2B,
chi11pk / chi2k,
chi11Qk / chi2k,
chi11pQ / chi2p);
fprintf(f, "%15lf%15lf%15lf%15lf%15lf%15lf%15lf%15lf%15lf%15lf%15lf%15lf%15lf\n",
ss,
T * 1.e3,
muB * 1.e3,
muqp * 1.e3,
musp * 1.e3,
chi2k / chi1k,
chi11BS / chi2S,
chi11pk / chi2k,
chi11QS / chi2S,
chi11Qk / chi2k,
chi11BQ / chi2B,
chi11pQ / chi2p,
chi2kav / chi1k);
fflush(f);
iters++;
}
fclose(f);
printf("%30s %lf s\n", "Running time:", (wt2 - wt1));
printf("%30s %lf s\n", "Time per single calculation:", (wt2 - wt1) / iters);
printf("\n\n");
if (!withMonteCarlo)
return 0;
printf("Monte Carlo\n");
f = fopen("cpc4.montecarlo.dat", "w");
fprintf(f, "%15s%15s%15s%15s%15s%15s%15s%15s%15s%15s%15s%15s\n",
"sqrts[GeV]",
"T[MeV]",
"muB[MeV]",
"muQ[MeV]",
"muS[MeV]",
"c2k/c1k",
"C_B,S",
"C_p,k_fd",
"C_Q,S",
"C_Q,k_fd",
"C_B,Q",
"C_p,Q_fd"
);
iters = 0;
for (size_t ind = 0; ind < ens.size(); ind++) {
double mc_B = 0., mc_Q = 0., mc_S = 0., mc_p = 0., mc_k = 0.;
double mc_B2 = 0., mc_Q2 = 0., mc_S2 = 0., mc_BQ = 0., mc_QS = 0., mc_BS = 0.;
double mc_p2 = 0., mc_k2 = 0., mc_pk = 0., mc_pQ = 0., mc_Qk = 0.;
double wsum = 0.;
for (int i = 0; i < nevents; ++i) {
int mcev_B = 0, mcev_Q = 0, mcev_S = 0, mcev_p = 0, mcev_k = 0;
for (
size_t part = 0; part < ev.
Particles.size(); ++part) {
if (pdgid == 2212)
mcev_p += 1;
else if (pdgid == -2212)
mcev_p += (-1);
if (pdgid == 321)
mcev_k += 1;
else if (pdgid == -321)
mcev_k += (-1);
}
mc_B2 += ev.
weight * mcev_B * mcev_B;
mc_Q2 += ev.
weight * mcev_Q * mcev_Q;
mc_S2 += ev.
weight * mcev_S * mcev_S;
mc_p2 += ev.
weight * mcev_p * mcev_p;
mc_k2 += ev.
weight * mcev_k * mcev_k;
mc_BQ += ev.
weight * mcev_B * mcev_Q;
mc_QS += ev.
weight * mcev_Q * mcev_S;
mc_BS += ev.
weight * mcev_B * mcev_S;
mc_pQ += ev.
weight * mcev_p * mcev_Q;
mc_pk += ev.
weight * mcev_p * mcev_k;
mc_Qk += ev.
weight * mcev_Q * mcev_k;
}
double chi1B = mc_B / wsum;
double chi1Q = mc_Q / wsum;
double chi1S = mc_S / wsum;
double chi1p = mc_p / wsum;
double chi1k = mc_k / wsum;
double chi2B = mc_B2 / wsum - mc_B / wsum * mc_B / wsum;
double chi2Q = mc_Q2 / wsum - mc_Q / wsum * mc_Q / wsum;
double chi2S = mc_S2 / wsum - mc_S / wsum * mc_S / wsum;
double chi11BS = mc_BS / wsum - mc_B / wsum * mc_S / wsum;
double chi11QS = mc_QS / wsum - mc_Q / wsum * mc_S / wsum;
double chi11BQ = mc_BQ / wsum - mc_B / wsum * mc_Q / wsum;
double chi2p = mc_p2 / wsum - mc_p / wsum * mc_p / wsum;
double chi2k = mc_k2 / wsum - mc_k / wsum * mc_k / wsum;
double chi11pk = mc_pk / wsum - mc_p / wsum * mc_k / wsum;
double chi11Qk = mc_Qk / wsum - mc_Q / wsum * mc_k / wsum;
double chi11pQ = mc_pQ / wsum - mc_p / wsum * mc_Q / wsum;
printf("%15lf%15lf%15lf%15lf%15lf%15lf%15lf\n", ens[ind], chi11BS / chi2S, chi11QS / chi2S, chi11BQ / chi2B, chi11pk / chi2k, chi11Qk / chi2k, chi11pQ / chi2p);
fprintf(f, "%15lf%15lf%15lf%15lf%15lf%15lf%15lf%15lf%15lf%15lf%15lf%15lf\n",
ens[ind],
Ts[ind] * 1.e3,
muBs[ind] * 1.e3,
muQs[ind] * 1.e3,
muSs[ind] * 1.e3,
chi2k / chi1k,
chi11BS / chi2S,
chi11pk / chi2k,
chi11QS / chi2S,
chi11Qk / chi2k,
chi11BQ / chi2B,
chi11pQ / chi2p);
fflush(f);
iters++;
}
fclose(f);
printf("%30s %lf s\n", "Running time:", (wt2 - wt1));
printf("%30s %lf s\n", "Time per single calculation:", (wt2 - wt1) / iters);
delete model;
return 0;
}
int main(int argc, char *argv[])
map< string, double > params
Class implementing the Thermal Event Generator for the isotropic blast-wave scenario.
Abstract base class for an HRG model implementation.
virtual void SetTemperature(double T)
Set the temperature.
virtual void CalculateFluctuations()
Computes the fluctuation observables.
bool ConstrainMuS() const
bool ConstrainMuQ() const
void ConstrainChemicalPotentials(bool resetInitialValues=true)
Constrains the chemical potentials by the conservation laws imposed.
bool ConstrainMuC() const
void SetUseWidth(bool useWidth)
Sets whether finite resonance widths are used. Deprecated.
virtual void SetBaryonChemicalPotential(double muB)
Set the baryon chemical potential.
void SetNormBratio(bool normBratio)
Whether branching ratios are renormalized to 100%.
virtual void SetParameters(const ThermalModelParameters ¶ms)
The thermal parameters.
virtual void SetElectricChemicalPotential(double muQ)
Set the electric chemical potential.
virtual void SetStrangenessChemicalPotential(double muS)
Set the strangeness chemical potential.
const ThermalModelParameters & Parameters() const
virtual void SetCharmChemicalPotential(double muC)
Set the charm chemical potential.
virtual void SetStatistics(bool stats)
Class implementing the Ideal HRG model.
Class containing all information about a particle specie.
int BaryonCharge() const
Particle's baryon number.
int Strangeness() const
Particle's strangeness.
@ BWTwoGamma
Energy-independent Breit-Wigner in +-2\Gamma interval.
int ElectricCharge() const
Particle's electric charge.
Class containing the particle list.
std::vector< std::pair< double, std::vector< int > > > ResonanceFinalStatesDistribution
double CalculateAveragedDecaysChi2(ThermalModelBase *model, const std::vector< double > &ch1, const std::vector< double > &ch2)
void SetSeed(const unsigned int seed)
Set the seed of the random number generator randgenMT.
constexpr double GeVtoifm()
A constant to transform GeV into fm .
The main namespace where all classes and functions of the Thermal-FIST library reside.
@ BaryonCharge
Baryon number.
@ StrangenessCharge
Strangeness.
@ ElectricCharge
Electric charge.
Structure containing the thermal event generator configuration.
Ensemble fEnsemble
The statistical ensemble used.
ThermalModelParameters CFOParameters
The chemical freeze-out parameters.
ModelType fModelType
The type of interaction model.
@ PointParticle
Ideal gas.
@ StabilityFlag
Feeddown from all particles marked as unstable.
Structure holding information about a single event in the event generator.
double weight
Event weight factor.
std::vector< SimpleParticle > Particles
Vector of all final particles in the event.
Structure containing all thermal parameters of the model.