Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 
0002 int Fun4All_EICAnalysis_DISReco(
0003                 const int nEvents = 1000,
0004                 const char * inputFile = "/gpfs/mnt/gpfs02/phenix/scratch/spjeffas/g4sim/G4_Leptoquark_DST_p250_e20_1000events_1seed_DIScharged.root",
0005                 //const char * inputFile = "G4EICDetector_DIS_10x250_20events.root",
0006                 //const char * inputFile = "G4EICDetector_DIS_SingleParticle_ele_10GeV_m05eta.root",
0007                 //const char * inputFile = "G4EICDetector_DIS_SingleParticle_ele_10GeV_m2eta.root",
0008                 const char * outputFile = "eicana_disreco_test2.root"
0009                 )
0010 {
0011 
0012   bool readdst = true;
0013   bool readhepmc = false;
0014 
0015   //---------------
0016   // Load libraries
0017   //---------------
0018 
0019   gSystem->Load("libeicana.so");
0020   gSystem->Load("libfun4all.so");
0021   gSystem->Load("libg4detectors.so");
0022   gSystem->Load("libphhepmc.so");
0023   //  gSystem->Load("libg4testbench.so");
0024   //  gSystem->Load("libg4hough.so");
0025   //  gSystem->Load("libcemc.so");
0026   gSystem->Load("libg4bbc.so");
0027   gSystem->Load("libg4eval.so");
0028 
0029   //---------------
0030   // Fun4All server
0031   //---------------
0032 
0033   Fun4AllServer *se = Fun4AllServer::instance();
0034   se->Verbosity(0);
0035   // just if we set some flags somewhere in this macro
0036   recoConsts *rc = recoConsts::instance();
0037 
0038   //--------------
0039   // Analysis modules
0040   //--------------
0041 
0042   gROOT->LoadMacro("G4_FastSim_Reco_EIC.C");
0043   FastSim_Reco_EIC();
0044 
0045   DISKinematicsReco *ana = new DISKinematicsReco(outputFile);
0046   ana->set_do_process_truth( true );
0047   ana->set_do_process_geant4_cluster( true );
0048   se->registerSubsystem( ana );
0049 
0050   //--------------
0051   // IO management
0052   //--------------
0053 
0054   /* Read DST Files */
0055   if ( readdst )
0056     {
0057       Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin");
0058       hitsin->fileopen(inputFile);
0059       se->registerInputManager(hitsin);
0060     }
0061   /* Read HepMC ASCII files */
0062   else if ( readhepmc )
0063     {
0064       Fun4AllInputManager *in = new Fun4AllHepMCInputManager( "DSTIN");
0065       se->registerInputManager( in );
0066       se->fileopen( in->Name().c_str(), inputFile );
0067     }
0068 
0069 
0070   //-----------------
0071   // Event processing
0072   //-----------------
0073   if (nEvents < 0)
0074     {
0075       return;
0076     }
0077   // if we run the particle generator and use 0 it'll run forever
0078   if (nEvents == 0 && !readhits && !readhepmc)
0079     {
0080       cout << "using 0 for number of events is a bad idea when using particle generators" << endl;
0081       cout << "it will run forever, so I just return without running anything" << endl;
0082       return;
0083     }
0084 
0085   se->run(nEvents);
0086 
0087   //-----
0088   // Exit
0089   //-----
0090 
0091   se->End();
0092   std::cout << "All done" << std::endl;
0093   delete se;
0094   gSystem->Exit(0);
0095 }