Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Fun4All_EICAnalysis_DIS.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Fun4All_EICAnalysis_DIS.C
1 #pragma once
2 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0)
3 #include <fun4all/SubsysReco.h>
12 #include <phool/recoConsts.h>
13 #include <eicana/DISKinematicsReco.h>
14 R__LOAD_LIBRARY(libfun4all.so)
15 R__LOAD_LIBRARY(libphhepmc.so)
16 R__LOAD_LIBRARY(libeicana.so)
17 #endif
18 
19 using namespace std;
20 
22  const int nEvents = 100,
23  const char * inputFile = "/sphenix/user/baschmoo/standard/macros/macros/g4simulations/G4EICDetector.root",
24  const char * outputFile = "output.root"
25  )
26 {
27 
28  bool readdst = true;
29  bool readhepmc = false;
30 
31  //---------------
32  // Load libraries
33  //---------------
34 
35  gSystem->Load("libfun4all.so");
36  gSystem->Load("libphhepmc.so");
37  gSystem->Load("libeicana.so");
38 
39  //---------------
40  // Fun4All server
41  //---------------
42 
44  se->Verbosity(0);
45  // just if we set some flags somewhere in this macro
47 
48  //--------------
49  // Analysis modules
50  //--------------
51 
52  DISKinematicsReco *ana = new DISKinematicsReco(outputFile);
53  ana->set_do_process_truth( true );
54  ana->set_do_process_geant4_cluster( true );
55  se->registerSubsystem( ana );
56 
57  //--------------
58  // IO management
59  //--------------
60 
61  /* Read DST Files */
62  if ( readdst )
63  {
64  Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin");
65  hitsin->fileopen(inputFile);
66  se->registerInputManager(hitsin);
67  }
68  /* Read HepMC ASCII files */
69  else if ( readhepmc )
70  {
72  se->registerInputManager( in );
73  se->fileopen( in->Name().c_str(), inputFile );
74  }
75 
76 
77  //-----------------
78  // Event processing
79  //-----------------
80  if (nEvents < 0)
81  {
82  return 0;
83  }
84  // if we run the particle generator and use 0 it'll run forever
85  if (nEvents == 0 && !readdst && !readhepmc)
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 0;
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  return 0;
103 }