Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 
0002 int Fun4All_EICAnalysis_Exclusive(
0003                 const int nEvents = 100,
0004                 const char * inputFile = "/sphenix/user/gregtom3/data/Summer2018/track2cluster_studies/sartre_20x250_dvmp_G4.root",
0005                 const char * outputFile = "out.root"
0006                 )
0007 {
0008 
0009   bool readdst = true;
0010   bool readhepmc = false;
0011 
0012   //---------------
0013   // Load libraries
0014   //---------------
0015 
0016   gSystem->Load("libfun4all.so");
0017   gSystem->Load("libphhepmc.so");
0018   gSystem->Load("libeicana.so");
0019 
0020   //---------------
0021   // Fun4All server
0022   //---------------
0023 
0024   Fun4AllServer *se = Fun4AllServer::instance();
0025   se->Verbosity(0);
0026   // just if we set some flags somewhere in this macro
0027   recoConsts *rc = recoConsts::instance();
0028 
0029   //--------------
0030   // Analysis modules
0031   //--------------
0032 
0033   ExclusiveReco *ana = new ExclusiveReco(outputFile);
0034   ana->set_do_process_dvmp( true );
0035   se->registerSubsystem( ana );
0036 
0037   //--------------
0038   // IO management
0039   //--------------
0040 
0041   /* Read DST Files */
0042   if ( readdst )
0043     {
0044       Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin");
0045       hitsin->fileopen(inputFile);
0046       se->registerInputManager(hitsin);
0047     }
0048   /* Read HepMC ASCII files  */
0049      else if ( readhepmc )
0050     {
0051       Fun4AllInputManager *in = new Fun4AllHepMCInputManager( "DSTIN");
0052       se->registerInputManager( in );
0053       se->fileopen( in->Name().c_str(), inputFile );
0054     }
0055 
0056 
0057   //-----------------
0058   // Event processing
0059   //-----------------
0060   if (nEvents < 0)
0061     {
0062       return;
0063     }
0064   // if we run the particle generator and use 0 it'll run forever
0065   if (nEvents == 0 && !readdst && !readhepmc)
0066     {
0067       cout << "using 0 for number of events is a bad idea when using particle generators" << endl;
0068       cout << "it will run forever, so I just return without running anything" << endl;
0069       return;
0070     }
0071 
0072   se->run(nEvents);
0073 
0074   //-----
0075   // Exit
0076   //-----
0077 
0078   se->End();
0079   std::cout << "All done" << std::endl;
0080   delete se;
0081   gSystem->Exit(0);
0082 }