Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Fun4All_MDM.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Fun4All_MDM.C
2 
3 #include <G4_Magnet.C>
4 #include <G4_Tracking.C>
5 
6 #include <multidetectormultiplicity/MultiDetectorMultiplicity.h>
7 
8 #include <FROG.h>
11 //#include <qa_modules/QAG4SimulationKFParticle.h>
12 
13 #include <g4centrality/PHG4CentralityReco.h> //Centrality
14 
15 R__LOAD_LIBRARY(libfun4all.so)
16 R__LOAD_LIBRARY(libg4centrality.so)
17 R__LOAD_LIBRARY(libmultidetectormultiplicity.so)
18 
19 
20 
21 
22 using namespace std;
23 //Inspired by Cameron Fun4All code
24 /****************************/
25 /* MDC2 Reco for MDC2 */
26 /* Cameron Dean, LANL, 2021 */
27 /* cdean@bnl.gov */
28 /****************************/
29 
30 void Fun4All_MDM(vector<string> myInputLists = {"productionFiles-D0JETS-dst_tracks-00000.list","productionFiles-D0JETS-dst_vertex-00000.list","productionFiles-D0JETS-dst_truth-00000.list","productionFiles-D0JETS-dst_trkr_g4hit-00000.list","productionFiles-D0JETS-dst_trackseeds-00000.list","productionFiles-D0JETS-dst_trkr_cluster-00000.list","productionFiles-D0JETS-dst_calo_cluster-00000.list","productionFiles-D0JETS-dst_truth_reco-00000.list"}, const int nEvents = 100)
31 {
32  int verbosity = 0;
33 
34  gSystem->Load("libg4dst.so");
35  gSystem->Load("libFROG.so");
36  FROG *fr = new FROG();
37 
38  //The next set of lines figures out folder revisions, file numbers etc
39  string outDir = "./";
40  if (outDir.substr(outDir.size() - 1, 1) != "/") outDir += "/";
41  outDir += "Output/";
42 
43  string fileNumber = myInputLists[0];
44  size_t findLastDash = fileNumber.find_last_of("-");
45  if (findLastDash != string::npos) fileNumber.erase(0, findLastDash + 1);
46  string remove_this = ".list";
47  size_t pos = fileNumber.find(remove_this);
48  if (pos != string::npos) fileNumber.erase(pos, remove_this.length());
49  string outputFileName = "outputData_" + fileNumber + ".root";
50 
51  string outputRecoDir = outDir + "/inReconstruction/";
52  string makeDirectory = "mkdir -p " + outputRecoDir;
53  system(makeDirectory.c_str());
54  string outputRecoFile = outputRecoDir + outputFileName;
55 
56  //Create the server
58  se->Verbosity(verbosity);
59 
60  //Add all required input files
61  for (unsigned int i = 0; i < myInputLists.size(); ++i)
62  {
64  infile->AddListFile(myInputLists[i]);
65  se->registerInputManager(infile);
66  }
67 
68  //Centrality module
70  cent->Verbosity(verbosity);
71  cent->GetCalibrationParameters().ReadFromFile("centrality", "xml", 0, 0, string(getenv("CALIBRATIONROOT")) + string("/Centrality/"));
72  se->registerSubsystem( cent );
73 
74  MultiDetectorMultiplicity *mdMulti = new MultiDetectorMultiplicity("mdMulti", outputRecoFile);
75  mdMulti->Verbosity(verbosity);
76  se->registerSubsystem(mdMulti);
77 
78  se->run(nEvents);
79  se->End();
80 
81  ifstream file(outputRecoFile.c_str());
82  if (file.good())
83  {
84  string moveOutput = "mv " + outputRecoFile + " " + outDir;
85  system(moveOutput.c_str());
86  }
87 
88 
89  std::cout << "All done" << std::endl;
90  delete se;
91  gSystem->Exit(0);
92 
93  return;
94 }