Class Reference for E1039 Core & Analysis Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Fun4SimDst.C
Go to the documentation of this file.
1 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0)
3 R__LOAD_LIBRARY(libinterface_main)
4 R__LOAD_LIBRARY(libfun4all)
5 R__LOAD_LIBRARY(libg4detectors)
6 R__LOAD_LIBRARY(libg4eval)
7 R__LOAD_LIBRARY(libktracker)
8 R__LOAD_LIBRARY(libtrigger_ana)
9 #endif
10 
11 int Fun4SimDst(const int n_dst_ana=0,
12  const char* fn_list_dst="list_dst.txt",
13  const char* fn_udst="uDST.root")
14 {
15  //gSystem->Load("libtrigger_ana.so");
16 
17  GeomSvc::UseDbSvc(true);
18  GeomSvc* geom_svc = GeomSvc::instance();
19 
21  //se->Verbosity(1);
22  Fun4AllInputManager *in = new Fun4AllDstInputManager("SimDst");
23  se->registerInputManager(in);
24 
25 
26  Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", fn_udst);
27  se->registerOutputManager(out);
28  out->AddNode("SQEvent");
29  out->AddNode("SQMCEvent");
30  //out->AddNode("SRecEvent");
31  out->AddNode("SQTruthTrackVector");
32  out->AddNode("SQTruthDimuonVector");
33  out->AddNode("SQHitVector");
34  out->AddNode("TrackletVector");
35 
36 
37  vector<string> list_dst;
38  string fn_dst;
39  ifstream ifs(fn_list_dst);
40  while (ifs >> fn_dst) list_dst.push_back(fn_dst);
41  ifs.close();
42 
43 
44  int n_dst = list_dst.size();
45  cout << "N of DSTs: all = " << n_dst;
46  if (n_dst_ana > 0 && n_dst > n_dst_ana) n_dst = n_dst_ana;
47  cout << ", to be analyzed = " << n_dst << endl;
48  for (int i_dst = 0; i_dst < n_dst; i_dst++) {
49  string fn_dst = list_dst[i_dst];
50  cout << "DST: " << i_dst << "/" << n_dst << ": " << fn_dst << endl;
51 
52  in->fileopen(fn_dst);
53 
54  se->run();
55 
56  }
57 
58 
59  se->End();
60  delete se;
61  return 0;
62 }
int registerInputManager(Fun4AllInputManager *InManager)
virtual int End()
int AddNode(const std::string &nodename)
add a node in outputmanager
static Fun4AllServer * instance()
Fun4AllServer * se
static bool UseDbSvc()
Definition: GeomSvc.h:304
int run(const int nevnts=0, const bool require_nevents=false)
run n events (0 means up to end of file)
int registerOutputManager(Fun4AllOutputManager *manager)
static GeomSvc * instance()
singlton instance
Definition: GeomSvc.cxx:211
int Fun4SimDst(const int n_dst_ana=0, const char *fn_list_dst="list_dst.txt", const char *fn_udst="uDST.root")
Fun4SimDst.C: Fun4all macro to analyze the E1039 simulated DST files.
Definition: Fun4SimDst.C:4
virtual int fileopen(const std::string &)