27 double EventGeneratorBase::m_LastWeight = 1., EventGeneratorBase::m_LastLogWeight = 0., EventGeneratorBase::m_LastNormWeight = 1.;
43 for (
size_t i = 0; i <
m_BWGens.size(); ++i) {
127 double left = 0.000, right = 0.900, center;
143 while ((right - left) > 0.00001) {
144 center = (left + right) / 2.;
151 if (valleft*valcenter > 0.) {
157 valright = valcenter;
184 printf(
"**WARNING** Could not constrain chemical potentials. Setting all for exactly conserved charges to zero...\n");
212 std::cout <<
"Chemical potentials constrained!\n" 265 m_AntiBaryons.resize(0);
266 m_StrangeMesons.resize(0);
267 m_AntiStrangeMesons.resize(0);
268 m_ChargeMesons.resize(0);
269 m_AntiChargeMesons.resize(0);
270 m_CharmMesons.resize(0);
271 m_AntiCharmMesons.resize(0);
272 m_CharmAll.resize(0);
273 m_AntiCharmAll.resize(0);
291 m_Baryons.push_back(std::make_pair(yields[i], i));
292 m_MeanB += yields[i];
295 m_AntiBaryons.push_back(std::make_pair(yields[i], i));
296 m_MeanAB += yields[i];
299 m_StrangeMesons.push_back(std::make_pair(yields[i], i));
300 m_MeanSM += yields[i];
303 m_AntiStrangeMesons.push_back(std::make_pair(yields[i], i));
304 m_MeanASM += yields[i];
307 m_ChargeMesons.push_back(std::make_pair(yields[i], i));
308 m_MeanCM += yields[i];
311 m_AntiChargeMesons.push_back(std::make_pair(yields[i], i));
312 m_MeanACM += yields[i];
315 m_CharmMesons.push_back(std::make_pair(yields[i], i));
316 m_MeanCHRMM += yields[i];
319 m_AntiCharmMesons.push_back(std::make_pair(yields[i], i));
320 m_MeanACHRMM += yields[i];
324 m_CharmAll.push_back(std::make_pair(yields[i], i));
325 m_MeanCHRM += yields[i];
328 m_AntiCharmAll.push_back(std::make_pair(yields[i], i));
329 m_MeanACHRM += yields[i];
334 std::sort(m_Baryons.begin(), m_Baryons.end(), std::greater< std::pair<double, int> >());
335 std::sort(m_AntiBaryons.begin(), m_AntiBaryons.end(), std::greater< std::pair<double, int> >());
336 std::sort(m_StrangeMesons.begin(), m_StrangeMesons.end(), std::greater< std::pair<double, int> >());
337 std::sort(m_AntiStrangeMesons.begin(), m_AntiStrangeMesons.end(), std::greater< std::pair<double, int> >());
338 std::sort(m_ChargeMesons.begin(), m_ChargeMesons.end(), std::greater< std::pair<double, int> >());
339 std::sort(m_AntiChargeMesons.begin(), m_AntiChargeMesons.end(), std::greater< std::pair<double, int> >());
340 std::sort(m_CharmMesons.begin(), m_CharmMesons.end(), std::greater< std::pair<double, int> >());
341 std::sort(m_AntiCharmMesons.begin(), m_AntiCharmMesons.end(), std::greater< std::pair<double, int> >());
342 std::sort(m_CharmAll.begin(), m_CharmAll.end(), std::greater< std::pair<double, int> >());
343 std::sort(m_AntiCharmAll.begin(), m_AntiCharmAll.end(), std::greater< std::pair<double, int> >());
345 for (
int i = 1; i < static_cast<int>(m_Baryons.size()); ++i) m_Baryons[i].first += m_Baryons[i - 1].first;
346 for (
int i = 1; i < static_cast<int>(m_AntiBaryons.size()); ++i) m_AntiBaryons[i].first += m_AntiBaryons[i - 1].first;
347 for (
int i = 1; i < static_cast<int>(m_StrangeMesons.size()); ++i) m_StrangeMesons[i].first += m_StrangeMesons[i - 1].first;
348 for (
int i = 1; i < static_cast<int>(m_AntiStrangeMesons.size()); ++i) m_AntiStrangeMesons[i].first += m_AntiStrangeMesons[i - 1].first;
349 for (
int i = 1; i < static_cast<int>(m_ChargeMesons.size()); ++i) m_ChargeMesons[i].first += m_ChargeMesons[i - 1].first;
350 for (
int i = 1; i < static_cast<int>(m_AntiChargeMesons.size()); ++i) m_AntiChargeMesons[i].first += m_AntiChargeMesons[i - 1].first;
351 for (
int i = 1; i < static_cast<int>(m_CharmMesons.size()); ++i) m_CharmMesons[i].first += m_CharmMesons[i - 1].first;
352 for (
int i = 1; i < static_cast<int>(m_AntiCharmMesons.size()); ++i) m_AntiCharmMesons[i].first += m_AntiCharmMesons[i - 1].first;
353 for (
int i = 1; i < static_cast<int>(m_CharmAll.size()); ++i) m_CharmAll[i].first += m_CharmAll[i - 1].first;
354 for (
int i = 1; i < static_cast<int>(m_AntiCharmAll.size()); ++i) m_AntiCharmAll[i].first += m_AntiCharmAll[i - 1].first;
363 m_LastNormWeight = 1.;
377 std::vector<double> *densitiesid = NULL;
378 std::vector<double> tmpdens;
382 densitiesid = &tmpdens;
393 if (VVN < 0.)
continue;
395 double logweight = 0.;
397 double normweight = 1.;
398 double weightev = 1.;
404 weight *= pow(VVN /
m_THM->
Volume() * densitiesid->operator[](i) / densities[i], totals[i]);
405 if (densitiesid->operator[](i) > 0. && densities[i] > 0.)
406 logweight += totals[i] * log(VVN /
m_THM->
Volume() * densitiesid->operator[](i) / densities[i]);
408 weightev *= pow(VVNev / V * densitiesid->operator[](i) / densities[i], densities[i] * V);
410 if (densitiesid->operator[](i) > 0. && densities[i] > 0.)
412 normweight *= pow(VVN / VVNev, totals[i]) * pow(VVNev / V, totals[i] - densities[i] * V) * pow(densitiesid->operator[](i) / densities[i], totals[i] - (densities[i] * V));
415 m_LastWeight = weight;
416 m_LastLogWeight = logweight;
417 m_LastNormWeight = normweight;
428 double logweight = 0.;
429 double normweight = 1.;
430 double weightev = 1.;
438 if (VVN < 0.) { fl =
false;
break; }
444 weight *= pow(VVN /
m_THM->
Volume() * densitiesid->operator[](i) / densities[i], totals[i]);
445 if (densitiesid->operator[](i) > 0. && densities[i] > 0.)
446 logweight += totals[i] * log(VVN /
m_THM->
Volume() * densitiesid->operator[](i) / densities[i]);
448 weightev *= pow(VVNev /
m_THM->
Volume() * densitiesid->operator[](i) / densities[i], densities[i] * V);
449 if (densitiesid->operator[](i) > 0. && densities[i] > 0.)
450 normweight *= pow(VVN / VVNev, totals[i]) * pow(VVNev / V, totals[i] - densities[i] * V) * pow(densitiesid->operator[](i) / densities[i], totals[i] - (densities[i] * V));
453 m_LastWeight = weight;
454 m_LastLogWeight = logweight;
455 m_LastNormWeight = normweight;
465 double logweight = 0.;
466 double normweight = 1.;
467 double weightvdw = 1.;
475 if (VVN < 0.) { fl =
false;
break; }
481 weight *= pow(VVN /
m_THM->
Volume() * densitiesid->operator[](i) / densities[i], totals[i]);
482 if (densitiesid->operator[](i) > 0. && densities[i] > 0.)
483 logweight += totals[i] * log(VVN /
m_THM->
Volume() * densitiesid->operator[](i) / densities[i]);
491 weightvdw *= pow(VVNev /
m_THM->
Volume() * densitiesid->operator[](i) / densities[i], densities[i] * V);
492 if (densitiesid->operator[](i) > 0. && densities[i] > 0.)
493 normweight *= pow(VVN / VVNev, totals[i]) * pow(VVNev / V, totals[i] - densities[i] * V) * pow(densitiesid->operator[](i) / densities[i], totals[i] - (densities[i] * V));
497 weightvdw *= exp(aij * densities[j] /
m_THM->
Parameters().
T * densities[i] * V);
503 m_LastWeight = weight;
504 m_LastLogWeight = logweight;
505 m_LastNormWeight = normweight;
559 for (
size_t i = 0; i < totalsaux.size(); ++i) {
560 for (
int j = 0; j < totalsaux[i]; ++j) {
572 for (
int iter = 0; iter < multiples; ++iter) {
574 for (
size_t i = 0; i < totalsaux.size(); ++i)
575 totals[i] += totalsaux[i];
581 if (fraction > 0.0) {
583 bool successflag =
false;
585 while (!successflag) {
590 for (
size_t i = 0; i < totalsaux.size(); ++i) {
592 for (
int j = 0; j < totalsaux[i]; ++j) {
605 for (
size_t i = 0; i < totalsaux.size(); ++i) {
612 printf(
"**WARNING** SCE Event generator: Cannot match S- with S+ = 1, discarding subconfiguration...\n");
617 int repeatmax = 10000;
621 for (
size_t i = 0; i < totalsaux.size(); ++i) {
624 for (
int j = 0; j < totalsaux[i]; ++j) {
633 for (
size_t i = 0; i < totalsaux2.size(); ++i)
634 totals[i] += totalsaux2[i];
639 if (repeat >= repeatmax) {
640 printf(
"**WARNING** SCE event generator: Cannot match S- with S+, too many tries, discarding configuration...\n");
667 std::vector< std::pair<double, int> > fStrangeMesonsc = m_StrangeMesons;
668 std::vector< std::pair<double, int> > fAntiStrangeMesonsc = m_AntiStrangeMesons;
670 for (
size_t i = 0; i < fStrangeMesonsc.size(); ++i)
671 fStrangeMesonsc[i].first *= VolumeSC /
m_THM->
Volume();
673 for (
size_t i = 0; i < fAntiStrangeMesonsc.size(); ++i)
674 fAntiStrangeMesonsc[i].first *= VolumeSC /
m_THM->
Volume();
676 double fMeanSMc = m_MeanSM * VolumeSC /
m_THM->
Volume();
677 double fMeanASMc = m_MeanASM * VolumeSC /
m_THM->
Volume();
687 double mean = densities[i] * VolumeSC;
696 if (netS != tASM - tSM)
continue;
698 for (
int i = 0; i < tSM; ++i) {
699 std::vector< std::pair<double, int> >::iterator it = lower_bound(fStrangeMesonsc.begin(), fStrangeMesonsc.end(), std::make_pair(fMeanSMc*
RandomGenerators::randgenMT.rand(), 0));
700 int tind = std::distance(fStrangeMesonsc.begin(), it);
701 if (tind < 0) tind = 0;
702 if (tind >= static_cast<int>(fStrangeMesonsc.size())) tind = fStrangeMesonsc.size() - 1;
703 totals[fStrangeMesonsc[tind].second]++;
705 for (
int i = 0; i < tASM; ++i) {
706 std::vector< std::pair<double, int> >::iterator it = lower_bound(fAntiStrangeMesonsc.begin(), fAntiStrangeMesonsc.end(), std::make_pair(fMeanASMc*
RandomGenerators::randgenMT.rand(), 0));
707 int tind = std::distance(fAntiStrangeMesonsc.begin(), it);
708 if (tind < 0) tind = 0;
709 if (tind >= static_cast<int>(fAntiStrangeMesonsc.size())) tind = fAntiStrangeMesonsc.size() - 1;
710 totals[fAntiStrangeMesonsc[tind].second]++;
715 for (
size_t i = 0; i < totals.size(); ++i) {
720 printf(
"**ERROR** EventGeneratorBase::GenerateTotalsSCESubVolume(): Generated strangeness is non-zero!");
737 printf(
"**ERROR** CCE Event generator does not support lists with multi-charmed particles\n");
757 for (
size_t i = 0; i < totalsaux.size(); ++i) {
758 for (
int j = 0; j < totalsaux[i]; ++j) {
770 for (
int iter = 0; iter < multiples; ++iter) {
772 for (
size_t i = 0; i < totalsaux.size(); ++i)
773 totals[i] += totalsaux[i];
779 if (fraction > 0.0) {
781 bool successflag =
false;
783 while (!successflag) {
788 for (
size_t i = 0; i < totalsaux.size(); ++i) {
790 for (
int j = 0; j < totalsaux[i]; ++j) {
803 for (
size_t i = 0; i < totalsaux.size(); ++i) {
810 printf(
"**WARNING** CCE Event generator: Cannot match C- with C+ = 1, discarding...\n");
815 int repeatmax = 10000;
819 for (
size_t i = 0; i < totalsaux.size(); ++i) {
822 for (
int j = 0; j < totalsaux[i]; ++j) {
831 for (
size_t i = 0; i < totalsaux2.size(); ++i)
832 totals[i] += totalsaux2[i];
837 if (repeat >= repeatmax) {
838 printf(
"**WARNING** CCE event generator: Cannot match S- with S+, too many tries, discarding...\n");
864 std::vector< std::pair<double, int> > fCharmAllc = m_CharmAll;
865 std::vector< std::pair<double, int> > fAntiCharmAllc = m_AntiCharmAll;
867 for (
size_t i = 0; i < fCharmAllc.size(); ++i)
870 for (
size_t i = 0; i < fAntiCharmAllc.size(); ++i)
871 fAntiCharmAllc[i].first *= VolumeSC /
m_THM->
Volume();
874 double fMeanCharmc = m_MeanCHRM * VolumeSC /
m_THM->
Volume();
875 double fMeanAntiCharmc = m_MeanACHRM * VolumeSC /
m_THM->
Volume();
888 for (
int i = 0; i < tC; ++i) {
889 std::vector< std::pair<double, int> >::iterator it = lower_bound(fCharmAllc.begin(), fCharmAllc.end(), std::make_pair(fMeanCharmc*
RandomGenerators::randgenMT.rand(), 0));
890 int tind = std::distance(fCharmAllc.begin(), it);
891 if (tind < 0) tind = 0;
892 if (tind >= static_cast<int>(fCharmAllc.size())) tind = fCharmAllc.size() - 1;
893 totals[fCharmAllc[tind].second]++;
895 for (
int i = 0; i < tAC; ++i) {
896 std::vector< std::pair<double, int> >::iterator it = lower_bound(fAntiCharmAllc.begin(), fAntiCharmAllc.end(), std::make_pair(fMeanAntiCharmc*
RandomGenerators::randgenMT.rand(), 0));
897 int tind = std::distance(fAntiCharmAllc.begin(), it);
898 if (tind < 0) tind = 0;
899 if (tind >= static_cast<int>(fAntiCharmAllc.size())) tind = fAntiCharmAllc.size() - 1;
900 totals[fAntiCharmAllc[tind].second]++;
905 for (
size_t i = 0; i < totals.size(); ++i) {
910 printf(
"**ERROR** EventGeneratorBase::GenerateTotalsCCESubVolume(): Generated charm is non-zero!");
922 const std::vector< std::pair<double, int> >& fBaryonsc = m_Baryons;
923 const std::vector< std::pair<double, int> >& fAntiBaryonsc = m_AntiBaryons;
924 const std::vector< std::pair<double, int> >& fStrangeMesonsc = m_StrangeMesons;
925 const std::vector< std::pair<double, int> >& fAntiStrangeMesonsc = m_AntiStrangeMesons;
926 const std::vector< std::pair<double, int> >& fChargeMesonsc = m_ChargeMesons;
927 const std::vector< std::pair<double, int> >& fAntiChargeMesonsc = m_AntiChargeMesons;
928 const std::vector< std::pair<double, int> >& fCharmMesonsc = m_CharmMesons;
929 const std::vector< std::pair<double, int> >& fAntiCharmMesonsc = m_AntiCharmMesons;
934 int netB = 0, netS = 0, netQ = 0, netC = 0;
960 int netB = 0, netS = 0, netQ = 0, netC = 0;
964 bool flNuclei =
false;
994 if (nu < 0) nu = -nu;
995 double a = 2. * sqrt(m_MeanB * m_MeanAB);
1011 for (
int i = 0; i < tB; ++i) {
1012 std::vector< std::pair<double, int> >::const_iterator it = lower_bound(fBaryonsc.begin(), fBaryonsc.end(), std::make_pair(m_MeanB*
RandomGenerators::randgenMT.rand(), 0));
1013 int tind = std::distance(fBaryonsc.begin(), it);
1014 if (tind < 0) tind = 0;
1015 if (tind >= static_cast<int>(fBaryonsc.size())) tind = fBaryonsc.size() - 1;
1016 totals[fBaryonsc[tind].second]++;
1021 for (
int i = 0; i < tAB; ++i) {
1022 std::vector< std::pair<double, int> >::const_iterator it = lower_bound(fAntiBaryonsc.begin(), fAntiBaryonsc.end(), std::make_pair(m_MeanAB*
RandomGenerators::randgenMT.rand(), 0));
1023 int tind = std::distance(fAntiBaryonsc.begin(), it);
1024 if (tind < 0) tind = 0;
1025 if (tind >= static_cast<int>(fAntiBaryonsc.size())) tind = fAntiBaryonsc.size() - 1;
1026 totals[fAntiBaryonsc[tind].second]++;
1040 for (
int i = 0; i < tSM; ++i) {
1041 std::vector< std::pair<double, int> >::const_iterator it = lower_bound(fStrangeMesonsc.begin(), fStrangeMesonsc.end(), std::make_pair(m_MeanSM*
RandomGenerators::randgenMT.rand(), 0));
1042 int tind = std::distance(fStrangeMesonsc.begin(), it);
1043 if (tind < 0) tind = 0;
1044 if (tind >= static_cast<int>(fStrangeMesonsc.size())) tind = fStrangeMesonsc.size() - 1;
1045 totals[fStrangeMesonsc[tind].second]++;
1046 netQ +=
m_THM->
TPS()->
Particles()[fStrangeMesonsc[tind].second].ElectricCharge();
1049 for (
int i = 0; i < tASM; ++i) {
1050 std::vector< std::pair<double, int> >::const_iterator it = lower_bound(fAntiStrangeMesonsc.begin(), fAntiStrangeMesonsc.end(), std::make_pair(m_MeanASM*
RandomGenerators::randgenMT.rand(), 0));
1051 int tind = std::distance(fAntiStrangeMesonsc.begin(), it);
1052 if (tind < 0) tind = 0;
1053 if (tind >= static_cast<int>(fAntiStrangeMesonsc.size())) tind = fAntiStrangeMesonsc.size() - 1;
1054 totals[fAntiStrangeMesonsc[tind].second]++;
1055 netQ +=
m_THM->
TPS()->
Particles()[fAntiStrangeMesonsc[tind].second].ElectricCharge();
1065 for (
int i = 0; i < tCM; ++i) {
1066 std::vector< std::pair<double, int> >::const_iterator it = lower_bound(fChargeMesonsc.begin(), fChargeMesonsc.end(), std::make_pair(m_MeanCM*
RandomGenerators::randgenMT.rand(), 0));
1067 int tind = std::distance(fChargeMesonsc.begin(), it);
1068 if (tind < 0) tind = 0;
1069 if (tind >= static_cast<int>(fChargeMesonsc.size())) tind = fChargeMesonsc.size() - 1;
1070 totals[fChargeMesonsc[tind].second]++;
1073 for (
int i = 0; i < tACM; ++i) {
1074 std::vector< std::pair<double, int> >::const_iterator it = lower_bound(fAntiChargeMesonsc.begin(), fAntiChargeMesonsc.end(), std::make_pair(m_MeanACM*
RandomGenerators::randgenMT.rand(), 0));
1075 int tind = std::distance(fAntiChargeMesonsc.begin(), it);
1076 if (tind < 0) tind = 0;
1077 if (tind >= static_cast<int>(fAntiChargeMesonsc.size())) tind = fAntiChargeMesonsc.size() - 1;
1078 totals[fAntiChargeMesonsc[tind].second]++;
1089 for (
int i = 0; i < tCHRMM; ++i) {
1090 std::vector< std::pair<double, int> >::const_iterator it = lower_bound(fCharmMesonsc.begin(), fCharmMesonsc.end(), std::make_pair(m_MeanCHRMM*
RandomGenerators::randgenMT.rand(), 0));
1091 int tind = std::distance(fCharmMesonsc.begin(), it);
1092 if (tind < 0) tind = 0;
1093 if (tind >= static_cast<int>(fCharmMesonsc.size())) tind = fCharmMesonsc.size() - 1;
1094 totals[fCharmMesonsc[tind].second]++;
1096 for (
int i = 0; i < tACHRNMM; ++i) {
1097 std::vector< std::pair<double, int> >::const_iterator it = lower_bound(fAntiCharmMesonsc.begin(), fAntiCharmMesonsc.end(), std::make_pair(m_MeanACHRMM*
RandomGenerators::randgenMT.rand(), 0));
1098 int tind = std::distance(fAntiCharmMesonsc.begin(), it);
1099 if (tind < 0) tind = 0;
1100 if (tind >= static_cast<int>(fAntiCharmMesonsc.size())) tind = fAntiCharmMesonsc.size() - 1;
1101 totals[fAntiCharmMesonsc[tind].second]++;
1117 int finB = 0, finQ = 0, finS = 0, finC = 0;
1118 for (
size_t i = 0; i < totals.size(); ++i) {
1126 printf(
"**ERROR** EventGeneratorBase::GenerateTotalsCE(): Generated baryon number does not match the input!");
1131 printf(
"**ERROR** EventGeneratorBase::GenerateTotalsCE(): Generated electric charge does not match the input!");
1136 printf(
"**ERROR** EventGeneratorBase::GenerateTotalsCE(): Generated strangeness does not match the input!");
1141 printf(
"**ERROR** EventGeneratorBase::GenerateTotalsCE(): Generated charm does not match the input!");
1153 return make_pair(totals, m_LastNormWeight);
1162 std::vector< std::vector<SimpleParticle> > primParticles(
m_THM->
TPS()->
Particles().size());
1166 primParticles[i].resize(0);
1167 int total = yields[i];
1168 for (
int part = 0; part < total; ++part) {
1169 double tmass = species.
Mass();
1176 if (species.
Statistics() == -1 && tmu > tmass) {
1180 std::vector<double> momentum =
m_MomentumGens[i]->GetMomentum(tmass);
1183 primParticles[i].push_back(
SimpleParticle(momentum[0], momentum[1], momentum[2], tmass, species.
PdgId()));
1187 for (
int i = primParticles.size() - 1; i >= 0; --i) {
1188 ret.
Particles.insert(ret.
Particles.end(), primParticles[i].begin(), primParticles[i].end());
1210 ret.
weight = m_LastWeight;
1212 ret.
weight = m_LastNormWeight;
1361 std::vector< std::vector<SimpleParticle> > primParticles(TPS->
Particles().size(), std::vector<SimpleParticle>(0));
1362 std::vector< std::vector<int> > AllParticlesMap(TPS->
Particles().size(), std::vector<int>(0));
1363 for(
int i = 0; i < evtin.
Particles.size(); ++i) {
1367 primParticles[tid].push_back(particle);
1368 AllParticlesMap[tid].push_back(i);
1372 bool flag_repeat =
true;
1373 while (flag_repeat) {
1374 flag_repeat =
false;
1375 for (
int i = static_cast<int>(primParticles.size()) - 1; i >= 0; --i) {
1377 for (
size_t j = 0; j < primParticles[i].size(); ++j) {
1378 if (!primParticles[i][j].processed) {
1381 primParticles[i][j].processed =
true;
1382 int tid = AllParticlesMap[i][j];
1390 for (
size_t j = 0; j < primParticles[i].size(); ++j) {
1391 if (!primParticles[i][j].processed) {
1395 std::vector<double> Bratios;
1396 if (primParticles[i][j].MotherPDGID != 0 ||
1398 Bratios = TPS->
Particles()[i].BranchingRatiosM(primParticles[i][j].m,
false);
1401 Bratios = TPS->
Particles()[i].BranchingRatiosM(primParticles[i][j].m,
true);
1405 for (DecayIndex = 0; DecayIndex < static_cast<int>(Bratios.size()); ++DecayIndex) {
1406 tsum += Bratios[DecayIndex];
1407 if (tsum > DecParam)
break;
1409 if (DecayIndex < static_cast<int>(TPS->
Particles()[i].Decays().size())) {
1410 std::vector<double> masses(0);
1411 std::vector<long long> pdgids(0);
1412 for (
size_t di = 0; di < TPS->
Particles()[i].Decays()[DecayIndex].mDaughters.size(); di++) {
1413 long long dpdg = TPS->
Particles()[i].Decays()[DecayIndex].mDaughters[di];
1414 if (TPS->
PdgToId(dpdg) == -1) {
1424 pdgids.push_back(dpdg);
1427 for (
size_t ind = 0; ind < decres.size(); ind++) {
1428 decres[ind].processed =
false;
1429 if (TPS->
PdgToId(decres[ind].PDGID) != -1) {
1430 int tid = TPS->
PdgToId(decres[ind].PDGID);
1432 primParticles[tid].push_back(dprt);
1434 AllParticlesMap[tid].push_back(static_cast<int>(ret.
AllParticles.size()) - 1);
1435 ret.
DecayMap.push_back(AllParticlesMap[i][j]);
1440 ret.
DecayMap.push_back(AllParticlesMap[i][j]);
1444 primParticles[i][j].processed =
true;
1448 primParticles[i][j].processed =
true;
1477 m_MeanCHRMM *= Vmod;
1478 m_MeanACHRMM *= Vmod;
1480 m_MeanACHRM *= Vmod;
1482 for (
int i = 0; i < static_cast<int>(m_Baryons.size()); ++i) m_Baryons[i].first *= Vmod;
1483 for (
int i = 0; i < static_cast<int>(m_AntiBaryons.size()); ++i) m_AntiBaryons[i].first *= Vmod;
1484 for (
int i = 0; i < static_cast<int>(m_StrangeMesons.size()); ++i) m_StrangeMesons[i].first *= Vmod;
1485 for (
int i = 0; i < static_cast<int>(m_AntiStrangeMesons.size()); ++i) m_AntiStrangeMesons[i].first *= Vmod;
1486 for (
int i = 0; i < static_cast<int>(m_ChargeMesons.size()); ++i) m_ChargeMesons[i].first *= Vmod;
1487 for (
int i = 0; i < static_cast<int>(m_AntiChargeMesons.size()); ++i) m_AntiChargeMesons[i].first *= Vmod;
1488 for (
int i = 0; i < static_cast<int>(m_CharmMesons.size()); ++i) m_CharmMesons[i].first *= Vmod;
1489 for (
int i = 0; i < static_cast<int>(m_AntiCharmMesons.size()); ++i) m_AntiCharmMesons[i].first *= Vmod;
1490 for (
int i = 0; i < static_cast<int>(m_CharmAll.size()); ++i) m_CharmAll[i].first *= Vmod;
1491 for (
int i = 0; i < static_cast<int>(m_AntiCharmAll.size()); ++i) m_AntiCharmAll[i].first *= Vmod;
1497 fModelType = PointParticle;
1500 CanonicalB = CanonicalQ = CanonicalS = CanonicalC =
true;
void ConstrainChemicalPotentials(bool resetInitialValues=true)
Constrains the chemical potentials by the conservation laws imposed.
int RandomPoisson(double mean)
Generates random integer distributed by Poisson with specified mean Uses randgenMT.
std::vector< RandomGenerators::ParticleMomentumGenerator * > m_MomentumGens
Vector of momentum generators for each particle species.
void SetVolume(double V)
Set system volume.
virtual void SetStrangenessChemicalPotential(double muS)
Set the strangeness chemical potential.
Quantum van der Waals model.
void RescaleCEMeans(double Vmod)
Rescale the precalculated GCE means.
std::vector< int > GenerateTotalsCE() const
const std::vector< double > & Densities() const
double CanonicalVolume() const
The canonical correlation volume V (fm )
virtual void SetElectricChemicalPotential(double muQ)
Set the electric chemical potential.
bool fUsePCE
Whether partial chemical equilibrium (PCE) is used.
Crossterms excluded-volume.
std::vector< int > GenerateTotalsCCE() const
double VirialCoefficient(int i, int j) const
Excluded volume coefficient .
virtual void CalculateDensitiesGCE()
Calculates the particle densities in a grand-canonical ensemble.
ThermalModelInteraction InteractionModel()
The interactions present in the current HRG model.
bool ConstrainMuC() const
virtual void SetBaryonChemicalPotential(double muB)
Set the baryon chemical potential.
bool ConstrainMuB() const
std::vector< int > GenerateTotalsCCESubVolume(double VolumeSC) const
Ensemble fEnsemble
The statistical ensemble used.
virtual void FixParameters()
Method which actually implements ConstrainChemicalPotentials() (for backward compatibility).
void SetUseWidth(bool useWidth)
Sets whether finite resonance widths are used. Deprecated.
int PdgToId(long long pdgid)
Transforms PDG ID to a 0-based particle id number.
EventGeneratorConfiguration()
Default configuration.
double VirialCoefficient(int i, int j) const
Excluded volume coefficient .
long long PdgId() const
Particle's Particle Data Group (PDG) ID number.
Class implementing the diagonal excluded-volume model.
Class containing the particle list.
Structure containing the thermal event generator configuration.
Energy-dependent Breit-Wigner scheme (eBW)
std::vector< double > m_DensitiesIdeal
Ideal gas densities used for sampling an interacting HRG.
int B
The total values of conserved charges in the CE.
Crossterms excluded volume model.
Structure holding information about a single event in the event generator.
void SetConfiguration(ThermalParticleSystem *TPS, const EventGeneratorConfiguration &config)
Sets the event generator configuration.
Structure containing all thermal parameters of the model.
double AttractionCoefficient(int i, int j) const
QvdW mean field attraction coefficient .
std::vector< SimpleParticle > AllParticles
Vector of all particles which ever appeared in the event (including those that decay and photons/lept...
virtual double CalculateStrangenessDensity()
std::vector< int > GenerateTotalsSCESubVolume(double VolumeSC) const
std::vector< SimpleParticle > PhotonsLeptons
Vector of all decay photons/leptons.
Class implementing the quantum van der Waals HRG model.
static int RandomBesselDevroye1(double a, int nu, MTRand &rangen)
void SetQoverB(double QB)
The electric-to-baryon charge ratio to be used to constrain the electric chemical potential...
virtual double CalculateBaryonDensity()
virtual double CalculateCharmDensity()
virtual void SetVirial(int, int, double)
Set the excluded volume coefficient .
virtual double FullIdealChemicalPotential(int i) const
Chemical potential entering the ideal gas expressions of particle species i.
void PrepareMultinomials()
Contains some extra mathematical functions used in the code.
std::vector< int > GenerateTotalsGCE() const
static SimpleEvent PerformDecays(const SimpleEvent &evtin, ThermalParticleSystem *TPS)
Performs decays of all unstable particles until only stable ones left.
Zero-width approximation.
virtual void FillChemicalPotentials()
Sets the chemical potentials of all particles.
const ThermalParticle & ParticleByPdg(long long pdg)
double logweight
Log of the event weight factor.
MTRand randgenMT
The Mersenne Twister random number generator.
Class containing all information about a particle specie.
ModelType fModelType
The type of interaction model.
std::vector< int > GenerateTotals() const
Structure holding information about a single particle in the event generator.
virtual double CalculateChargeDensity()
std::vector< double > fPCEChems
PCE chemical potentials.
const std::vector< ThermalParticle > & Particles() const
Returns the vector of all particle species.
Class implementing the crossterms excluded-volume model.
virtual bool SolveChemicalPotentials(double totB=0., double totQ=0., double totS=0., double totC=0., double muBinit=0., double muQinit=0., double muSinit=0., double muCinit=0., bool ConstrMuB=true, bool ConstrMuQ=true, bool ConstrMuS=true, bool ConstrMuC=true)
The procedure which calculates the chemical potentials which reproduce the specified total baryon...
virtual void SetCharmChemicalPotential(double muC)
Set the charm chemical potential.
bool UseWidth() const
Whether finite resonance widths are considered.
int PdgToId(long long pdg)
std::vector< std::vector< double > > bij
The matrix of excluded volume coefficients .
virtual ~EventGeneratorBase()
Destructor.
EventGeneratorConfiguration m_Config
virtual SimpleEvent GetEvent(bool PerformDecays=true) const
Generates a single event.
double ExcludedVolume(int i) const
The excluded volume parameter of particle species i.
std::vector< SimpleParticle > Particles
Vector of all final particles in the event.
virtual void CalculateDensities()
Calculates the primordial and total (after decays) densities of all species.
std::vector< int > GenerateTotalsSCE() const
double Mass() const
Particle's mass [GeV].
std::vector< int > DecayMap
std::pair< std::vector< int >, double > SampleYields() const
Samples the primordial yields for each particle species.
Diagonal excluded volume model.
bool ConstrainMuQ() const
bool CanonicalB
Mixed-canonical configuration (full canonical by default)
ResonanceWidthIntegration GetResonanceWidthIntegrationType() const
Resonance width integration scheme used to treat finite resonance widths.
bool ZeroWidthEnforced() const
Whether zero-width approximation is enforced for this particle species.
void SetCanonicalVolume(double Volume)
Set the canonical correlation volume V .
ThermalModelParameters CFOParameters
The chemical freeze-out parameters.
virtual void SetAttraction(int, int, double)
Set the vdW mean field attraction coefficient .
std::vector< double > GetIdealGasDensities() const
Diagonal excluded-volume.
virtual SimpleEvent SampleMomenta(const std::vector< int > &yields) const
Samples the momenta of the particles and returns the sampled list of particles as an event...
std::vector< RandomGenerators::ThermalBreitWignerGenerator * > m_BWGens
bool IsGCECalculated() const
Class implementing the Ideal HRG model.
std::vector< std::vector< double > > aij
The matrix of van der Waals attraction coefficients .
ThermalModelVDW ThermalModelVDWFull
For backward compatibility.
std::vector< SimpleParticle > ManyBodyDecay(const SimpleParticle &Mother, std::vector< double > masses, std::vector< long long > pdgs)
Samples the decay products of a many-body decay.
ThermalParticle::ResonanceWidthIntegration ResonanceWidthIntegrationType() const
const ThermalModelParameters & Parameters() const
void ClearMomentumGenerators()
Clears the momentum generators for all particles.
The main namespace where all classes and functions of the Thermal-FIST library reside.
virtual void SetChemicalPotentials(const std::vector< double > &chem=std::vector< double >(0))
Sets the chemical potentials of all particles.
double Volume() const
System volume (fm )
std::vector< int > DecayMapFinal
Vector for each Particles element pointing to the index of the primordial resonance from which this p...
double weight
Event weight factor.
ThermalParticleSystem * TPS()
bool ConstrainMuS() const
int Statistics() const
Particle's statistics.
ThermalParticle & ParticleByPDG(long long pdgid)
ThermalParticle object corresponding to particle species with a provided PDG ID.
void SetVolume(double Volume)
Sets the system volume.