File indexing completed on 2025-08-03 08:14:01
0001 #include <g4main/Fun4AllDstPileupInputManager.h>
0002
0003 #include <G4_Magnet.C>
0004 #include <G4_Tracking.C>
0005
0006 #include <multidetectormultiplicity/MultiDetectorMultiplicity.h>
0007
0008 #include <FROG.h>
0009 #include <decayfinder/DecayFinder.h>
0010 #include <fun4all/Fun4AllDstInputManager.h>
0011
0012
0013 #include <g4centrality/PHG4CentralityReco.h> //Centrality
0014
0015 R__LOAD_LIBRARY(libfun4all.so)
0016 R__LOAD_LIBRARY(libg4centrality.so)
0017 R__LOAD_LIBRARY(libmultidetectormultiplicity.so)
0018
0019
0020
0021
0022 using namespace std;
0023
0024
0025
0026
0027
0028
0029
0030 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)
0031 {
0032 int verbosity = 0;
0033
0034 gSystem->Load("libg4dst.so");
0035 gSystem->Load("libFROG.so");
0036 FROG *fr = new FROG();
0037
0038
0039 string outDir = "./";
0040 if (outDir.substr(outDir.size() - 1, 1) != "/") outDir += "/";
0041 outDir += "Output/";
0042
0043 string fileNumber = myInputLists[0];
0044 size_t findLastDash = fileNumber.find_last_of("-");
0045 if (findLastDash != string::npos) fileNumber.erase(0, findLastDash + 1);
0046 string remove_this = ".list";
0047 size_t pos = fileNumber.find(remove_this);
0048 if (pos != string::npos) fileNumber.erase(pos, remove_this.length());
0049 string outputFileName = "outputData_" + fileNumber + ".root";
0050
0051 string outputRecoDir = outDir + "/inReconstruction/";
0052 string makeDirectory = "mkdir -p " + outputRecoDir;
0053 system(makeDirectory.c_str());
0054 string outputRecoFile = outputRecoDir + outputFileName;
0055
0056
0057 Fun4AllServer *se = Fun4AllServer::instance();
0058 se->Verbosity(verbosity);
0059
0060
0061 for (unsigned int i = 0; i < myInputLists.size(); ++i)
0062 {
0063 Fun4AllInputManager *infile = new Fun4AllDstInputManager("DSTin_" + to_string(i));
0064 infile->AddListFile(myInputLists[i]);
0065 se->registerInputManager(infile);
0066 }
0067
0068
0069 PHG4CentralityReco *cent = new PHG4CentralityReco();
0070 cent->Verbosity(verbosity);
0071 cent->GetCalibrationParameters().ReadFromFile("centrality", "xml", 0, 0, string(getenv("CALIBRATIONROOT")) + string("/Centrality/"));
0072 se->registerSubsystem( cent );
0073
0074 MultiDetectorMultiplicity *mdMulti = new MultiDetectorMultiplicity("mdMulti", outputRecoFile);
0075 mdMulti->Verbosity(verbosity);
0076 se->registerSubsystem(mdMulti);
0077
0078 se->run(nEvents);
0079 se->End();
0080
0081 ifstream file(outputRecoFile.c_str());
0082 if (file.good())
0083 {
0084 string moveOutput = "mv " + outputRecoFile + " " + outDir;
0085 system(moveOutput.c_str());
0086 }
0087
0088
0089 std::cout << "All done" << std::endl;
0090 delete se;
0091 gSystem->Exit(0);
0092
0093 return;
0094 }