Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:13:34

0001 
0002 int Fun4All_RICHReco(
0003                      const int nEvents = 1,
0004                      const char * inputFile = "G4EICDetector.root",
0005                      const char * evalFile = "eval_RICH.root"
0006                      )
0007 {
0008 
0009   bool readdst = true;
0010 
0011   /* switch: do_fastpid = 'true' uses FastPid module based on parametrization of RICH response; if
0012      set to 'false', use full reconstructed based on detected photon hits. */
0013   bool do_fastpid = false;
0014 
0015   //---------------
0016   // Load libraries
0017   //---------------
0018 
0019   gSystem->Load("librichana.so");
0020   gSystem->Load("libfun4all.so");
0021   gSystem->Load("libg4detectors.so");
0022 
0023   //---------------
0024   // Fun4All server
0025   //---------------
0026 
0027   Fun4AllServer *se = Fun4AllServer::instance();
0028   se->Verbosity(0);
0029   // just if we set some flags somewhere in this macro
0030   recoConsts *rc = recoConsts::instance();
0031 
0032   //--------------
0033   // Analysis modules
0034   //--------------
0035 
0036   /* Adding RICH analysis modules */
0037   if ( do_fastpid )
0038     {
0039       FastPid_RICH *fastpid_rich = new FastPid_RICH("SvtxTrackMap", "RICH");
0040       se->registerSubsystem(fastpid_rich);
0041     }
0042   else
0043     {
0044       RICHParticleID *richpid = new RICHParticleID("SvtxTrackMap", "RICH");
0045       richpid->set_refractive_index(1.000526);
0046       se->registerSubsystem(richpid);
0047 
0048       RICHEvaluator *richeval = new RICHEvaluator("SvtxTrackMap", "RICH", evalFile);
0049       richeval->set_refractive_index(1.000526);
0050       se->registerSubsystem(richeval);
0051     }
0052 
0053   //--------------
0054   // IO management
0055   //--------------
0056 
0057   /* Read DST Files */
0058   if ( readdst )
0059     {
0060       Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin");
0061       hitsin->fileopen(inputFile);
0062       se->registerInputManager(hitsin);
0063     }
0064 
0065   //-----------------
0066   // Event processing
0067   //-----------------
0068   if (nEvents < 0)
0069     {
0070       return;
0071     }
0072   // if we run the particle generator and use 0 it'll run forever
0073   if (nEvents == 0 && !readdst && !readhepmc)
0074     {
0075       cout << "using 0 for number of events is a bad idea when using particle generators" << endl;
0076       cout << "it will run forever, so I just return without running anything" << endl;
0077       return;
0078     }
0079 
0080   se->run(nEvents);
0081 
0082   //-----
0083   // Exit
0084   //-----
0085 
0086   se->End();
0087   std::cout << "All done" << std::endl;
0088   delete se;
0089   gSystem->Exit(0);
0090 }