6 const float photenergy = 10,
7 const int doembedding = 0,
8 const char *inputFile =
"/sphenix/data/data02/review_2017-08-02/single_particle/spacal2d/fieldmap/G4Hits_sPHENIX_e-_eta0_8GeV-0002.root",
9 const char *outputFile =
"G4sPHENIX.root",
10 const char *embed_input_file =
"/sphenix/data/data02/review_2017-08-02/sHijing/fm_0-4.list")
13 const int n_TPC_layers = 40;
26 const bool readhits =
false;
29 const bool readhepmc =
false && doembedding;
32 const bool runpythia8 =
false;
33 const bool runpythia6 =
false;
39 const bool do_embedding = doembedding &&
false;
45 const bool usegun =
false && !readhits;
47 const bool upsilons =
false && !readhits;
50 const double pileup_collision_rate = 0;
61 bool do_svtx_cell = do_svtx &&
true;
62 bool do_svtx_track = do_svtx_cell &&
false;
63 bool do_svtx_eval = do_svtx_track &&
false;
65 bool do_pstof =
false;
68 bool do_cemc_cell = do_cemc &&
true;
69 bool do_cemc_twr = do_cemc_cell &&
true;
70 bool do_cemc_cluster = do_cemc_twr &&
true;
71 bool do_cemc_eval = do_cemc_cluster &&
false;
73 bool do_hcalin =
true;
74 bool do_hcalin_cell = do_hcalin &&
true;
75 bool do_hcalin_twr = do_hcalin_cell &&
true;
76 bool do_hcalin_cluster = do_hcalin_twr &&
true;
77 bool do_hcalin_eval = do_hcalin_cluster &&
false;
79 bool do_magnet =
true;
81 bool do_hcalout =
true;
82 bool do_hcalout_cell = do_hcalout &&
true;
83 bool do_hcalout_twr = do_hcalout_cell &&
true;
84 bool do_hcalout_cluster = do_hcalout_twr &&
true;
85 bool do_hcalout_eval = do_hcalout_cluster &&
false;
88 bool do_plugdoor =
false;
90 bool do_global =
true;
91 bool do_global_fastsim =
true;
93 bool do_calotrigger =
true && do_cemc_twr && do_hcalin_twr && do_hcalout_twr;
95 bool do_jet_reco =
false;
96 bool do_jet_eval = do_jet_reco &&
false;
101 bool do_HIjetreco =
false && do_cemc_twr && do_hcalin_twr && do_hcalout_twr;
103 bool do_dst_compress =
false;
106 bool do_DSTReader =
false;
111 gSystem->Load(
"libfun4all.so");
112 gSystem->Load(
"libg4detectors.so");
113 gSystem->Load(
"libphhepmc.so");
114 gSystem->Load(
"libg4testbench.so");
115 gSystem->Load(
"libg4hough.so");
116 gSystem->Load(
"libg4eval.so");
119 gROOT->LoadMacro(
"G4Setup_sPHENIX.C");
120 G4Init(do_svtx, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, do_plugdoor, n_TPC_layers);
122 int absorberactive = 1;
124 const string magfield =
"/phenix/upgrades/decadal/fieldmaps/sPHENIX.2d.root";
156 cout <<
"Do not support read hits and embed background at the same time." << endl;
171 gSystem->Load(
"libPHPythia8.so");
184 gSystem->Load(
"libPHPythia6.so");
201 if (readhepmc || do_embedding || runpythia8 || runpythia6)
244 pgen->
set_phi_range(5.3 / 180. * TMath::Pi(), 5.7 / 180. * TMath::Pi());
256 if (readhepmc || do_embedding || particles || runpythia8 || runpythia6)
262 vgen->set_vtx_zrange(-10.0, +10.0);
277 else if (istate == 2)
294 cout <<
"Upsilon generator for istate = " << istate <<
" created and registered " << endl;
305 do_svtx, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe,do_plugdoor, magfield_rescale);
314 gROOT->LoadMacro(
"G4_Bbc.C");
361 gROOT->LoadMacro(
"G4_Global.C");
365 else if (do_global_fastsim)
367 gROOT->LoadMacro(
"G4_Global.C");
377 gROOT->LoadMacro(
"G4_CaloTrigger.C");
387 gROOT->LoadMacro(
"G4_Jets.C");
393 gROOT->LoadMacro(
"G4_HIJetReco.C");
401 if (do_svtx_eval)
Svtx_Eval(
string(outputFile) +
"_g4svtx_eval.root");
403 if (do_cemc_eval)
CEMC_Eval(
string(outputFile) +
"_g4cemc_eval.root");
405 if (do_hcalin_eval)
HCALInner_Eval(
string(outputFile) +
"_g4hcalin_eval.root");
407 if (do_hcalout_eval)
HCALOuter_Eval(
string(outputFile) +
"_g4hcalout_eval.root");
409 if (do_jet_eval)
Jet_Eval(
string(outputFile) +
"_g4jet_eval.root");
411 gSystem->Load(
"libPhotons.so");
424 gSystem->ListLibraries();
435 gSystem->Load(
"libg4dst.so");
445 if (embed_input_file == NULL)
447 cout <<
"Missing embed_input_file! Exit";
452 gSystem->Load(
"libg4dst.so");
463 gSystem->Load(
"libg4dst.so");
486 if (pileup_collision_rate > 0)
493 const string pileupfile(
"/sphenix/sim/sim01/sHijing/sHijing_0-12fm.dat");
499 double time_window_minus = -35000;
500 double time_window_plus = 35000;
509 cout <<
"Collision pileup enabled using file " << pileupfile <<
" with collision rate " << pileup_collision_rate
510 <<
" and time window " << time_window_minus <<
" to " << time_window_plus << endl;
516 gROOT->LoadMacro(
"G4_DSTReader.C");
544 if (
nEvents == 0 && !readhits && !readhepmc)
546 cout <<
"using 0 for number of events is a bad idea when using particle generators" << endl;
547 cout <<
"it will run forever, so I just return without running anything" << endl;
558 std::cout <<
"All done" << std::endl;