Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-09 08:12:08

0001 #include "../ClusHistogram.h"
0002 
0003 R__LOAD_LIBRARY(../libClusHistogram.so)
0004 
0005 TH1D * GetReweighting_hist(string input_map_directory, string map_name)
0006 {
0007   TFile * file_in = TFile::Open(Form("%s", input_map_directory.c_str()));
0008   TH1D * h1D_INTT_vtxZ_reweighting = (TH1D*)file_in->Get(map_name.c_str()); // todo : the map of the vtxZ reweighting
0009   return h1D_INTT_vtxZ_reweighting;
0010 }
0011 
0012 void Run_PrepareHist_MC(
0013   int process_id = 0,
0014   int run_num = 54280,
0015   int nevents = -1,
0016   string input_directory = "/sphenix/user/ChengWei/INTT/INTT/general_codes/CWShih/INTTBcoResolution/macro",
0017   string input_filename = "file_list_54280_intt.txt",
0018   string output_directory = "/sphenix/tg/tg01/commissioning/INTT/work/cwshih/seflgendata/run_54280/completed/BCO_check",
0019   
0020   // todo : modify here
0021   std::string output_file_name_suffix = "",
0022   std::pair<double, double> vertexXYIncm = {-0.0214921, 0.223299}, // note : in cm // note : MC
0023 
0024   std::pair<bool, TH1D*> vtxZReweight = {true, nullptr},
0025   bool BcoFullDiffCut = false,
0026   bool INTT_vtxZ_QA = true,
0027   std::pair<bool, std::pair<double, double>> isClusQA = {true, {35, 500}}, // note : {adc, phi size}
0028   bool HaveGeoOffsetTag = false,
0029   std::pair<bool, int> SetRandomHits = {false, 0},
0030   bool RandInttZ = false,
0031 
0032   std::string vtxZReWeighting_input_directory = "/sphenix/tg/tg01/commissioning/INTT/work/cwshih/seflgendata/run_54280_HR_Dec042024/completed/Run3/EvtVtxZ/completed/VtxZDist/completed/vtxZ_comp_withVtxZQA/INTTvtxZReWeight.root",
0033   std::string map_name = "HIJING_noZWeight_VtxZQA_Inclusive70"
0034 )
0035 {
0036 
0037   if (vtxZReweight.first) {vtxZReweight.second = (TH1D*)(GetReweighting_hist(vtxZReWeighting_input_directory, map_name))->Clone();}
0038 
0039   ClusHistogram * CSH = new ClusHistogram(
0040     process_id,
0041     run_num,
0042     nevents,
0043     input_directory,
0044     input_filename,
0045     output_directory,
0046 
0047     output_file_name_suffix,
0048     vertexXYIncm,
0049 
0050     vtxZReweight,
0051     BcoFullDiffCut,
0052     INTT_vtxZ_QA,
0053     isClusQA,
0054     HaveGeoOffsetTag,
0055     SetRandomHits
0056   );
0057 
0058   string final_output_file_name = CSH->GetOutputFileName();
0059   cout<<"final_output_file_name: "<<final_output_file_name<<endl;
0060   system(Form("if [ -f %s/completed/%s ]; then rm %s/completed/%s; fi;", output_directory.c_str(), final_output_file_name.c_str(), output_directory.c_str(), final_output_file_name.c_str()));  
0061 
0062   CSH -> MainProcess();
0063   CSH -> EndRun();
0064 
0065   system(Form("mv %s/%s %s/completed", output_directory.c_str(), final_output_file_name.c_str(), output_directory.c_str()));
0066 
0067   return;
0068 }