Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-17 09:14:36

0001 
0002 int Fun4All_EICAnalysis_Leptoquarks(
0003                     const int nEvents = 10,
0004                     const char * inputFile = "/gpfs/mnt/gpfs02/phenix/scratch/jlab/Leptoquark/TestOut.10event.root",
0005                     const char * outputFile = "eicana_milou.root"
0006                     )
0007 {
0008 
0009   const bool readdst = false;
0010   const bool readhepmc = false;
0011   const bool readeictree = true;
0012 
0013   //---------------
0014   // Load libraries
0015   //---------------
0016 
0017   gSystem->Load("libfun4all.so");
0018   gSystem->Load("libphhepmc.so");
0019   gSystem->Load("libg4detectors.so");
0020   gSystem->Load("libg4testbench.so");
0021   gSystem->Load("libg4hough.so");
0022   gSystem->Load("libg4calo.so");
0023   gSystem->Load("libg4eval.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   // IO management
0043   //--------------
0044 
0045   /* Read DST Files */
0046   if ( readdst )
0047     {
0048       Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin");
0049       hitsin->fileopen(inputFile);
0050       se->registerInputManager(hitsin);
0051     }
0052   /* Read HepMC ASCII files */
0053   else if ( readhepmc )
0054     {
0055       Fun4AllInputManager *in = new Fun4AllHepMCInputManager( "DSTIN");
0056       se->registerInputManager( in );
0057       se->fileopen( in->Name().c_str(), inputFile );
0058     }
0059   /* Read EICTree files */
0060   else if (readeictree)
0061     {
0062       // this module is needed to read the EICTree style records into our G4 sims
0063       ReadEICFiles *eicr = new ReadEICFiles();
0064       eicr->OpenInputFile(inputFile);
0065       se->registerSubsystem(eicr);
0066     }
0067 
0068   //--------------
0069   // Analysis modules
0070   //--------------
0071 
0072   Leptoquarks *mcana = new Leptoquarks(outputFile);
0073   mcana->set_beam_energies(10,250);
0074   se->registerSubsystem( mcana );
0075 
0076 
0077   //-----------------
0078   // Event processing
0079   //-----------------
0080   if (nEvents < 0)
0081     {
0082       return;
0083     }
0084   // if we run the particle generator and use 0 it'll run forever
0085   if (nEvents == 0 && !readhits && !readhepmc && !readeictree)
0086     {
0087       cout << "using 0 for number of events is a bad idea when using particle generators" << endl;
0088       cout << "it will run forever, so I just return without running anything" << endl;
0089       return;
0090     }
0091 
0092   se->run(nEvents);
0093 
0094   //-----
0095   // Exit
0096   //-----
0097 
0098   se->End();
0099   std::cout << "All done" << std::endl;
0100   delete se;
0101   gSystem->Exit(0);
0102 }