Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:12:53

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