Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 /* To run this macro, need to compile the library from analysis/Tracking/FastTrackingEval */
0002 
0003 int Fun4All_EICAnalysis_TrackEval(
0004                   const int nEvents = 10,
0005                   const char * inputFile = "/gpfs/mnt/gpfs04/sphenix/user/nfeege/sphenixsw/devel/analysis/EICAnalysis/data/G4EICDetector_DIS_SingleParticle_ele_10GeV_m3eta.root",
0006 //                const char * inputFile = "/gpfs/mnt/gpfs04/sphenix/user/nfeege/sphenixsw/devel/analysis/EICAnalysis/data/G4EICDetector_DIS_SingleParticle_ele_10GeV_m2eta.root",
0007 //                const char * inputFile = "/gpfs/mnt/gpfs04/sphenix/user/nfeege/sphenixsw/devel/analysis/EICAnalysis/data/G4EICDetector_DIS_SingleParticle_ele_10GeV_m05eta.root",
0008 //                const char * inputFile = "/gpfs/mnt/gpfs04/sphenix/user/nfeege/sphenixsw/devel/analysis/EICAnalysis/data/G4EICDetector_DIS_SingleParticle_ele_10GeV_p05eta.root",
0009 //                const char * inputFile = "/gpfs/mnt/gpfs04/sphenix/user/nfeege/sphenixsw/devel/analysis/EICAnalysis/data/G4EICDetector_DIS_SingleParticle_ele_10GeV_p2eta.root",
0010                   const char* evalFile = "eval_track_fastsim.root"
0011                   )
0012 {
0013 
0014   bool readdst = true;
0015   bool readhepmc = false;
0016 
0017   //---------------
0018   // Load libraries
0019   //---------------
0020 
0021   gSystem->Load("libeicana.so");
0022   gSystem->Load("libfun4all.so");
0023   gSystem->Load("libg4eval.so");
0024 
0025   //---------------
0026   // Fun4All server
0027   //---------------
0028 
0029   Fun4AllServer *se = Fun4AllServer::instance();
0030   se->Verbosity(0);
0031   // just if we set some flags somewhere in this macro
0032   recoConsts *rc = recoConsts::instance();
0033 
0034   //--------------
0035   // Additional tracking modules
0036   //--------------
0037 
0038   gROOT->LoadMacro("G4_FastSim_Reco_EIC.C");
0039   FastSim_Reco_EIC();
0040 
0041   //--------------
0042   // Analysis modules
0043   //--------------
0044 
0045   gSystem->Load("libFastTrackingEval.so");
0046   FastTrackingEval* eval_fasttrack;
0047   eval_fasttrack = new FastTrackingEval("FASTTRACKEVALUATOR", evalFile, "SvtxTrackMap_FastSim");
0048   se->registerSubsystem( eval_fasttrack );
0049 
0050   //SvtxEvaluator* eval;
0051   //eval = new SvtxEvaluator("SVTXEVALUATOR", "track_eval.root", "SvtxTrackMap_FastSim");
0052   ////eval = new SvtxEvaluator("SVTXEVALUATOR", "track_eval.root", "SvtxTrackMap");
0053   //eval->do_cluster_eval(true);
0054   //eval->do_g4hit_eval(true);
0055   //eval->do_hit_eval(false);  // enable to see the hits that includes the chamber physics...
0056   //eval->do_gpoint_eval(false);
0057   //eval->scan_for_embedded(false);  // take all tracks if false - take only embedded tracks if true
0058   //eval->Verbosity(0);
0059   //se->registerSubsystem(eval);
0060 
0061   //--------------
0062   // IO management
0063   //--------------
0064 
0065   /* Read DST Files */
0066   if ( readdst )
0067     {
0068       Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin");
0069       hitsin->fileopen(inputFile);
0070       se->registerInputManager(hitsin);
0071     }
0072   /* Read HepMC ASCII files */
0073   else if ( readhepmc )
0074     {
0075       Fun4AllInputManager *in = new Fun4AllHepMCInputManager( "DSTIN");
0076       se->registerInputManager( in );
0077       se->fileopen( in->Name().c_str(), inputFile );
0078     }
0079 
0080 
0081   //-----------------
0082   // Event processing
0083   //-----------------
0084   if (nEvents < 0)
0085     {
0086       return;
0087     }
0088   // if we run the particle generator and use 0 it'll run forever
0089   if (nEvents == 0 && !readhits && !readhepmc)
0090     {
0091       cout << "using 0 for number of events is a bad idea when using particle generators" << endl;
0092       cout << "it will run forever, so I just return without running anything" << endl;
0093       return;
0094     }
0095 
0096   se->run(nEvents);
0097 
0098   //-----
0099   // Exit
0100   //-----
0101 
0102   se->End();
0103   std::cout << "All done" << std::endl;
0104   delete se;
0105   gSystem->Exit(0);
0106 }