1 #ifndef MACRO_G4INPUT_C
2 #define MACRO_G4INPUT_C
6 #include <phpythia6/PHPythia6.h>
8 #include <phpythia8/PHPythia8.h>
19 #include <fermimotionafterburner/FermimotionAfterburner.h>
26 #include <phsartre/PHSartre.h>
27 #include <phsartre/PHSartreParticleTrigger.h>
94 if (HepMCGen ==
nullptr)
96 std::cout <<
"ApplysPHENIXBeamParameter(): Fatal Error - null input pointer HepMCGen" << std::endl;
118 if (HepMCGen ==
nullptr)
120 std::cout <<
"ApplyEICIP6BeamParameter(): Fatal Error - null input pointer HepMCGen" << std::endl;
131 TString beam_setting_str;
132 beam_setting_str.Form(
"%.0fx%.0f", ION_Energy, ELECTRON_Energy);
134 cout <<
"Beam scattering setting: " << beam_setting_str << endl;
146 if (beam_opt ==
"ep-high-acceptance") {
147 beamFile = string(getenv(
"CALIBRATIONROOT")) +
"/Beam/ip6_ep_high_acceptance_parameter.dat";
148 }
else if (beam_opt ==
"ep-high-divergence") {
149 beamFile = string(getenv(
"CALIBRATIONROOT")) +
"/Beam/ip6_ep_high_divergence_parameter.dat";
150 }
else if (beam_opt ==
"eA") {
151 beamFile = string(getenv(
"CALIBRATIONROOT")) +
"/Beam/ip6_eAu_parameter.dat";
153 cout <<
"No beam scattering configuration file was identified." << endl;
163 double beta_star_p_h, beta_star_p_v, beta_star_e_h, beta_star_e_v;
164 double emit_p_h, emit_p_v, emit_e_h, emit_e_v;
166 double beam_angular_divergence_p_h;
167 double beam_angular_divergence_p_v;
168 double beam_angular_divergence_e_h;
169 double beam_angular_divergence_e_v;
171 double sigma_e_l, sigma_p_l;
173 bool setting_found =
false;
175 float ION_Energy_Setting = 275;
176 float ION_Energy_Setting_diff = 275;
178 std::ifstream infile(beamFile);
180 if (infile.is_open())
182 double biggest_z = 0.;
185 while (std::getline(infile, line))
188 if (line.find(
"#")!=std::string::npos) {
192 std::istringstream iss(line);
194 if (!(iss >> settingname >> beta_star_p_h >> beta_star_p_v >> beta_star_e_h >> beta_star_e_v >> emit_p_h >> emit_p_v >> emit_e_h >> emit_e_v >> beam_angular_divergence_p_h >> beam_angular_divergence_p_v >> beam_angular_divergence_e_h >> beam_angular_divergence_e_v >> sigma_p_l >> sigma_e_l))
196 cout <<
"could not decode " << line << endl;
201 cout << line << endl;
203 if (settingname==beam_setting_str) {
204 setting_found =
true;
209 float hadron_setting = stof(settingname.substr(0, settingname.find(
"x")));
213 if (fabs(hadron_setting - ION_Energy) < ION_Energy_Setting_diff ) {
214 ION_Energy_Setting = hadron_setting;
215 ION_Energy_Setting_diff = fabs(hadron_setting - ION_Energy);
222 infile.seekg(0,std::ios::beg);
226 beam_setting_str.Form(
"%.0fx%.0f", ION_Energy_Setting, ELECTRON_Energy);
229 while (std::getline(infile, line))
232 if (line.find(
"#")!=std::string::npos) {
236 std::istringstream iss(line);
238 if (!(iss >> settingname >> beta_star_p_h >> beta_star_p_v >> beta_star_e_h >> beta_star_e_v >> emit_p_h >> emit_p_v >> emit_e_h >> emit_e_v >> beam_angular_divergence_p_h >> beam_angular_divergence_p_v >> beam_angular_divergence_e_h >> beam_angular_divergence_e_v >> sigma_p_l >> sigma_e_l))
240 cout <<
"could not decode " << line << endl;
245 cout << line << endl;
247 if (settingname == beam_setting_str) {
252 setting_found =
true;
263 if (!setting_found) {
264 cout <<
"Could not find the specifed beam collision energy setting!" << endl;
273 const double EIC_hadron_crossing_angle = 25
e-3;
289 const double beta_crab_p = 1300
e2;
290 const double beta_crab_e = 150
e2;
293 EIC_hadron_crossing_angle,
306 beam_angular_divergence_p_h*1
e-6, beam_angular_divergence_p_v*1
e-6,
307 beam_angular_divergence_e_h*1
e-6, beam_angular_divergence_e_v*1
e-6
318 -EIC_hadron_crossing_angle / 2. / sqrt(beta_star_p_h * beta_crab_p), 0,
319 -EIC_hadron_crossing_angle / 2. / sqrt(beta_star_e_h * beta_crab_e), 0);
333 const double sigma_p_h = sqrt(beta_star_p_h * emit_p_h * 1
e-7);
334 const double sigma_p_v = sqrt(beta_star_p_v * emit_p_v * 1
e-7);
339 const double sigma_e_h = sqrt(beta_star_e_h * emit_e_h * 1
e-7);
340 const double sigma_e_v = sqrt(beta_star_e_v * emit_e_v * 1
e-7);
346 std::vector<double>{sigma_p_h, sigma_p_v, sigma_p_l},
347 std::vector<double>{sigma_e_h, sigma_e_v, sigma_e_l});
355 if (HepMCGen ==
nullptr)
357 std::cout <<
"ApplyEICIP8BeamParameter(): Fatal Error - null input pointer HepMCGen" << std::endl;
362 const double EIC_hadron_crossing_angle = 35
e-3;
365 EIC_hadron_crossing_angle,
378 const double z_hadron_cavity = 52
e2;
379 const double z_e_cavity = 38
e2;
381 -EIC_hadron_crossing_angle / 2. / z_hadron_cavity, 0,
382 -EIC_hadron_crossing_angle / 2. / z_e_cavity, 0);
385 const double sigma_p_h = sqrt(80 * 11.3
e-7);
386 const double sigma_p_v = sqrt(7.2 * 1.0
e-7);
387 const double sigma_p_l = 6;
388 const double sigma_e_h = sqrt(45 * 20.0
e-7);
389 const double sigma_e_v = sqrt(5.6 * 1.3
e-7);
390 const double sigma_e_l = 2;
393 const double collision_sigma_z = sqrt(sigma_p_l * sigma_p_l + sigma_e_l * sigma_e_l) / 2;
394 const double collision_sigma_t = collision_sigma_z / 29.9792;
397 sigma_p_h * sigma_e_h / sqrt(sigma_p_h * sigma_p_h + sigma_e_h * sigma_e_h),
398 sigma_p_v * sigma_e_v / sqrt(sigma_p_v * sigma_p_v + sigma_e_v * sigma_e_v),
413 if (HepMCGen ==
nullptr)
415 std::cout <<
"ApplyEICBeamParameter(): Fatal Error - null input pointer HepMCGen" << std::endl;
421 cout <<
"Can not enable Enable::IP6 and Enable::IP8 at the same time!" << endl;
426 cout <<
"None of the possible EIC IPs were selected: Enable::IP6 and Enable::IP8 !" << endl;
434 else if (Enable::IP8)
455 namespace INPUTREADEIC
460 namespace INPUTREADHITS
474 string config_file = string(getenv(
"CALIBRATIONROOT")) +
"/Generators/phpythia6_e18p275_MinPartonP10GeV.cfg";
479 string config_file = string(getenv(
"CALIBRATIONROOT")) +
"/Generators/phpythia8.cfg";
484 string config_file = string(getenv(
"CALIBRATIONROOT")) +
"/Generators/sartre.cfg";
489 string pileupfile =
"/sphenix/sim/sim01/sphnxpro/MDC1/sHijing_HepMC/data/sHijing_0_20fm-0000000001-00000.dat";
494 namespace INPUTGENERATOR
501 std::vector<PHG4ParticleGun *>
Gun;
509 namespace INPUTMANAGER
521 cout <<
"Reading Hits and Embedding into background at the same time is not supported" << endl;
526 cout <<
"Reading Hits and running G4 simultanously is not supported" << endl;
531 cout <<
"Pythia6 and Pythia8 cannot be run together - might be possible but needs R&D" << endl;
537 cout <<
"Flow Afterburner and Pileup cannot be run simultanously" << endl;
564 gSystem->Load(
"libPHSartre.so");
775 gSystem->Load(
"libg4dst.so");
778 cout <<
"only filenames or filelists are supported, not mixtures" << endl;
783 cout <<
"you need to give an input filenames or filelist" << endl;
788 string mgrname =
"DSTin" +
to_string(iter->first);
797 string mgrname =
"DSTin" +
to_string(iter->first);
819 cout <<
"no filename INPUTHEPMC::filename or listfile INPUTHEPMC::listfile given" << endl;
825 gSystem->Load(
"libg4dst.so");
828 cout <<
"only filenames or filelists are supported, not mixtures" << endl;
833 cout <<
"you need to give an input filenames or filelist" << endl;
838 string mgrname =
"DSTin" +
to_string(iter->first);
846 string mgrname =
"DSTin" +
to_string(iter->first);