7 const char *inputFile =
"hepmc_pythia.dat",
8 const char *outputFile =
"G4sPHENIX.root",
9 const char *embed_input_file =
"/sphenix/data/data02/review_2017-08-02/sHijing/fm_0-4.list")
12 const int n_TPC_layers = 40;
25 const bool readhits =
false;
28 const bool readhepmc =
false;
31 const bool runpythia8 =
true;
32 const bool runpythia6 =
false;
38 const bool do_embedding =
false;
42 const bool particles =
false && !readhits;
44 const bool usegun =
false && !readhits;
46 const bool upsilons =
false && !readhits;
49 const double pileup_collision_rate = 0;
60 bool do_svtx_cell = do_svtx &&
false;
61 bool do_svtx_track = do_svtx_cell &&
false;
62 bool do_svtx_eval = do_svtx_track &&
false;
64 bool do_pstof =
false;
67 bool do_cemc_cell = do_cemc &&
false;
68 bool do_cemc_twr = do_cemc_cell &&
false;
69 bool do_cemc_cluster = do_cemc_twr &&
false;
70 bool do_cemc_eval = do_cemc_cluster &&
false;
72 bool do_hcalin =
false;
73 bool do_hcalin_cell = do_hcalin &&
false;
74 bool do_hcalin_twr = do_hcalin_cell &&
false;
75 bool do_hcalin_cluster = do_hcalin_twr &&
false;
76 bool do_hcalin_eval = do_hcalin_cluster &&
false;
78 bool do_magnet =
false;
80 bool do_hcalout =
false;
81 bool do_hcalout_cell = do_hcalout &&
false;
82 bool do_hcalout_twr = do_hcalout_cell &&
false;
83 bool do_hcalout_cluster = do_hcalout_twr &&
false;
84 bool do_hcalout_eval = do_hcalout_cluster &&
false;
86 bool do_global =
true;
87 bool do_global_fastsim =
false;
89 bool do_calotrigger =
false && do_cemc_twr && do_hcalin_twr && do_hcalout_twr;
91 bool do_jet_reco =
true;
92 bool do_jet_eval = do_jet_reco &&
false;
97 bool do_HIjetreco =
false && do_jet_reco && do_cemc_twr && do_hcalin_twr && do_hcalout_twr;
99 bool do_dst_compress =
false;
102 bool do_DSTReader =
false;
107 gSystem->Load(
"libfun4all.so");
108 gSystem->Load(
"libg4detectors.so");
109 gSystem->Load(
"libphhepmc.so");
110 gSystem->Load(
"libg4testbench.so");
111 gSystem->Load(
"libg4hough.so");
112 gSystem->Load(
"libcemc.so");
113 gSystem->Load(
"libg4eval.so");
116 gROOT->LoadMacro(
"G4Setup_sPHENIX.C");
117 G4Init(do_svtx, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, n_TPC_layers);
119 int absorberactive = 1;
121 const string magfield =
"/phenix/upgrades/decadal/fieldmaps/sPHENIX.2d.root";
153 cout <<
"Do not support read hits and embed background at the same time." << endl;
168 gSystem->Load(
"libPHPythia8.so");
207 gSystem->Load(
"libPHPythia6.so");
224 if (readhepmc || do_embedding || runpythia8 || runpythia6)
266 pgen->
set_phi_range(5.3 / 180. * TMath::Pi(), 5.7 / 180. * TMath::Pi());
278 if (readhepmc || do_embedding || particles || runpythia8 || runpythia6)
284 vgen->set_vtx_zrange(-10.0, +10.0);
299 else if (istate == 2)
316 cout <<
"Upsilon generator for istate = " << istate <<
" created and registered " << endl;
327 do_svtx, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, magfield_rescale);
336 gROOT->LoadMacro(
"G4_Bbc.C");
383 gROOT->LoadMacro(
"G4_Global.C");
387 else if (do_global_fastsim)
389 gROOT->LoadMacro(
"G4_Global.C");
399 gROOT->LoadMacro(
"G4_CaloTrigger.C");
409 gROOT->LoadMacro(
"G4_TruthJets.C");
415 gROOT->LoadMacro(
"G4_HIJetReco.C");
423 if (do_svtx_eval)
Svtx_Eval(
string(outputFile) +
"_g4svtx_eval.root");
425 if (do_cemc_eval)
CEMC_Eval(
string(outputFile) +
"_g4cemc_eval.root");
427 if (do_hcalin_eval)
HCALInner_Eval(
string(outputFile) +
"_g4hcalin_eval.root");
429 if (do_hcalout_eval)
HCALOuter_Eval(
string(outputFile) +
"_g4hcalout_eval.root");
431 if (do_jet_eval)
Jet_Eval(
string(outputFile) +
"_g4jet_eval.root");
434 gSystem->Load(
"libTruthPhotonJet.so");
453 gSystem->Load(
"libg4dst.so");
463 if (embed_input_file == NULL)
465 cout <<
"Missing embed_input_file! Exit";
470 gSystem->Load(
"libg4dst.so");
481 gSystem->Load(
"libg4dst.so");
506 if (pileup_collision_rate > 0)
513 const string pileupfile(
"/sphenix/sim/sim01/sHijing/sHijing_0-12fm.dat");
519 double time_window_minus = -35000;
520 double time_window_plus = 35000;
529 cout <<
"Collision pileup enabled using file " << pileupfile <<
" with collision rate " << pileup_collision_rate
530 <<
" and time window " << time_window_minus <<
" to " << time_window_plus << endl;
536 gROOT->LoadMacro(
"G4_DSTReader.C");
564 if (
nEvents == 0 && !readhits && !readhepmc)
566 cout <<
"using 0 for number of events is a bad idea when using particle generators" << endl;
567 cout <<
"it will run forever, so I just return without running anything" << endl;
578 std::cout <<
"All done" << std::endl;