Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Fun4All_FilterEvents.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Fun4All_FilterEvents.C
1 
2 #pragma once
3 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0)
4 #include <fun4all/SubsysReco.h>
9 
10 #include <filterevents/FilterEvents.h>
11 
12 R__LOAD_LIBRARY(libfun4all.so)
13 R__LOAD_LIBRARY(libfilterevents.so)
14 #endif
15 
16 void Fun4All_FilterEvents(vector<string> myInputLists = {"condorJob/fileLists/productionFiles-HIJING_0-20-tracks-00000.list"}, const int nEvents = 10)
17 {
18 
19 // gSystem->Load("libg4dst");
20 // gSystem->Load("libfiltereventsupsilon");
21  string outDir = "/sphenix/u/rosstom/analysis/FilterEvents/macro/";
22 
23  string fileNumber = myInputLists[0];
24  size_t findLastDash = fileNumber.find_last_of("-");
25  if (findLastDash != string::npos) fileNumber.erase(0, findLastDash + 1);
26  string remove_this = ".list";
27  size_t pos = fileNumber.find(remove_this);
28  if (pos != string::npos) fileNumber.erase(pos, remove_this.length());
29  string outputFileName = "outputFilteredTrackSeeds_" + fileNumber + ".root";
30 
31  string outputRecoDir = outDir + "inReconstruction/";
32  string makeDirectory = "mkdir -p " + outputRecoDir;
33  system(makeDirectory.c_str());
34  const string outputRecoFile = outputRecoDir + outputFileName;
35 
36  cout << "output file name: " << outputRecoFile << endl;
37 
38  bool upsilonFilter = false; // true for Upsilon, false for D0 (will make more general soon)
39 
41  se->Verbosity(1);
42 
43  //Add all required input files
44  for (unsigned int i = 0; i < myInputLists.size(); ++i)
45  {
47  infile->AddListFile(myInputLists[i]);
48  se->registerInputManager(infile);
49  }
50  //Needs TRACKS, TRACKSEEDS, TRKR_CLUSTER, CALO_CLUSTER, and VERTEX DSTs
51 
52  //in1->AddFile("DST_TRACKS_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000060-00000.root");
53  //in2->AddFile("DST_TRACKSEEDS_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000060-00000.root");
54  //in3->AddFile("DST_TRKR_CLUSTER_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000060-00000.root");
55  //in4->AddFile("DST_CALO_CLUSTER_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000060-00000.root");
56  //in5->AddFile("DST_VERTEX_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000060-00000.root");
57 
58  FilterEvents *filter = new FilterEvents("FilterEvents");
59  if (!upsilonFilter) filter->setCuts(1.0, 0.01, 20, false);
60  se->registerSubsystem(filter);
61 
62  Fun4AllOutputManager *out = new Fun4AllDstOutputManager("out",outputRecoFile);
63  out->Verbosity(1);
64  //out->AddNode("SvtxTrackMap_ee");
65  out->AddNode("TRKR_CLUSTER");
66  out->AddNode("SiliconTrackSeedContainer");
67  out->AddNode("TpcTrackSeedContainer");
68  out->AddNode("SvtxTrackSeedContainer");
69  if (upsilonFilter) out->AddNode("CLUSTER_CEMC");
70  out->AddNode("SvtxVertexMap");
71  out->AddNode("GlobalVertexMap");
72  se->registerOutputManager(out);
73  out->Print();
74 
75  se->run(nEvents);
76  se->End();
77 
78  ifstream file(outputRecoFile.c_str());
79  if (file.good())
80  {
81  string moveOutput = "mv " + outputRecoFile + " " + outDir;
82  system(moveOutput.c_str());
83  }
84 
85 cout << "all done." << endl;
86 }
87 
88 
89