Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:12:04

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