Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:13:23

0001 #include <trackandclustermatchingqa/TrackAndClusterMatchingQA.h>
0002 
0003 #include <fun4all/Fun4AllDstInputManager.h>
0004 #include <fun4all/Fun4AllServer.h>
0005 
0006 #include <jetbackground/RetowerCEMC.h>
0007 
0008 #include <G4_Global.C>
0009 
0010 #include <phool/recoConsts.h>
0011 
0012 #include <caloreco/RawClusterBuilderTopo.h>
0013 #include <particleflowreco/ParticleFlowReco.h>
0014 
0015 R__LOAD_LIBRARY(libfun4all.so)
0016 R__LOAD_LIBRARY(libtrackandclustermatchingqa.so)
0017 R__LOAD_LIBRARY(libjetbackground.so)
0018 
0019 using namespace std;
0020 
0021 void Fun4All_Template(vector<string> myInputLists = {"productionFiles-JET_30GEV-dst_tracks-00000.list","productionFiles-JET_30GEV-dst_vertex-00000.list","productionFiles-JET_30GEV-dst_truth-00000.list","productionFiles-JET_30GEV-dst_trkr_g4hit-00000.list", "productionFiles-JET_30GEV-dst_trkr_hit-00000.list","productionFiles-JET_30GEV-dst_trackseeds-00000.list","productionFiles-JET_30GEV-dst_trkr_cluster-00000.list","productionFiles-JET_30GEV-dst_calo_cluster-00000.list","productionFiles-JET_30GEV-dst_bbc_g4hit-00000.list"}, const int nEvents = 100)
0022 {
0023   int verbosity = 0;
0024 
0025   gSystem->Load("libg4dst.so");
0026   recoConsts *rc = recoConsts::instance();
0027   Enable::CDB = true;
0028   // global tag
0029   rc->set_StringFlag("CDB_GLOBALTAG",CDB::global_tag);
0030   // 64 bit timestamp
0031   rc->set_uint64Flag("TIMESTAMP",CDB::timestamp);
0032 
0033 
0034   //The next set of lines figures out folder revisions, file numbers etc
0035   string outDir = "./";
0036   if (outDir.substr(outDir.size() - 1, 1) != "/") outDir += "/";
0037   outDir +=  "Output/";
0038 
0039   string fileNumber = myInputLists[0];
0040   size_t findLastDash = fileNumber.find_last_of("-");
0041   if (findLastDash != string::npos) fileNumber.erase(0, findLastDash + 1);
0042   string remove_this = ".list";
0043   size_t pos = fileNumber.find(remove_this);
0044   if (pos != string::npos) fileNumber.erase(pos, remove_this.length());
0045   string outputFileName = "outputData_" + fileNumber + ".root";
0046 
0047   string outputRecoDir = outDir + "/inReconstruction/";
0048   string makeDirectory = "mkdir -p " + outputRecoDir;
0049   system(makeDirectory.c_str());
0050   string outputRecoFile = outputRecoDir + outputFileName;
0051 
0052   //Create the server
0053   Fun4AllServer *se = Fun4AllServer::instance();
0054   se->Verbosity(verbosity);
0055 
0056   //Add all required input files
0057   for (unsigned int i = 0; i < myInputLists.size(); ++i)
0058   {
0059     Fun4AllInputManager *infile = new Fun4AllDstInputManager("DSTin_" + to_string(i));
0060     infile->AddListFile(myInputLists[i]);
0061     se->registerInputManager(infile);
0062   }
0063 
0064   Global_Reco();
0065 
0066   RetowerCEMC *rcemc = new RetowerCEMC();
0067   rcemc->set_towerinfo(true);
0068   rcemc->Verbosity(verbosity);
0069   se->registerSubsystem(rcemc);
0070 
0071   TrackAndClusterMatchingQA *module = new TrackAndClusterMatchingQA("module", outputRecoFile);
0072   module->set_EM_clustersName("CLUSTER_POS_COR_CEMC");
0073   module->set_EM_retoweredTowersName("TOWERINFO_CALIB_CEMC_RETOWER");
0074   module->Verbosity(verbosity);
0075   se->registerSubsystem(module);
0076 
0077   se->run(nEvents);
0078   se->End();
0079 
0080   ifstream file(outputRecoFile.c_str());
0081   if (file.good())
0082   {
0083     string moveOutput = "mv " + outputRecoFile + " " + outDir;
0084     system(moveOutput.c_str());
0085   }
0086 
0087 
0088   std::cout << "All done" << std::endl;
0089   delete se;
0090   gSystem->Exit(0);
0091 
0092   return;
0093 }