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"
#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.;
double mn2 = 0., mn3 = 0.;
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";
vector<double> coefsk(parts.
Particles().size(), 0.);
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 chi2B = model->
Susc(ConservedCharge::BaryonCharge, ConservedCharge::BaryonCharge);
double chi2Q = model->
Susc(ConservedCharge::ElectricCharge, ConservedCharge::ElectricCharge);
double chi2S = model->
Susc(ConservedCharge::StrangenessCharge, ConservedCharge::StrangenessCharge);
double chi11BS = model->
Susc(ConservedCharge::BaryonCharge, ConservedCharge::StrangenessCharge);
double chi11QS = model->
Susc(ConservedCharge::ElectricCharge, ConservedCharge::StrangenessCharge);
double chi11BQ = model->
Susc(ConservedCharge::ElectricCharge, ConservedCharge::BaryonCharge);
double chi2p = model->
ProxySusc(ConservedCharge::BaryonCharge, ConservedCharge::BaryonCharge);
double chi2k = model->
ProxySusc(ConservedCharge::StrangenessCharge, ConservedCharge::StrangenessCharge);
double chi11pk = model->
ProxySusc(ConservedCharge::BaryonCharge, ConservedCharge::StrangenessCharge);
double chi11Qk = model->
ProxySusc(ConservedCharge::ElectricCharge, ConservedCharge::StrangenessCharge);
double chi11pQ = model->
ProxySusc(ConservedCharge::ElectricCharge, ConservedCharge::BaryonCharge);
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.;
config.
fEnsemble = EventGeneratorConfiguration::GCE;
config.
fModelType = EventGeneratorConfiguration::PointParticle;
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;
}