ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4_Input.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4_Input.C
1 #ifndef MACRO_G4INPUT_C
2 #define MACRO_G4INPUT_C
3 
4 #include <GlobalVariables.C>
5 
6 #include <phpythia6/PHPythia6.h>
7 
8 #include <phpythia8/PHPythia8.h>
9 
10 #include <g4main/HepMCNodeReader.h>
11 #include <g4main/PHG4IonGun.h>
15 #include <g4main/PHG4ParticleGun.h>
17 #include <g4main/ReadEICFiles.h>
18 
19 #include <fermimotionafterburner/FermimotionAfterburner.h>
20 
25 
26 #include <phsartre/PHSartre.h>
27 #include <phsartre/PHSartreParticleTrigger.h>
28 
33 #include <fun4all/Fun4AllServer.h>
34 
35 #include <set>
36 
37 R__LOAD_LIBRARY(libfun4all.so)
38 R__LOAD_LIBRARY(libg4testbench.so)
39 R__LOAD_LIBRARY(libPHPythia6.so)
40 R__LOAD_LIBRARY(libPHPythia8.so)
41 R__LOAD_LIBRARY(libPHSartre.so)
42 R__LOAD_LIBRARY(libFermimotionAfterburner.so)
43 
44 namespace Input
45 {
46  // Real Event generators
47  bool PYTHIA6 = false;
48  int PYTHIA6_EmbedId = 0;
49 
50  bool PYTHIA8 = false;
51  int PYTHIA8_EmbedId = 0;
52 
53  bool SARTRE = false;
54  int SARTRE_EmbedId = 0;
55 
56  // Single/multiple particle generators
57  bool DZERO = false;
58  int DZERO_NUMBER = 1;
59  int DZERO_VERBOSITY = 0;
60  std::set<int> DZERO_EmbedIds;
61 
62  bool GUN = false;
63  int GUN_NUMBER = 1;
64  int GUN_VERBOSITY = 0;
65  std::set<int> GUN_EmbedIds;
66 
67  bool IONGUN = false;
68  int IONGUN_NUMBER = 1;
70  std::set<int> IONGUN_EmbedIds;
71 
72  bool PGEN = false;
73  int PGEN_NUMBER = 1;
74  int PGEN_VERBOSITY = 0;
75  std::set<int> PGEN_EmbedIds;
76 
77  bool SIMPLE = false;
78  int SIMPLE_NUMBER = 1;
80 
81  int UPSILON_NUMBER = 1;
83  // other UPSILON settings which are also used elsewhere are in GlobalVariables.C
84 
85  double PILEUPRATE = 0.;
86  bool READHITS = false;
87  int VERBOSITY = 0;
88  int EmbedId = 1;
89 
93  {
94  if (HepMCGen == nullptr)
95  {
96  std::cout << "ApplysPHENIXBeamParameter(): Fatal Error - null input pointer HepMCGen" << std::endl;
97  exit(1);
98  }
99  HepMCGen->set_beam_direction_theta_phi(1e-3, 0, M_PI - 1e-3, 0); //2mrad x-ing of sPHENIX per sPH-TRG-2020-001
100 
102  100e-4, // approximation from past RICH data
103  100e-4, // approximation from past RICH data
104  7, // sPH-TRG-2020-001. Fig 3.2
105  20 / 29.9792); // 20cm collision length / speed of light in cm/ns
111  }
112 
117  {
118  if (HepMCGen == nullptr)
119  {
120  std::cout << "ApplyEICIP6BeamParameter(): Fatal Error - null input pointer HepMCGen" << std::endl;
121  exit(1);
122  }
123 
124  // ---------------------------------------
125 
126 // cout << Enable::HFARFWD_ION_ENERGY << " " << Enable::HFARBWD_E_ENERGY << endl;
127 
128  float ION_Energy = Enable::HFARFWD_ION_ENERGY;
129  float ELECTRON_Energy = Enable::HFARBWD_E_ENERGY;
130 
131  TString beam_setting_str;
132  beam_setting_str.Form("%.0fx%.0f", ION_Energy, ELECTRON_Energy);
133 
134  cout << "Beam scattering setting: " << beam_setting_str << endl;
135 
136  TString beam_opt;
137 // beam_opt = "ep-high-acceptance";
139 // beam_opt = "ep-high-divergence";
140 // beam_opt = "eA";
141 // cout << Enable::HFARFWD_ION_ENERGY << endl;;
142 // cout << Enable::IP6 << endl;;
143 
144  string beamFile;
145 
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";
152  } else {
153  cout << "No beam scattering configuration file was identified." << endl;
154  gSystem->Exit(1);
155  }
156 
157 // cout << << endl;
158 // beamFile = string(getenv("CALIBRATIONROOT")) + "/Beam/ip6_ep_high_acceptance_parameter.dat";
159 // beamFile = string(getenv("CALIBRATIONROOT")) + "/Beam/ip6_eAu_parameter.dat";
160 
161  string settingname;
162 
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;
165 
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;
170 
171  double sigma_e_l, sigma_p_l;
172 
173  bool setting_found = false;
174 
175  float ION_Energy_Setting = 275;
176  float ION_Energy_Setting_diff = 275;
177 
178  std::ifstream infile(beamFile);
179 
180  if (infile.is_open())
181  {
182  double biggest_z = 0.;
183  int imagnet = 0;
184  std::string line;
185  while (std::getline(infile, line))
186  {
187 
188  if (line.find("#")!=std::string::npos) {
189  continue;
190  }
191 
192  std::istringstream iss(line);
193 
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))
195  {
196  cout << "could not decode " << line << endl;
197  gSystem->Exit(1);
198 
199  } else {
200 
201  cout << line << endl;
202 
203  if (settingname==beam_setting_str) {
204  setting_found = true;
205  }
206 
207 // cout << "aaaaaa "<< settingname.find("x") << " " << settingname.substr(0, settingname.find("x")) << endl;
208 
209  float hadron_setting = stof(settingname.substr(0, settingname.find("x")));
210 
211 // cout << hadron_setting - ION_Energy << endl;
212 
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);
216  }
217  }
218  }
219 
220  // Reseting the pointer to the infile
221  infile.clear();
222  infile.seekg(0,std::ios::beg);
223  // cout << infile.getline() << endl;;
224 
225  if(!setting_found) {
226  beam_setting_str.Form("%.0fx%.0f", ION_Energy_Setting, ELECTRON_Energy);
227  }
228 
229  while (std::getline(infile, line))
230  {
231 
232  if (line.find("#")!=std::string::npos) {
233  continue;
234  }
235 
236  std::istringstream iss(line);
237 
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))
239  {
240  cout << "could not decode " << line << endl;
241  gSystem->Exit(1);
242 
243  } else {
244 
245  cout << line << endl;
246 
247  if (settingname == beam_setting_str) {
248 
249 // cout << beta_star_p_h << " "<< beta_star_p_v << endl;
250 // cout << "BBBbBBBB" << endl;
251 
252  setting_found = true;
253 
254  break;
255  }
256 
257  }
258  }
259 
260  infile.close();
261  }
262 
263  if (!setting_found) {
264  cout << "Could not find the specifed beam collision energy setting!" << endl;
265  gSystem->Exit(1);
266  }
267 
268  // ---------------------------------------
269 
270  HepMCGen->PHHepMCGenHelper_Verbosity(VERBOSITY);
271 
272  //25mrad x-ing as in EIC CDR
273  const double EIC_hadron_crossing_angle = 25e-3;
274  // beta* for 275*x18 collisions
275  // Table 4 of
276  // https://github.com/eic/documents/blob/master/reports/general/Note-Simulations-BeamEffects.pdf
277 // const double beta_star_p_h = 80;
278 // const double beta_star_p_v = 7.1;
279 // const double beta_star_e_h = 59;
280 // const double beta_star_e_v = 5.7;
281 
282 // beta_star_p_h = 80;
283 // beta_star_p_v = 7.1;
284 // beta_star_e_h = 59;
285 // beta_star_e_v = 5.7;
286 
287  // Table 1-2 of
288  // https://github.com/eic/documents/blob/master/reports/general/Note-Simulations-BeamEffects.pdf
289  const double beta_crab_p = 1300e2;
290  const double beta_crab_e = 150e2;
291 
293  EIC_hadron_crossing_angle, // beamA_theta
294  M_PI, // beamA_phi
295  M_PI, // beamB_theta
296  0 // beamB_phi
297  );
298  // Table 4 of
299  // https://github.com/eic/documents/blob/master/reports/general/Note-Simulations-BeamEffects.pdf
300 // HepMCGen->set_beam_angular_divergence_hv(
301 // 150e-6, 150e-6, // proton beam divergence horizontal & vertical
302 // 202e-6, 187e-6 // electron beam divergence horizontal & vertical
303 // );
304 
306  beam_angular_divergence_p_h*1e-6, beam_angular_divergence_p_v*1e-6, // proton beam divergence horizontal & vertical
307  beam_angular_divergence_e_h*1e-6, beam_angular_divergence_e_v*1e-6 // electron beam divergence horizontal & vertical
308  );
309 
310 
311  // vertex shape from beam_bunch_sim
312  HepMCGen->use_beam_bunch_sim(true);
313 
314  // angular kick within a bunch as result of crab cavity
315  // Eq 5 of
316  // https://github.com/eic/documents/blob/master/reports/general/Note-Simulations-BeamEffects.pdf
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);
320 
321  // Table 4 of
322  // https://github.com/eic/documents/blob/master/reports/general/Note-Simulations-BeamEffects.pdf
323 
324 // const double sigma_p_h = sqrt(beta_star_p_h * 18e-7);
325 // const double sigma_p_v = sqrt(beta_star_p_v * 1.6e-7);
328 // const double sigma_e_h = sqrt(beta_star_e_h * 24e-7);
329 // const double sigma_e_v = sqrt(beta_star_e_v * 2.0e-7);
332 
333  const double sigma_p_h = sqrt(beta_star_p_h * emit_p_h * 1e-7);
334  const double sigma_p_v = sqrt(beta_star_p_v * emit_p_v * 1e-7);
335 
336 // const double sigma_p_l = 6;
337 // sigma_p_l = 6;
338 
339  const double sigma_e_h = sqrt(beta_star_e_h * emit_e_h * 1e-7);
340  const double sigma_e_v = sqrt(beta_star_e_v * emit_e_v * 1e-7);
341 
342 // const double sigma_e_l = 0.9;
343 // sigma_e_l = 0.9;
344 
345  HepMCGen->set_beam_bunch_width(
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});
348  }
349 
354  {
355  if (HepMCGen == nullptr)
356  {
357  std::cout << "ApplyEICIP8BeamParameter(): Fatal Error - null input pointer HepMCGen" << std::endl;
358  exit(1);
359  }
360 
361  //25mrad x-ing as in EIC CDR
362  const double EIC_hadron_crossing_angle = 35e-3;
363 
365  EIC_hadron_crossing_angle, // beamA_theta
366  0, // beamA_phi
367  M_PI, // beamB_theta
368  0 // beamB_phi
369  );
371  119e-6, 119e-6, // proton beam divergence horizontal & vertical, as in EIC CDR Table 1.1
372  211e-6, 152e-6 // electron beam divergence horizontal & vertical, as in EIC CDR Table 1.1
373  );
374 
375  // angular kick within a bunch as result of crab cavity
376  // using an naive assumption of transfer matrix from the cavity to IP,
377  // which is NOT yet validated with accelerator optics simulations!
378  const double z_hadron_cavity = 52e2; // CDR Fig 3.3
379  const double z_e_cavity = 38e2; // CDR Fig 3.2
381  -EIC_hadron_crossing_angle / 2. / z_hadron_cavity, 0,
382  -EIC_hadron_crossing_angle / 2. / z_e_cavity, 0);
383 
384  // calculate beam sigma width at IP as in EIC CDR table 1.1
385  const double sigma_p_h = sqrt(80 * 11.3e-7);
386  const double sigma_p_v = sqrt(7.2 * 1.0e-7);
387  const double sigma_p_l = 6;
388  const double sigma_e_h = sqrt(45 * 20.0e-7);
389  const double sigma_e_v = sqrt(5.6 * 1.3e-7);
390  const double sigma_e_l = 2;
391 
392  // combine two beam gives the collision sigma in z
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; // speed of light in cm/ns
395 
397  sigma_p_h * sigma_e_h / sqrt(sigma_p_h * sigma_p_h + sigma_e_h * sigma_e_h), //x
398  sigma_p_v * sigma_e_v / sqrt(sigma_p_v * sigma_p_v + sigma_e_v * sigma_e_v), //y
399  collision_sigma_z, //z
400  collision_sigma_t); //t
406  }
407 
412  {
413  if (HepMCGen == nullptr)
414  {
415  std::cout << "ApplyEICBeamParameter(): Fatal Error - null input pointer HepMCGen" << std::endl;
416  exit(1);
417  }
418 
419  if (Enable::IP6 and Enable::IP8)
420  {
421  cout << "Can not enable Enable::IP6 and Enable::IP8 at the same time!" << endl;
422  gSystem->Exit(1);
423  }
424  if (Enable::IP6 == false and Enable::IP8 == false)
425  {
426  cout << "None of the possible EIC IPs were selected: Enable::IP6 and Enable::IP8 !" << endl;
427  gSystem->Exit(1);
428  }
429 
430  if (Enable::IP6)
431  {
432  ApplyEICIP6BeamParameter(HepMCGen);
433  }
434  else if (Enable::IP8)
435  {
436  ApplyEICIP8BeamParameter(HepMCGen);
437  }
438  else
439  // logically impossible
440  exit(1);
441  }
442 
443 } // namespace Input
444 
445 namespace INPUTHEPMC
446 {
447  string filename;
448  string listfile;
449  bool FLOW = false;
450  int FLOW_VERBOSITY = 0;
451  bool FERMIMOTION = false;
452 
453 } // namespace INPUTHEPMC
454 
455 namespace INPUTREADEIC
456 {
457  string filename;
458 } // namespace INPUTREADEIC
459 
460 namespace INPUTREADHITS
461 {
462  map<unsigned int, std::string> filename;
463  map<unsigned int, std::string> listfile;
464 } // namespace INPUTREADHITS
465 
466 namespace INPUTEMBED
467 {
468  map<unsigned int, std::string> filename;
469  map<unsigned int, std::string> listfile;
470 } // namespace INPUTEMBED
471 
472 namespace PYTHIA6
473 {
474  string config_file = string(getenv("CALIBRATIONROOT")) + "/Generators/phpythia6_e18p275_MinPartonP10GeV.cfg";
475 }
476 
477 namespace PYTHIA8
478 {
479  string config_file = string(getenv("CALIBRATIONROOT")) + "/Generators/phpythia8.cfg";
480 }
481 
482 namespace SARTRE
483 {
484  string config_file = string(getenv("CALIBRATIONROOT")) + "/Generators/sartre.cfg";
485 }
486 
487 namespace PILEUP
488 {
489  string pileupfile = "/sphenix/sim/sim01/sphnxpro/MDC1/sHijing_HepMC/data/sHijing_0_20fm-0000000001-00000.dat";
490  double TpcDriftVelocity = 8.0 / 1000.0;
491 } // namespace PILEUP
492 
493 // collection of pointers to particle generators we can grab in the Fun4All macro
494 namespace INPUTGENERATOR
495 {
496  std::vector<PHG4IonGun *> IonGun;
497  std::vector<PHG4ParticleGenerator *> ParticleGenerator;
498  std::vector<PHG4ParticleGeneratorD0 *> DZeroMesonGenerator;
499  std::vector<PHG4ParticleGeneratorVectorMeson *> VectorMesonGenerator;
500  std::vector<PHG4SimpleEventGenerator *> SimpleEventGenerator;
501  std::vector<PHG4ParticleGun *> Gun;
502  PHPythia6 *Pythia6 = nullptr;
503  PHPythia8 *Pythia8 = nullptr;
504  PHSartre *Sartre = nullptr;
507 } // namespace INPUTGENERATOR
508 
509 namespace INPUTMANAGER
510 {
513 } // namespace INPUTMANAGER
514 
515 void InputInit()
516 {
517  // first consistency checks - not all input generators play nice
518  // with each other
520  {
521  cout << "Reading Hits and Embedding into background at the same time is not supported" << endl;
522  gSystem->Exit(1);
523  }
525  {
526  cout << "Reading Hits and running G4 simultanously is not supported" << endl;
527  gSystem->Exit(1);
528  }
530  {
531  cout << "Pythia6 and Pythia8 cannot be run together - might be possible but needs R&D" << endl;
532  gSystem->Exit(1);
533  }
534 
536  {
537  cout << "Flow Afterburner and Pileup cannot be run simultanously" << endl;
538  gSystem->Exit(1);
539  }
540  // done with consistency checks, create generators in no specific order
541 
543  if (Input::PYTHIA6)
544  {
547 
550  Input::EmbedId++;
551  }
552  if (Input::PYTHIA8)
553  {
555  // see coresoftware/generators/PHPythia8 for example config
557 
560  Input::EmbedId++;
561  }
562  if (Input::SARTRE)
563  {
564  gSystem->Load("libPHSartre.so");
567  // particle trigger to enhance forward J/Psi -> ee
570  //INPUTGENERATOR::SartreTrigger->SetEtaHighLow(4.0,1.4);
571  INPUTGENERATOR::SartreTrigger->SetEtaHighLow(1.0, -1.1); // central arm
573 
576  Input::EmbedId++;
577  }
578  // single particle generators
579  if (Input::DZERO)
580  {
581  for (int i = 0; i < Input::DZERO_NUMBER; ++i)
582  {
583  std::string name = "DZERO_" + std::to_string(i);
585  dzero->Embed(Input::EmbedId);
587  Input::EmbedId++;
588  INPUTGENERATOR::DZeroMesonGenerator.push_back(dzero);
589  }
590  }
591  if (Input::GUN)
592  {
593  for (int i = 0; i < Input::GUN_NUMBER; ++i)
594  {
595  std::string name = "GUN_" + std::to_string(i);
596  PHG4ParticleGun *gun = new PHG4ParticleGun(name);
597  gun->Embed(Input::EmbedId);
599  Input::EmbedId++;
600  INPUTGENERATOR::Gun.push_back(gun);
601  }
602  }
603  if (Input::IONGUN)
604  {
605  for (int i = 0; i < Input::IONGUN_NUMBER; ++i)
606  {
607  std::string name = "IONGUN_" + std::to_string(i);
608  PHG4IonGun *iongun = new PHG4IonGun(name);
609  iongun->Embed(Input::EmbedId);
611  Input::EmbedId++;
612  INPUTGENERATOR::IonGun.push_back(iongun);
613  }
614  }
615  if (Input::PGEN)
616  {
617  for (int i = 0; i < Input::PGEN_NUMBER; ++i)
618  {
619  std::string name = "PGEN_" + std::to_string(i);
621  pgen->Embed(Input::EmbedId);
623  Input::EmbedId++;
624  INPUTGENERATOR::ParticleGenerator.push_back(pgen);
625  }
626  }
627  if (Input::SIMPLE)
628  {
629  for (int i = 0; i < Input::SIMPLE_NUMBER; ++i)
630  {
631  std::string name = "EVTGENERATOR_" + std::to_string(i);
633  simple->Embed(Input::EmbedId);
635  Input::EmbedId++;
636  INPUTGENERATOR::SimpleEventGenerator.push_back(simple);
637  }
638  }
639  if (Input::UPSILON)
640  {
641  for (int i = 0; i < Input::UPSILON_NUMBER; ++i)
642  {
643  std::string name = "UPSILON_" + std::to_string(i);
645  upsilon->Embed(Input::EmbedId);
647  Input::EmbedId++;
648  INPUTGENERATOR::VectorMesonGenerator.push_back(upsilon);
649  }
650  }
651 
652  // input managers for which we might need to set options
653  if (Input::HEPMC)
654  {
656  }
657  if (Input::PILEUPRATE > 0)
658  {
660  }
661 }
662 
664 {
666  if (Input::PYTHIA6)
667  {
669  }
670  if (Input::PYTHIA8)
671  {
673  }
674  if (Input::SARTRE)
675  {
678  }
679  if (Input::DZERO)
680  {
681  int verbosity = max(Input::DZERO_VERBOSITY, Input::VERBOSITY);
682  for (size_t icnt = 0; icnt < INPUTGENERATOR::DZeroMesonGenerator.size(); ++icnt)
683  {
684  INPUTGENERATOR::DZeroMesonGenerator[icnt]->Verbosity(verbosity);
686  }
687  }
688  if (Input::GUN)
689  {
690  int verbosity = max(Input::GUN_VERBOSITY, Input::VERBOSITY);
691  for (size_t icnt = 0; icnt < INPUTGENERATOR::Gun.size(); ++icnt)
692  {
693  INPUTGENERATOR::Gun[icnt]->Verbosity(verbosity);
695  }
696  }
697  if (Input::IONGUN)
698  {
699  int verbosity = max(Input::IONGUN_VERBOSITY, Input::VERBOSITY);
700  for (size_t icnt = 0; icnt < INPUTGENERATOR::IonGun.size(); ++icnt)
701  {
702  INPUTGENERATOR::IonGun[icnt]->Verbosity(verbosity);
704  }
705  }
706  if (Input::PGEN)
707  {
708  int verbosity = max(Input::PGEN_VERBOSITY, Input::VERBOSITY);
709  for (size_t icnt = 0; icnt < INPUTGENERATOR::ParticleGenerator.size(); ++icnt)
710  {
711  INPUTGENERATOR::ParticleGenerator[icnt]->Verbosity(verbosity);
713  }
714  }
715  if (Input::SIMPLE)
716  {
717  int verbosity = max(Input::SIMPLE_VERBOSITY, Input::VERBOSITY);
718  for (size_t icnt = 0; icnt < INPUTGENERATOR::SimpleEventGenerator.size(); ++icnt)
719  {
720  INPUTGENERATOR::SimpleEventGenerator[icnt]->Verbosity(verbosity);
722  }
723  }
724  if (Input::UPSILON)
725  {
726  for (size_t icnt = 0; icnt < INPUTGENERATOR::VectorMesonGenerator.size(); ++icnt)
727  {
730  {
731  INPUTGENERATOR::VectorMesonGenerator[icnt]->set_reuse_existing_vertex(true);
732  }
733  INPUTGENERATOR::VectorMesonGenerator[icnt]->Verbosity(verbosity);
735  }
736  }
737  if (Input::READEIC)
738  {
743  }
744  // here are the various utility modules which read particles and
745  // put them onto the G4 particle stack
747  {
748  if (Input::HEPMC)
749  {
750  // these need to be applied before the HepMCNodeReader since they
751  // work on the hepmc records
752  if (INPUTHEPMC::FLOW)
753  {
756  se->registerSubsystem(burn);
757  }
759  {
761  se->registerSubsystem(fermi);
762  }
763  }
764  // copy HepMC records into G4
765  HepMCNodeReader *hr = new HepMCNodeReader();
766  se->registerSubsystem(hr);
767  }
768 }
769 
771 {
773  if (Input::EMBED)
774  {
775  gSystem->Load("libg4dst.so");
776  if (!INPUTEMBED::filename.empty() && !INPUTEMBED::listfile.empty())
777  {
778  cout << "only filenames or filelists are supported, not mixtures" << endl;
779  gSystem->Exit(1);
780  }
781  if (INPUTEMBED::filename.empty() && INPUTEMBED::listfile.empty())
782  {
783  cout << "you need to give an input filenames or filelist" << endl;
784  gSystem->Exit(1);
785  }
786  for (auto iter = INPUTEMBED::filename.begin(); iter != INPUTEMBED::filename.end(); ++iter)
787  {
788  string mgrname = "DSTin" + to_string(iter->first);
789  Fun4AllInputManager *hitsin = new Fun4AllDstInputManager(mgrname);
790  hitsin->fileopen(iter->second);
791  hitsin->Verbosity(Input::VERBOSITY);
792  hitsin->Repeat();
793  se->registerInputManager(hitsin);
794  }
795  for (auto iter = INPUTEMBED::listfile.begin(); iter != INPUTEMBED::listfile.end(); ++iter)
796  {
797  string mgrname = "DSTin" + to_string(iter->first);
798  Fun4AllInputManager *hitsin = new Fun4AllDstInputManager(mgrname);
799  hitsin->AddListFile(iter->second);
800  hitsin->Verbosity(Input::VERBOSITY);
801  hitsin->Repeat();
802  se->registerInputManager(hitsin);
803  }
804  }
805  if (Input::HEPMC)
806  {
809  if (!INPUTHEPMC::filename.empty() && INPUTHEPMC::listfile.empty())
810  {
812  }
813  else if (!INPUTHEPMC::listfile.empty())
814  {
816  }
817  else
818  {
819  cout << "no filename INPUTHEPMC::filename or listfile INPUTHEPMC::listfile given" << endl;
820  gSystem->Exit(1);
821  }
822  }
823  else if (Input::READHITS)
824  {
825  gSystem->Load("libg4dst.so");
826  if (!INPUTREADHITS::filename.empty() && !INPUTREADHITS::listfile.empty())
827  {
828  cout << "only filenames or filelists are supported, not mixtures" << endl;
829  gSystem->Exit(1);
830  }
831  if (INPUTREADHITS::filename.empty() && INPUTREADHITS::listfile.empty())
832  {
833  cout << "you need to give an input filenames or filelist" << endl;
834  gSystem->Exit(1);
835  }
836  for (auto iter = INPUTREADHITS::filename.begin(); iter != INPUTREADHITS::filename.end(); ++iter)
837  {
838  string mgrname = "DSTin" + to_string(iter->first);
839  Fun4AllInputManager *hitsin = new Fun4AllDstInputManager(mgrname);
840  hitsin->fileopen(iter->second);
841  hitsin->Verbosity(Input::VERBOSITY);
842  se->registerInputManager(hitsin);
843  }
844  for (auto iter = INPUTREADHITS::listfile.begin(); iter != INPUTREADHITS::listfile.end(); ++iter)
845  {
846  string mgrname = "DSTin" + to_string(iter->first);
847  Fun4AllInputManager *hitsin = new Fun4AllDstInputManager(mgrname);
848  hitsin->AddListFile(iter->second);
849  hitsin->Verbosity(Input::VERBOSITY);
850  se->registerInputManager(hitsin);
851  }
852  }
853  else
854  {
857  se->registerInputManager(in);
858  }
859  if (Input::PILEUPRATE > 0)
860  {
865  double time_window = 105.5 / PILEUP::TpcDriftVelocity;
866  INPUTMANAGER::HepMCPileupInputManager->set_time_window(-time_window, time_window);
868  }
869 }
870 #endif