EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
eic-smear.cxx
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file eic-smear.cxx
1 // Authors: Wouter Deconinck, Kolja Kauder
2 
3 // ROOT headers
4 #include <TROOT.h>
5 #include <TRint.h>
6 #include <TSystem.h>
7 #include <TThread.h>
8 #include <TString.h>
9 
10 #include <iostream>
11 #include <string>
12 
13 #include "eicsmear/functions.h"
14 
15 R__EXTERN class SmearRint* gSmearRint;
16 
17 class SmearRint : public TRint {
18 
19 protected:
20 
21  static SmearRint* fExists;
22 
23 public:
25  SmearRint (const char* appClassName, int* argc, char** argv,
26  void* options = 0, int numOptions = 0, bool noLogo = kFALSE)
27  : TRint (appClassName, argc, argv, options, numOptions, noLogo) {
28  gSmearRint = this;
29 
30  // eic-smear command prompt
31  SetPrompt("eic-smear [%d] ");
32 
33  // Pointer to self
34  fExists = this;
35  };
36 
38  virtual ~SmearRint() {
39  // Reset point to self
40  if (fExists == this)
41  fExists = NULL;
42  };
43 
44 }; // class smearRint
45 
46 // Global pointers
47 SmearRint* gSmearRint = NULL;
48 
49 // Pointer to self
51 
52 int main(int argc, char** argv)
53 {
54  // Load library, assume in LD_LIBRARY_PATH
55  gSystem->Load("libeicsmear");
56  std::cout << "Using eic-smear version: " << erhic::EicSmearVersionString << std::endl;
57  if ( argc >=2 ){
58  std::string a1 = argv[1];
59  if ( a1 == "-v" || a1 == "--version"){
60  return 0;
61  }
62  }
63  gSystem->Load("libeicsmeardetectors");
64  auto libeicsmearpath=gSystem->DynamicPathName("libeicsmear");
65  auto libdetectorpath=gSystem->DynamicPathName("libeicsmeardetectors");
66  std::cout << "Using these eic-smear libraries : "<< std::endl
67  << libeicsmearpath << std::endl
68  << libdetectorpath << std::endl;
69 
70  // Start command prompt
71  SmearRint* rint = new SmearRint("eic-smear ", &argc, argv);
72  rint->Run();
73  delete rint;
74 }