Skip to content

Commit 8be1dad

Browse files
committed
Merge branch 'JETSCAPE' into XSCAPE
2 parents 8bc4f1b + db176d4 commit 8be1dad

File tree

7 files changed

+219
-99
lines changed

7 files changed

+219
-99
lines changed

src/FSSW.cpp

Lines changed: 55 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ FSSW::FSSW(std::shared_ptr<RandomUtil::Random> ran_gen,
6565
FO_length = FOsurf_ptr.size();
6666

6767
paraRdr = paraRdr_in;
68+
echoLevel_ = paraRdr->getVal("JSechoLevel", 1);
6869

6970
hydro_mode = paraRdr->getVal("hydro_mode");
7071

@@ -83,12 +84,19 @@ FSSW::FSSW(std::shared_ptr<RandomUtil::Random> ran_gen,
8384
} else {
8485
bUSE_GZIP_FORMAT = true;
8586
}
87+
8688
if (paraRdr->getVal("use_binary_format") == 0) {
8789
bUSE_BINARY_FORMAT = false;
8890
} else {
8991
bUSE_BINARY_FORMAT = true;
9092
}
9193

94+
if (paraRdr->getVal("RegVisYield", 0) == 1) {
95+
flagRegVisYield_ = true;
96+
} else {
97+
flagRegVisYield_ = false;
98+
}
99+
92100
if (paraRdr->getVal("include_deltaf_shear") == 0) {
93101
bINCLUDE_SHEAR_DELTAF = false;
94102
} else {
@@ -808,6 +816,9 @@ void FSSW::calculate_dN_dxtdy_for_one_particle_species(
808816
}
809817

810818
total_N = N_eq + deltaN_bulk + deltaN_qmu;
819+
if (flagRegVisYield_) {
820+
total_N = std::min(2.*N_eq, total_N);
821+
}
811822

812823
dN_dxtdy_for_one_particle_species[l] = std::max(0., total_N);
813824
}
@@ -983,7 +994,10 @@ void FSSW::sample_using_dN_dxtdy_4all_particles_conventional() {
983994
*/
984995
Stopwatch sw_total;
985996
sw_total.tic();
986-
messager_.info(" Function sample_using_dN_dxtdy_4all_particles started...");
997+
if (echoLevel_ > 0) {
998+
messager_.info(
999+
" Function sample_using_dN_dxtdy_4all_particles started...");
1000+
}
9871001

9881002
std::vector<double> visCoefficients;
9891003

@@ -1018,11 +1032,14 @@ void FSSW::sample_using_dN_dxtdy_4all_particles_conventional() {
10181032
// reusable variables
10191033
// dN_dxtdy for 1 particle
10201034
//vector<double> dN_dxtdy_single_particle(FO_length, 0);
1021-
messager_ << "Sampling using dN/dy with "
1022-
<< "sample_using_dN_dxtdy_4all_particles function.";
1023-
messager_.flush("info");
1024-
messager_<< "number of repeated sampling = " << number_of_repeated_sampling;
1025-
messager_.flush("info");
1035+
if (echoLevel_ > 0) {
1036+
messager_ << "Sampling using dN/dy with "
1037+
<< "sample_using_dN_dxtdy_4all_particles function.";
1038+
messager_.flush("info");
1039+
messager_ << "number of repeated sampling = "
1040+
<< number_of_repeated_sampling;
1041+
messager_.flush("info");
1042+
}
10261043
for (int n = 0; n < number_of_chosen_particles; n++) {
10271044
int real_particle_idx = chosen_particles_sampling_table[n];
10281045
const particle_info *particle = &particles[real_particle_idx];
@@ -1031,14 +1048,18 @@ void FSSW::sample_using_dN_dxtdy_4all_particles_conventional() {
10311048
const int baryon = particle->baryon;
10321049
const int strange = particle->strange;
10331050
const int charge = particle->charge;
1034-
messager_ << "Index: " << n << ", Name: " << particle->name
1051+
if (echoLevel_ > 0) {
1052+
messager_ << "Index: " << n << ", Name: " << particle->name
10351053
<< ", Monte-carlo index: " << particle->monval;
1036-
messager_.flush("info");
1054+
messager_.flush("info");
1055+
}
10371056
if (local_charge_conservation == 1) {
10381057
if (particle->charge < 0) {
1039-
cout << "local charge conservation is turn on~ "
1040-
<< "Skip the negative charge particles."
1041-
<< endl;
1058+
if (echoLevel_ > 0) {
1059+
messager_ << "local charge conservation is turn on~ "
1060+
<< "Skip the negative charge particles.";
1061+
messager_.flush("info");
1062+
}
10421063
continue;
10431064
}
10441065
}
@@ -1062,9 +1083,11 @@ void FSSW::sample_using_dN_dxtdy_4all_particles_conventional() {
10621083
// for (3+1)-d case, dN_dy is total N (summing over all etas)
10631084
dN = dN_dy;
10641085
}
1065-
messager_ << " -- Sampling using dN_dy=" << dN_dy << ", "
1066-
<< "dN=" << dN << "...";
1067-
messager_.flush("info");
1086+
if (echoLevel_ > 0) {
1087+
messager_ << " -- Sampling using dN_dy=" << dN_dy << ", "
1088+
<< "dN=" << dN << "...";
1089+
messager_.flush("info");
1090+
}
10681091

10691092
Stopwatch sw;
10701093
sw.tic();
@@ -1177,9 +1200,11 @@ void FSSW::sample_using_dN_dxtdy_4all_particles_conventional() {
11771200
} // n; particle loop
11781201

11791202
sw_total.toc();
1180-
cout << endl
1181-
<< "sample_using_dN_dxtdy_4all_particles finished in "
1182-
<< sw_total.takeTime() << " seconds." << endl;
1203+
if (echoLevel_ > 0) {
1204+
cout << endl
1205+
<< "sample_using_dN_dxtdy_4all_particles finished in "
1206+
<< sw_total.takeTime() << " seconds." << endl;
1207+
}
11831208
}
11841209

11851210

@@ -1719,7 +1744,9 @@ double FSSW::get_deltaf_qmu_coeff(double T, double muB) {
17191744

17201745

17211746
void FSSW::initialize_special_function_arrays() {
1722-
messager_.info("Initializing special function arrays ... ");
1747+
if (echoLevel_ > 0) {
1748+
messager_.info("Initializing special function arrays ... ");
1749+
}
17231750
sf_expint_truncate_order = 10;
17241751
sf_x_min = 0.5;
17251752
sf_x_max = 400;
@@ -1857,7 +1884,9 @@ void FSSW::check_samples_in_memory() {
18571884

18581885
void FSSW::perform_resonance_feed_down(
18591886
vector< vector<iSS_Hadron>* >* input_particle_list) {
1860-
cout << "perform resonance decays... " << endl;
1887+
if (echoLevel_ > 0) {
1888+
cout << "perform resonance decays... " << endl;
1889+
}
18611890
// loop over events
18621891
unsigned int nev = input_particle_list->size();
18631892
for (unsigned int ievent = 0; ievent < nev; ievent++) {
@@ -2162,26 +2191,17 @@ void FSSW::computeAvgTotalEnergyMomentum() {
21622191
std::vector<double> Pmu_err(4, 0);
21632192
std::vector<double> nQ_avg(3, 0);
21642193
std::vector<double> nQ_err(3, 0);
2165-
for (auto const &Pmu_i : PmuList) {
2166-
for (int j = 0; j < 4; j++) {
2167-
Pmu_avg[j] += Pmu_i[j];
2168-
Pmu_err[j] += Pmu_i[j]*Pmu_i[j];
2169-
}
2170-
nev++;
2171-
}
2172-
for (auto const &nQ_i : ChargesList) {
2173-
for (int j = 0; j < 3; j++) {
2174-
nQ_avg[j] += nQ_i[j];
2175-
nQ_err[j] += nQ_i[j]*nQ_i[j];
2176-
}
2194+
if (echoLevel_ > 0) {
2195+
messager_.info("Averaged total energy and momentum:");
21772196
}
2178-
messager_.info("Averaged total energy and momentum:");
21792197
for (int i = 0; i < 4; i++) {
21802198
Pmu_avg[i] = Pmu_avg[i]/nev;
21812199
Pmu_err[i] = sqrt((Pmu_err[i]/nev - Pmu_avg[i]*Pmu_avg[i])/nev);
2182-
messager_ << "<P[" << i << "]> = " << Pmu_avg[i] << " +/- "
2183-
<< Pmu_err[i] << " GeV.";
2184-
messager_.flush("info");
2200+
if (echoLevel_ > 0) {
2201+
messager_ << "<P[" << i << "]> = " << Pmu_avg[i] << " +/- "
2202+
<< Pmu_err[i] << " GeV.";
2203+
messager_.flush("info");
2204+
}
21852205
}
21862206
messager_.info("Averaged total conserved charges:");
21872207
for (int i = 0; i < 3; i++) {

src/FSSW.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class FSSW {
2727
private:
2828
int hydro_mode; // switch for (2+1)-d or (3+1)-d hypersurface
2929
int flag_PCE_;
30+
int echoLevel_;
3031

3132
pretty_ostream messager_;
3233

@@ -50,6 +51,7 @@ class FSSW {
5051
int NEoS_deltaf_kind_; // 0: 14-mom, 1: CE
5152
int bulk_deltaf_kind_;
5253
int iEoS_MUSIC_;
54+
bool flagRegVisYield_;
5355

5456
// dN/(dxt dy) for one particle species
5557
std::vector<double> dN_dxtdy_for_one_particle_species;

src/iSS.cpp

Lines changed: 63 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ iSS::iSS(std::string path, std::string table_path,
2121
flag_PCE_ = 0;
2222
paraRdr_ptr = new ParameterReader;
2323
paraRdr_ptr->readFromFile(inputfile);
24+
echoLevel_ = paraRdr_ptr->getVal("JSechoLevel", 1);
2425
}
2526

2627

@@ -91,14 +92,46 @@ void iSS::perform_checks() {
9192
}
9293

9394

95+
void iSS::getSurfaceCellFromJETSCAPE(std::vector<FO_surf> &FOsurf_arr) {
96+
FOsurf_array_.clear();
97+
FOsurf_LRF_array_.clear();
98+
99+
echoLevel_ = paraRdr_ptr->getVal("JSechoLevel", 1);
100+
read_FOdata freeze_out_data(paraRdr_ptr, path_, table_path_,
101+
particle_table_path_);
102+
messager << "total number of cells: " << FOsurf_arr.size();
103+
messager.flush("info");
104+
if (FOsurf_arr.size() == 0) {
105+
messager << "No freeze-out fluid cell, exit now ...";
106+
messager.flush("Warning");
107+
}
108+
109+
afterburner_type_ = freeze_out_data.get_afterburner_type();
110+
freeze_out_data.read_in_chemical_potentials(FOsurf_arr, particle_);
111+
flag_PCE_ = freeze_out_data.get_flag_PCE();
112+
113+
computeFOSurfTmunu(FOsurf_arr);
114+
if (paraRdr_ptr->getVal("MC_sampling") == 4) {
115+
transform_to_local_rest_frame(FOsurf_arr, FOsurf_LRF_array_);
116+
} else {
117+
FOsurf_array_ = FOsurf_arr;
118+
}
119+
if (echoLevel_ > 0) {
120+
messager.info(" -- Read in data finished!");
121+
}
122+
}
123+
124+
94125
int iSS::read_in_FO_surface() {
126+
echoLevel_ = paraRdr_ptr->getVal("JSechoLevel", 1);
95127
std::vector<FO_surf> FOsurf_temp;
96128
read_FOdata freeze_out_data(paraRdr_ptr, path_, table_path_,
97129
particle_table_path_);
98-
//freeze_out_data.read_in_freeze_out_data(FOsurf_array_);
99130
freeze_out_data.read_in_freeze_out_data(FOsurf_temp, surface_filename_);
100-
messager << "total number of cells: " << FOsurf_temp.size();
101-
messager.flush("info");
131+
if (echoLevel_ > 0) {
132+
messager << "total number of cells: " << FOsurf_temp.size();
133+
messager.flush("info");
134+
}
102135
if (FOsurf_temp.size() == 0) {
103136
messager << "No freeze-out fluid cell, exit now ...";
104137
messager.flush("Warning");
@@ -117,7 +150,9 @@ int iSS::read_in_FO_surface() {
117150
} else {
118151
FOsurf_array_ = FOsurf_temp;
119152
}
120-
messager.info(" -- Read in data finished!");
153+
if (echoLevel_ > 0) {
154+
messager.info(" -- Read in data finished!");
155+
}
121156
FOsurf_temp.clear();
122157
return(0);
123158
}
@@ -151,7 +186,9 @@ int iSS::generate_samples() {
151186
+ "/chosen_particles_s95p-v1.dat");
152187
}
153188

154-
messager.info("Start computation and generating samples ...");
189+
if (echoLevel_ > 0) {
190+
messager.info("Start computation and generating samples ...");
191+
}
155192
if (paraRdr_ptr->getVal("MC_sampling") == 4) {
156193
spectra_sampler_ = std::unique_ptr<FSSW> (new FSSW(
157194
ran_gen_ptr_, &chosen_particles,
@@ -180,7 +217,9 @@ int iSS::generate_samples() {
180217
void iSS::transform_to_local_rest_frame(
181218
std::vector<FO_surf> &FOsurf_ptr,
182219
std::vector<FO_surf_LRF> &FOsurf_LRF_ptr) {
183-
messager.info("Transforming fluid cells to their local rest frame ...");
220+
if (echoLevel_ > 0) {
221+
messager.info("Transforming fluid cells to their local rest frame ...");
222+
}
184223
for (auto &surf_i: FOsurf_ptr) {
185224
FO_surf_LRF surf_LRF_i;
186225
surf_LRF_i.tau = surf_i.tau;
@@ -456,22 +495,24 @@ void iSS::computeFOSurfTmunu(std::vector<FO_surf> &FOsurf_ptr) {
456495
}
457496
}
458497
}
459-
//messager << "The total energy-momentum tensor from the surface:";
460-
//messager.flush("info");
461-
//for (int i = 0; i < 4; i++) {
462-
// for (int j = 0; j < 4; j++) {
463-
// messager << "T[" << i << "][" << j << "] = "
464-
// << std::scientific << std::setprecision(6)
465-
// << FOsurf_Tmunu_[4*i+j] << " GeV/fm^3.";
466-
// messager.flush("info");
467-
// }
468-
//}
469-
messager << "The total charges from the surface (B, Q, S):";
470-
messager.flush("info");
471-
for (int i = 0; i < 3; i++) {
472-
messager << "nQ[" << i << "] = "
473-
<< std::scientific << std::setprecision(6)
474-
<< FOsurf_Q_[i];
498+
if (echoLevel_ > 0) {
499+
messager << "The total energy-momentum tensor from the surface:";
500+
messager.flush("info");
501+
for (int i = 0; i < 4; i++) {
502+
for (int j = 0; j < 4; j++) {
503+
messager << "T[" << i << "][" << j << "] = "
504+
<< std::scientific << std::setprecision(6)
505+
<< FOsurf_Tmunu_[4*i+j] << " GeV/fm^3.";
506+
messager.flush("info");
507+
}
508+
}
509+
messager << "The total charges from the surface (B, Q, S):";
475510
messager.flush("info");
511+
for (int i = 0; i < 3; i++) {
512+
messager << "nQ[" << i << "] = "
513+
<< std::scientific << std::setprecision(6)
514+
<< FOsurf_Q_[i];
515+
messager.flush("info");
516+
}
476517
}
477518
}

src/iSS.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ class iSS {
2727
std::vector<float> FOsurf_Q_;
2828
std::shared_ptr<RandomUtil::Random> ran_gen_ptr_;
2929

30+
int echoLevel_;
31+
3032
int flag_PCE_;
3133
AfterburnerType afterburner_type_;
3234

@@ -58,6 +60,7 @@ class iSS {
5860

5961
int shell();
6062
int read_in_FO_surface();
63+
void getSurfaceCellFromJETSCAPE(std::vector<FO_surf> &FOsurf_arr);
6164
int generate_samples();
6265
void compute_spin_polarization();
6366

src/particle_decay.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ particle_decay::~particle_decay() {
3232
//! This function reads in resonance decay table
3333
int particle_decay::read_resonances_list() {
3434
double eps = 1e-15;
35-
cout << " -- Read in particle resonance decay table..." << endl;
35+
//cout << " -- Read in particle resonance decay table..." << endl;
3636
std::string reso_filename;
3737
if (afterburner_type_ == AfterburnerType::SMASH) {
3838
reso_filename = table_path_ + "/pdg-SMASH.dat";

0 commit comments

Comments
 (0)