Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-17 09:14:36

0001 int Fun4All_G4_EICDetector_LQ_analysis_nf(
0002                       string fileindex="1",
0003                                           string n="10",
0004                                           string ebeam="20",
0005                                           string pbeam="250",
0006                                           //string inputFile,
0007                                           //string output="tau"
0008                                           )
0009 {
0010   // string inputFile="/gpfs/mnt/gpfs02/phenix/scratch/spjeffas/data/G4_Leptoquark_DST_p250_e20_"+fileindex+"events.root";
0011   //string inputFile="/gpfs/mnt/gpfs02/phenix/scratch/spjeffas/data/G4_Leptoquark_DST_p250_e20_1000events_"+fileindex+".root";
0012   //    string inputFile="/gpfs/mnt/gpfs02/phenix/scratch/spjeffas/data/G4_Leptoquark_DST_p250_e20_1093events.root";
0013 
0014   //  string inputFile = "/gpfs/mnt/gpfs02/phenix/scratch/spjeffas/g4sim/G4_Leptoquark_DST_p250_e20_1000events_"+fileindex+"seed_3pion.root";
0015   string inputFile = "/gpfs/mnt/gpfs02/phenix/scratch/spjeffas/g4sim/G4_Leptoquark_DST_p250_e20_1000events_"+fileindex+"seed_3pion.root";
0016 
0017   cout << "Using input file: " << inputFile << endl;
0018 
0019   int nEvents;
0020   stringstream geek(n);
0021   geek>>nEvents;
0022 
0023   string directory = "./";//"/direct/phenix+u/spjeffas/leptoquark/output/"+output+"/";
0024 
0025   //===============
0026   // Input options
0027   //===============
0028 
0029   // Either:
0030   // read previously generated g4-hits files, in this case it opens a DST and skips
0031   // the simulations step completely. The G4Setup macro is only loaded to get information
0032   // about the number of layers used for the cell reco code
0033   //
0034   // In case reading production output, please double check your G4Setup_sPHENIX.C and G4_*.C consistent with those in the production macro folder
0035   // E.g. /sphenix/sim//sim01/production/2016-07-21/single_particle/spacal2d/
0036   const bool readhits = true;
0037 
0038   //do leptoquark analysis modules
0039   bool do_lepto_analysis = true;
0040 
0041   // Other options
0042   bool do_cemc_eval = false;
0043 
0044   bool do_jet_reco = true;
0045   bool do_jet_eval = do_jet_reco && true;
0046 
0047   bool do_fwd_jet_reco = false;
0048   bool do_fwd_jet_eval = do_fwd_jet_reco && false;
0049 
0050   // HI Jet Reco for jet simulations in Au+Au (default is false for
0051   // single particle / p+p simulations, or for Au+Au simulations which
0052   // don't care about jets)
0053   bool do_HIjetreco = false && do_jet_reco && do_cemc_twr && do_hcalin_twr && do_hcalout_twr;
0054 
0055   // Compress DST files
0056   bool do_dst_compress = false;
0057 
0058   //Option to convert DST to human command readable TTree for quick poke around the outputs
0059   bool do_DSTReader = false;
0060 
0061   //---------------
0062   // Load libraries
0063   //---------------
0064 
0065   gSystem->Load("libfun4all.so");
0066   gSystem->Load("libg4eval.so");
0067   gSystem->Load("libeicana.so");
0068 
0069   //---------------
0070   // Fun4All server
0071   //---------------
0072 
0073   Fun4AllServer *se = Fun4AllServer::instance();
0074   se->Verbosity(0); // uncomment for batch production running with minimal output messages
0075   // se->Verbosity(Fun4AllServer::VERBOSITY_SOME); // uncomment for some info for interactive running
0076 
0077   // just if we set some flags somewhere in this macro
0078   recoConsts *rc = recoConsts::instance();
0079   // By default every random number generator uses
0080   // PHRandomSeed() which reads /dev/urandom to get its seed
0081   // if the RANDOMSEED flag is set its value is taken as seed
0082   // You can either set this to a random value using PHRandomSeed()
0083   // which will make all seeds identical (not sure what the point of
0084   // this would be:
0085   //  rc->set_IntFlag("RANDOMSEED",PHRandomSeed());
0086   // or set it to a fixed value so you can debug your code
0087   // rc->set_IntFlag("RANDOMSEED", 12345);
0088 
0089   //-----------------
0090   // Event generation
0091   //-----------------
0092 
0093   //---------
0094   // Jet reco
0095   //---------
0096 
0097   if (do_jet_reco)
0098     {
0099       gROOT->LoadMacro("G4_Jets.C");
0100       Jet_Reco();
0101     }
0102 
0103   if (do_HIjetreco) {
0104     gROOT->LoadMacro("G4_HIJetReco.C");
0105     HIJetReco();
0106   }
0107 
0108   if (do_fwd_jet_reco)
0109     {
0110       gROOT->LoadMacro("G4_FwdJets.C");
0111       Jet_FwdReco();
0112     }
0113 
0114 
0115   if (do_cemc_eval)
0116     {
0117       //gROOT->LoadMacro("G4_CEmc_Spacal.C");
0118       //CEMC_Eval("cemc_eval_lq.root");
0119 
0120       CaloEvaluator *eval = new CaloEvaluator("CEMCEVALUATOR", "CEMC",
0121                           directory+"p"+pbeam+"_e"+ebeam+"_"+n+"events_file"+fileindex+"_cemceval.root");
0122       se->registerSubsystem(eval);
0123 
0124     }
0125 
0126   //----------------------
0127   // Simulation evaluation
0128   //----------------------
0129 
0130   if (do_jet_eval)
0131     {
0132       Jet_Eval(directory+"p"+pbeam+"_e"+ebeam+"_"+n+"events_file"+fileindex+"_jeteval_r05.root");
0133     }
0134 
0135   if (do_fwd_jet_eval) Jet_FwdEval(directory+"p"+pbeam+"_e"+ebeam+"_"+n+"events_file"+fileindex+"_fwdjeteval.root");
0136 
0137   if(do_lepto_analysis){
0138     gROOT->LoadMacro("G4_Lepto.C");
0139     G4_Lepto(directory+"p"+pbeam+"_e"+ebeam+"_"+n+"events_file"+fileindex+"_LeptoAna");
0140   }
0141 
0142 
0143   //--------------
0144   // IO management
0145   //--------------
0146 
0147   if (readhits)
0148     {
0149       // Hits file
0150       Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin");
0151       hitsin->fileopen(inputFile);
0152       se->registerInputManager(hitsin);
0153     }
0154 
0155   //-----------------
0156   // Event processing
0157   //-----------------
0158   if (nEvents < 0)
0159     {
0160       return;
0161     }
0162 
0163 
0164   se->run(nEvents);
0165 
0166   //-----
0167   // Exit
0168   //-----
0169 
0170   se->End();
0171   std::cout << "All done" << std::endl;
0172   delete se;
0173   gSystem->Exit(0);
0174 }