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