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 R__LOAD_LIBRARY(libana_sim_dst)
3 
4 int Fun4SimDst(const int n_dst_ana=0,
5  const char* fn_list_dst="list_dst.txt",
6  const char* fn_udst="uDST.root")
7 {
9  //se->Verbosity(1);
10  Fun4AllInputManager *in = new Fun4AllDstInputManager("SimDst");
11  se->registerInputManager(in);
12 
13  //se->registerSubsystem(new FilterSimEvent());
14 
15  Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", fn_udst);
16  se->registerOutputManager(out);
17  out->AddNode("SQHitVector");
18  out->AddNode("SQEvent");
19  out->AddNode("SRecEvent");
20  out->AddNode("SQMCEvent");
21  out->AddNode("SQTruthTrackVector");
22  out->AddNode("SQTruthDimuonVector");
23 
24  vector<string> list_dst;
25  string fn_dst;
26  ifstream ifs(fn_list_dst);
27  while (ifs >> fn_dst) list_dst.push_back(fn_dst);
28  ifs.close();
29 
30  int n_dst = list_dst.size();
31  cout << "N of DSTs: all = " << n_dst;
32  if (n_dst_ana > 0 && n_dst > n_dst_ana) n_dst = n_dst_ana;
33  cout << ", to be analyzed = " << n_dst << endl;
34  for (int i_dst = 0; i_dst < n_dst; i_dst++) {
35  string fn_dst = list_dst[i_dst];
36  cout << "DST: " << i_dst << "/" << n_dst << ": " << fn_dst << endl;
37  in->fileopen(fn_dst);
38  se->run();
39  }
40 
41  se->End();
42  delete se;
43  return 0;
44 }
int registerInputManager(Fun4AllInputManager *InManager)
virtual int End()
int AddNode(const std::string &nodename)
add a node in outputmanager
static Fun4AllServer * instance()
Fun4AllServer * se
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)
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 &)