Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Fun4All_G4_EICDetector_LQ_analysis.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Fun4All_G4_EICDetector_LQ_analysis.C
2  string n="1000",
3  string ebeam="20",
4  string pbeam="250",
5  string seed="1",
6  string type="3pion"
7  )
8 {
9  // Set the number of TPC layer
10 
11  //Get parameter variables from parameter file
12 
13  string inputFile="/gpfs/mnt/gpfs02/phenix/scratch/spjeffas/g4sim/G4_Leptoquark_DST_p"+pbeam+"_e"+ebeam+"_"+n+"events_"+seed+"seed_"+type+".root";
14  //string inputFile="/gpfs/mnt/gpfs04/sphenix/user/nfeege/sphenixsw/devel/analysis/EICAnalysis/data/G4EICDetector_DIS_10x250_20events.root";
15  int nEvents;
16  stringstream geek(n);
17  geek>>nEvents;
18 
19 
20  string directory = "/gpfs/mnt/gpfs02/phenix/scratch/spjeffas/data/";
21 
22 
23  //===============
24  // Input options
25  //===============
26 
27  // Either:
28  // read previously generated g4-hits files, in this case it opens a DST and skips
29  // the simulations step completely. The G4Setup macro is only loaded to get information
30  // about the number of layers used for the cell reco code
31  //
32  // In case reading production output, please double check your G4Setup_sPHENIX.C and G4_*.C consistent with those in the production macro folder
33  // E.g. /sphenix/sim//sim01/production/2016-07-21/single_particle/spacal2d/
34  const bool readhits = true;
35 
36  //do leptoquark analysis modules
37  bool do_lepto_analysis = true;
38 
39  // Other options
40  bool do_jet_reco = true;
41  bool do_jet_eval = do_jet_reco && false;
42 
43  bool do_fwd_jet_reco = true;
44  bool do_fwd_jet_eval = do_fwd_jet_reco && false;
45 
46  // HI Jet Reco for jet simulations in Au+Au (default is false for
47  // single particle / p+p simulations, or for Au+Au simulations which
48  // don't care about jets)
49  bool do_HIjetreco = false && do_jet_reco && do_cemc_twr && do_hcalin_twr && do_hcalout_twr;
50 
51  // Compress DST files
52  bool do_dst_compress = false;
53 
54  //Option to convert DST to human command readable TTree for quick poke around the outputs
55  bool do_DSTReader = false;
56 
57 
58  //---------------
59  // Load libraries
60  //---------------
61 
62  gSystem->Load("libfun4all.so");
63  //gSystem->Load("libg4detectors.so");
64  //gSystem->Load("libphhepmc.so");
65  //gSystem->Load("libg4testbench.so");
66  gSystem->Load("libg4hough.so");
67  gSystem->Load("libg4eval.so");
68  gSystem->Load("libeicana.so");
69 
70 
71  //---------------
72  // Fun4All server
73  //---------------
74 
76  se->Verbosity(0); // uncomment for batch production running with minimal output messages
77  // se->Verbosity(Fun4AllServer::VERBOSITY_SOME); // uncomment for some info for interactive running
78 
79  // just if we set some flags somewhere in this macro
81  // By default every random number generator uses
82  // PHRandomSeed() which reads /dev/urandom to get its seed
83  // if the RANDOMSEED flag is set its value is taken as seed
84  // You can either set this to a random value using PHRandomSeed()
85  // which will make all seeds identical (not sure what the point of
86  // this would be:
87  // rc->set_IntFlag("RANDOMSEED",PHRandomSeed());
88  // or set it to a fixed value so you can debug your code
89  // rc->set_IntFlag("RANDOMSEED", 12345);
90 
91  //-----------------
92  // Event generation
93  //-----------------
94 
95  //---------
96  // Jet reco
97  //---------
98 
99  if (do_jet_reco)
100  {
101  gROOT->LoadMacro("G4_Jets.C");
102  Jet_Reco();
103  }
104 
105  if (do_HIjetreco) {
106  gROOT->LoadMacro("G4_HIJetReco.C");
107  HIJetReco();
108  }
109 
110  if (do_fwd_jet_reco)
111  {
112  gROOT->LoadMacro("G4_FwdJets.C");
113  Jet_FwdReco();
114  }
115 
116 
117  //----------------------
118  // Simulation evaluation
119  //----------------------
120 
121 
122  if (do_jet_eval) Jet_Eval(directory+"g4jet_p"+pbeam+"_e"+ebeam+"_"+n+"events_"+seed+"seed_"+type+"_eval.root");
123 
124  if (do_fwd_jet_eval) Jet_FwdEval(directory+"g4fwdjet_p"+pbeam+"_e"+ebeam+"_"+n+"events_"+seed+"seed_"+type+"_eval.root");
125 
126  if(do_lepto_analysis){
127  gROOT->LoadMacro("G4_Lepto.C");
128  G4_Lepto(directory+"LeptoAna_p"+pbeam+"_e"+ebeam+"_"+n+"events_"+seed+"seed_"+type);
129  }
130 
131 
132 
133 
134 
135  //--------------
136  // IO management
137  //--------------
138 
139  if (readhits)
140  {
141  // Hits file
142  Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin");
143  hitsin->fileopen(inputFile);
144  se->registerInputManager(hitsin);
145  }
146 
147  //-----------------
148  // Event processing
149  //-----------------
150  if (nEvents < 0)
151  {
152  return;
153  }
154 
155 
156  se->run(nEvents);
157 
158  //-----
159  // Exit
160  //-----
161 
162  se->End();
163  std::cout << "All done" << std::endl;
164  delete se;
165  gSystem->Exit(0);
166 }