Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Fun4All_EICAnalysis_Leptoquarks.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Fun4All_EICAnalysis_Leptoquarks.C
1 
3  const int nEvents = 10,
4  const char * inputFile = "/gpfs/mnt/gpfs02/phenix/scratch/jlab/Leptoquark/TestOut.10event.root",
5  const char * outputFile = "eicana_milou.root"
6  )
7 {
8 
9  const bool readdst = false;
10  const bool readhepmc = false;
11  const bool readeictree = true;
12 
13  //---------------
14  // Load libraries
15  //---------------
16 
17  gSystem->Load("libfun4all.so");
18  gSystem->Load("libphhepmc.so");
19  gSystem->Load("libg4detectors.so");
20  gSystem->Load("libg4testbench.so");
21  gSystem->Load("libg4hough.so");
22  gSystem->Load("libg4calo.so");
23  gSystem->Load("libg4eval.so");
24  gSystem->Load("libeicana.so");
25 
26  //---------------
27  // Fun4All server
28  //---------------
29 
31  se->Verbosity(0);
32  // just if we set some flags somewhere in this macro
34 
35  rc->set_FloatFlag("WorldSizex",1000);
36  rc->set_FloatFlag("WorldSizey",1000);
37  rc->set_FloatFlag("WorldSizez",1000);
38  rc->set_CharFlag("WorldShape","G4Tubs");
39 
40 
41  //--------------
42  // IO management
43  //--------------
44 
45  /* Read DST Files */
46  if ( readdst )
47  {
48  Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin");
49  hitsin->fileopen(inputFile);
50  se->registerInputManager(hitsin);
51  }
52  /* Read HepMC ASCII files */
53  else if ( readhepmc )
54  {
56  se->registerInputManager( in );
57  se->fileopen( in->Name().c_str(), inputFile );
58  }
59  /* Read EICTree files */
60  else if (readeictree)
61  {
62  // this module is needed to read the EICTree style records into our G4 sims
63  ReadEICFiles *eicr = new ReadEICFiles();
64  eicr->OpenInputFile(inputFile);
65  se->registerSubsystem(eicr);
66  }
67 
68  //--------------
69  // Analysis modules
70  //--------------
71 
72  Leptoquarks *mcana = new Leptoquarks(outputFile);
73  mcana->set_beam_energies(10,250);
74  se->registerSubsystem( mcana );
75 
76 
77  //-----------------
78  // Event processing
79  //-----------------
80  if (nEvents < 0)
81  {
82  return;
83  }
84  // if we run the particle generator and use 0 it'll run forever
85  if (nEvents == 0 && !readhits && !readhepmc && !readeictree)
86  {
87  cout << "using 0 for number of events is a bad idea when using particle generators" << endl;
88  cout << "it will run forever, so I just return without running anything" << endl;
89  return;
90  }
91 
92  se->run(nEvents);
93 
94  //-----
95  // Exit
96  //-----
97 
98  se->End();
99  std::cout << "All done" << std::endl;
100  delete se;
101  gSystem->Exit(0);
102 }